📄 productsimulation.cpp
字号:
#include "StdAfx.h"
#include "ProductSimulation.h"
using namespace FAP;
void ProductSimulation::iniGrid(int intLang){
DataGridTextBoxColumn *oPCode;
DataGridTextBoxColumn *oPName;
DataGridTextBoxColumn *oStockQty;
DataGridTextBoxColumn *oStockNotEnough;
DataGridTableStyle *oTblStyle;
oTblStyle = new DataGridTableStyle();
oTblStyle->MappingName = S"DD";
// oLot = new DataGridTextBoxColumn();
//oLot->MappingName =S"lot";
//oLot->HeaderText = oInf->saG_StrArrayLotNum[iLanguage];
//oLot->Alignment = HorizontalAlignment::Center;
//oLot->Width =100;
//oLot->NullText =S"";
oPCode = new DataGridTextBoxColumn();
oPCode->Width = 170;
oPCode->ReadOnly = true;
oPCode->HeaderText = infProSim->saPROCode[intLang];
oPCode->MappingName = S"PARTS_CODE";
oPCode->NullText = S"";
oPName = new DataGridTextBoxColumn();
oPName->Width = 350;
oPName->ReadOnly = true;
oPName->HeaderText = infProSim->saPrductName[intLang];
oPName->MappingName = S"Name";
oPName->NullText = S"";
oStockQty = new DataGridTextBoxColumn();
oStockQty->MappingName = S"Qty";
oStockQty->HeaderText = infProSim->saG_QTY[intLang];
oStockQty->Alignment = HorizontalAlignment::Right;
oStockQty->Width = 200;
oStockQty->ReadOnly = true;
oStockQty->NullText = S"";
oStockNotEnough = new DataGridTextBoxColumn();
oStockNotEnough->Width = 200;
oStockNotEnough->ReadOnly = true;
oStockNotEnough->HeaderText = infProSim->saG_QTY_Enough[intLang];
oStockNotEnough->MappingName = S"NotEnough1";
oStockNotEnough->NullText = S"";
oStockNotEnough->Alignment = HorizontalAlignment::Right;
oTblStyle->GridColumnStyles->Add(oPCode);
oTblStyle->GridColumnStyles->Add(oPName);
oTblStyle->GridColumnStyles->Add(oStockQty);
oTblStyle->GridColumnStyles->Add(oStockNotEnough);
this->DBGridPrd->TableStyles->Add( oTblStyle);
}
void ProductSimulation::intCombo(int intLang){
String *strSQL;
DataSet *dSetTmp;
DataTable *dTblTmp;
strSQL = S"select distinct product_code as CODE,";
strSQL = String::Concat(strSQL,S"PARTS_NAME_",sa_lang[intLang]);
strSQL = String::Concat(strSQL,S" || ' ' || product_code as NAME from parts_mst ");
dbProSim->blnCnnOpen();
dSetTmp = dbProSim->dSetSQL_Select(strSQL,S"AA",0);
dbProSim->blnCnnClose();
dTblTmp = dSetTmp->Tables->Item[S"AA"];
cboName->DataSource = dTblTmp;
cboName->DisplayMember = S"NAME";
cboName->ValueMember = S"CODE";
cboName->Refresh();
}
void ProductSimulation::setGrid(int intLang,Single sngTmp,String *strCode){
String * strSQL;
DataSet *dSetTmp;
DataTable *dTblTmp;
strSQL = S" select b.PARTS_CODE,a.PARTS_NAME_";
strSQL = String::Concat(strSQL,sa_lang[intLang],S" as Name ,sum(c.STOCK_QTY) as Qty, ");
strSQL = String::Concat(strSQL,S" case when (b.BOMQTY *", sngTmp.ToString(),S" - sum(c.STOCK_QTY)) < 0 then 0" );
strSQL = String::Concat(strSQL,S" else (b.BOMQTY *", sngTmp.ToString(),S" - sum(c.STOCK_QTY) )");
strSQL = String::Concat(strSQL,S" end as NotEnough1 ");
strSQL = String::Concat(strSQL,S" from ");
strSQL = String::Concat(strSQL,S" parts_mst a,");
strSQL = String::Concat(strSQL,S" (select PARTS_COUNT as BOMQTY, PARTS_CODE from part_composition where PRODUCT_CODE = '",strCode ,S"') b,");
strSQL = String::Concat(strSQL,S" stock_data c");
strSQL = String::Concat(strSQL,S" where ");
strSQL = String::Concat(strSQL,S" b.parts_code = a.product_code(+) and");
strSQL = String::Concat(strSQL,S" b.parts_code = c.product_code(+) ");
//****** begin **************************//
//* corrected by DongZhaoLiang in 2006/05/17 *//
//****** begin **************************//
/*strSQL = String::Concat(strSQL,S" group by b.PARTS_CODE,a.PARTS_NAME_C,b.BOMQTY");*/
strSQL = String::Concat(strSQL,S" group by b.PARTS_CODE, a.PARTS_NAME_", sa_lang[intLang],S", b.BOMQTY");
//****** end **************************//
//* corrected by DongZhaoLiang in 2006/05/17 *//
//****** end **************************//
dbProSim->blnCnnOpen();
dSetTmp = dbProSim->dSetSQL_Select(strSQL,S"DD",0);
dTblTmp = dSetTmp->Tables->Item[S"DD"];
this->DBGridPrd->DataSource = dTblTmp;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -