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

📄 mrp_qry_newtotalmrp.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 3 页
字号:
if AdoQry_Main.fieldbyname('PmCode').asinteger=2  then
   begin
   Background:=$ffccee;
   afont.Color:=clblack;
   end;
if AdoQry_Main.fieldbyname('PmCode').asinteger=3  then
   begin
   Background:=$ff99bb;
   afont.Color:=clblack;
   end;

end;

procedure TFrm_Mrp_Qry_NewTotalMrp.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,formatdatetime('yyyy.mm.dd',now));
           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,formatdatetime('yyyy.mm.dd',now));
           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,formatdatetime('yyyy.mm.dd',now));
           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,formatdatetime('yyyy.mm.dd',now));
           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_Mrp_Qry_NewTotalMrp.getValue(Code,
  tableName: string;ValueType:integer): variant;
var tmpAdoQry:TAdoQuery;
begin
 tmpAdoQry:=TAdoQuery.Create(Application);
 tmpAdoQry.EnableBCD:=False;
 try
   with tmpAdoQry do
     begin
      Connection:=dbconnect;
       Close;
       sql.clear;
       sql.Text:='select MrpParamValuen,MrpParamValuec from '+tableName+' where MrpParamCode='+quotedstr(Code);
       open;
       if ValueType=0 then
       Result:=fieldbyname('MrpParamValuec').asstring;
       if ValueType=1 then
       Result:=floattostr(fieldbyname('MrpParamValuen').asfloat);
     end;
 finally
   tmpAdoQry.Free;
 end;
end;

function TFrm_Mrp_Qry_NewTotalMrp.getenddate(sdate: string;
  dayCount: integer): string;
var tmpAdoQry:TAdoQuery;
begin
 tmpAdoQry:=TAdoQuery.Create(Application);
 tmpAdoQry.EnableBCD:=False;
 try
   with tmpAdoQry do
     begin
      Connection:=dbconnect;
       Close;
       sql.clear;
       sql.Text:='select enddate=convert(datetime,'+quotedstr(copy(sdate,1,10))+')+'+inttostr(dayCount);
       open;
       try
       Result:=fieldbyname('enddate').asstring;
       except
       Result:='';
       end;
     end;
 finally
   tmpAdoQry.Free;
 end;
end;


function TFrm_Mrp_Qry_NewTotalMrp.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_Mrp_Qry_NewTotalMrp.btn_SySclick(Sender: TObject);
begin
  inherited;
  try
       if Frm_Mrp_Qry_NewInformalTotalMrp_Sys=nil then
          begin
           Frm_Mrp_Qry_NewInformalTotalMrp_Sys:=TFrm_Mrp_Qry_NewInformalTotalMrp_Sys.Create(Self);
           Frm_Mrp_Qry_NewInformalTotalMrp_Sys.SetSysParam(userCode,ModuleCode,menuid,formatdatetime('yyyy.mm.dd',now));
           Frm_Mrp_Qry_NewInformalTotalMrp_Sys.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
           Frm_Mrp_Qry_NewInformalTotalMrp_Sys.TotalType:=2;
           Frm_Mrp_Qry_NewInformalTotalMrp_Sys.InitForm(AdoQry_Main.Connection,True);
          end
        else Frm_Mrp_Qry_NewInformalTotalMrp_Sys.Show;
  finally
  activecontrol:=dbgrideh;
  end;

end;

procedure TFrm_Mrp_Qry_NewTotalMrp.btn_VendorClick(Sender: TObject);
begin
  inherited;
 try
 if ((AdoQry_Main.fieldbyname('PmCode').asinteger<>1) and (AdoQry_Main.fieldbyname('PmCode').asinteger<>2) and (AdoQry_Main.fieldbyname('PmCode').asinteger<>3)) then
  exit;
    if AdoQry_Main.fieldbyname('Orderpreqty').asfloat+AdoQry_Main.fieldbyname('Orderxdqty').asfloat=0 then
      exit;
        if Frm_Mrp_Qry_InformalTotalMrp_vd=nil then
          begin
           Frm_Mrp_Qry_InformalTotalMrp_vd:=TFrm_Mrp_Qry_InformalTotalMrp_vd.Create(Self);
           Frm_Mrp_Qry_InformalTotalMrp_vd.SetSysParam(userCode,ModuleCode,menuid,formatdatetime('yyyy.mm.dd',now));
           Frm_Mrp_Qry_InformalTotalMrp_vd.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
           Frm_Mrp_Qry_InformalTotalMrp_vd.InitForm(AdoQry_Main.Connection,True);
          end
        else Frm_Mrp_Qry_InformalTotalMrp_vd.Show;
  //  Qry_Vendor(dbconnect,)
 finally
 activecontrol:=dbgrideh;
 end;

end;

procedure TFrm_Mrp_Qry_NewTotalMrp.btn_iteItem_PeggingClick(
  Sender: TObject);
begin
  inherited;
  try
 if  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo=nil then
 begin
  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo:=TFrm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.Create(Self);
  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.SetSysParam(userCode,ModuleCode,menuid,formatdatetime('yyyy.mm.dd',now));
  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.Qclt:=inttostr(AdoQry_Main.fieldbyname('Qclt').asinteger);
  tmplowPmCode1:=AdoQry_Main.fieldbyname('PmCode').asinteger;
  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.initType:=1;
  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.TotalType:='MrpTotal';
  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.peggingType:=2;
  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.ItemCode:=AdoQry_Main.fieldbyname('ItemCode').asstring;
//  Frm_Mrp_Qry_InformalUpRightMrp_D_ParentMo.duedate:=datetimetostr(AdoQry_Main.fieldbyname('requiredate').asdatetime);
  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.strpath:=AdoQry_Main.fieldbyname('ItemCode').asstring+',';
  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.InitForm(dbconnect,True);
 end
 else  Frm_Mrp_Qry_InformalUpRightMrp_D_NewParentMo.Show;
 finally
 activecontrol:=dbgrideh;
 end;
end;

procedure TFrm_Mrp_Qry_NewTotalMrp.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,formatdatetime('yyyy.mm.dd',now));
  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_Mrp_Qry_NewTotalMrp.FormActivate(Sender: TObject);
begin
  inherited;
activecontrol:=dbgrideh;
end;

end.

⌨️ 快捷键说明

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