📄 wsgm.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include "Wsgm.h"
#include "WsgmCopy.h"
//---------------------------------------------------------------------------
#pragma hdrstop
#pragma package(smart_init)
#pragma link "RecBaseForm"
#pragma link "DateEdit"
#pragma link "fpanel"
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmWsgm *frmWsgm;
TfrmWsgmCopy *WsgmCopyfrm;
//---------------------------------------------------------------------------
__fastcall TfrmWsgm::TfrmWsgm(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr)
: TRecBaseForm(Owner,chWnd,MidCode,WhereStr)
{
IsUserGernerate=true;
}
//---------------------------------------------------------------------------
__fastcall TfrmWsgm::TfrmWsgm(TComponent* Owner, HWND chWnd, AnsiString MidCode,AnsiString WhereStr,AnsiString ParamString)
: TRecBaseForm(Owner,chWnd,MidCode,WhereStr)
{
int iPos;
iPos=ParamString.Pos("\t");
FWsgmWoCode=ParamString.SubString(1,iPos-1);
ParamString=ParamString.SubString(iPos+1,ParamString.Length());
iPos=ParamString.Pos("\t");
FWsgmWoGoods=ParamString.SubString(1,iPos-1);
ParamString=ParamString.SubString(iPos+1,ParamString.Length());
iPos=ParamString.Pos("\t");
FWsgmCheck=StrToInt(ParamString.SubString(1,iPos-1));
ParamString=ParamString.SubString(iPos+1,ParamString.Length());
iPos=ParamString.Pos("\t");
FWsgmCancel=StrToInt(ParamString.SubString(1,iPos-1));
FWsgmFrom=StrToInt(ParamString.SubString(iPos+1,ParamString.Length()));
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::InitEditControl()
{
ClientGroup->AddComponent(2,false,false,true,PageControl1,PageControl1->Name);
ClientGroup->AddComponent(2,true,true,false,sgWsgm,sgWsgm->Name);
ClientGroup->AddComponent(2,true,true,false,sbtWsgmCopy,sbtWsgmCopy->Name);
ClientGroup->AddComponent(2,true,false,true,cheWsgmClose,cheWsgmClose->Name);
ClientGroup->AddComponent(2,true,true,true,PanelQty,PanelQty->Name);
ClientGroup->AddComponent(2,true,true,true,scWsgmBatch,scWsgmBatch->Name);
ClientGroup->AddComponent(2,true,true,true,seWsgmSn,seWsgmSn->Name);
FillComboBox(Handle,scWsgmUnit,"SELECT UnitCode,UnitName FROM sdUnit order by UnitCode","UnitName","UnitCode");
FillComboBox(Handle,scWsgmLoc,"SELECT LocCode,memo=LocCode+space(1)+'('+LocName+')' FROM sdLoc order by LocCode","memo","LocCode");
FillComboBox(Handle,scWsgmBatch,"SELECT BatchCode,memo=BatchCode+space(1)+'('+BatchDesc+')' FROM sdBatch order by BatchCode","memo","BatchCode");
FillComboBox(Handle,scWsgmProcess,"SELECT ProcessCode,memo=ProcessCode+space(1)+'('+ProcessName+')' FROM sdProcess order by ProcessCode","memo","ProcessCode");
PageControl1->ActivePage=BaseInfo;
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::RefreshUpdateData(int MsgSrc,int MsgType)
{
/*
try
{
switch (MsgSrc)
{
case euSdUnit:
if(ShowUpdateMessage(MsgSrc,MsgType)){
StartWaitForm("正在刷新引用数据!");
FillComboBox(Handle,scWsgmUnit,"Select UnitCode,UnitName FROM sdUnit order by UnitCode","UnitName","UnitCode");
EndWaitForm();
break;
}
case euSdLoc:
if(ShowUpdateMessage(MsgSrc,MsgType)){
StartWaitForm("正在刷新引用数据!");
FillComboBox(Handle,scWsgmLoc,"Select LocCode,memo=LocCode+space(1)+'('+LocName+')' FROM sdLoc order by LocCode","memo","LocCode");
EndWaitForm();
break;
}
case euSdBatch:
if(ShowUpdateMessage(MsgSrc,MsgType)){
StartWaitForm("正在刷新引用数据!");
FillComboBox(Handle,scWsgmBatch,"Select BatchCode,memo=BatchCode+space(1)+'('+BatchDesc+')' FROM sdBatch order by BatchCode","memo","BatchCode");
EndWaitForm();
break;
}
case euSdProcess:
if(ShowUpdateMessage(MsgSrc,MsgType)){
StartWaitForm("正在刷新引用数据!");
FillComboBox(Handle,scWsgmProcess,"Select ProcessCode,memo=ProcessCode+space(1)+'('+ProcessName+')' FROM sdProcess order by ProcessCode","memo","ProcessCode");
EndWaitForm();
break;
}
default:
break;
}
}
__finally
{
//AddCode
}
*/
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::ClearControl(bool BringToNext)
{
if(!BringToNext)
{
if(FWsgmFrom==2)
seWsgmSn->Text=AnsiString(comServer->RecordCount+1);
seWsgmGoods->Text="";
seWsgmGoodsName->Text="";
scWsgmUnit->ItemIndex=-1;
seWsgmQty->Text="0";
seWsgmOoq->Text="0";
seWsgmShl->Text="0";
scWsgmLoc->ItemIndex=-1;
scWsgmBatch->ItemIndex=-1;
scWsgmProcess->ItemIndex=-1;
labUserCode->Caption=g_sdUserCode;
cheWsgmClose->Checked=false;
labCloseDate->Caption="";
seWsgmPQty->Text="0";
seWsgmGQty->Text="0";
seWsgmLQty->Text="0";
seWsgmDQty->Text="0";
seWsgmUQty->Text="0";
seWsgmRQty->Text="0";
seWsgmAQty->Text="0";
seWsgmTQty->Text="0";
}
seWsgmSn->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::GetDataFromComObject()
{
seWsgmSn->Text=GetFieldValue("WsgmSn");
seWsgmGoods->Text=GetFieldValue("WsgmGoods");
//MoveFirst,MovePrority,MoveNext,MoveLast
sgWsgm->LocateGrid(1,GetFieldValue("WsgmGoods"));
InitRsGoods(seWsgmGoods->Text);
l_Query->LocateByKey(WideString(GetFieldValue("WsgmGoods")));
seWsgmGoodsName->Text=GetGoodsValue(gtInitRs,"GoodsName");
// seWsgmGoodsName->Text=GetFieldValue("WsgmGoodsName");
scWsgmUnit->LocateKey(GetFieldValue("WsgmUnit"));
seWsgmQty->Text=GetFieldValue("WsgmQty");
seWsgmShl->Text=GetFieldValue("WsgmShl");
seWsgmOoq->Text=GetFieldValue("WsgmOoq");
scWsgmLoc->LocateKey(GetFieldValue("WsgmLoc"));
scWsgmBatch->LocateKey(GetFieldValue("WsgmBatch"));
scWsgmProcess->LocateKey(GetFieldValue("WsgmProcess"));
if(GetFieldValue("WsgmUser")!="")
labUserCode->Caption=GetFieldValue("WsgmUser");
else
labUserCode->Caption=g_sdUserCode;
cheWsgmClose->Checked=GetFieldValue("WsgmClose")=="1";
labCloseDate->Caption=GetFieldValue("WsgmCloseDate");
seWsgmPQty->Text=GetFieldValue("WsgmPQty");
seWsgmGQty->Text=GetFieldValue("WsgmGQty");
seWsgmLQty->Text=GetFieldValue("WsgmLQty");
seWsgmDQty->Text=GetFieldValue("WsgmDQty");
seWsgmUQty->Text=GetFieldValue("WsgmUQty");
seWsgmRQty->Text=GetFieldValue("WsgmRQty");
seWsgmAQty->Text=GetFieldValue("WsgmAQty");
seWsgmTQty->Text=GetFieldValue("WsgmTQty");
//如果加工单(Check=1 || Cancel=1)
SetToolBarEnable();
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::SetToolBarEnable()
{
if(FWsgmCheck==1 || FWsgmCancel==1)
{
tbAddHead->Enabled=false;
tbEditHead->Enabled=false;
tbGenrate->Enabled=false;
tbDeleteHead->Enabled=false;
muAddDetail->Enabled=false;
muEditDetail->Enabled=false;
muDeleteDetail->Enabled=false;
muCancel->Enabled =false;
muSave->Enabled =false;
sbtWsgmCopy->Visible = false;
}
else
{
if(FWsgmFrom==2)
{
tbAddHead->Enabled=true;
tbEditHead->Enabled=true;
tbDeleteHead->Enabled=true;
muAddDetail->Enabled=true;
muEditDetail->Enabled=true;
muDeleteDetail->Enabled=true;
}
tbGenrate->Enabled=true;
muCancel->Enabled =true;
muSave->Enabled =true;
sbtWsgmCopy->Visible = true;
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::SendDataToComObject()
{
SetFieldValue("WsgmWo",labWsgmWo->Caption);
SetFieldValue("WsgmSn",seWsgmSn->Text);
SetFieldValue("WsgmFrom",FWsgmFrom);
SetFieldValue("WsgmGoods",seWsgmGoods->Text);
SetFieldValue("WsgmGoodsName",seWsgmGoodsName->Text);
SetFieldValue("WsgmQty",seWsgmQty->Text);
SetFieldValue("WsgmShl",seWsgmShl->Text);
SetFieldValue("WsgmOoq",seWsgmOoq->Text);
SetFieldValue("WsgmLoc",scWsgmLoc->ItemData[cbItem2]);
SetFieldValue("WsgmBatch",scWsgmBatch->ItemData[cbItem2]);
SetFieldValue("WsgmProcess",scWsgmProcess->ItemData[cbItem2]);
SetFieldValue("WsgmUser",labUserCode->Caption);
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::WaitUserInput()
{
PageControl1->ActivePage=BaseInfo;
if(seWsgmGoods->Enabled)
seWsgmGoods->SetFocus();
InitRsGoods(WideString(GetFieldValue("WsgmGoods")));
// l_RsGoods->LocateByKey(WideString(GetFieldValue("WsgmGoods")));
if(GetGoodsValue(gtInitRs,"GoodsBatch")=="1")
scWsgmBatch->Enabled=true;
else
scWsgmBatch->Enabled=false;
seWsgmSn->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::RefreshGridData(int mAction)
{
int i;
AnsiString m_ItemStr;
m_ItemStr=GetDataToGrid();
switch(mAction)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -