📄 mrp_enter_ssalternativeinfo.pas
字号:
unit Mrp_Enter_SsAlterNativeInfo;
//
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Outer, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin;
Type
TFrm_Mrp_Enter_SsAlterNativeInfo = Class(TFrm_Base_Outer)
AdoQry_MainSSId: TAutoIncField;
AdoQry_MainItemCode: TStringField;
AdoQry_MainSSSysInfoFlag: TIntegerField;
AdoQry_MaInOrderNo: TStringField;
AdoQry_MaInOrderLineNo: TIntegerField;
AdoQry_MainSSDate: TDateTimeField;
AdoQry_MainSSQty: TFloatField;
AdoQry_MainPmType: TIntegerField;
AdoQry_MainSScheck: TIntegerField;
AdoQry_MainGrossRequireQty: TFloatField;
AdoQry_MaInPlanInvQty: TFloatField;
AdoQry_MaInOrderLineStatus: TIntegerField;
AdoQry_MainDeptVendorCode: TStringField;
AdoQry_Mainduedate: TDateTimeField;
AdoQry_MainReMainQty: TFloatField;
AdoQry_MainItemName: TStringField;
AdoQry_MainEmployeeCode: TStringField;
AdoQry_MainEmployeeName: TStringField;
AdoQry_MainDeptCode: TStringField;
AdoQry_MainDeptName: TStringField;
AdoQry_MainUomName: TStringField;
AdoQry_MainSSName: TStringField;
AdoQry_Mainssflag: TStringField;
AdoQry_Mainmnldtime: TFloatField;
AdoQry_MainEmployeeFlag: TStringField;
AdoQry_MainDeptFlag: TStringField;
AdoQry_MainItemFlag: TStringField;
AdoQry_MaintMpssreMainqty: TFloatField;
Label1: TLabel;
lbl_RunMrpdate: TLabel;
AdOCommand: TAdOCommand;
AdoQry_MainPmCode: TIntegerField;
AdoQry_MainSysqty: TFloatField;
procedure FormDestroy(Sender: TObject);
procedure AdoQry_MainBeforeInsert(DataSet: TDataSet);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Act_LookExecute(Sender: TObject);
private
checked:boolean;
{ Private declarations }
public
procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
function getMrpdate:string;
function getQclt(ItemCode:string):string;{ Public declarations }
{ Public declarations }
end;
var
Frm_Mrp_Enter_SsAlterNativeInfo: TFrm_Mrp_Enter_SsAlterNativeInfo;
implementation
uses Sys_Global, Mrp_Enter_AssignAlterNative;
{$R *.DFM}
{ TFrm_Mrp_Qry_DynamicMrpInfo }
procedure TFrm_Mrp_Enter_SsAlterNativeInfo.InitForm(
AdOConnection: TAdOConnection; ReadOnly: Boolean);
var sqltext:string;
begin
Application.ProcessMessages;
inherited;
If ReadOnly=True Then
begin
TlBtn_Copy.Visible:=False;
end;
lbl_RunMrpdate.Caption:=getMrpdate;
Adocommand.Connection:=AdoQry_Main.Connection;
sqltext:='select *,Sysqty=ssqty,ssreMainqty=reMainqty into #tmpalterssInfo from ss '
+' where ssSysInfoflag=1 '
+' and PmType=9 and reMainqty>0 ';
with Adocommand do
begin
commandtext:=sqltext;
Execute;
end;
sqltext:='select #tmpalterssInfo.*,tMpssreMainqty=case #tmpalterssInfo.ssreMainqty when 0 then null else #tmpalterssInfo.ssreMainqty end,Item.mnldtime,Item.ItemName,Uom.UomName,Dept.DeptCode,Dept.DeptName,'
+' Employee.EmployeeCode,Employee.EmployeeName,'
+' ssflag=convert(varchAr,#tmpalterssInfo.ssSysInfoflag)+'' ''+SysssInfo.ssName,'
+' Employee.EmployeeCode+'''+' '+'''+Employee.EmployeeName As EmployeeFlag,'
+' Dept.DeptCode+'''+' '+'''+Dept.DeptName As DeptFlag, '
+' Item.ItemCode+'''+' '+'''+Item.ItemName As ItemFlag,'
+' Item.PmCode,'
+' ConVert(varchAr,SysSsInfo.SSCode)+'''+' '+'''+SysSsInfo.SsName As SsName'
+' into #tmpalterssInfoResult '
+' From #tmpalterssInfo '
+' Join Item On #tmpalterssInfo.ItemCode=Item.ItemCode '
+' Left Join Dept On isnull(#tmpalterssInfo.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'
+' left outer Join Uom On Item.UomCode=Uom.UomCode'
+' Join SysSsInfo On #tmpalterssInfo.SSSysInfoFlag=SysSsInfo.SSCode';
with Adocommand do
begin
commandtext:=sqltext;
Execute;
end;
// Executesql(AdoQry_Main,sqltext,1);
Executesql(AdoQry_Main,'select * from #tmpalterssInfoResult Order by ItemCode',0);
selectfromsql:='select * from #tmpalterssInfoResult';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Select MrpParamValueN from MrpParam '
+' where MrpParamCode='''+'SSForwArdDay'+'''';
AdoQry_Tmp.Open;
Lbl_Condition.Caption:='全部';
AdoQry_Tmp.Close;
Checked:=False;
Application.ProcessMessages;
end;
procedure TFrm_Mrp_Enter_SsAlterNativeInfo.FormDestroy(Sender: TObject);
begin
inherited;
Frm_Mrp_Enter_SsAlterNativeInfo:=nil;
end;
procedure TFrm_Mrp_Enter_SsAlterNativeInfo.AdoQry_MainBeforeInsert(
DataSet: TDataSet);
begin
inherited;
Abort;
end;
procedure TFrm_Mrp_Enter_SsAlterNativeInfo.FormCreate(Sender: TObject);
begin
inherited;
ExtendCaption:=False;
toolbutton6.Action:=act_auto;
end;
procedure TFrm_Mrp_Enter_SsAlterNativeInfo.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
Executesql(AdoQry_tmp,'drop table #tmpalterssInfo,#tmpalterssInfoResult',1);
end;
function TFrm_Mrp_Enter_SsAlterNativeInfo.getMrpdate: string;
var AdoQry:TAdoQuery;
begin
AdoQry:=TAdoQuery.Create(self);
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;
function TFrm_Mrp_Enter_SsAlterNativeInfo.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_SsAlterNativeInfo.Act_LookExecute(
Sender: TObject);
var
BookmArk:String;
begin
inherited;
If AdoQry_Main.RecordCount=0 Then
begin
Abort;
end;
If AdoQry_Main.fieldbyname('ReMainQty').AsFloat<=0 Then
begin
DispInfo('本条建议"系统建议余量"已分配完毕,不能再分配!',3);
Abort;
end;
try
BookmArk:=AdoQry_Main.BookmArk;
begin
Frm_Mrp_Enter_AssignAlterNative:=TFrm_Mrp_Enter_AssignAlterNative.Create(Application);
Frm_Mrp_Enter_AssignAlterNative.SetSysParam(UserCode,ModuleCode,MenuId,DateTimeToStr(Now));
Frm_Mrp_Enter_AssignAlterNative.lbl_Item.Caption:=AdoQry_Main.fieldbyname('Itemflag').asstring;
Frm_Mrp_Enter_AssignAlterNative.Label2.Caption:=AdoQry_Main.fieldbyname('UomName').asstring;
Frm_Mrp_Enter_AssignAlterNative.Label5.Caption:=AdoQry_Main.fieldbyname('ssflag').asstring;
Frm_Mrp_Enter_AssignAlterNative.Label8.Caption:=AdoQry_Main.fieldbyname('ssdate').asstring;
Frm_Mrp_Enter_AssignAlterNative.Label12.Caption:=AdoQry_Main.fieldbyname('Sysqty').asstring;
Frm_Mrp_Enter_AssignAlterNative.Label14.Caption:=AdoQry_Main.fieldbyname('tMpssreMainqty').asstring;
Frm_Mrp_Enter_AssignAlterNative.ite_Ssid:=AdoQry_Main.fieldbyname('ssid').asinteger;
Frm_Mrp_Enter_AssignAlterNative.ite_reMainqty:=AdoQry_Main.fieldbyname('tMpssreMainqty').asfloat;
Frm_Mrp_Enter_AssignAlterNative.GetalterItem(AdoQry_Main,AdoQry_Main.fieldbyname('ItemCode').asstring);
Frm_Mrp_Enter_AssignAlterNative.ShowModal;
end;
finally
AdoQry_Main.BookmArk:=BookmArk;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -