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

📄 ecoh.cpp

📁 速达开源ERP系统
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include "Ecoh.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"

TfrmEcoh *frmEcoh;
//---------------------------------------------------------------------------
__fastcall TfrmEcoh::TfrmEcoh(TComponent* Owner)
    : TBillBaseForm(Owner,euSdEcoh,"")
{
    AutoCtl=seEcohCode;
}
//---------------------------------------------------------------------------
void __fastcall TfrmEcoh::InitEditControl()
{
    ClientGroup->AddComponent(1,true,true,false,sgEcoh,sgEcoh->Name);
    ClientGroup->AddComponent(1,false,false,true,FloatPanel1,FloatPanel1->Name);
    ClientGroup->AddComponent(1,false,true,false,seEcohCode,seEcohCode->Name);
    ClientGroup->AddComponent(1,true,true,true,seEcohGoodsName,seEcohGoodsName->Name);
    ClientGroup->AddComponent(1,true,false,true,cheEcohCheck,cheEcohCheck->Name);
    ClientGroup->AddComponent(2,false,false,true,FloatPanel2,FloatPanel2->Name);
    ClientGroup->AddComponent(2,true,true,true,Panel1,Panel1->Name);
    ClientGroup->AddComponent(2,true,true,true,seEcodBgoodsName,seEcodBgoodsName->Name);
    ClientGroup->AddComponent(2,false,false,true,memEcodReason,memEcodReason->Name);
    ClientGroup->AddComponent(2,false,true,true,btnOK,btnOK->Name);
    ClientGroup->AddComponent(2,false,false,false,btnCancel,btnCancel->Name);

    //Ecoh
    FillComboBox(scEcohGoods,"SELECT BomhGoods,GoodsName,memo=BomhGoods+space(1)+'('+GoodsName+')' FROM sdBomh,sdGoods Where GoodsCode=BomhGoods order by BomhGoods","memo","BomhGoods","GoodsName");
    //Ecod
    FillComboBox(scEcodUnit,"SELECT UnitCode,UnitName FROM sdUnit order by UnitCode","UnitName","UnitCode");
    FillComboBox(scEcodProcess,"SELECT memo=ProcessCode+space(1)+'('+ProcessName+')',ProcessCode from sdProcess order by ProcessCode","memo","ProcessCode");
}
//---------------------------------------------------------------------------

void __fastcall TfrmEcoh::RefreshUpdateData(int MsgSrc,int MsgType)
{
    try
    {
       switch (MsgSrc)
       {
         case euSdBomh:
           if(ShowUpdateMessage(MsgSrc,MsgType)){
	           StartWaitForm("正在刷新引用数据!");
	           FillComboBox(scEcohGoods,"SELECT BomhGoods,GoodsName,memo=BomhGoods+space(1)+'('+GoodsName+')' FROM sdBomh,sdGoods Where GoodsCode=BomhGoods order by BomhGoods","memo","BomhGoods","GoodsName");
	           EndWaitForm();
	           break;
           }
         case euSdUnit:
           if(ShowUpdateMessage(MsgSrc,MsgType)){
	           StartWaitForm("正在刷新引用数据!");
	           FillComboBox(scEcodUnit,"SELECT UnitCode,UnitName FROM sdUnit order by UnitCode","UnitName","UnitCode");
	           EndWaitForm();
	           break;
           }
         case euSdProcess:
           if(ShowUpdateMessage(MsgSrc,MsgType)){
	           StartWaitForm("正在刷新引用数据!");
	           FillComboBox(scEcodProcess,"SELECT memo=ProcessCode+space(1)+'('+ProcessName+')',ProcessCode from sdProcess order by ProcessCode","memo","ProcessCode");
	           EndWaitForm();
	           break;
           }
         default:
           break;
       }
    }
    __finally
    {
        //AddCode
    }
}
//---------------------------------------------------------------------------

void __fastcall TfrmEcoh::ClearControl(int Section,bool BringToNext)
{
    if(Section == 1)
    {
       if(!BringToNext)
       {
           seEcohCode->Text ="";
           seEcohVer->Text ="";
           seEcohFileNo->Text = "";
           deEcohDate->Text =g_sdCurDate;
           deEcohEdate->Text=g_sdCurDate;
           deEcohIdate->Text = "";
           scEcohGoods->ItemIndex = -1;
           seEcohGoodsName->Text = "";
           labEcohUser->Caption = g_sdUserCode;
           cheEcohCheck->Checked =false;
           labCheckDate->Caption="";
           labEcohChecker->Caption="";
           memEcohDesc->Text="";
       }
       sgEcoh->RowCount=1;
    }
    else if(Section==2)
    {
        if(!BringToNext)
        {
           seEcodLine->Text =AnsiString(comServer->ItemCount+1);
           scEcodBgoods->ItemIndex=-1;
           seEcodBgoodsName->Text="";
           seEcodAgoods->Text="";
           seEcodAgoodsName->Text="";
           seEcodModel->Text="";
           scEcodUnit->ItemIndex =-1;
           seEcodQty->Text="0";
           seEcodShl->Text="0.00";
           scEcodFrom->ItemIndex=0;
           scEcodType->ItemIndex=0;
           scEcodProcess->ItemIndex=-1;
           scEcodOp->ItemIndex=0;
           scEcodPp->ItemIndex=0;
           scEcodCfg->ItemIndex=0;
           seEcodLot->Text="0";
           memEcodDesc->Text="";
           memEcodReason->Text="";
        }
    }
}
//---------------------------------------------------------------------------

void __fastcall TfrmEcoh::GetDataFromComObject(int Section)
{
    if(Section==1)
    {
       seEcohCode->Text=GetHeadValue(fiEcohCode);
       seEcohVer->Text=GetHeadValue(fiEcohVer);
       seEcohFileNo->Text=GetHeadValue(fiEcohFileNo);
       deEcohDate->Text=GetHeadValue(fiEcohDate);
       deEcohEdate->Text=GetHeadValue(fiEcohEdate);
       deEcohIdate->Text=GetHeadValue(fiEcohIdate);
       scEcohGoods->LocateKey(GetHeadValue(fiEcohGoods));
       scEcohGoodsClick(this); //触发Click事件
       seEcohGoodsName->Text=scEcohGoods->ItemData[cbItem3];
       labEcohUser->Caption=GetHeadValue(fiEcohUser);
       cheEcohCheck->Checked=GetHeadValue(fiEcohCheck)=="1";
       if(cheEcohCheck->Checked)
          SetCheckToolbarStatus(true);
       else
          SetCheckToolbarStatus(false);
       labCheckDate->Caption=GetHeadValue(fiEcohCheckDate);
       labEcohChecker->Caption=GetHeadValue(fiEcohChecker);
       memEcohDesc->Text=GetHeadValue(fiEcohDesc);
    }
    else
    {
       seEcodLine->Text=GetDetailValue(fiEcodLine);
       scEcodBgoods->LocateKey(GetDetailValue(fiEcodBgoods));
       g_sdRsGoods->LocateByKey(WideString(GetDetailValue(fiEcodBgoods)));
       seEcodBgoodsName->Text=GetGoodsValue("GoodsName");
       g_sdRsGoods->LocateByKey(WideString(GetDetailValue(fiEcodAgoods)));
       seEcodAgoods->Text=GetGoodsValue("GoodsCode");
       seEcodAgoodsName->Text=GetGoodsValue("GoodsName");
       seEcodModel->Text=GetGoodsValue("GoodsModel");
       scEcodUnit->LocateKey(GetGoodsValue("GoodsUnitCode"));
       seEcodQty->Text=GetDetailValue(fiEcodQty);
       seEcodShl->Text=GetDetailValue(fiEcodShl);
       scEcodType->ItemIndex=StrToInt(GetDetailValue(fiEcodType))-1;
       scEcodFrom->ItemIndex=StrToInt(GetDetailValue(fiEcodFrom))-1;
       scEcodProcess->LocateKey(GetDetailValue(fiEcodProcess));
       scEcodOp->ItemIndex=StrToInt(GetDetailValue(fiEcodOp))-1;
       scEcodPp->ItemIndex=StrToInt(GetDetailValue(fiEcodPp))-1;
       scEcodCfg->ItemIndex=StrToInt(GetDetailValue(fiEcodCfg))-1;
       seEcodLot->Text=GetDetailValue(fiEcodLot);
       memEcodDesc->Text=GetDetailValue(fiEcodDesc);
       memEcodReason->Text=GetDetailValue(fiEcodReason);
    }
}
//---------------------------------------------------------------------------

void __fastcall TfrmEcoh::SendDataToComObject(int Section)
{
    if(Section==1)
    {
        SetHeadValue(fiEcohCode,seEcohCode->Text);
        SetHeadValue(fiEcohVer,seEcohVer->Text);
        SetHeadValue(fiEcohFileNo,seEcohFileNo->Text);
        SetHeadValue(fiEcohDate,deEcohDate->Text);
        SetHeadValue(fiEcohEdate,deEcohEdate->Text);
        SetHeadValue(fiEcohIdate,deEcohIdate->Text);
        SetHeadValue(fiEcohGoods,scEcohGoods->ItemData[1]);
        SetHeadValue(fiEcohUser,labEcohUser->Caption);
        SetHeadValue(fiEcohCheck,cheEcohCheck->Checked ? "1":"0");
        if(cheEcohCheck->Checked) //if checked is true
        {
           SetHeadValue(fiEcohChecker,labEcohChecker->Caption);
           SetHeadValue(fiEcohCheckDate,labCheckDate->Caption);
        }
        SetHeadValue(fiEcohDesc,memEcohDesc->Text);
    }
    else
    {
        //给工程更改单行的更改单号(EcodCode)赋值
        //---------------------------------------
        SetDetailValue(fiEcodCode,seEcohCode->Text);
        SetDetailValue(fiEcodLine,seEcodLine->Text);
        SetDetailValue(fiEcodBgoods,scEcodBgoods->ItemData[1]);
        SetDetailValue(fiEcodAgoods,seEcodAgoods->Text);
        SetDetailValue(fiEcodQty,seEcodQty->Text);
        SetDetailValue(fiEcodShl,seEcodShl->Text);
        SetDetailValue(fiEcodProcess,scEcodProcess->ItemData[1]);
        SetDetailValue(fiEcodOp,IntToStr(scEcodOp->ItemIndex+1));
        SetDetailValue(fiEcodPp,IntToStr(scEcodPp->ItemIndex+1));
        SetDetailValue(fiEcodCfg,IntToStr(scEcodCfg->ItemIndex+1));
        SetDetailValue(fiEcodLot,seEcodLot->Text);
        SetDetailValue(fiEcodDesc,memEcodDesc->Text);
        SetDetailValue(fiEcodReason,memEcodReason->Text);
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmEcoh::WaitUserInput(int Section)
{
    if(Section ==1){
      if(CurrentState==caAddHead && seEcohCode->Enabled)
        seEcohCode->SetFocus();
      else
        seEcohVer->SetFocus();
    }
    else
    {
      ChangeToBrowseState(false);
      if(CurrentState!=caNormal)
         seEcodLine->SetFocus();
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmEcoh::RefreshGridData(int mAction)
{
    int i;
    AnsiString ItemStr=GetItemStringToGrid();
    switch(mAction)
    {
       case 0:
         sgEcoh->AddItem(ItemStr);
         sgEcoh->Row=sgEcoh->RowCount-1;
         break;
       case 1:
         sgEcoh->ChangeItem(ItemStr,sgEcoh->Row);
         break;
       case 2:
         sgEcoh->RemoveItem(sgEcoh->Row);
    }
}

⌨️ 快捷键说明

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