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

📄 pm_enter_sspoinfo3.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 4 页
字号:
     AdoQry_Main.Next;
  end;
  AdoQry_Main.ReQuery;
  if AdoQry_Main.RecordCount >0 then
      AdoQry_Main.BookmArk:=BookmArk;
end;

procedure TFrm_Pm_Enter_SsPoInfo3.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_SsPoInfo3.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_SsPoInfo3.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text := 'Drop Table #ss1,#ss ';
  AdoQry_Tmp.ExecSQL;
  frentform:=0;
end;

procedure TFrm_Pm_Enter_SsPoInfo3.Initselect;
begin
  SelectFromSql:= 'Select * from #ss';
  OrderByfields:='ItemCode,ssdate ';
  GetData;
end;

function TFrm_Pm_Enter_SsPoInfo3.getQclt(ItemCode: string): string;
begin
  try
   Executesql(AdoQry_tmp,'select Qclt from Item where ItemCode='+quotedstr(ItemCode),0);
   Result:=inttostr(AdoQry_tmp.fieldbyname('Qclt').asinteger);
  except
   Result:='9999999';
  end;

end;

procedure TFrm_Pm_Enter_SsPoInfo3.btn_ItemClick(Sender: TObject);
begin
  inherited;
  Qry_Item(Dbconnect,AdoQry_Main.fieldbyname('ItemCode').AsString);
  DBGridEh.SetFocus;
end;

procedure TFrm_Pm_Enter_SsPoInfo3.btn_VendorClick(Sender: TObject);
begin
  inherited;
  Qry_Vendor(Dbconnect,AdoQry_Main.fieldbyname('DeptVendorCode').AsString);
  DBGridEh.SetFocus;
end;

procedure TFrm_Pm_Enter_SsPoInfo3.btn_ite_ItemClick(Sender: TObject);
begin
  inherited;
  try
    if  Frm_Mrp_Qry_InformalTotalMrp_Item=nil then
      begin
        Frm_Mrp_Qry_InformalTotalMrp_Item:=TFrm_Mrp_Qry_InformalTotalMrp_Item.Create(Self);
        Frm_Mrp_Qry_InformalTotalMrp_Item.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
        Frm_Mrp_Qry_InformalTotalMrp_Item.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
        Frm_Mrp_Qry_InformalTotalMrp_Item.InitForm(dbconnect,True);
      end
      else  Frm_Mrp_Qry_InformalTotalMrp_Item.Show;
  finally
    activecontrol:=dbgrideh;
  end;
end;

procedure TFrm_Pm_Enter_SsPoInfo3.btn_OrderClick(Sender: TObject);
begin
  inherited;
  try
  ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
  if ((AdoQry_Main.fieldbyname('PmCode').asinteger=1) or (AdoQry_Main.fieldbyname('PmCode').asinteger=2)) then
   begin
//    if AdoQry_Main.fieldbyname('Orderpreqty').asfloat+AdoQry_Main.fieldbyname('Orderxdqty').asfloat=0 then
 //     exit;
    if Frm_Mrp_Qry_InformalTotalMrp_Po=nil then
          begin
           Frm_Mrp_Qry_InformalTotalMrp_Po:=TFrm_Mrp_Qry_InformalTotalMrp_Po.Create(Self);
           Frm_Mrp_Qry_InformalTotalMrp_Po.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
           Frm_Mrp_Qry_InformalTotalMrp_Po.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
           Frm_Mrp_Qry_InformalTotalMrp_Po.InitForm(AdoQry_Main.Connection,True);
          end
        else Frm_Mrp_Qry_InformalTotalMrp_Po.Show;
    exit;
   end;
  if AdoQry_Main.fieldbyname('PmCode').asinteger=0 then
  begin
//   if AdoQry_Main.fieldbyname('Orderpreqty').asfloat+AdoQry_Main.fieldbyname('Orderxdqty').asfloat=0 then
 //    exit;
   if Frm_Mrp_Qry_InformalTotalMrp_Mo=nil then
          begin
           Frm_Mrp_Qry_InformalTotalMrp_Mo:=TFrm_Mrp_Qry_InformalTotalMrp_Mo.Create(Self);
           Frm_Mrp_Qry_InformalTotalMrp_Mo.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
           Frm_Mrp_Qry_InformalTotalMrp_Mo.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
           Frm_Mrp_Qry_InformalTotalMrp_Mo.InitForm(AdoQry_Main.Connection,True);
          end
        else Frm_Mrp_Qry_InformalTotalMrp_Mo.Show;
   exit;
  end;
  if AdoQry_Main.fieldbyname('PmCode').asinteger=3 then
  begin
    if ismorethanzero('moqty','MoLine','ItemCode')=True then
    if Frm_Mrp_Qry_InformalTotalMrp_Mo=nil then
          begin
           Frm_Mrp_Qry_InformalTotalMrp_Mo:=TFrm_Mrp_Qry_InformalTotalMrp_Mo.Create(Self);
           Frm_Mrp_Qry_InformalTotalMrp_Mo.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
           Frm_Mrp_Qry_InformalTotalMrp_Mo.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
           Frm_Mrp_Qry_InformalTotalMrp_Mo.InitForm(AdoQry_Main.Connection,True);
          end
        else Frm_Mrp_Qry_InformalTotalMrp_Mo.Show;
   if ismorethanzero('poqty','poline','ItemCode')=True then
       if Frm_Mrp_Qry_InformalTotalMrp_Po=nil then
          begin
           Frm_Mrp_Qry_InformalTotalMrp_Po:=TFrm_Mrp_Qry_InformalTotalMrp_Po.Create(Self);
           Frm_Mrp_Qry_InformalTotalMrp_Po.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
           Frm_Mrp_Qry_InformalTotalMrp_Po.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
           Frm_Mrp_Qry_InformalTotalMrp_Po.InitForm(AdoQry_Main.Connection,True);
          end
        else Frm_Mrp_Qry_InformalTotalMrp_Po.Show;

 end;
 finally
 activecontrol:=dbgrideh;
 end;
end;

function TFrm_Pm_Enter_SsPoInfo3.ismorethanzero(fieldName, tableName,
  conditionfield: string): boolean;
var AdoQry:TAdoQuery;
begin
 Result:=False;
  AdoQry:=TAdoQuery.Create(Application);
  AdoQry.EnableBCD := False;
  try
    with AdoQry do
     begin
       Close;
       Connection:=dbconnect;
       sql.clear;
       sql.Add('select sum('+fieldName+') as SumQty from '+tableName+' where '+conditionfield+'='+quotedstr(AdoQry_Main.fieldbyname('ItemCode').asstring));
       open;
       if fieldbyname('SumQty').asfloat>0 then
         Result:=True
       else Result:=False;
     end;
  finally
   AdoQry.Free;
  end;
end;

procedure TFrm_Pm_Enter_SsPoInfo3.Button1Click(Sender: TObject);
begin
  inherited;
  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_SsPoInfo3.Button4Click(Sender: TObject);
var
  BookmArk:string;
begin
  inherited;
  try
    if AdoQry_Main.fieldbyname('PmType').asinteger=9 then
    begin
      Frm_Mrp_Enter_oldcommonAssignAlterNative:=TFrm_Mrp_Enter_oldcommonAssignAlterNative.Create(Application);
      Frm_Mrp_Enter_oldcommonAssignAlterNative.SetSysParam(UserCode,ModuleCode,MenuId,DateTimeToStr(Now));
      Frm_Mrp_Enter_oldcommonAssignAlterNative.GetalterItem(dbconnect,AdoQry_Main.fieldbyname('ssid').asinteger);
      Frm_Mrp_Enter_oldcommonAssignAlterNative.ShowModal;
      try
        BookMArk:=AdoQry_Main.BookmArk;
        with  AdoQry_Main do
        begin
          edit ;
          fieldbyname('reMainQty').Asfloat:=fieldbyname('reMainQty').Asfloat- ite_ItemTotalAssignedqty;
          post;
        end;
        AdoQry_tmp.Close;
        AdoQry_Tmp.SQL.clear;
        AdoQry_Tmp.SQL.Text :=' update #ss Set reMainQty=reMainQty-'+floattostr(ite_ItemTotalAssignedqty)
                             +' ,ssreMainQty=ssreMainQty-'+floattostr(ite_ItemTotalAssignedqty)
                             +' where ssid='''+AdoQry_Main.fieldbyname('SsId').asstring+'''';
        AdoQry_Tmp.ExecSQL;
        Getdata;
        AdoQry_Main.BookmArk:=BookMArk;
      except
      end;
    end;
  finally
    DBGridEh.SetFocus;
  end;

end;

end.


⌨️ 快捷键说明

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