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

📄 umakenotice.~pas

📁 是分布式粮库程序,是采用Delphi实现的
💻 ~PAS
📖 第 1 页 / 共 4 页
字号:
//    changhaodblookupcombobox.Enabled :=false;
//    huoweidblookupcombobox.Enabled :=false;
    additemflag:=0;
end;

procedure Tfmakenotice.okBitBtnClick(Sender: TObject);
var  Counst:integer;
     i:integer;
     s:string;
     count:integer;
begin
    additemflag:=0;

     //!!!!!!添加文号时不能添入相同文号;
     if ((NewNotice=1) or (NewNotice=2)) then
     begin
       Newwenhaoquery.ParamByName('NotyNo').AsString:=Edit8.Text+'年'+edit9.Text;
       Newwenhaoquery.Close;
       Newwenhaoquery.Open;
       if  Not newwenhaoquery.IsEmpty then
         begin
              application.MessageBox('该文号与原有的通知文号重复!','编制通知文号时出错',MB_OK+MB_ICONEXCLAMATION);
              Edit9.Text:='';
              Edit9.SetFocus;
              exit;
         end;
     end;
      //!!!!!!修改文号时不能添入相同文号;
     if  NewNotice=3 then
     begin
       UpdatewenhaoQuery.ParamByName('NotyNo').AsString:=Edit8.Text+'年'+Edit9.Text;
       UpdatewenhaoQuery.ParamByName('NotListId').AsInteger:=NotListId;
       UpdatewenhaoQuery.Close;
       UpdatewenhaoQuery.Open;
       if Not UpdatewenhaoQuery.IsEmpty then
         begin
              application.MessageBox('该文号与原有的通知文号重复!','编制通知文号时出错',MB_OK+MB_ICONEXCLAMATION);
              NoticeQuery.ParamByName('NotListId').AsInteger:=NotListId;
              NoticeQuery.Close;
              NoticeQuery.Open;
              Edit8.Text:=Copy(NoticeQuery.FieldByName('NOTY_NO').AsString,1,4);
              Edit9.Text:=Copy(NoticeQuery.FieldByName('NOTY_NO').AsString,7,Length(NoticeQuery.FieldByName('NOTY_NO').AsString)-6);
              Edit9.SetFocus;
              exit;
         end;
     end;
    if Edit8.Text='' then
       begin
       Application.MessageBox('通知项文号不能为空!','编制通知时出错',MB_OK+MB_ICONERROR);
       Edit8.SetFocus;
       Exit;
    end;
    if Length(Edit8.Text)<>4 then
       begin
           count:=4-Length(Edit8.Text);
           for i:=1 to count do
             s:=s+' ';
           Edit8.Text:=s+Edit8.Text;
      end;
    if Edit9.Text='' then
    begin
       Application.MessageBox('通知项文号不能为空!','编制通知时出错',MB_OK+MB_ICONERROR);
       Edit9.SetFocus;
       Exit;
    end;

   planquery.ParamByName('plan_id').asstring:= edit10.Text ;
   planquery.close;
   planquery.Open;
   if planquery.IsEmpty then
    begin
    application.MessageBox('没有该计划编号,请重新输入','',mb_ok+mb_iconerror);
    edit10.SetFocus ;
    exit;
    end;

    if Edit2.Text='' then
    begin
      Application.MessageBox('批准文号不为空!','编制通知时出错',MB_OK+MB_ICONERROR);
      Edit2.SetFocus;
      exit;
    end;

    if unitDBLookupComboBox.Text='' then
     begin
      Application.MessageBox('必须选择入库单位!','编制通知时出错',MB_OK+MB_ICONERROR);
      unitDBLookupComboBox.SetFocus;
      exit;
     end;
    if combobox1.Text='' then
     begin
      Application.MessageBox('供货单位不能为空!','编制通知时出错',MB_OK+MB_ICONERROR);
      combobox1.SetFocus;
      exit;
     end;
    if DateTimePicker1.DateTime>DateTimePicker2.DateTime then
     begin
      Application.MessageBox('入/移库开始时间必须小于结束时间!','编制通知时出错',MB_OK+MB_ICONERROR);
      DateTimePicker1.SetFocus;
      exit;
     end;
    if edit11.Text =''  then
     begin
       application.MessageBox('还没有填写通知细目!','请填写细目',MB_OK+MB_ICONEXCLAMATION);
       edit11.SetFocus;
       exit;
     end;
    if huowudblookupcombobox.Text ='' then
     begin
       application.MessageBox('还没有填写货物名称!','请填写细目',MB_OK+MB_ICONEXCLAMATION);
       huowudblookupcombobox.SetFocus;
       exit;
     end;
    if edit5.Text ='' then
     begin
       application.MessageBox('还没有填写货物数量!','请填写细目',MB_OK+MB_ICONEXCLAMATION);
       edit5.SetFocus;
       exit;
     end;

    if edit6.Text ='' then
     begin
       application.MessageBox('还没有填写货物单价!','请填写细目',MB_OK+MB_ICONEXCLAMATION);
       edit6.SetFocus;
       exit;
     end;

    Edit10.Enabled:=false;
    speedbutton2.Enabled :=false;
    Edit2.Enabled:=false;
    unitdblookupcombobox.Enabled :=false;
    combobox1.Enabled :=false;
    DateTimePicker2.Enabled:=false;
    DateTimePicker1.Enabled:=false;
    memo1.Enabled:=false;
    edit3.Enabled:=false;
    edit4.Enabled:=false;
    OkBitBtn.Enabled:=false;
  //  CancelBitBtn.Enabled:=false;
  //  exitBitBtn.Enabled:=false;
    edit8.Enabled:=false;
    edit9.Enabled:=false;

    edit11.Enabled:=false;
    kudianDBlookupCombobox.Enabled:=false;
    changhaoDBlookupCombobox.Enabled:=false;
    huoweidblookupcombobox.Enabled :=false;
    huowuDBlookupCombobox.Enabled:=false;
    fukuanDBlookupCombobox.Enabled:=false;
    chubeiDBlookupCombobox.Enabled:=false;
    guishuDBlookupCombobox.Enabled:=false;
    yewuDBlookupCombobox.Enabled:=false;
    edit5.Enabled:=false;
    edit6.Enabled:=false;
    edit7.Enabled:=false;
    memo2.Enabled:=false;

    additembitbtn.Enabled:=true;
    deleteitembitbtn.Enabled:=true;
    modifyitembitbtn.Enabled:=true;
    cancelitembitbtn.Enabled:=true;

  if ((NewNotice=1) or (NewNotice=2)) then   //新建通知
    begin
     NewQuery.ParamByName('MaxNoticeId').AsInteger:=MaxNotId;
     NewQuery.ParamByName('Noty_No').AsString:=Edit8.Text+'年'+Edit9.Text;
     newnotyitemquery.ParamByName('notlistid').AsInteger:=maxnotid;
     if NewNotice=1 then
       begin
       Counst:=1;//入库通知
       end
     else
       Counst:=2; //移库通知

       NewQuery.ParamByName('Noty_Type').ASInteger:=Counst;
       NewQuery.ParamByName('PLAN_ID').AsString:=Edit10.Text;
       NewQuery.ParamByName('AUTHORITY_NO').AsString:=Edit2.Text;
       NewQuery.ParamByName('UNIT_ID').AsInteger:=unitdblookupcombobox.KeyValue;
       NewQuery.ParamByName('COUNTERPART').AsString:=combobox1.Text;
       NewQuery.ParamByName('START_TIME').asdatetime:=DateTimePicker1.date;
       NewQuery.ParamByName('FINISH_TIME').AsDatetime:=DateTimePicker2.date;
       NewQuery.ParamByName('INPUT_TIME').AsDatetime:=date;
       NewQuery.ParamByName('MEMO').AsString:=Memo1.Text;
       NewQuery.ParamByName('MANAGER').AsString:=Edit3.Text;
       NewQuery.ParamByName('CLERK').AsString:=Edit4.Text;
       NewQuery.ParamByName('status').AsInteger:=0;
   //    NewQuery.ParamByName('NotyStatus').AsInteger:=1; //未签发!

       newnotyitemquery.ParamByName('itemlistid').AsString:=inttostr(notyid)+'_'+edit11.Text;
       newnotyitemquery.ParamByName('sitename').AsString:=kudiandblookupcombobox.text;
       newnotyitemquery.ParamByName('depotname').AsString:=changhaodblookupcombobox.text;
       newnotyitemquery.ParamByName('foodposition').AsString:=huoweidblookupcombobox.text;

       newnotyitemquery.ParamByName('FOOD_TYPE').AsString:=huowudblookupcombobox.text;
       newnotyitemquery.ParamByName('SETTLEMENT').AsString:=fukuandblookupcombobox.text;
       newnotyitemquery.ParamByName('ATTRIBUTE').AsString:=chubeidblookupcombobox.text;
       newnotyitemquery.ParamByName('ATTACHMENT').AsString:=guishudblookupcombobox.text;
       newnotyitemquery.ParamByName('BUSINESS_TYPE').AsString:=yewudblookupcombobox.text;
       newnotyitemquery.ParamByName('QUANTITY').Asfloat:=strtofloat(edit5.Text);
       newnotyitemquery.ParamByName('PRICE').Asfloat:=strtofloat(edit6.Text);
       newnotyitemquery.ParamByName('memo').AsString:=memo2.Text;
       NewnotyitemQuery.ParamByName('status').AsInteger:=0;

       try
         NewQuery.ExecSQL;
         newnotyitemquery.ExecSQL;
       except
         Application.MessageBox('新建通知时出错!','系统错误',MB_OK+MB_ICONERROR);
         Exit;
       end;

    end;
    if NewNotice=3 then   //修改通知
      begin
       UpdateQuery.ParamByName('Noty_No').AsString:=Edit8.Text+'年'+Edit9.Text;
       UpdateQuery.ParamByName('PLAN_ID').AsString:=Edit10.Text;
       UpdateQuery.ParamByName('AUTHORITY_NO').AsString:=Edit2.Text;
       UpdateQuery.ParamByName('UNIT_ID').AsString:=unitdblookupcombobox.KeyValue;
       UpdateQuery.ParamByName('COUNTERPART').AsString:=combobox1.Text;
       UpdateQuery.ParamByName('START_TIME').AsDatetime:=DateTimePicker1.date;
       UpdateQuery.ParamByName('FINISH_TIME').AsDatetime:=DateTimePicker2.date;
       UpdateQuery.ParamByName('MEMO').AsString:=Memo1.Text;
       UpdateQuery.ParamByName('MANAGER').AsString:=Edit3.Text;
       UpdateQuery.ParamByName('CLERK').AsString:=Edit4.Text;
    //   UpdateQuery.ParamByName('NotyStatus').AsInteger:=1; //未签发!
       UpdateQuery.ParamByName('NotListId').AsInteger:=NotListId;

       updateitemquery.ParamByName('notlistid').AsInteger:=NotlistId;
       updateitemquery.ParamByName('itemlistid').AsString:=inttostr(notyid)+'_'+edit11.Text;
       updateitemquery.ParamByName('sitename').AsString:=kudiandblookupcombobox.KeyValue;
       updateitemquery.ParamByName('depotname').AsString:=changhaodblookupcombobox.KeyValue;
       updateitemquery.ParamByName('foodposition').AsString:=huoweidblookupcombobox.text;

       updateitemquery.ParamByName('FOOD_TYPE').AsString:=huowudblookupcombobox.KeyValue;
       updateitemquery.ParamByName('SETTLEMENT').AsString:=fukuandblookupcombobox.KeyValue;
       updateitemquery.ParamByName('ATTRIBUTE').AsString:=chubeidblookupcombobox.KeyValue;
       updateitemquery.ParamByName('ATTACHMENT').AsString:=guishudblookupcombobox.KeyValue;
       updateitemquery.ParamByName('BUSINESS_TYPE').AsString:=yewudblookupcombobox.KeyValue;
       updateitemquery.ParamByName('QUANTITY').Asfloat:=strtofloat(edit5.Text);
       updateitemquery.ParamByName('PRICE').asfloat:=strtofloat(edit6.Text);
       updateitemquery.ParamByName('memo').AsString:=memo2.Text;

          try
            UpdateQuery.ExecSQL;
            updateitemquery.ExecSQL;
          except
            Application.MessageBox('新修改通知时出错!','系统错误',MB_OK+MB_ICONERROR);
            Exit;
          end;
    end;
   if newnotice=4 then
     begin   //新建通知细目
      if edit11.Text <>'' then
       begin
       newnotyitemquery.ParamByName('notlistid').AsInteger:=notlistid;
       newnotyitemquery.ParamByName('itemlistid').AsString:=inttostr(notyid)+'_'+edit11.Text;
       newnotyitemquery.ParamByName('sitename').AsString:=kudiandblookupcombobox.Text;
       newnotyitemquery.ParamByName('depotname').AsString:=changhaodblookupcombobox.text;
       newnotyitemquery.ParamByName('foodposition').AsString:=huoweidblookupcombobox.text;

       newnotyitemquery.ParamByName('FOOD_TYPE').AsString:=huowudblookupcombobox.text;
       newnotyitemquery.ParamByName('SETTLEMENT').AsString:=fukuandblookupcombobox.text;
       newnotyitemquery.ParamByName('ATTRIBUTE').AsString:=chubeidblookupcombobox.text;
       newnotyitemquery.ParamByName('ATTACHMENT').AsString:=guishudblookupcombobox.text;
       newnotyitemquery.ParamByName('BUSINESS_TYPE').AsString:=yewudblookupcombobox.text;
       newnotyitemquery.ParamByName('QUANTITY').Asfloat:=strtofloat(edit5.Text);
       newnotyitemquery.ParamByName('PRICE').Asfloat:=strtofloat(edit6.Text);
       newnotyitemquery.ParamByName('memo').Asstring:=memo2.Text;
       NewnotyitemQuery.ParamByName('status').AsInteger:=0;
       try
       newnotyitemquery.ExecSQL;
       except
       application.MessageBox('新建通知细目时出错','系统错误',MB_OK+MB_ICONERROR);
       exit;
       end;
      end;
    end;
    if newnotice=5 then
    begin    //修改通知细目
       updateitemquery.ParamByName('notlistid').AsInteger:=NotlistId;
       updateitemquery.ParamByName('itemlistid').AsString:=inttostr(notyid)+'_'+edit11.Text;
       updateitemquery.ParamByName('sitename').AsString:=kudiandblookupcombobox.KeyValue;
       updateitemquery.ParamByName('depotname').AsString:=changhaodblookupcombobox.KeyValue;
       updateitemquery.ParamByName('foodposition').AsString:=huoweidblookupcombobox.text;

       updateitemquery.ParamByName('FOOD_TYPE').AsString:=huowudblookupcombobox.KeyValue;
       updateitemquery.ParamByName('SETTLEMENT').AsString:=fukuandblookupcombobox.KeyValue;
       updateitemquery.ParamByName('ATTRIBUTE').AsString:=chubeidblookupcombobox.KeyValue;
       updateitemquery.ParamByName('ATTACHMENT').AsString:=guishudblookupcombobox.KeyValue;
       updateitemquery.ParamByName('BUSINESS_TYPE').AsString:=yewudblookupcombobox.KeyValue;
       updateitemquery.ParamByName('QUANTITY').Asfloat:=strtofloat(edit5.Text);
       updateitemquery.ParamByName('PRICE').asfloat:=strtofloat(edit6.Text);
       updateitemquery.ParamByName('memo').AsString:=memo2.Text;
    try
      updateitemquery.ExecSQL;
    except
      application.MessageBox('修改通知细目时出错','系统错误',MB_OK+MB_ICONERROR);
      exit;
    end;
   end;
    NoteListQuery.Close;
    NoteListQuery.Open;
    notyitemlistquery.Close;
    notyitemlistquery.Open;
end;

procedure Tfmakenotice.newyikuClick(Sender: TObject);
var s:string;
begin
    Edit10.Enabled:=true;
    speedbutton2.Enabled :=true;
    Edit2.Enabled:=true;
    unitdblookupcombobox.Enabled :=true;
    combobox1.Enabled :=true;
    DateTimePicker2.Enabled:=true;
    DateTimePicker1.Enabled:=true;
    memo1.Enabled:=true;
    edit3.Enabled:=true;
    edit4.Enabled:=true;
    OkBitBtn.Enabled:=true;
    CancelBitBtn.Enabled:=true;
  //  exitBitBtn.Enabled:=true;
    edit8.Enabled:=true;
    edit9.Enabled:=true;
    Edit8.SetFocus;

    edit11.Enabled:=true;
//    kudianDBlookupCombobox.Enabled:=true;
//    changhaoDBlookupCombobox.Enabled:=true;
//    huoweidblookupcombobox.Enabled :=true;
    huowuDBlookupCombobox.Enabled:=true;
    fukuanDBlookupCombobox.Enabled:=true;
    chubeiDBlookupCombobox.Enabled:=true;
    guishuDBlookupCombobox.Enabled:=true;
    yewuDBlookupCombobox.Enabled:=true;
    edit5.Enabled:=true;
//  edit6.Enabled:=true;   移库时单价不可见
//    edit7.Enabled:=true;
    memo2.Enabled:=true;
    additembitbtn.Enabled:=false;
    deleteitembitbtn.Enabled:=false;
    modifyitembitbtn.Enabled:=false;
    cancelitembitbtn.Enabled:=false;

⌨️ 快捷键说明

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