📄 productresultlist.cpp
字号:
////
////finalSQL=String::Concat(finalSQL,S"\n)KKTABLE left outer join(\n");
////
////finalSQL=String::Concat(finalSQL,S" select parts_name_");
////finalSQL=String::Concat(finalSQL,ssaLang[iLanguage]);
////
////
////finalSQL=String::Concat(finalSQL,S" as product_name,product_code from parts_mst");
////
////finalSQL=String::Concat(finalSQL,S"\n)BBTABLE \n");
////
////finalSQL=String::Concat(finalSQL,S" on KKTABLE.PRODUCT_CODE=BBTABLE.PRODUCT_CODE");
////tempSQL=S"";
////tempSQL=finalSQL;
////finalSQL=S"";
////
//////取LINE
////finalSQL=String::Concat(finalSQL,S"select BBTABLE.line_name,KKTABLE.product_name,KKTABLE.SECYMD,KKTABLE.YMD,KKTABLE.scheduled_shift as scheduled_shift,KKTABLE.PRODUCT_CODE,KKTABLE.LOT,KKTABLE.PS_QTY,KKTABLE.PR_QTY,KKTABLE.PERCENTAGE,\n");
////finalSQL=String::Concat(finalSQL,S"KKTABLE.YMD_DATE,KKTABLE.TOTAL,KKTABLE.NAME_B,KKTABLE.QTY_B,KKTABLE.NAME_A,KKTABLE.QTY_A\n");
////finalSQL=String::Concat(finalSQL,S" from (\n");
////finalSQL=String::Concat(finalSQL,tempSQL);
////
////finalSQL=String::Concat(finalSQL,S"\n)KKTABLE left outer join(\n");
////finalSQL=String::Concat(finalSQL,S" select product_no as product_code ,(case line_no when 'L001' then 'R' when 'L002' then 'V' end) as line_name from process_pro");
////
////finalSQL=String::Concat(finalSQL,S"\n)BBTABLE \n");
////
////finalSQL=String::Concat(finalSQL,S" on KKTABLE.PRODUCT_CODE=BBTABLE.PRODUCT_CODE order by KKTABLE.YMD,KKTABLE.PRODUCT_CODE,KKTABLE.LOT");
////////////////////////////////////////////////////////
///////////////////////////////////////结束////////////////////////////////
//oDataSetMinor = oDB->dSetSQL_Select(sSQL, S"GridDataMinor", 0);
//oDataTableMinor = oDataSetMinor->Tables->Item["GridDataMinor"];
//dataGridMinor->DataSource = oDataTableMinor;
///////////////////////////////////////////////////////////////////////////////////
oDataSetMain = oDB->dSetSQL_Select(sMySQLDay, S"GridDataMainForDay", 0);
oDataTableMain = oDataSetMain->Tables->Item[S"GridDataMainForDay"];
///begin
///add a sum row to the end
/*double sumTotal;*/
long sumTotalPlan;
long sumTotalResult;
sumTotalPlan=0;
sumTotalResult=0;
IEnumerator* tempRow = oDataTableMain->Rows->GetEnumerator();
tempRow->Reset();
while (tempRow->MoveNext())
{
DataRow *dRowTmp = __try_cast<DataRow*>(tempRow->Current);
//sumTotal=sumTotal+Convert::ToDouble(dRowTmp->Item[S"PS_QTY"]);
sumTotalPlan =sumTotalPlan+Convert::ToInt32(dRowTmp->Item[S"ps_qty"]);
sumTotalResult =sumTotalResult+Convert::ToInt32(dRowTmp->Item[S"pr_qty"]);
}
DataRow* sumRow=oDataTableMain->NewRow();
switch (iLanguage)//0 is chinese,1 is jap ,2 is english
{
case 0:
sumRow->Item["product_code"]= S"合计";
break;
case 1:
sumRow->Item["product_code"]= S"合計";
break;
case 2:
sumRow->Item["product_code"]= S"sum";
break;
default: break;
}
sumRow->Item["ps_qty"]=Convert::ToString(sumTotalPlan1);//Convert::ToString(5435984358);//
//sumRow->Item["result_ymd"]=S" ";
sumRow->Item["pr_qty"]=Convert::ToString(sumTotalResult);
//sumRow->Item["PERCENTAGE"]=Convert::ToString((sumTotalResult)/(sumTotalPlan)*100);
sumRow->Item["diff_qty"]=Convert::ToString((sumTotalResult)-(sumTotalPlan1));
////sumRow->Item["TOTAL"]=Convert::ToString(0);
////sumRow->Item["TEAMQTY"]=S"";
//////sumRow->Item["NAME_B"]=S"";
//////sumRow->Item["QTY_B"]=S"";
//sumRow->Item["QTY_B"]=S"";
oDataTableMain->Rows->Add(sumRow);
///end
///add a sum row to the enddataGridMainForDay
dataGridMainForDay->DataSource = oDataTableMain;
///////////////////////////////////////////////////////////////////////////////////
}
void ProductResultList::GetDataGridMinorForMonth(String* sProcessNo)
{
//BindingManagerBase* oBM;
//DataRow* oDR;
//
//String* sDate;
//String* sProductCode;
//Get selected Lot
//oBM = dataGridMainForMonth->BindingContext->get_Item(oDataTableMain);
//oDR = (dynamic_cast<DataRowView*>(oBM->Current))->Row;
//sDate = oDR->get_Item(S"YMD")->ToString();//get current selected YMD field's value
//sProductCode=oDR->get_Item(S"PRODUCT_CODE")->ToString();
// dataGridMinor->DataSource = NULL;
// dataGridMinor->Refresh();
String *sSQL = S"";
String* saLang[] = {S"C", S"J", S"E"};
/*if(comboBoxUnit->SelectedIndex==0)
{*/
//sSQL = String::Concat(sSQL, S" " );
sSQL = String::Concat(sSQL, S"select " );
sSQL = String::Concat(sSQL, S" CALE.PRODUCT_CODE, " );
sSQL = String::Concat(sSQL, S" CALE.YMD as YMD, " );
sSQL = String::Concat(sSQL, S" to_char(CALE.YMD,'yyyy-mm-dd') as YMD_DATE, " );
sSQL = String::Concat(sSQL, S" nvl(SCHE.TOTAL,0) as TOTAL, " );
sSQL = String::Concat(sSQL, S" nvl(CALE.NAME_B, ' ') as NAME_B, " );
sSQL = String::Concat(sSQL, S" nvl(to_char(SR_B.PRODUCT_QTY, '999990'), ' ') as QTY_B, " );
sSQL = String::Concat(sSQL, S" nvl(CALE.NAME_A, ' ') as NAME_A, " );
sSQL = String::Concat(sSQL, S" nvl(to_char(SR_A.PRODUCT_QTY, '999990'), ' ') as QTY_A " );
sSQL = String::Concat(sSQL, S"from " );
sSQL = String::Concat(sSQL, S" ( " );
sSQL = String::Concat(sSQL, S" select distinct " );
sSQL = String::Concat(sSQL, S" CAL.WORK_YMD as YMD, " );
sSQL = String::Concat(sSQL, S" M_M.FACTORY_CODE, " );
sSQL = String::Concat(sSQL, S" M_M.LOT, " );
sSQL = String::Concat(sSQL, S" M_M.LINE_CODE, " );
sSQL = String::Concat(sSQL, S" M_M.PROCESS_NO, " );
sSQL = String::Concat(sSQL, S" M_M.PRODUCT_CODE, " );
sSQL = String::Concat(sSQL, S" CAL.NAME_A, " );
sSQL = String::Concat(sSQL, S" CAL.NAME_B " );
sSQL = String::Concat(sSQL, S" from " );
sSQL = String::Concat(sSQL, S" ( " );
sSQL = String::Concat(sSQL, S" select distinct " );
sSQL = String::Concat(sSQL, S" CALE.FACTORY_CODE, " );
sSQL = String::Concat(sSQL, S" CALE.LINE_CODE, " );
sSQL = String::Concat(sSQL, S" CALE.WORK_YMD, " );
sSQL = String::Concat(sSQL, S" CALE.PROCESS_NO, " );
sSQL = String::Concat(sSQL, S" TE_A.NAME_", saLang[iLanguage],S" as NAME_A, " );
sSQL = String::Concat(sSQL, S" TE_B.NAME_", saLang[iLanguage],S" as NAME_B " );
sSQL = String::Concat(sSQL, S" from " );
sSQL = String::Concat(sSQL, S" WORK_CALENDER CALE, " );
sSQL = String::Concat(sSQL, S" TEAM_MST TE_A, " );
sSQL = String::Concat(sSQL, S" TEAM_MST TE_B " );
sSQL = String::Concat(sSQL, S" where " );
sSQL = String::Concat(sSQL, S" CALE.DAY_SHIFT = TE_A.TEAM(+) and " );
sSQL = String::Concat(sSQL, S" CALE.NIGHT_SHIFT = TE_B.TEAM(+) and " );
sSQL = String::Concat(sSQL, S" CALE.PROCESS_NO = TE_A.PROCESS_NO(+) and " );
sSQL = String::Concat(sSQL, S" CALE.PROCESS_NO = TE_B.PROCESS_NO(+) " );
sSQL = String::Concat(sSQL, S" ) CAL, " );
sSQL = String::Concat(sSQL, S" ( " );
sSQL = String::Concat(sSQL, S" select" );
sSQL = String::Concat(sSQL, S" FACTORY_CODE, " );
sSQL = String::Concat(sSQL, S" LOT, " );
sSQL = String::Concat(sSQL, S" LINE_CODE, " );
sSQL = String::Concat(sSQL, S" PROCESS_NO, " );
sSQL = String::Concat(sSQL, S" PRODUCT_CODE, " );
sSQL = String::Concat(sSQL, S" min(YMD) as W_MIN, " );
sSQL = String::Concat(sSQL, S" max(YMD) as W_MAX " );
sSQL = String::Concat(sSQL, S" from " );
sSQL = String::Concat(sSQL, S" ( " );
sSQL = String::Concat(sSQL, S" select " );
sSQL = String::Concat(sSQL, S" YMD, " );
sSQL = String::Concat(sSQL, S" FACTORY_CODE, " );
sSQL = String::Concat(sSQL, S" LOT, " );
sSQL = String::Concat(sSQL, S" LINE_CODE, " );
sSQL = String::Concat(sSQL, S" PROCESS_NO, " );
sSQL = String::Concat(sSQL, S" PRODUCT_CODE " );
sSQL = String::Concat(sSQL, S" from " );
sSQL = String::Concat(sSQL, S" PRODUCT_SCHEDULE " );
//sSQL = String::Concat(sSQL, S" where " );
//sSQL = String::Concat(sSQL, S" PRODUCT_CODE=ABEF.PRODUCT_CODE " );
sSQL = String::Concat(sSQL, S" union " );
sSQL = String::Concat(sSQL, S" select " );
sSQL = String::Concat(sSQL, S" YMD, " );
sSQL = String::Concat(sSQL, S" FACTORY_CODE, " );
sSQL = String::Concat(sSQL, S" LOT, " );
sSQL = String::Concat(sSQL, S" LINE_CODE, " );
sSQL = String::Concat(sSQL, S" PROCESS_NO, " );
sSQL = String::Concat(sSQL, S" PRODUCT_CODE " );
sSQL = String::Concat(sSQL, S" from " );
sSQL = String::Concat(sSQL, S" PRODUCT_RESULT_DATA " );
//sSQL = String::Concat(sSQL, S" where " );
//sSQL = String::Concat(sSQL, S" PRODUCT_CODE=ABEF.PRODUCT_CODE " );
sSQL = String::Concat(sSQL, S" ) M_M " );
sSQL = String::Concat(sSQL, S" group by " );
sSQL = String::Concat(sSQL, S" FACTORY_CODE, LOT, LINE_CODE, PROCESS_NO, PRODUCT_CODE " );
sSQL = String::Concat(sSQL, S" ) M_M " );
sSQL = String::Concat(sSQL, S" where " );
sSQL = String::Concat(sSQL, S" CAL.FACTORY_CODE = M_M.FACTORY_CODE and " );
sSQL = String::Concat(sSQL, S" CAL.LINE_CODE = M_M.LINE_CODE and " );
sSQL = String::Concat(sSQL, S" CAL.PROCESS_NO = M_M.PROCESS_NO and " );
sSQL = String::Concat(sSQL, S" CAL.WORK_YMD >= M_M.W_MIN and " );
sSQL = String::Concat(sSQL, S" CAL.WORK_YMD <= M_M.W_MAX " );
sSQL = String::Concat(sSQL, S" order by " );
sSQL = String::Concat(sSQL, S" M_M.LOT, M_M.PROCESS_NO, CAL.WORK_YMD " );
sSQL = String::Concat(sSQL, S" ) CALE, " );
sSQL = String::Concat(sSQL, S" ( " );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -