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

📄 wo.cpp

📁 速达开源ERP系统
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	           FillComboBox(scWoUnit,"select UnitCode,UnitName from sdUnit order by UnitCode","UnitName","UnitCode");
	           EndWaitForm();
	           break;
           }
         case euSdRouteh:
           if(ShowUpdateMessage(MsgSrc,MsgType)){
	           StartWaitForm("正在刷新引用数据!");
               FillEdit(seWoRoute,"select RoutehCode,RoutehName=RoutehCode+space(1)+'('+RoutehName+')' from sdRouteh where RoutehCancel=0 order by RoutehCode","RoutehName","RoutehCode");
	           EndWaitForm();
	           break;
           }
         case euSdBatch:
           if(ShowUpdateMessage(MsgSrc,MsgType)){
	           StartWaitForm("正在刷新引用数据!");
               AnsiString m_Sql=AnsiString("Select BatchCode,BatchCode+space(1)+'('+BatchDesc+')' memo from sdBatch ")+
                    AnsiString("where '"+g_sdCurDate+"'>=BatchEffectdate and '"+g_sdCurDate+"'<=(case BatchAbatedate when '' then '9999-99-99' else BatchAbatedate end) ")+
                    AnsiString("order by BatchCode");
               FillComboBox(scWoBatch,m_Sql,"memo","BatchCode");
	           EndWaitForm();
	           break;
           }
         case euSdProducter:
           if(ShowUpdateMessage(MsgSrc,MsgType)){
	           StartWaitForm("正在刷新引用数据!");
	           FillComboBox(scWoProducter,"select ProducterCode,memo=ProducterCode+space(1)+'('+UserName+')' from sdProducter,sdUser where ProducterCode=UserCode Order by ProducterCode",
	                        "memo","ProducterCode");
	           EndWaitForm();
	           break;
           }
         default:
           break;
       }
    }
    __finally{
      //AddCode;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::FormShow(TObject *Sender)
{
    tbClose->Visible=true;
    //当需要质检时
    if(g_sdQuality==1)
       cheWoChkFlg->Checked=true;
    else
       cheWoChkFlg->Checked=false;
    FillGridWithData();
    comServer->MoveFirst();
    GetDataFromComObject();
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::FormCreate(TObject *Sender)
{
    //AnsiString FormIniFile="D:\Test.Ini";
    //SetGridWidth(Name,sgWo,FormIniFile);
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::FormClose(TObject *Sender, TCloseAction &Action)
{
    TRecBaseForm::FormClose(Sender,Action);
    //AnsiString FormIniFile = "D:\Test.Ini";
    //WriteGridWidth(Name,sgWo,FormIniFile);
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::seWoGoodsButtonClick(TObject *Sender)
{
  AnsiString SqlStr;
  SqlStr="007[产品编码][产品名称][版本号][型号][类型][计量单位][批量]";
  SqlStr+="Select GoodsCode,GoodsName,GoodsVer,GoodsModel,GoodsType,GoodsUnitCode,GoodsEoq from sdGoods where (GoodsType=1 or GoodsType=2) and GoodsFrom=2 order by GoodsCode";
  TfrmWnQuery *p;
  try
  {
    StartWaitForm("正在查询,请稍候...");
    p=new TfrmWnQuery(this,"产品数据查询",SqlStr);
  }
  __finally
  {
    EndWaitForm();
  }
  if(p->ShowModal()==mrOk)
  {
    seWoGoods->Text=p->ColData[1];
    if(g_sdRsGoods->LocateByKey(WideString(seWoGoods->Text))==0)
    {
      seWoGoodsName->Text =  GetGoodsValue("GoodsName");
      scWoUnit->LocateKey(GetGoodsValue("GoodsUnitCode"));
      if(GetGoodsValue("GoodsBatch")=="0")
      {
        scWoBatch->ItemIndex=-1;
        scWoBatch->Enabled=false;
      }
      if(GetGoodsValue("GoodsTrackSo")=="0")
      {
        seWoSoCode->Text="";
        seWoSodLine->Text="0";
        seWoSoCode->Enabled=false;
      }
    }
  }
  delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::sbtWsgmClick(TObject *Sender)
{
    if(comServer->RecordCount==0)
    {
       ShowMessage("当前没有加工单的记录,不能调用工单配套表!");
       return;
    }
    try
    {
       StartWaitForm("正在启动<工单配套表>界面...");
       t_WoCode=GetFieldValue(fiWoCode);
       t_WoGoods=GetFieldValue(fiWoGoods);
       t_WoFrom=scWoConsume->ItemIndex+1;
       t_WoCheck=GetFieldValue(fiWoCheck).ToInt();
       t_WoCancel=GetFieldValue(fiWoCancel).ToInt();
       frmWsgm=new TfrmWsgm(this,t_WoCode,t_WoGoods,t_WoCheck,t_WoCancel,t_WoFrom);
       EndWaitForm();
       frmWsgm->ShowModal();
    }
    __finally
    {
        delete frmWsgm;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::sbtWrgClick(TObject *Sender)
{
    if(comServer->RecordCount==0 )
    {
       ShowMessage("当前没有加工单的记录,不能调用工单工艺路线表!");
       return;
    }
    try
    {
       StartWaitForm("正在启动<工单工艺路线表>界面...");
       t_WoCode=GetFieldValue(fiWoCode);
       t_WoRoute=seWoRoute->ItemData[1];
       t_WoFrom=scWoTrace->ItemIndex+1;
       t_WoCheck=GetFieldValue(fiWoCheck).ToInt();
       t_WoCancel=GetFieldValue(fiWoCancel).ToInt();
       frmWrg=new TfrmWrg(this,t_WoCode,t_WoRoute,t_WoCheck,t_WoCancel,t_WoFrom);
       EndWaitForm();
       frmWrg->ShowModal();
    }
    __finally
    {
       delete frmWrg;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::sbtWnClick(TObject *Sender)
{
    if(comServer->RecordCount==0 )
    {
       ShowMessage("当前没有加工单的记录,不能调用工票!");
       return;
    }
    try
    {
       StartWaitForm("正在启动<工票维护>界面...");
       t_WoCode=GetFieldValue(fiWoCode);
       t_WoCheck=GetFieldValue(fiWoCheck).ToInt();
       t_WoCancel=GetFieldValue(fiWoCancel).ToInt();
       frmWn=new TfrmWn(this,t_WoCode,t_WoCheck,t_WoCancel);
       EndWaitForm();
       frmWn->ShowModal();
    }
    __finally
    {
       delete frmWn;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::sgWoClick(TObject *Sender)
{
    int ARow;
    ARow=sgWo->Row;
    if(ARow > 0)
       comServer->LocateByKey(WideString(sgWo->TextMatrix[ARow][0]));
    if(!comServer->Eof)
       GetDataFromComObject();
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::seWoGoodsExit(TObject *Sender)
{
    AnsiString tempS;
    tempS=seWoGoods->Text;
    if(!tempS.IsEmpty())
    {
       if(g_sdRsGoods->LocateByKey(WideString(tempS))==0)
       {
           seWoGoodsName->Text = GetGoodsValue("GoodsName");
           scWoUnit->LocateKey(GetGoodsValue("GoodsUnitCode"));
           //对批号的处理
           if(GetGoodsValue("GoodsBatch")=="1")
              scWoBatch->Enabled=true;
           else
              scWoBatch->Enabled=false;
           //对订单跟踪的处理
           if(GetGoodsValue("GoodsTrackSo")=="1")
              seWoSoCode->Enabled=true;
           else
              seWoSoCode->Enabled=false;
           scWoBatch->ItemIndex=-1;
           seWoSoCode->Text="";
           seWoSodLine->Text="";
       }
       else
         ::MessageBox(Handle,"输入的物料编码不存在!","错误提示",MB_OK|MB_ICONSTOP);
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::seWoCodeKeyDown(TObject *Sender, WORD &Key,
      TShiftState Shift)
{
    AnsiString p_WoCode=seWoCode->Text;
    if(Key==13 && !p_WoCode.IsEmpty() && CurrentState==caNormal)
    {
       comServer->LocateByKey(WideString(p_WoCode));
       GetDataFromComObject();
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::seWoSoCodeButtonClick(TObject *Sender)
{
    AnsiString SqlStr;
    SqlStr="006[订单单号][订单行号][货物编码][计量单位][订单要求数][要求交货日]Select SohCode,";
    SqlStr=SqlStr+"SodLine,SodGoods,SodUnit,SodQty,SodRecDate from sdSod,sdSoh WHERE SodGoods=";
    SqlStr=SqlStr+"'"+seWoGoods->Text+"' and SohCheck=1 and SohClose=0  and SohCode=SodCode order ";
    SqlStr=SqlStr+"by SohCode,SodLine";
    TfrmWnQuery *p;
    try
    {
       StartWaitForm("正在查询,请稍候...");
       p=new TfrmWnQuery(this,"客户订单资料查询",SqlStr);
    }
    __finally
    {
       EndWaitForm();
    }
    if(p->ShowModal()==mrOk)
    {
       seWoSoCode->Text=p->ColData[1];
       seWoSodLine->Text=p->ColData[2];
    }
    delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::seWoRouteButtonClick(TObject *Sender)
{
    AnsiString SqlStr;
    SqlStr="004[工艺路线代码][工艺路线名称][货物编码][货物名称]SELECT RoutehCode,RoutehName,RoutehGoods,GoodsName FROM sdRouteh,";
    SqlStr=SqlStr+"sdGoods where GoodsCode=RoutehGoods and RoutehGoods='"+seWoGoods->Text+"' ORDER BY RoutehCode,RoutehGoods";
    TfrmWnQuery *p;
    try
    {
       StartWaitForm("正在查询,请稍候...");
       p=new TfrmWnQuery(this,"工艺路线资料查询",SqlStr);
    }
    __finally
    {
       EndWaitForm();
    }
    if(p->ShowModal()==mrOk)
    {
       seWoRoute->LocateKey(p->ColData[1]);
    }
    delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmWo::scWoTraceClick(TObject *Sender)
{
    if(CurrentState==caNormal)
       return;
    if(scWoTrace->ItemIndex==0)
      seWoRoute->Enabled=true;
    else
    {
      seWoRoute->Enabled=false;
      seWoRoute->Text="";
    }
}
//---------------------------------------------------------------------------

void __fastcall TfrmWo::GenrateDoc()
{
    int FCurNo,FRecordCount;
    FCurNo=comServer->CurRecNo;
    FRecordCount=comServer->RecordCount;
    TfrmWoGen *p=new TfrmWoGen(this);
    try
    {
      p->GetComObject(comServer);
      p->ShowModal();
      comServer->LocateByIndex(FCurNo);
      if(FRecordCount<comServer->RecordCount)
        comServer->MoveNext();
      GetDataFromComObject();
    }
    __finally
    {
      delete p;
    }
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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