📄 mrp_enter_newmrpinfo3.pas
字号:
+' Left Join Dept On isnull(#ss12.DeptVendorCode,Item.DeptCode)=Dept.DeptCode'
//+' Left Join Dept On (Case When #tMpssInfo.SsSysInfoFlag<>1 Then #tMpssInfo.DeptVendorCode Else Item.DeptCode end)=Dept.DeptCode'
+' Left Join Employee On Item.Pla_EmployeeCode=Employee.EmployeeCode'
+' Join Uom On Item.UomCode=Uom.UomCode'
+' Join SysSsInfo On #ss12.SSSysInfoFlag=SysSsInfo.SSCode'
+' where ((#ss12.SsSysInfoFlag=1 '
+' And Item.LongPurchLT=0 And #ss12.DueDate-(select MrpParamValueN from MrpParam '
+' where MrpParamCode='''+'SSForwArdDay'+''')<='''+DateTimeToStr(Date())+''')'
+' Or (#ss12.SsSysInfoFlag=1 And Item.LongPurchLT=1) Or (#ss12.SsSysInfoFlag<>1 and #ss12.ssqty<>0)) '
+' Order by #ss12.ItemCode,ssdate ';
Executesql(AdoQry_tmp,sqltext,1);
Executesql(AdoQry_Main,'select * from #ssInfoResult',0);
selectfromsql:='select * from #ssInfoResult';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Select MrpParamValueN from MrpParam '
+' where MrpParamCode='''+'SSForwArdDay'+'''';
AdoQry_Tmp.Open;
Lbl_Condition.Caption:='系统建议下达(约定开工日-'+FormatDateTime('yyyy.mm.dd',Date())+')'
+'<=建议可见提前天数('+IntToStr(AdoQry_Tmp.fieldbyname('MrpParamValueN').AsInteger)+') 其它(全部)';
AdoQry_Tmp.Close;
Checked:=False;
if ShowAnimate<>nil then ShowAnimate.Free;
if ShowPanel<>nil then ShowPanel.Free;
Application.ProcessMessages;
end;
procedure TFrm_Mrp_Enter_NewMrpInfo3.FormDestroy(Sender: TObject);
begin
inherited;
Frm_Mrp_Enter_NewMrpInfo3:=Nil;
end;
procedure TFrm_Mrp_Enter_NewMrpInfo3.Act_NewExecute(Sender: TObject);
var
I:Boolean;
BookmArk:String;
begin
inherited;
If AdoQry_Main.RecordCount=0 Then
begin
Abort;
end;
BookmArk:=AdoQry_Main.BookmArk;
I:=False;
AdoQry_Main.First;
While Not AdoQry_Main.Eof do
begin
If AdoQry_Main.fieldbyname('sScheck').AsInteger>0 Then
begin
I:=True;
Break;
end;
AdoQry_Main.Next;
end;
try
If I=True Then
begin
Frm_Mrp_Enter_NewAutoMo2:=TFrm_Mrp_Enter_NewAutoMo2.Create(Application);
Frm_Mrp_Enter_NewAutoMo2.SetSysParam(UserCode,ModuleCode,MenuId,DateTimeToStr(Now));
Frm_Mrp_Enter_NewAutoMo2.edt_DeptCode.Text:=AdoQry_Main.fieldbyname('DeptCode').asstring;
Frm_Mrp_Enter_NewAutoMo2.edt_DeptName.Text:=AdoQry_Main.fieldbyname('DeptName').asstring;
reMainqty:=AdoQry_Main.fieldbyname('reMainqty').asfloat;
Frm_Mrp_Enter_NewAutoMo2.flag:=5;
Frm_Mrp_Enter_NewAutoMo2.GetConnect(AdoQry_Main);
Frm_Mrp_Enter_NewAutoMo2.ShowModal;
end;
finally
AdoQry_Main.BookmArk:=BookmArk;
end;
end;
procedure TFrm_Mrp_Enter_NewMrpInfo3.FormCreate(Sender: TObject);
begin
inherited;
ExtendCaption:=False;
activecontrol:=dbgrideh;
// toolbutton6.Action:=act_Sum;
// TlBtn_Copy.Action:=Act_Check;
end;
procedure TFrm_Mrp_Enter_NewMrpInfo3.Act_CheckExecute(Sender: TObject);
var
BookmArk:String;
begin
inherited;
If AdoQry_Main.RecordCount=0 Then
Abort;
BookmArk:=AdoQry_Main.BookmArk;
AdoQry_Main.First;
While Not AdoQry_Main.Eof Do
begin
AdoQry_Main.Edit;
AdoQry_Main.fieldbyname('SScheck').AsInteger:=1;
AdoQry_Main.Post;
AdoQry_Main.Next;
end;
AdoQry_Main.BookmArk:=BookmArk;
end;
procedure TFrm_Mrp_Enter_NewMrpInfo3.AdoQry_MainBeforeInsert(
DataSet: TDataSet);
begin
inherited;
Abort;
end;
procedure TFrm_Mrp_Enter_NewMrpInfo3.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 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 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;
function TFrm_Mrp_Enter_NewMrpInfo3.getMrpdate: string;
var AdoQry:TAdoQuery;
begin
AdoQry:=TAdoQuery.Create(self);
AdoQry.EnableBCD:=False;
try
with AdoQry do
begin
Close;
Connection:=dbconnect;
sql.clear;
sql.Text:=' Select MrpParamValueC '
+' From MrpParam '
+' Where MrpParamCode=''RunMrpDate'' ';
Prepared;
try
open;
Result:=fieldbyname('MrpParamValuec').asstring;
except
Result:='';
end;
end;
finally
AdoQry.Free;
end;
end;
procedure TFrm_Mrp_Enter_NewMrpInfo3.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
Executesql(AdoQry_tmp,'drop table #ssInfoResult',1);
end;
procedure TFrm_Mrp_Enter_NewMrpInfo3.AdoQry_MainBeforeEdit(DataSet: TDataSet);
begin
inherited;
If AdoQry_Main.fieldbyname('SSSysInfoFlag').AsInteger<>1 Then
begin
DispInfo('本条建议不为"建议下达",不能执行选定操作!',3);
Abort;
end;
If AdoQry_Main.fieldbyname('tMpssReMainQty').AsFloat<=0 Then
begin
DispInfo('本条建议"系统建议余量"已分配完毕,不能执行选定操作!',3);
Abort;
end;
end;
function TFrm_Mrp_Enter_NewMrpInfo3.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_Mrp_Enter_NewMrpInfo3.btn_ItemClick(Sender: TObject);
begin
inherited;
if AdoQry_Main.RecordCount=0 then
begin
activecontrol:=dbgrideh;
exit;
end;
Qry_Item(dbconnect,AdoQry_Main.fieldbyname('ItemCode').asstring);
activecontrol:=dbgrideh;
{ try
Frm_Mrp_Qry_UpRightMrp_D_Item:=TFrm_Mrp_Qry_UpRightMrp_D_Item.Create(Application);
with Frm_Mrp_Qry_UpRightMrp_D_Item do
begin
with AdoQry_tmp do
begin
Connection:=dbconnect;
Close;
sql.clear;
sql.Add('select Item.*,t1.EmployeeName as buyerName,'
+' t2.EmployeeName as PlannerName,'
+' t3.EmployeeName as whkeeperName,'
+' t4.UomName '
+' from Item,Employee t1,Employee t2,Employee t3,Uom t4'
+' where Item.EmployeeCode*=t1.EmployeeCode '
+' and Item.Pla_EmployeeCode*=t2.EmployeeCode'
+' and Item.wh_EmployeeCode*=t3.EmployeeCode'
+' and Item.UomCode*=t4.UomCode'
+' and ItemCode='+quotedstr(AdoQry_Main.fieldbyname('ItemCode').asstring));
open;
edit1.text:=fieldbyname('ItemCode').asstring;
edit2.text:=fieldbyname('ItemName').asstring;
edit3.text:=fieldbyname('UomCode').asstring;
label4.Caption:=fieldbyname('UomName').asstring;
edit4.text:=fieldbyname('designno').asstring;
edit3.text:=fieldbyname('UomCode').asstring;
combobox1.ItemIndex:=fieldbyname('ItemUsable').asinteger;
combobox2.ItemIndex:=fieldbyname('ItemType').asinteger;
edit5.text:=fieldbyname('EmployeeCode').asstring;
label9.Caption:=fieldbyname('buyerName').asstring;
edit6.text:=fieldbyname('Pla_EmployeeCode').asstring;
label11.Caption:=fieldbyname('PlannerName').asstring;
edit7.text:=fieldbyname('whCode').asstring;
edit8.text:=fieldbyname('wh_EmployeeCode').asstring;
label14.Caption:=fieldbyname('whkeeperName').asstring;
combobox3.ItemIndex:=fieldbyname('onlydefaultwh').asinteger;
edit9.text:=floattostr(fieldbyname('maxqty').asfloat);
edit10.text:=floattostr(fieldbyname('minqty').asfloat);
combobox4.ItemIndex:=fieldbyname('limitout').asinteger;
combobox5.ItemIndex:=fieldbyname('longpurchlt').asinteger;
edit11.text:=floattostr(fieldbyname('purchldtime').asfloat);
edit12.text:=floattostr(fieldbyname('mnldtime').asfloat);
combobox6.ItemIndex:=fieldbyname('PmCode').asinteger;
combobox7.ItemIndex:=fieldbyname('Batchstrat').asinteger;
edit13.text:=floattostr(fieldbyname('PmBatch').asfloat);
edit14.text:=fieldbyname('DeptCode').asstring;
edit15.text:=fieldbyname('BarCode').asstring;
combobox8.ItemIndex:=fieldbyname('BatchCtrl').asinteger;
edit16.text:=floattostr(fieldbyname('Capacityhours').asfloat);
combobox9.ItemIndex:=fieldbyname('canSale').asinteger;
edit17.text:=fieldbyname('ItemCode2').asstring;
edit18.text:=fieldbyname('ItemshortName').asstring;
edit19.text:=floattostr(fieldbyname('CurrentonhandInv').asfloat);
edit20.text:=floattostr(fieldbyname('CurrentonCheckInv').asfloat);
end;
showmodal;
end;
finally
Frm_Mrp_Qry_UpRightMrp_D_Item.Free;
activecontrol:=dbgrideh;
end; }
end;
procedure TFrm_Mrp_Enter_NewMrpInfo3.btn_ite_ItemClick(Sender: TObject);
begin
inherited;
if AdoQry_Main.RecordCount=0 then
begin
activecontrol:=dbgrideh;
exit;
end;
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_Enter_NewMrpInfo3.btn_OrderClick(Sender: TObject);
begin
inherited;
try
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.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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -