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

📄 routeh.cpp

📁 科思ERP部分源码及控件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
         break;
       case 2:
         sgRouteh->RemoveItem(sgRouteh->Row);
    }
}
//---------------------------------------------------------------------------

AnsiString __fastcall TfrmRouteh::GetItemStringToGrid()
{
    AnsiString s_ItemStr;
    scRoutedWc->LocateKey(GetDetailValue("RoutedWc"));
    scRoutedLoc->LocateKey(GetDetailValue("RoutedLoc"));
    s_ItemStr=GetDetailValue("RoutedSn")+
              "\t"+GetDetailValue("RoutedProcess")+
              "\t"+GetDetailValue("RoutedName")+
              "\t"+scRoutedWc->ItemData[2]+
              "\t"+scRoutedLoc->ItemData[2];
    return s_ItemStr;
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::DisplayBill()
{
    if(comServer->RecordCount>0)
    {
      GetDataFromComObject(1);
      FillGridWithData();
      if(sgRouteh->RowCount >1)
      {
         AnsiString Keystr;
         Keystr=seRoutehCode->Text+"\t"+sgRouteh->Cells[1][sgRouteh->Row];
         comServer->LocateItemByKey(Keystr);
         GetDataFromComObject(2);
      }
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::GetBill(AnsiString BillID)
{
    bool iRow;
    iRow=comServer->Find("RoutehCode='"+BillID+"'");
    if(iRow)      //FIND THIS BILL
       DisplayBill();
    else
    {
       if(ShowMessageWindow("在数据库中没有查到记录:"+BillID+",要增加吗?",mwsConfirmation)==IDYES)
          AddHeadRecord();
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::FillGridWithData()
{
    int i;
    AnsiString ItemStr;
    sgRouteh->RowCount=1;
    if(comServer->RecordCount>0){
      for(i=0;i<comServer->ItemCount;i++){
         comServer->LocateItemByIndex(i);
         RefreshGridData(0);
      }
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::FormClose(TObject *Sender,
      TCloseAction &Action)
{
     TBillBaseForm::FormClose(Sender,Action);
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::FormShow(TObject *Sender)
{
    ClearControl(1,false);
    ClearControl(2,false);
    tbCheck->Visible=false;
    sgRouteh->RowCount=1;
    TBillBaseForm::MoveToFirst();
    ChangeToBrowseState();
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::sgRoutehDblClick(TObject *Sender)
{
    int iRow;
    iRow=sgRouteh->Row;
    if(iRow == 0)
       return;
    ChangeToBrowseState(false);
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::ChangeToBrowseState(bool agree)
{
    if(agree)
    {
       sgRouteh->Visible=true;
       FloatPanel2->Visible=false;
       sgRouteh->Align=alClient;
       FloatPanel2->Align=alNone;
    }
    else
    {
       sgRouteh->Visible=false;
       FloatPanel2->Visible=true;
       sgRouteh->Align=alNone;
       FloatPanel2->Align=alClient;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::btnOKClick(TObject *Sender)
{
    try{
      if((CurrentState==caAddDetail)||(CurrentState==caAddBill)){
         if(DetailState==caAddDetail)
            comServer->AddItem();
         SendDataToComObject(2);
         comServer->AddToObject();
         ClearControl(2,false);
         seRoutedSn->SetFocus();
      }
      else
         ChangeToBrowseState();
    }
    catch(Exception &e)
    {
        throw Exception(e.Message);
    }
}
//---------------------------------------------------------------------------

void __fastcall TfrmRouteh::btnCancelClick(TObject *Sender)
{
    CancelChange();
}
//---------------------------------------------------------------------------

void __fastcall TfrmRouteh::seRoutehGoodsButtonClick(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)
  {
    seRoutehGoods->Text=p->ColData[1];
    seRoutehGoodsName->Text=p->ColData[2];
  }
  delete p;
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::cheRoutehCancelClick(TObject *Sender)
{
    if(cheRoutehCancel->Checked)
       labCancelDate->Caption = g_sdCurDate;
    else
       labCancelDate->Caption = "";
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::seRoutehCodeKeyDown(TObject *Sender, WORD &Key,
      TShiftState Shift)
{
    AnsiString tempS=seRoutehCode->Text;
    if(Key==13 && CurrentState==caNormal && !tempS.IsEmpty())
    {
       comServer->LocateByKey(WideString(tempS));
       DisplayBill();
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::seRoutehGoodsKeyDown(TObject *Sender,
      WORD &Key, TShiftState Shift)
{
    AnsiString tempS=seRoutehGoods->Text;
    if(Key==13 && CurrentState!=caNormal && !tempS.IsEmpty())
    {
       if(InitRsGoods(WideString(tempS)))
         seRoutehGoodsName->Text=GetGoodsValue(gtInitRs,"GoodsName");
       else
         ::MessageBox(Handle,"输入的物料编码不存在!","错误提示",MB_OK|MB_ICONSTOP);
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::cheWxFlgClick(TObject *Sender)
{
    if(CurrentState!=caNormal){
      if(cheWxFlg->Checked)
         seRoutedWxAmt->Enabled=true;
      else{
         seRoutedWxAmt->Enabled=false;
         seRoutedWxAmt->Text=0;
      }
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmRouteh::seRoutedProcessButtonClick(TObject *Sender)
{
    AnsiString SqlStr;
    SqlStr="015[工序代码][工序名称][工作中心][在制货位][类型][状态][需质检][属外协][外协费率]";
    SqlStr=SqlStr+"[排队时间][准备时间][加工时间][等待时间][运输时间][特殊工艺要求]SELECT ProcessCode,";
    SqlStr=SqlStr+"ProcessName,ProcessWc,ProcessLoc,ProcessType,ProcessState,ProcessChkFlg,ProcessWxFlg,";
    SqlStr=SqlStr+"ProcessWxAmt,ProcessQlt,ProcessSlt,ProcessRlt,ProcessWlt,ProcessMlt,ProcessSpec ";
    SqlStr=SqlStr+"FROM sdProcess order by ProcessCode";
    TfrmWnQuery *p;
    try
    {
       StartWaitForm("正在查询,请稍候...");
       p=new TfrmWnQuery(this,"标准工序资料查询",SqlStr);
    }
    __finally
    {
       EndWaitForm();
    }
    if(p->ShowModal()==mrOk)
    {
       seRoutedProcess->Text=p->ColData[1];
       seRoutedName->Text=p->ColData[2];
       scRoutedWc->LocateKey(p->ColData[3]);
       scRoutedLoc->LocateKey(p->ColData[4]);
       scRoutedType->LocateKey(p->ColData[5]);
       scRoutedState->LocateKey(p->ColData[6]);
       cheChkFlg->Checked=p->ColData[7]=="1";
       cheWxFlg->Checked=p->ColData[8]=="1";
       seRoutedWxAmt->Text=p->ColData[9];
       seRoutedQlt->Text=p->ColData[10];
       seRoutedSlt->Text=p->ColData[11];
       seRoutedRlt->Text=p->ColData[12];
       seRoutedWlt->Text=p->ColData[13];
       seRoutedMlt->Text=p->ColData[14];
       memRoutedSpec->Text=p->ColData[15];
    }
    delete p;
}
//---------------------------------------------------------------------------


void __fastcall TfrmRouteh::sgRoutehClick(TObject *Sender)
{
      if(sgRouteh->Row > 0)
    {
      comServer->LocateItemByKey(seRoutehCode->Text+"\t"+sgRouteh->TextMatrix[sgRouteh->Row][1]);
      GetDataFromComObject(2);
    }
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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