⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wsgm.cpp

📁 速达开源ERP系统
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include "Wsgm.h"
#include "WsgmCopy.h"
#include "func.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)
        : TRecBaseForm(Owner,euSdWsgm,"")
{
}
//---------------------------------------------------------------------------
__fastcall TfrmWsgm::TfrmWsgm(TComponent* Owner,AnsiString FWoCode,AnsiString FWoGoods,
          int FWoCheck,int FWoCancel,int FWoFrom)
        : TRecBaseForm(Owner,euSdWsgm,"WsgmWo='"+FWoCode+"'")
{
    FWsgmWoCode=FWoCode;
    FWsgmWoGoods=FWoGoods;
    FWsgmFrom=FWoFrom;
    FWsgmCheck=FWoCheck;
    FWsgmCancel=FWoCancel;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmWsgm::GetFieldValue(int FieldIndex)
{
    return ReadFieldValue(comServer,FieldIndex);
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::SetFieldValue(int FieldIndex,AnsiString Value)
{
    WriteFieldValue(comServer,FieldIndex,Value);
}
//---------------------------------------------------------------------------
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(scWsgmUnit,"SELECT UnitCode,UnitName FROM sdUnit order by UnitCode","UnitName","UnitCode");
    FillComboBox(scWsgmLoc,"SELECT LocCode,memo=LocCode+space(1)+'('+LocName+')' FROM sdLoc order by LocCode","memo","LocCode");
    FillComboBox(scWsgmBatch,"SELECT BatchCode,memo=BatchCode+space(1)+'('+BatchDesc+')' FROM sdBatch order by BatchCode","memo","BatchCode");
    FillComboBox(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(scWsgmUnit,"Select UnitCode,UnitName FROM sdUnit order by UnitCode","UnitName","UnitCode");
	           EndWaitForm();
	           break;
           }
         case euSdLoc:
           if(ShowUpdateMessage(MsgSrc,MsgType)){
	           StartWaitForm("正在刷新引用数据!");
	           FillComboBox(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(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(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";
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::GetDataFromComObject()
{
    seWsgmSn->Text=GetFieldValue(fiWsgmSn);
    seWsgmGoods->Text=GetFieldValue(fiWsgmGoods);
    //MoveFirst,MovePrority,MoveNext,MoveLast
    sgWsgm->LocateGrid(1,GetFieldValue(fiWsgmGoods));
    g_sdRsGoods->LocateByKey(WideString(GetFieldValue(fiWsgmGoods)));
    seWsgmGoodsName->Text=GetGoodsValue("GoodsName");

    scWsgmUnit->LocateKey(GetFieldValue(fiWsgmUnit));
    seWsgmQty->Text=GetFieldValue(fiWsgmQty);
    seWsgmShl->Text=GetFieldValue(fiWsgmShl);
    seWsgmOoq->Text=GetFieldValue(fiWsgmOoq);

    scWsgmLoc->LocateKey(GetFieldValue(fiWsgmLoc));
    scWsgmBatch->LocateKey(GetFieldValue(fiWsgmBatch));
    scWsgmProcess->LocateKey(GetFieldValue(fiWsgmProcess));

    if(GetFieldValue(fiWsgmUser)!="")
       labUserCode->Caption=GetFieldValue(fiWsgmUser);
    else
       labUserCode->Caption=g_sdUserCode;
    cheWsgmClose->Checked=GetFieldValue(fiWsgmClose)=="1";
    labCloseDate->Caption=GetFieldValue(fiWsgmCloseDate);

    seWsgmPQty->Text=GetFieldValue(fiWsgmPQty);
    seWsgmGQty->Text=GetFieldValue(fiWsgmGQty);
    seWsgmLQty->Text=GetFieldValue(fiWsgmLQty);
    seWsgmDQty->Text=GetFieldValue(fiWsgmDQty);
    seWsgmUQty->Text=GetFieldValue(fiWsgmUQty);
    seWsgmRQty->Text=GetFieldValue(fiWsgmRQty);
    seWsgmAQty->Text=GetFieldValue(fiWsgmAQty);
    seWsgmTQty->Text=GetFieldValue(fiWsgmTQty);
    //如果加工单(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(fiWsgmWo,labWsgmWo->Caption);
    SetFieldValue(fiWsgmSn,seWsgmSn->Text);
    SetFieldValue(fiWsgmFrom,FWsgmFrom);
    SetFieldValue(fiWsgmGoods,seWsgmGoods->Text);
    SetFieldValue(fiWsgmQty,seWsgmQty->Text);
    SetFieldValue(fiWsgmShl,seWsgmShl->Text);
    SetFieldValue(fiWsgmOoq,seWsgmOoq->Text);
    SetFieldValue(fiWsgmLoc,scWsgmLoc->ItemData[cbItem2]);
    SetFieldValue(fiWsgmBatch,scWsgmBatch->ItemData[cbItem2]);
    SetFieldValue(fiWsgmProcess,scWsgmProcess->ItemData[cbItem2]);
    SetFieldValue(fiWsgmUser,labUserCode->Caption);
}
//---------------------------------------------------------------------------
void __fastcall TfrmWsgm::WaitUserInput()
{
    PageControl1->ActivePage=BaseInfo;
    if(seWsgmGoods->Enabled)
       seWsgmGoods->SetFocus();
    g_sdRsGoods->LocateByKey(WideString(GetFieldValue(fiWsgmGoods)));
    if(GetGoodsValue("GoodsBatch")=="1")
       scWsgmBatch->Enabled=true;
    else
       scWsgmBatch->Enabled=false;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -