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

📄 sfc_mnlistrequest_d.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 5 页
字号:
     cmbx_WhCode1.SetFocus ;
end;

procedure TFrm_Sfc_MnListRequest_D.edt_Batchno1KeyDon(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  inherited;
  if key=120 then
     edt_Batchno1.text:=BatchHint(AdoQry_tmp.Connection,Extedt_ItemCode.text,'',whCode,WhPositionCode);
end;

procedure TFrm_Sfc_MnListRequest_D.btn_okClick(Sender: TObject);
var
  stext,ItemCode,time1,time2,time3,time4,time5:string;
begin
  judge1:=False;
  judge2:=False;
  judge3:=False;
  judge4:=False;
  judge5:=False;
  ItemCode:=Extedt_ItemCode.Text ;
  Itemid:=AdoQry_Body.fieldbyname('ItemListid').asstring;
  //设置三次领料的有效性判断依据
  if getCode(cmbx_WhCode1.Text)<>getCode(AdoQry_Body.fieldbyname('whCode1').asstring) then
     judge1:=True;
  if getCode(cmbx_WhpCode1.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode1').asstring) then
     judge1:=True;
//  if (edt_MoRequestqty1.Text<>AdoQry_Body.fieldbyname('Requestqty1').asstring)and(edt_MoRequestqty1.Text<>'0') then
//     judge1:=True;
  if edt_Batchno1.Text<>AdoQry_Body.fieldbyname('Batchno1').asstring then
     judge1:=True;
  if getCode(cmbx_WhCode2.Text)<>getCode(AdoQry_Body.fieldbyname('whCode2').asstring) then
     judge2:=True;
  if getCode(cmbx_WhpCode2.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode2').asstring) then
     judge2:=True;
//  if (edt_MoRequestqty2.Text<>AdoQry_Body.fieldbyname('Requestqty2').asstring)and(edt_MoRequestqty2.Text<>'0') then
//     judge2:=True;
  if edt_Batchno2.Text<>AdoQry_Body.fieldbyname('Batchno2').asstring then
     judge2:=True;
  if getCode(cmbx_WhCode3.Text)<>getCode(AdoQry_Body.fieldbyname('whCode3').asstring) then
     judge3:=True;
  if getCode(cmbx_WhpCode3.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode3').asstring) then
     judge3:=True;
//  if (edt_MoRequestqty3.Text<>AdoQry_Body.fieldbyname('Requestqty3').asstring)and(edt_MoRequestqty3.Text<>'0')then
//     judge3:=True;
  if edt_Batchno3.Text<>AdoQry_Body.fieldbyname('Batchno3').asstring then
     judge3:=True;
//
  if getCode(cmbx_WhCode4.Text)<>getCode(AdoQry_Body.fieldbyname('whCode4').asstring) then
     judge4:=True;
  if getCode(cmbx_WhpCode4.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode4').asstring) then
     judge4:=True;
  if edt_Batchno4.Text<>AdoQry_Body.fieldbyname('Batchno4').asstring then
     judge4:=True;
//
  if getCode(cmbx_WhCode5.Text)<>getCode(AdoQry_Body.fieldbyname('whCode5').asstring) then
     judge5:=True;
  if getCode(cmbx_WhpCode5.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode5').asstring) then
     judge5:=True;
  if edt_Batchno5.Text<>AdoQry_Body.fieldbyname('Batchno5').asstring then
     judge5:=True;
  if judge1 then
  begin
     time1:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
     lbl_Requesttime1.Caption:=time1;
  end
  else
     time1:=AdoQry_Body.fieldbyname('Requesttime1').asstring;
  if judge2 then
  begin
     time2:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
     lbl_Requesttime2.Caption:=time2;
  end
  else
     time2:=AdoQry_Body.fieldbyname('Requesttime2').asstring;
  if judge3 then
  begin
     time3:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
     lbl_Requesttime3.Caption:=time3;
  end
  else
     time3:=AdoQry_Body.fieldbyname('Requesttime3').asstring;
//
  if judge4 then
  begin
     time4:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
     lbl_Requesttime4.Caption:=time4;
  end
  else
     time4:=AdoQry_Body.fieldbyname('Requesttime4').asstring;
  if judge5 then
  begin
     time5:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
     lbl_Requesttime5.Caption:=time5;
  end
  else
     time5:=AdoQry_Body.fieldbyname('Requesttime5').asstring;

  inherited;
  if status='Add' then
  begin
    with AdoQry_tmp do
    begin
      Close;        //对MNItemList的表的数据判断插入、修改
      sql.clear ;
      sql.Text :='select * from mnItemList where ItemCode='''+ItemCode+'''';
      open;
      if eof then
      begin
          Close;
          sql.Text:='insert into mnItemList(ItemCode,moCtrlqty,MoRealqty,mono,MoLineno)'+
                    ' Values ('''+ItemCode+''','+
                    lbl_MoCtrlqty.Caption+','+
                    lbl_MoRealqty.Caption+','''+
                    tmp_Mono+''','+
                    ''''+tmp_MoLineno+''')';
          execsql;
          Close;
          sql.Text :='select @@IDENTITY aa';
          open;
          Itemid:=fieldbyname('aa').asstring;
      end;
    end;
      with AdoQry_tmp do
        begin
          Close;
          sql.clear ;
          sText :='insert into mnListRequest (ItemListid,shiftType,whCode1,WhPositionCode1,'+
                     'realoutqty1,Requesttime1,Batchno1,whCode2,WhPositionCode2,'+
                     'realoutqty2,Batchno2,whCode3,WhPositionCode3,'+
                     'realoutqty3,Batchno3,whCode4,WhPositionCode4,'+
                     'realoutqty4,Batchno4,whCode5,WhPositionCode5,'+
                     'realoutqty5,Batchno5) Values ('+
                     Itemid+','+
                     ''''+tmp_ShiftType+''','+
                     ''''+getCode(cmbx_WhCode1.Text)+''','+
                     ''''+getCode(cmbx_WhpCode1.Text)+''','+
                     edt_MoRealqty1.Text +','+
                     ''''+formatdatetime('yyyy.mm.dd hh:nn:ss',now)+''','+
                     ''''+edt_Batchno1.Text+''','+
                     ''''+getCode(cmbx_WhCode2.Text)+''','+
                     ''''+getCode(cmbx_WhpCode2.Text)+''','+
                     edt_MoRealqty2.Text +','+
                     ''''+edt_Batchno2.Text+''','+
                      ''''+getCode(cmbx_WhCode3.Text)+''','+
                     ''''+getCode(cmbx_WhpCode3.Text)+''','+
//                     edt_MoRequestqty3.Text+','+
                     edt_MoRealqty3.Text +','+
                     ''''+edt_Batchno3.Text+''','+
                      ''''+getCode(cmbx_WhCode4.Text)+''','+
                     ''''+getCode(cmbx_WhpCode4.Text)+''','+
                     edt_MoRealqty4.Text +','+
                     ''''+edt_Batchno4.Text+''','+
                      ''''+getCode(cmbx_WhCode5.Text)+''','+
                     ''''+getCode(cmbx_WhpCode5.Text)+''','+
                     edt_MoRealqty5.Text +','+
                     ''''+edt_Batchno5.Text+''' )';
          sql.Add(stext);
          try
          execsql;
          except

          end;
    end;
  end
  else
  begin
    with AdoQry_tmp do
    begin
      Close;
      sql.Text:='select * from mnListRequest where ItemListid='+Itemid+' and shiftType='''+tmp_ShiftType+'''';
      open;
      if not eof then
      begin
         with AdoQry_tmp do
         begin
          Close;
          sql.Text :='update mnListRequest set shiftType='''+tmp_ShiftType+''','+
                     'whCode1='''+getCode(cmbx_WhCode1.Text)+''','+
                     'WhPositionCode1='''+getCode(cmbx_WhpCode1.Text)+''','+
                     'realoutqty1='+
                     edt_MoRealqty1.Text +','+
                     'Requesttime1='''+time1+''','+
                     'Batchno1='''+edt_Batchno1.Text+''','+
                     'whCode2='''+getCode(cmbx_WhCode2.Text)+''','+
                     'WhPositionCode2='''+getCode(cmbx_WhpCode2.Text)+''','+
                     'realoutqty2='+
                     edt_MoRealqty2.Text +','+
                     'Requesttime2='''+time2+''','+
                     'Batchno2='''+edt_Batchno2.Text+''','+
                     'whCode3='''+getCode(cmbx_WhCode3.Text)+''','+
                     'WhPositionCode3='''+getCode(cmbx_WhpCode3.Text)+''','+
                     'realoutqty3='+
                     edt_MoRealqty3.Text +','+
                     'Requesttime3='''+time3+''','+
                     'Batchno3='''+edt_Batchno3.Text+''','+
                     'whCode4='''+getCode(cmbx_WhCode4.Text)+''','+
                     'WhPositionCode4='''+getCode(cmbx_WhpCode4.Text)+''','+
                     'realoutqty4='+
                     edt_MoRealqty4.Text +','+
                     'Requesttime4='''+time4+''','+
                     'Batchno4='''+edt_Batchno4.Text+''','+
                     'whCode5='''+getCode(cmbx_WhCode5.Text)+''','+
                     'WhPositionCode5='''+getCode(cmbx_WhpCode5.Text)+''','+
                     'realoutqty5='+
                     edt_MoRealqty5.Text +','+
                     'Requesttime5='''+time5+''','+
                     'Batchno5='''+edt_Batchno5.Text+''' '+
                     'where ItemListid='''+Itemid+''' and'+
                     ' shiftType='''+tmp_ShiftType+'''';
         try
         execsql;
         except
         end;
        end;
      end
      else
      begin
        with AdoQry_tmp do
        begin
           Close;
           sql.clear;
           sText :='insert into mnListRequest (ItemListid,shiftType,whCode1,WhPositionCode1,'+
                     'realoutqty1,Requesttime1,Batchno1,whCode2,WhPositionCode2,'+
                     'realoutqty2,Batchno2,whCode3,WhPositionCode3,'+
                     'realoutqty3,Batchno3,whCode4,WhPositionCode4,'+
                     'realoutqty4,Batchno4,whCode5,WhPositionCode5,'+
                     'realoutqty5,Batchno5) Values ('+
                     Itemid+','+
                     ''''+tmp_ShiftType+''','+
                     ''''+getCode(cmbx_WhCode1.Text)+''','+
                     ''''+getCode(cmbx_WhpCode1.Text)+''','+
                     edt_MoRealqty1.Text +','+
                     ''''+formatdatetime('yyyy.mm.dd hh:nn:ss',now)+''','+
                     ''''+edt_Batchno1.Text+''','+
                     ''''+getCode(cmbx_WhCode2.Text)+''','+
                     ''''+getCode(cmbx_WhpCode2.Text)+''','+
                     edt_MoRealqty2.Text +','+
                     ''''+edt_Batchno2.Text+''','+
                     ''''+getCode(cmbx_WhCode3.Text)+''','+
                     ''''+getCode(cmbx_WhpCode3.Text)+''','+
                     edt_MoRealqty3.Text +','+
                     ''''+edt_Batchno3.Text+''','+
                      ''''+getCode(cmbx_WhCode4.Text)+''','+
                     ''''+getCode(cmbx_WhpCode4.Text)+''','+
                     edt_MoRealqty4.Text +','+
                     ''''+edt_Batchno4.Text+''','+
                      ''''+getCode(cmbx_WhCode5.Text)+''','+
                     ''''+getCode(cmbx_WhpCode5.Text)+''','+
                     edt_MoRealqty5.Text +','+
                     ''''+edt_Batchno5.Text+''' )';
          sql.Add(stext);
          try
          execsql;
          except
          end;
      end;
    end;
   end;
  end;

end;

procedure TFrm_Sfc_MnListRequest_D.cmbx_WhCode1Change(Sender: TObject);
begin
  inherited;
//    InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode1,'WhPosition','WhPositionCode',
//        'WhPositionName','whCode='''+getCode(cmbx_WhCode1.text)+'''  and not (Backflushwhp=1 or WhPositionType=1)');
  initcmbx1(cmbx_WhpCode1,Extedt_ItemCode.text,'nwh',getCode(cmbx_WhCode1.Text));
    btn_ok.Enabled :=True;
    whCode:=getCode(cmbx_WhCode1.Text) ;
    WhPositionCode:=getCode(cmbx_WhpCode1.Text);
    CurrentInvfields:=getInvfield(AdoQry_tmp,whCode,WhPositionCode,'CurrentInv');
    with AdoQry_tmp do
    begin
      Close;
      sql.clear;
      sql.Add('select '+CurrentInvfields+ ' as onhandInv from CurrentInv where whCode='''+whCode+''' and WhPositionCode='''+WhPositionCode+''' and ItemCode='''+Extedt_ItemCode.text+'''');
      open;
      if not eof then
        lbl_onhandInv.Caption:=fieldbyname('onhandInv').asstring
      else
      lbl_onhandInv.Caption:='0';
    end;
    show_WhName;
end;

procedure TFrm_Sfc_MnListRequest_D.cmbx_WhCode2Change(Sender: TObject);
begin
  inherited;
//    InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode2,'WhPosition','WhPositionCode',
//        'WhPositionName','whCode='''+getCode(cmbx_WhCode2.text)+'''  and not (Backflushwhp=1 or WhPositionType=1)');
  initcmbx1(cmbx_WhpCode2,Extedt_ItemCode.text,'nwh',getCode(cmbx_WhCode2.Text));
    btn_ok.Enabled :=True;
    whCode:=getCode(cmbx_WhCode2.Text);
    WhPositionCode:=getCode(cmbx_WhpCode2.Text);
    CurrentInvfields:=getInvfield(AdoQry_tmp,whCode,WhPositionCode,'CurrentInv');
    with AdoQry_tmp do
    begin
      Close;
      sql.clear;
      sql.Add('select '+CurrentInvfields+ ' as onhandInv from CurrentInv where whCode='''+whCode+''' and WhPositionCode='''+WhPositionCode+''' and ItemCode='''+Extedt_ItemCode.text+'''');
      open;
      if not eof then
        lbl_onhandInv.Caption:=fieldbyname('onhandInv').asstring
      else
      lbl_onhandInv.Caption:='0';
    end;
    show_WhName;
end;

procedure TFrm_Sfc_MnListRequest_D.cmbx_WhCode3Change(Sender: TObject);
begin
  inherited;
//    InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode3,'WhPosition','WhPositionCode',
//        'WhPositionName','whCode='''+getCode(cmbx_WhCode3.text)+'''  and not (Backflushwhp=1 or WhPositionType=1)');
  initcmbx1(cmbx_WhpCode3,Extedt_ItemCode.text,'nwh',getCode(cmbx_WhCode3.Text));
    btn_ok.Enabled :=True;
    whCode:=getCode(cmbx_WhCode3.Text) ;
    WhPositionCode:=getCode(cmbx_WhpCode3.Text) ;
    CurrentInvfields:=getInvfield(AdoQry_tmp,whCode,WhPositionCode,'CurrentInv');
    with AdoQry_tmp do
    begin
      Close;
      sql.clear;
      sql.Add('select '+CurrentInvfields+ ' as onhandInv from CurrentInv where whCode='''+whCode+''' and WhPositionCode='''+WhPositionCode+''' and ItemCode='''+Extedt_ItemCode.text+'''');
      open;
      if not eof then
        lbl_onhandInv.Caption:=fieldbyname('onhandInv').asstring
      else
      lbl_onhandInv.Caption:='0';
    end;
    show_WhName;
end;
procedure TFrm_Sfc_MnListRequest_D.Show_WhCode(ItemCode:string;flag:integer);
var
  sqltext:string;
begin

⌨️ 快捷键说明

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