📄 productresult.cpp
字号:
#include "StdAfx.h"
#include "ProductResult.h"
#include "infClass.h"
void FAP::ProductResult::setProcessCbo(){
// String * strSQL ;
// strSQL = S"select district ";
}
void FAP::ProductResult::InitDetailGrid(int intLang){
DataGridTextBoxColumn *oYMD;
DataGridTextBoxColumn *oShift;
DataGridTextBoxColumn *oPro_QTY;
DataGridTextBoxColumn *oSche_QTY;
DataGridTextBoxColumn *oDiff;
DataGridTableStyle *oTableStyle = new DataGridTableStyle();
oTableStyle->MappingName = S"ProductCalendar";
//oYMD
oYMD = new DataGridTextBoxColumn();
oYMD->MappingName = S"YMD";
oYMD->HeaderText = String::Concat(S" ",infClsPrd->saPROYMD [intLang]);
oYMD->Alignment = HorizontalAlignment::Left;
oYMD->Width = 120;
oYMD->ReadOnly = true;
oYMD->NullText = S"";
oYMD->Format = S"yyyy-MM-dd";
String * ooShift[]={S"勤务",S"シフト",S"Shift"};
//oShift
oShift = new DataGridTextBoxColumn();
oShift->MappingName = S"Shift";
oShift->HeaderText = ooShift[intLang];//infClsPrd->saPROShift[intLang];
oShift->Alignment = HorizontalAlignment::Center;
oShift->Width = 80;
oShift->ReadOnly = true;
oShift->NullText =S"";
//oPro_QTY
oPro_QTY = new DataGridTextBoxColumn();
oPro_QTY->MappingName = S"Pro_QTY";
oPro_QTY->HeaderText = String::Concat(infClsPrd->saPROResult[intLang],S" \0");
oPro_QTY->Alignment = HorizontalAlignment::Right;
oPro_QTY->Width = 120;
oPro_QTY->ReadOnly = true;
oPro_QTY->NullText =S"";
oPro_QTY->Format =S"#,###";
//oSche_QTY
oSche_QTY = new DataGridTextBoxColumn();
oSche_QTY->MappingName = S"Sche_QTY";
oSche_QTY->HeaderText = String::Concat(infClsPrd->saPROPlan[intLang],S" \0");
oSche_QTY->Alignment = HorizontalAlignment::Right;
oSche_QTY->Width = 120;
oSche_QTY->ReadOnly = false;
oSche_QTY->NullText =S"";
oSche_QTY->Format =S"#,###";
//oDiff
String * asaPRODiff[]={S"差值",S"差異値",S"Diff"};
oDiff = new DataGridTextBoxColumn();
oDiff->MappingName = S"Diff";
oDiff->HeaderText = String::Concat(asaPRODiff[intLang],S" \0");
oDiff->Alignment = HorizontalAlignment::Right;
oDiff->Width = 80;
oDiff->ReadOnly = false;
oDiff->NullText = S"";
oDiff->Format =S"#,###";
oTableStyle->GridColumnStyles->Add(oYMD);
oTableStyle->GridColumnStyles->Add(oShift);
oTableStyle->GridColumnStyles->Add(oPro_QTY);
oTableStyle->GridColumnStyles->Add(oSche_QTY);
oTableStyle->GridColumnStyles->Add(oDiff);
DBGridSch->TableStyles->Add(oTableStyle);
}
void FAP::ProductResult::InitSimpleGird(int intLang){
DataGridTextBoxColumn *oYmd;
DataGridTextBoxColumn *oProCode;
DataGridTextBoxColumn *oLot;
DataGridTextBoxColumn *oLine;
DataGridTextBoxColumn *oShift;
DataGridTextBoxColumn *oPlan;
DataGridTextBoxColumn *oResult;
DataGridTextBoxColumn *oPer;
DataGridTableStyle *oTableStyle = new DataGridTableStyle();
oTableStyle->MappingName = S"ProductSchedule";
oYmd = new DataGridTextBoxColumn();
oYmd->MappingName = S"Ymd";
oYmd->HeaderText = String::Concat(S" ",infClsPrd->saG_StocYMD[intLang]);//标题居中
oYmd->Alignment = HorizontalAlignment::Left;
oYmd->Width = 120;
oYmd->ReadOnly = true;
oYmd->NullText = S"";
oYmd->Format = S"yyyy-MM-dd";
//product code
oProCode = new DataGridTextBoxColumn();
oProCode->MappingName = S"Procode";
oProCode->HeaderText = String::Concat(S" ",infClsPrd->saPROCode[intLang]);
oProCode->Alignment = HorizontalAlignment::Left;
oProCode->Width = 120;
oProCode->ReadOnly = true;
oProCode->NullText = S"";
//Lot
String * stroLot[]={S"计划号",S"ロット",S"Order No"};
oLot = new DataGridTextBoxColumn();
oLot->MappingName = S"LOT";
oLot->HeaderText = String::Concat(S" ",stroLot[intLang]);
oLot->Alignment = HorizontalAlignment::Left;
oLot->Width = 130;
oLot->ReadOnly = true;
oLot->NullText =S"";
oLine = new DataGridTextBoxColumn();
oLine->MappingName = S"line";
oLine->HeaderText = infClsPrd->saG_LineName[intLang];
oLine->Alignment = HorizontalAlignment::Center;
oLine->Width = 80;
oLine->ReadOnly = true;
oLine->NullText =S"";
String * ooShift[]={S"勤务",S"シフト",S"Shift"};
oShift = new DataGridTextBoxColumn();
oShift->MappingName = S"shift";
oShift->HeaderText = ooShift[intLang];//infClsPrd->saPROShift[intLang];
oShift->Alignment = HorizontalAlignment::Center;
oShift->Width = 80;
oShift->ReadOnly = true;
oShift->NullText =S"";
//Sche_QTY
oPlan = new DataGridTextBoxColumn();
oPlan->MappingName = S"Sche_QTY";
oPlan->HeaderText = String::Concat(infClsPrd->saPROPlan[intLang],S" \0");
oPlan->Alignment = HorizontalAlignment::Right;
oPlan->Width = 120;
oPlan->ReadOnly = true;
oPlan->NullText =S"";
oPlan->Format =S"#,###";
//Pro_QTY
oResult = new DataGridTextBoxColumn();
oResult->MappingName = S"Pro_QTY";
oResult->HeaderText = String::Concat(infClsPrd->saPROResult[intLang],S" \0");
oResult->Alignment = HorizontalAlignment::Right;
oResult->Width = 120;
oResult->ReadOnly = false;
oResult->NullText =S"0";
oResult->Format =S"#,###";
//Percents //修改为差值
String * saPRODiff[]={S"差值",S"差異値",S"Diff"};
oPer = new DataGridTextBoxColumn();
oPer->MappingName = S"Percents";
oPer->HeaderText = String::Concat(saPRODiff[intLang],S" \0");
oPer->Alignment = HorizontalAlignment::Right;
oPer->Width = 80;
oPer->ReadOnly = false;
oPer->NullText = S"";
oPer->Format =S"#,###";
oTableStyle->GridColumnStyles->Add(oYmd);
oTableStyle->GridColumnStyles->Add(oProCode);
oTableStyle->GridColumnStyles->Add(oLot);
oTableStyle->GridColumnStyles->Add(oLine);
oTableStyle->GridColumnStyles->Add(oShift);
oTableStyle->GridColumnStyles->Add(oPlan);
oTableStyle->GridColumnStyles->Add(oResult);
oTableStyle->GridColumnStyles->Add(oPer);
DBGridPrd->TableStyles->Add(oTableStyle);
}
void FAP::ProductResult::setSchedule(String * strProcessNo,String * strLineNo){
String * strSQL ;
DataSet *dSetPro;
//DataTable *tblTmp;// 已经修改为全局变量了
String * vstrDateTime;
vstrDateTime=String::Format("{0:yyyy-MM-dd}",__box(DateTime::Now));
String * vstrDateTime1;
vstrDateTime1=String::Format("{0:yyyy-MM-dd}",__box(DateTime::Now.AddDays(-2)));
DateTime dteTmp = DateTime::Now;
//DateTime dteTmp1;
dteTmp = DateTime( dteTmp.Year,dteTmp.Month,1) ;
//////strSQL = S"select a.lot as LOT, a.product_code as Procode ,b.product_qty as Sche_QTY , sum(a.product_qty) as Pro_QTY , trim(to_char((sum(a.product_qty) / b.product_qty) * 100 , '999999990.00')) as Percents from product_result_data a left join product_schedule b on a.process_no = b.process_no and a.lot = b.lot ";
//////
//////strSQL = String::Concat(strSQL,S" and (a.YMD between to_date('", dteTmp.ToString(S"yyyy-MM-dd"),S"','yyyy-MM-dd') and last_day(to_date('",dteTmp.ToString(S"yyyy-MM-dd"), S"','yyyy-MM-dd'))) ");
//////
//////strSQL = String::Concat(strSQL,S" and a.process_no = '",infClsPrd->strProcess,S"'");
//////strSQL = String::Concat(strSQL,S" having sum(b.product_qty) >0 group by a.product_code,a.lot,b.product_qty");
strSQL = S" Select a.ymd as Ymd,a.product_code as Procode,a.lot as LOT, case a.line_code when 'L001' then 'R' when 'L002' then 'V' end as line, a.shift as shift, a.product_qty as Sche_QTY,nvl(sum(b.product_qty),0) as Pro_QTY,nvl(( nvl(sum(b.product_qty),0) - a.product_qty) ,-a.product_qty) as Percents ";
strSQL = String::Concat(strSQL,S" from product_schedule a left outer join product_result_data b on a.lot=b.lot where a.ymd>=to_date('",vstrDateTime1,S"','yyyy-MM-dd') and a.ymd<=to_date('",vstrDateTime,S"','yyyy-MM-dd') ");
strSQL = String::Concat(strSQL,S" and a.process_no = '",infClsPrd->strProcess,S"' ");
strSQL = String::Concat(strSQL,S" group by a.lot,a.product_code,a.product_qty,a.ymd,a.line_code,a.shift order by a.ymd desc,a.shift,a.product_code asc ");
dSetPro=DBPrdRst->dSetSQL_Select(strSQL,S"ProductSchedule",0);
//DBGridPrd->SetDataBinding(dSetPro, S"ProductSchedule");
tblTmp = dSetPro->Tables->Item[S"ProductSchedule"];
DBGridPrd->DataSource = tblTmp;
}
void FAP::ProductResult::setCalendar(String * strProductCode){
String * strSQL ;
DataSet *dSetCalendar;
//修改为全局变量了
//DataTable *tblTmp;
//strSQL = S"select ";
//strSQL = String::Concat(strSQL,S" b.ymd as YMD, b.shift as Shift,a.product_qty as Pro_QTY,b.product_qty as Sche_QTY,(b.product_qty - a.product_qty) as diff ");
//strSQL = String::Concat(strSQL,S" from product_result_data a, product_schedule b");
//strSQL = String::Concat(strSQL,S" where a.process_no = b.process_no and a.product_code = '",strProductCode ,S"' and a.lot = '",strOrderNo,S"'");
//strSQL = String::Concat(strSQL,S" and b.ymd = to_date('",(DateTime::Today).ToString(S"yyyy-MM-dd"),S"','yyyy-mm-dd')");
strSQL = S"select ";
strSQL = String::Concat(strSQL,S" a.ymd as YMD,a.shift as Shift,a.product_qty as Pro_QTY,b.product_qty as Sche_QTY,(a.product_qty - b.product_qty) as diff ");
strSQL = String::Concat(strSQL,S" from product_result_data a, product_schedule b");
strSQL = String::Concat(strSQL,S" where a.process_no = b.process_no and a.product_code = '",strProductCode ,S"' and a.lot = '",strOrderNo,S"' and a.lot = b.lot");
//strSQL = String::Concat(strSQL,S" and a.ymd = to_date('",(DateTime::Today).ToString(S"yyyy-MM-dd"),S"','yyyy-mm-dd')",S"and a.lot = b.lot" );
strSQL = String::Concat(strSQL,S" and a.process_no = '",infClsPrd->strProcess,S"' order by a.ymd asc");
dSetCalendar=DBPrdRst->dSetSQL_Select(strSQL,S"ProductCalendar",0);
//DBGridSch->SetDataBinding(dSetCalendar, S"ProductCalendar");
tblTmp1 = dSetCalendar->Tables->Item[S"ProductCalendar"];
DBGridSch->DataSource = tblTmp1;
}
void FAP::ProductResult::setLineCbo(){
// String * strSQL ;
// strSQL = S"select district ";
}
String * FAP::ProductResult::strGetProcessName(String * strDelFromNo,int iLanguage){
System::Data::DataRow *dRowTmp;
String *strSQL = S"select * from cost_mst ";
String *strFdName ;
if (String::Compare(strDelFromNo->Trim(), S"")!=0)
strSQL=String::Concat (strSQL, S" where process_no = '" ,strDelFromNo->Trim(),S"'");
if (DBPrdRst->blnCnnOpen()==false) {
MessageBox::Show(S"Open Oracle Failed!!",S"Deliver",MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
return S"";
}
switch(iLanguage) {
case FapLan_EN:
strFdName = S"name_e";
break;
case FapLan_JP:
strFdName = S"name_j";
break;
case FapLan_CN:
strFdName = S"name_c";
break;
default:
strFdName = S"name_e";
}
dRowTmp = DBPrdRst->dRowSQL_Select(strSQL);
try
{
DBPrdRst->blnCnnClose ();
}
catch (...) {
return S"";
}
try
{
return Convert::ToString(dRowTmp->Item[strFdName]);
}
catch (...) {
return S"";
}
}
String * FAP::ProductResult::strGetLineName(String * strDelFromNo,int iLanguage)
{
System::Data::DataRow *dRowTmp;
String *strSQL = S"select * from line_mst ";
String *strFdName ;
if (String::Compare(strDelFromNo->Trim(), S"")!=0)
strSQL=String::Concat (strSQL, S" where line_code = '" ,strDelFromNo->Trim(),S"'");
if (DBPrdRst->blnCnnOpen()==false) {
MessageBox::Show(S"Open Oracle Failed!!",S"Product_Result",MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
return S"";
}
strFdName = S"Line_name";
dRowTmp = DBPrdRst->dRowSQL_Select(strSQL);
try
{
DBPrdRst->blnCnnClose ();
}
catch (...) {
return S"";
}
try
{
return Convert::ToString(dRowTmp->Item[strFdName]);
}
catch (...) {
return S"";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -