📄 pdmh.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include "Pdmh.h"
//---------------------------------------------------------------------------
#pragma hdrstop
#pragma package(smart_init)
#pragma link "BillBaseForm"
#pragma link "DateEdit"
#pragma link "fpanel"
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmPdmh *frmPdmh;
//---------------------------------------------------------------------------
__fastcall TfrmPdmh::TfrmPdmh(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
: TBillBaseForm(Owner,chWnd,MidCode,WhereStr)
{
//AutoCtl=sePdmhCode;
SetAutoCodeString(sePdmhCode,"ACM-030");
// InitRsGoods();
}
//---------------------------------------------------------------------------
void __fastcall TfrmPdmh::InitEditControl()
{
ClientGroup->AddComponent(1,false,false,true,fpPdmh,fpPdmh->Name);
ClientGroup->AddComponent(1,false,true,true,sePdmhCode,sePdmhCode->Name);
ClientGroup->AddComponent(1,true,true,true,scPdmhFmonth,scPdmhFmonth->Name);
ClientGroup->AddComponent(1,false,true,true,sePdmhWo,sePdmhWo->Name);
ClientGroup->AddComponent(2,false,false,true,fpPdmd,fpPdmd->Name);
ClientGroup->AddComponent(2,false,true,true,sePdmdProcess,sePdmdProcess->Name);
ClientGroup->AddComponent(2,true,true,true,sePdmdLoc,sePdmdLoc->Name);
ClientGroup->AddComponent(2,false,false,false,btnCancel,btnCancel->Name);
ClientGroup->AddComponent(2,false,true,true,btnOK,btnOK->Name);
ClientGroup->AddComponent(2,true,true,true,plPdmdGoods,plPdmdGoods->Name);
//Pdmh
FillComboBox(Handle,scPdmhFmonth,"SELECT FcMonth FROM sdFc order by FcMonth","FcMonth");
FillComboBox(Handle,scPdmhPosType,"SELECT PosTypeCode,PosTypeName FROM sdPosType where PosTypeFlg=3 order by PosTypeCode","PosTypeName","PosTypeCode");
FillEdit(Handle,sePdmdLoc,"SELECT LocName,LocCode from sdLoc where LocType=2 order by LocCode","LocName","LocCode");
FillEdit(Handle,sePdmdProcess,"SELECT ProcessName,ProcessCode from sdProcess ","ProcessName","ProcessCode");
//Pdmd
FillComboBox(Handle,scGoodsUnit,"SELECT UnitName,UnitCode from sdUnit order by UnitCode","UnitName","UnitCode");
scPdmdType->ClearAll();
scPdmdType->AddItems("1-工废","1");
scPdmdType->AddItems("2-料废","2");
}
//---------------------------------------------------------------------------
void __fastcall TfrmPdmh::RefreshUpdateData(int MsgSrc,int MsgType)
{
/*
try
{
switch (MsgSrc)
{
case euSdFc:
if(ShowUpdateMessage(MsgSrc,MsgType)){
StartWaitForm("正在刷新引用数据!");
FillComboBox(Handle,scPdmhFmonth,"SELECT FcMonth FROM sdFc order by FcMonth","FcMonth");
EndWaitForm();
break;
}
case euSdPosType:
if(ShowUpdateMessage(MsgSrc,MsgType)){
StartWaitForm("正在刷新引用数据!");
FillComboBox(Handle,scPdmhPosType,"SELECT PosTypeCode,PosTypeName FROM sdPosType order by PosTypeCode","PosTypeName","PosTypeCode");
EndWaitForm();
break;
}
case euSdUnit:
if(ShowUpdateMessage(MsgSrc,MsgType)){
StartWaitForm("正在刷新引用数据!");
FillComboBox(Handle,scGoodsUnit,"SELECT UnitName,UnitCode from sdUnit order by UnitCode","UnitName","UnitCode");
EndWaitForm();
break;
}
case euSdLoc:
if(ShowUpdateMessage(MsgSrc,MsgType)){
StartWaitForm("正在刷新引用数据!");
FillEdit(Handle,sePdmdLoc,"SELECT LocName,LocCode from sdLoc where LocType=2 order by LocCode","LocName","LocCode");
EndWaitForm();
break;
}
case euSdProcess:
if(ShowUpdateMessage(MsgSrc,MsgType)){
StartWaitForm("正在刷新引用数据!");
FillEdit(Handle,sePdmdProcess,"SELECT ProcessName,ProcessCode from sdProcess order by ProcessCode","ProcessName","ProcessCode");
EndWaitForm();
break;
}
default:
break;
}
}
__finally
{
//AddCode;
}
*/
}
//---------------------------------------------------------------------------
void __fastcall TfrmPdmh::ClearControl(int Section,bool BringToNext)
{
if(Section == 1)
{
if(!BringToNext)
{
sePdmhCode->Text="";
dePdmhDate->Text=g_sdCurDate;
scPdmhFmonth->LocateKey(g_sdMMonth);
scPdmhPosType->ItemIndex=-1;
sePdmhWo->Text="";
labUser->Caption=g_sdUserCode;
chkPdmhCheck->Checked=false;
labChecker->Caption="";
labCheckDate->Caption="";
memPdmhDesc->Text="";
}
sgPdmh->RowCount=1;
}
else
{
if(!BringToNext)
{
sePdmdLine->Text=AnsiString(comServer->ItemCount+1);
sePdmdProcess->ItemIndex=-1;
sePdmdLoc->ItemIndex=-1;
sePdmdGoods->Text="";
seGoodsName->Text="";
scGoodsUnit->ItemIndex=-1;
seGoodsSpec->Text="";
seGoodsModel->Text="";
scGoodsType->ItemIndex=-1;
scGoodsFrom->ItemIndex=-1;
sePdmdQty->Text="0";
memPdmdDesc->Text="";
scPdmdType->ItemIndex=0;
}
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmPdmh::GetDataFromComObject(int Section)
{
if(Section==1)
{
sePdmhCode->Text=GetHeadValue("PdmhCode");
dePdmhDate->Text=GetHeadValue("PdmhDate");
scPdmhFmonth->LocateKey(GetHeadValue("PdmhFMonth"));
scPdmhPosType->LocateKey(GetHeadValue("PdmhPosType"));
sePdmhWo->Text=GetHeadValue("PdmhWo");
chkPdmhCheck->Checked=GetHeadValue("PdmhCheck")=="1" ;
if(chkPdmhCheck->Checked)
SetCheckToolbarStatus(true);
else
SetCheckToolbarStatus(false);
labChecker->Caption=GetHeadValue("PdmhChecker");
labCheckDate->Caption=GetHeadValue("PdmhCheckDate");
memPdmhDesc->Text=GetHeadValue("PdmhDesc");
}
else
{
sePdmdLine->Text=GetDetailValue("PdmdLine");
sePdmdProcess->LocateKey(GetDetailValue("PdmdProcess"));
sePdmdLoc->LocateKey(GetDetailValue("PdmdLoc"));
sePdmdGoods->Text=GetDetailValue("PdmdGoods");
InitRsGoods(sePdmdGoods->Text);
// l_RsGoods->LocateByKey(WideString(GetDetailValue("PdmdGoods")));
seGoodsName->Text=GetGoodsValue(gtInitRs,"GoodsName");
scGoodsUnit->LocateKey(GetGoodsValue(gtInitRs,"GoodsUnitCode"));
seGoodsSpec->Text=GetGoodsValue(gtInitRs,"GoodsSpec");
seGoodsModel->Text=GetGoodsValue(gtInitRs,"GoodsModel");
if(GetGoodsValue(gtInitRs,"GoodsType")!="")
scGoodsType->ItemIndex=StrToInt(GetGoodsValue(gtInitRs,"GoodsType"))-1;
else
scGoodsType->ItemIndex=-1;
if(GetGoodsValue(gtInitRs,"GoodsFrom")!="")
scGoodsFrom->ItemIndex=StrToInt(GetGoodsValue(gtInitRs,"GoodsFrom"))-1;
else
scGoodsFrom->ItemIndex=-1;
sePdmdQty->Text=GetDetailValue("PdmdQty");
scPdmdType->LocateKey(GetDetailValue("PdmdType"));
memPdmdDesc->Text=GetDetailValue("PdmdDesc");
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmPdmh::SendDataToComObject(int Section)
{
if(Section==1)
{
SetHeadValue("PdmhCode",sePdmhCode->Text);
SetHeadValue("PdmhDate",dePdmhDate->Text);
SetHeadValue("PdmhFMonth",scPdmhFmonth->Text);
SetHeadValue("PdmhPosType",scPdmhPosType->ItemData[1]);
SetHeadValue("PdmhWo",sePdmhWo->Text);
SetHeadValue("PdmhUser",labUser->Caption);
SetHeadValue("PdmhDesc",memPdmhDesc->Text);
}
else
{
SetDetailValue("PdmdCode",sePdmhCode->Text);
SetDetailValue("PdmdLine",sePdmdLine->Text);
SetDetailValue("PdmdProcess",sePdmdProcess->ItemData[1]);
SetDetailValue("PdmdLoc",sePdmdLoc->ItemData[1]);
SetDetailValue("PdmdGoods",sePdmdGoods->Text);
SetDetailValue("PdmdGoodsName",seGoodsName->Text);
SetDetailValue("PdmdUnit",scGoodsUnit->Text);
SetDetailValue("PdmdQty",sePdmdQty->Text);
SetDetailValue("PdmdType",scPdmdType->ItemData[1]);
SetDetailValue("PdmdDesc",memPdmdDesc->Text);
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmPdmh::WaitUserInput(int Section)
{
if(Section ==1){
if(sePdmhCode->Enabled)
sePdmhCode->SetFocus();
else
dePdmhDate->SetFocus();
}
else
{
ChangeToBrowseState(false);
if(sePdmdLine->Enabled)
sePdmdLine->SetFocus();
}
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmPdmh::GetDataToGrid()
{
AnsiString ItemStr,s;
s=GetDetailValue("PdmdUnit");
scGoodsUnit->LocateKey(s);
// l_RsGoods->LocateByKey(WideString(GetDetailValue("PdmdGoods")));
ItemStr=GetDetailValue("PdmdLine")+
"\t"+GetDetailValue("PdmdGoods")+
"\t"+GetDetailValue("PdmdGoodsName")+
"\t"+GetDetailValue("PdmdGoodsSpec")+
"\t"+scGoodsUnit->ItemData[0]+
"\t"+GetDetailValue("PdmdQty");
return ItemStr;
}
//---------------------------------------------------------------------------
void __fastcall TfrmPdmh::RefreshGridData(int mAction)
{
int i;
AnsiString ItemStr=GetDataToGrid();
switch(mAction)
{
case 0: //Add
sgPdmh->AddItem(ItemStr);
sgPdmh->Row=sgPdmh->RowCount-1;
break;
case 1: //Edit
sgPdmh->ChangeItem(ItemStr,sgPdmh->Row);
break;
case 2: //Delete
sgPdmh->RemoveItem(sgPdmh->Row);
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmPdmh::FillGridWithData()
{
int i;
AnsiString ItemStr;
sgPdmh->RowCount=1;
if(comServer->RecordCount > 0)
{
for(i=0;i<comServer->ItemCount;i++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -