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

📄 pm_enter_newsspoinfo3.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 4 页
字号:
    Frm_Pm_Enter_NewAutoPo.Free;
  end
  Else
  begin
    AdoQry_Main.BookmArk:=BookmArk;
    DispInfo('没有选定记录,不能执行新增操作!',3);
    Abort;
  end;
{  AdoQry_Main.First;
  While Not AdoQry_Main.Eof Do
  begin
    If AdoQry_Main.fieldbyname('SScheck').AsInteger=1 Then
    begin
     PcNo:=AdoQry_Main.fieldbyname('PcNo').AsString;
     PmCode:=AdoQry_Main.fieldbyname('PmType').AsInteger;
     Break;
   end
   Else
   AdoQry_Main.Next;
  end;
  If AdoQry_Main.Eof Then
  begin
    PcNo:='';
    PmCode:=0;
  end;}
  PcNo:='';
  PmCode:=0;
  if AdoQry_Main.Locate('sScheck',1,[locaseinsensitive]) then
    begin
      PcNo:=AdoQry_Main.fieldbyname('PcNo').AsString;
      PmCode:=AdoQry_Main.fieldbyname('PmType').AsInteger;
    end;
  
  AdoQry_Main.BookmArk:=BookMArk;
end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.FormCreate(Sender: TObject);
begin
  inherited;
  ExtendCaption:=False;
  TlBtn_Copy.Action:=Act_Auto;
  PcNo:='';
  PmCode:=0;
  Selected:=0;
end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.Act_CheckExecute(Sender: TObject);
begin
  inherited;
  If AdoQry_Main.RecordCount=0 Then
    Abort;
  AdoQry_Main.First;
  While Not AdoQry_Main.Eof Do
  begin
    AdoQry_Main.Edit;
    AdoQry_Main.fieldbyname('SScheck').AsInteger:=1;
    AdoQry_Main.Post;
    Selected:=Selected+1;
    AdoQry_Main.Next;
  end;
end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.AdoQry_MainBeforeInsert(
  DataSet: TDataSet);
begin
  inherited;
  Abort;
end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.Act_DeleteExecute(Sender: TObject);
begin
  //inherited;

end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.AdoQry_MainBeforeEdit(DataSet: TDataSet);
begin
  inherited;
  IF (AdoQry_Main.fieldbyname('pcno').AsString='替代件待分配') and (ActiveControl.Name='DBGridEh' )  Then    //(Flag=1) And
  begin
    DispInfo('本条建议不能下单,请按 "替代件建议分配"按钮!',3);
    Abort;
  end;
  IF (Flag=1) And (AdoQry_Main.fieldbyname('SSSysInfoFlag').AsInteger<>1) Then
  begin
    DispInfo('本条建议不为"建议下达",不能执行选定操作!',3);
    Abort;
 end;
 If Trim(AdoQry_Main.fieldbyname('PcNo').AsString)='' Then
 begin
   DispInfo('不能对一条没有可用采购价格单号的记录进行操作!',3);
   Abort;
 end;
 If (PmCode=1) And (AdoQry_Main.fieldbyname('PmType').AsInteger<>PmCode) Then
 begin
   DispInfo('本条记录物料制构类型与选定的不一值!',3);
   Abort;
 end;
 If AdoQry_Main.fieldbyname('ssReMainQty').AsFloat<=0 Then
 begin
   DispInfo('本条建议"系统建议余量"已分配完毕,不能执行选定操作!',3);
   Abort;
 end;
 If (PmCode In [2,3]) And (AdoQry_Main.fieldbyname('PmType').AsInteger=1) Then
 begin
   DispInfo('本条记录物料制构类型与选定的不一值!',3);
   Abort;
 end;
 If (Length(PcNo)>0) And (AdoQry_Main.fieldbyname('PcNo').AsString<>PcNo) Then
 begin
   DispInfo('不能一次选中两个不相同可用采购价格单号!',3);
   Abort;
 end;
end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.AdoQry_MainAfterPost(DataSet: TDataSet);
begin
  inherited;
  Executesql(AdoQry_tmp,'update #ss set sScheck='+AdoQry_Main.fieldbyname('sScheck').asstring+' where ssid='+AdoQry_Main.fieldbyname('ssid').asstring,1);
  If AdoQry_Main.fieldbyname('SScheck').AsInteger=1 Then
  begin
    PcNo:=AdoQry_Main.fieldbyname('PcNo').AsString;
    PmCode:=AdoQry_Main.fieldbyname('PmType').AsInteger;
    Selected:=Selected+1;
  end
  Else
  begin
    Selected:=Selected-1;
    If Selected=0 Then
    begin
      PcNo:='';
      PmCode:=0;
    end;
  end;
end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.Act_autoExecute(Sender: TObject);
var
  Flag:Boolean;
  I:Integer;
  BookmArk:String;
begin
  inherited;
  Flag:=False;
  If AdoQry_Main.RecordCount=0 Then
    Exit;
  BookmArk:=AdoQry_Main.BookmArk;
  AdoQry_Main.First;
  While Not AdoQry_Main.Eof Do
  If (Trim(AdoQry_Main.fieldbyname('DeptVendorCode').AsString)='') And
     (Trim(AdoQry_Main.fieldbyname('PcNo').AsString)='待分配') And
     (AdoQry_Main.fieldbyname('SScheck').AsInteger=1) Then
  begin
    Flag:=True;
    Break;
  end
  Else
    AdoQry_Main.Next;
  If Not Flag Then
  begin
    DispInfo('没有选定待分配的数据或选定的数据不能再分!',3);
    if AdoQry_Main.RecordCount >0 then
      AdoQry_Main.BookmArk:=BookmArk;
    Abort;
  end;
  If (DispInfo('确认真的要分配这条采购订单吗?',2)<>'y') Then
  begin
    if AdoQry_Main.RecordCount >0 then
     AdoQry_Main.BookmArk:=BookmArk;
    Abort;
  end;
  I:=1;
  AdoQry_Main.First;
  While Not AdoQry_Main.Eof Do
  begin
    If (Trim(AdoQry_Main.fieldbyname('DeptVendorCode').AsString)='') And
       (Trim(AdoQry_Main.fieldbyname('PcNo').AsString)='待分配') And
       (AdoQry_Main.fieldbyname('SScheck').AsInteger=1) Then
      If VendorAssign(DbConnect,InttoStr(AdoQry_Main.fieldbyname('SsId').AsInteger),
           AdoQry_Main.fieldbyname('ItemCode').AsString,IntToStr(AdoQry_Main.fieldbyname('PmType').AsInteger),FloatToStr(AdoQry_Main.fieldbyname('GrossRequireQty').AsFloat),
           IntToStr(AdoQry_Main.fieldbyname('OrderLineStatus').AsInteger),
           DateTimeToStr(AdoQry_Main.fieldbyname('SsDate').AsDateTime),FloatToStr(AdoQry_Main.fieldbyname('SsQty').AsFloat),
           FloatToStr(AdoQry_Main.fieldbyname('ReMainQty').AsFloat),DateTimeToStr(AdoQry_Main.fieldbyname('DueDate').AsDateTime))  Then
         I:=I+1
      Else
        DispInfo('由于相应的采购合同中供应商与供应商分配比例表中供应商不相对应'+#13+#10+'        或其它的问题,选定第'+IntToStr(I)+'行记录分配失败!',3);
     AdoQry_Main.Next;
  end;
  AdoQry_Main.ReQuery;
  if AdoQry_Main.RecordCount >0 then
     AdoQry_Main.BookmArk:=BookmArk;
end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.DBGridEhTitleClick(Column: TColumnEh);
var
  BookMArk:String;
begin
  inherited;
  If Trim(Column.Title.Caption)<>'标记' Then
    Abort;
  If AdoQry_Main.RecordCount=0 Then
    Abort;
  BookMArk:=AdoQry_Main.BookmArk;
  If Not Checked Then
  begin
    AdoQry_Main.First;
    While Not AdoQry_Main.Eof Do
    begin
      If (Trim(AdoQry_Main.fieldbyname('PcNo').AsString)<>'')
        And (AdoQry_Main.fieldbyname('SsSysInfoFlag').AsInteger=1) Then
      begin
        AdoQry_Main.Edit;
        AdoQry_Main.fieldbyname('SScheck').AsInteger:=1;
        AdoQry_Main.Post;
      end;
      AdoQry_Main.Next;
    end;
  end
  Else
  begin
    AdoQry_Main.First;
    While Not AdoQry_Main.Eof Do
    begin
      If (Trim(AdoQry_Main.fieldbyname('PcNo').AsString)<>'')
        And (AdoQry_Main.fieldbyname('SsSysInfoFlag').AsInteger=1) Then
      begin
        AdoQry_Main.Edit;
        AdoQry_Main.fieldbyname('SScheck').AsInteger:=0;
        AdoQry_Main.Post;
      end;
      AdoQry_Main.Next;
    end;
  end;
  AdoQry_Main.BookmArk:=BookMArk;
  Checked:=Not Checked;
end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.Act_LookExecute(Sender: TObject);
begin
  inherited;
{  If (AdoQry_Main.RecordCount>0) And (AdoQry_Main.fieldbyname('SsSysInfoFlag').AsInteger=1) Then
 if  Frm_Pm_Enter_PoSsParent=nil then
 begin
  Frm_Pm_Enter_PoSsParent:=TFrm_Pm_Enter_PoSsParent.Create(Self);
  Frm_Pm_Enter_PoSsParent.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
  Frm_Pm_Enter_PoSsParent.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
  tmplowPmCode:=AdoQry_Main.fieldbyname('PmCode').asinteger;
  Frm_Pm_Enter_PoSsParent.Qclt:=getQclt(AdoQry_Main.fieldbyname('ItemCode').asstring);
  Frm_Pm_Enter_PoSsParent.duedate:=datetimetostr(AdoQry_Main.fieldbyname('ssdate').asdatetime);
  Frm_Pm_Enter_PoSsParent.strpath:=AdoQry_Main.fieldbyname('ItemCode').asstring+',';
  Frm_Pm_Enter_PoSsParent.InitForm(dbconnect,True);
 end
 else  Frm_Pm_Enter_PoSsParent.Show;}
  try
    If (AdoQry_Main.RecordCount>0) And (AdoQry_Main.fieldbyname('SsSysInfoFlag').AsInteger=1) Then
    if  Frm_Mrp_Enter_MoSsParent=nil then
    begin
      Frm_Mrp_Enter_MoSsParent:=TFrm_Mrp_Enter_MoSsParent.Create(Self);
      Frm_Mrp_Enter_MoSsParent.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
      Frm_Mrp_Enter_MoSsParent.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
      tmplowPmCode:=AdoQry_Main.fieldbyname('PmCode').asinteger;
      Frm_Mrp_Enter_MoSsParent.Qclt:=getQclt(AdoQry_Main.fieldbyname('ItemCode').asstring);
      Frm_Mrp_Enter_MoSsParent.duedate:=datetimetostr(AdoQry_Main.fieldbyname('ssdate').asdatetime);
      Frm_Mrp_Enter_MoSsParent.strpath:=AdoQry_Main.fieldbyname('ItemCode').asstring+',';
      Frm_Mrp_Enter_MoSsParent.InitForm(dbconnect,True);
    end
    else  Frm_Mrp_Enter_MoSsParent.Show;
  finally
    activecontrol:=dbgrideh;
  end;

end;

procedure TFrm_Pm_Enter_NewSsPoInfo3.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  try
    AdoQry_Tmp.Close;
    AdoQry_Tmp.SQL.Text := 'Drop Table #ss1,#ss ';
    AdoQry_Tmp.ExecSQL;

⌨️ 快捷键说明

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