⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plateproductresult.cpp

📁 这是一个工厂的生产线的仓库管理.有计划,实绩,库存等
💻 CPP
字号:
//******  begin  **************************//
//changed noted by dongzhaoliang in 2006/5
//******  end  **************************//
#include "StdAfx.h"
#include "PlateProductResult.h"

//#include "PlateProductResult.h"


//Insert data into plate_data table
//return:		success:     true
//				failed:		 false
//Create:		KasenHOo @ Elplan ShangHai   051025
void FAP::PlateProductResult::txtlotno(String *text){
		String *strSQL;
		DataRow *dRow;

		strSQL=S"select t.product_code from part_composition t where t.parts_code='";
		strSQL=String::Concat(strSQL,text,S"'");
		DbPltePrdRst->blnCnnOpen();
		dRow = DbPltePrdRst->dRowSQL_Select(strSQL);
		DbPltePrdRst->blnCnnClose();
		txtLotNo->Text=String::Concat (Convert::ToString(dRow->Item[S"product_code"]),S"G");
		DbPltePrdRst->blnCnnOpen();
		strSQL=S"select distinct max(t.serial_end) as serial_end  from plate_data t where t.product_code='";
		strSQL=String::Concat(strSQL,text,S"'");

		dRow=DbPltePrdRst->dRowSQL_Select(strSQL);
		DbPltePrdRst->blnCnnClose();
		//dSetTmp = DbPltePrdRst->dSetSQL_Select(strSQL,S"plate_data",0);
		txtNoStart->Text=Convert::ToString(dRow->Item[S"serial_end"]);
	
}

bool FAP::PlateProductResult::blnInstPlateData()
{
	String *strSQL;

	//strSQL = S"insert into plate_data(PRODUCT_CODE,SERIAL_START,SERIAL_END,	USE_DIV,FACTORY_CODE,LINE_CODE,LOT,PRO_YMD) values( ";
	////strSQL = S"insert into plate_data(PRODUCT_CODE,SERIAL_START,SERIAL_END,	USE_DIV,USE_YMD,FACTORY_CODE,LINE_CODE,LOT) values( ";
	//strSQL = String::Concat(strSQL,S" '", txtProCode->Text, "'," );
	//strSQL = String::Concat(strSQL, txtNoStart->Text, "," );
	//strSQL = String::Concat(strSQL, txtNoEnd->Text, "," );
	//strSQL = String::Concat(strSQL,S"  0," );
	////strSQL = String::Concat(strSQL,S" to_date( '", txtDate->Text, "','yyyy-mm-dd hh24-mi-ss')," );
	//
	//strSQL = String::Concat(strSQL,S" '", infClsPltePrdRst->strFactoryCode, "'," );
	//strSQL = String::Concat(strSQL,S" '", infClsPltePrdRst->strLine, "'," );
	//strSQL = String::Concat(strSQL, txtLotNo->Text,S",");
	//strSQL = String::Concat(strSQL,S" to_date('", txtDate->Text, "','yyyy-MM-dd hh24-mi-ss'))" );
	strSQL=S"";
	strSQL = String::Concat(strSQL,S"insert into plate_data");
	strSQL = String::Concat(strSQL,S"	(PRODUCT_CODE, ");
	strSQL = String::Concat(strSQL,S"    SERIAL_START, ");
	strSQL = String::Concat(strSQL,S"	 SERIAL_END, "  );
	strSQL = String::Concat(strSQL,S"    USE_DIV, "     );
	strSQL = String::Concat(strSQL,S"    FACTORY_CODE," );
	strSQL = String::Concat(strSQL,S"	 LINE_CODE,"    );
	strSQL = String::Concat(strSQL,S"    LOT,"			);
	strSQL = String::Concat(strSQL,S"	 PRO_YMD) "     );
	strSQL = String::Concat(strSQL,S"values ");
	strSQL = String::Concat(strSQL,S"  ( '", txtProCode->Text,S"'," );
	strSQL = String::Concat(strSQL,          txtNoStart->Text,S","  );
	strSQL = String::Concat(strSQL,          txtNoEnd->Text,S"," );
	strSQL = String::Concat(strSQL,S"		  0,");																									//0 indicate plate producing, 1 indicate plate pasting
	strSQL = String::Concat(strSQL,S"    '", infClsPltePrdRst->strFactoryCode, "',");
	strSQL = String::Concat(strSQL,S"    '", infClsPltePrdRst->strLine, "','" );
	strSQL = String::Concat(strSQL,          txtLotNo->Text,S"',");
	strSQL = String::Concat(strSQL,S"        to_date('", txtDate->Text, "','yyyy-MM-dd hh24-mi-ss'))" );											//txtDate->Text is the form's data txtbox's value ,according to the analysis of other part of code,it's current data


	if (!DbPltePrdRst->blnSQL_Execute(strSQL)) 
	{				
		return false;
	}
	else
	{
		return true;
	}
	
}
bool FAP::PlateProductResult::blnUpdStock(String * text){
   	DataSet * dSetTmp ;
	DataTable * dTableTmp;
DataSet *dSetTmp1;
DataTable * dTableTmp1;
Single in=0;
String *strscheduleqtycode1=S"";
String *str=S"";
	String *strSQL1;
	String *strSQL;
 
   strSQL1=S"select * from part_composition t where t.product_code='";
   strSQL1=String::Concat(strSQL1,text,S"'");
   DbPltePrdRst->blnCnnOpen();
   dSetTmp = DbPltePrdRst->dSetSQL_Select(strSQL1,S"part_composition",0);

	//Get Table
	dTableTmp = dSetTmp->Tables->Item[S"part_composition"];
     DbPltePrdRst->blnCnnClose ();
	System::Collections::IEnumerator* emnFapRow = dTableTmp->Rows->GetEnumerator();

	emnFapRow->Reset();
  while (emnFapRow->MoveNext())
			{
				

				DataRow *dRowTmp = __try_cast<DataRow*>(emnFapRow->Current);
		//Single *in;
				strscheduleqtycode1	= dRowTmp->Item[S"parts_code"]->ToString();
				str=dRowTmp->Item[S"parts_count"]->ToString();
				str=Convert::ToString(Convert::ToSingle(str)*Convert::ToSingle(txtQuantity->Text));

		//strTmp1 = String::Format("{0:######}",dRowTmp->Item[S"stock_qty"]);
				  DbPltePrdRst->blnCnnOpen();
				// DbPltePrdRst->blnBeginTrans();
			strSQL=S"update  stock_data set stock_qty=";
			strSQL=String::Concat (strSQL,S"(");
			strSQL=String::Concat (strSQL,S"select stock_qty-");
			strSQL=String::Concat(strSQL,str,S" from stock_data where product_code='");
			 
			strSQL=String::Concat (strSQL,strscheduleqtycode1,S"') where product_code='");
		   strSQL=String::Concat(strSQL,strscheduleqtycode1,S"'");
		// strSQL=String::Concat(strSQL,str,S"')");
			if (!DbPltePrdRst->blnSQL_Execute(strSQL)) 
			{				
			DbPltePrdRst->blnRollBack();
			}
			else
			{
				DbPltePrdRst->blnCommit();
			}
		//dSetTmp1 = DBBRstInput->dSetSQL_Select(strSQL,S"stock_data",0);

			//Get Table
		//	dTableTmp1 = dSetTmp1->Tables->Item[S"stock_data"];
		DbPltePrdRst->blnCnnClose ();
			//System::Collections::IEnumerator* emnFapRow1 = dTableTmp1->Rows->GetEnumerator();

			//emnFapRow1->Reset();


				//strscheduleymd	= String::Format("{0:dd}",dRowTmp->Item[S"scheduleymd"]);
				
			}
	return true;
	
}

/********************************************************************
	Function Name:
	
	created		 :	2005/10/26
	
	return		 :	success:   true

					failed:    false
	
	author		 :	KasenHOo  @ Eleplan ShangHai  20051026
	
	Update		 :		
	
	purpose		 :	check input data of plate data

*********************************************************************/



bool FAP::PlateProductResult::blnChkInput(String * strProCode, int intStart,int intEnd)
{
	String * strSQL;
	int intCnt;

	/*strSQL = S"select count(*) from plate_data";
	strSQL = String::Concat(strSQL,S"  where (serial_start between ");
	strSQL = String::Concat(strSQL,intStart.ToString(),S" and " ,intEnd.ToString(),S")");
	strSQL = String::Concat(strSQL,S" or (serial_end between ");
	strSQL = String::Concat(strSQL,intStart.ToString(),S" and " ,intEnd.ToString(),S")");*/
	strSQL = S"";
	strSQL = String::Concat(strSQL,S"select count(*) "                                                                    );
	strSQL = String::Concat(strSQL,S"	from plate_data "																  );
	strSQL = String::Concat(strSQL,S"  where (serial_start between ",intStart.ToString(),S" and " ,intEnd.ToString(),S") ");
	strSQL = String::Concat(strSQL,S"	  or (serial_end between ",intStart.ToString(),S" and " ,intEnd.ToString(),S") "  );

	DbPltePrdRst->blnCnnOpen();

	intCnt = DbPltePrdRst->intSQL_Select(strSQL);

	if (intCnt >0){
		return false;																												//in the database plate_data table, the serial number  has been repeated. ie the  serial number you inputed in the PlateProductResult form has same number with the plate in the database plate_data table
	}
	else{
		return true;
	}

	DbPltePrdRst->blnCnnClose();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -