Initial commit - Delphi MES client project
This commit is contained in:
@@ -0,0 +1,163 @@
|
||||
unit uFrame_Moldpress;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
uFrameBase, System.ImageList, FMX.ImgList, FMX.Controls.Presentation,uksoap,
|
||||
FMX.Edit, FMX.Objects,uListConent,uShowInfo,uTCPDevice;
|
||||
|
||||
type
|
||||
TFrame_Moldpress = class(TFrameBase)
|
||||
Rectangle88: TRectangle;
|
||||
Option1: TRectangle;
|
||||
Glyph9: TGlyph;
|
||||
OptionLabel1: TText;
|
||||
Text19: TText;
|
||||
Edit_Speed: TEdit;
|
||||
Option2: TRectangle;
|
||||
Glyph2: TGlyph;
|
||||
OptionLabel3: TText;
|
||||
Text6: TText;
|
||||
Edit_Pressure: TEdit;
|
||||
Option3: TRectangle;
|
||||
Glyph3: TGlyph;
|
||||
OptionLabel5: TText;
|
||||
Text23: TText;
|
||||
Edit_DRY_FILM_TYPE: TEdit;
|
||||
TxtError: TText;
|
||||
ImageList1: TImageList;
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
procedure FillDefaultValue(sPartnumValue,sDefaultTxt:string);override;
|
||||
function DoExec():boolean;override;
|
||||
function CheckValid(var sTxt:string):boolean;override;
|
||||
end;
|
||||
|
||||
var
|
||||
Frame_Moldpress: TFrame_Moldpress;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
uses uDM, uInkPrintConent;
|
||||
|
||||
function TFrame_Moldpress.CheckValid(var sTxt:string):boolean; //返回面次数据
|
||||
var
|
||||
aa:Extended;
|
||||
sError:string;
|
||||
begin
|
||||
Result:=false;
|
||||
if Trim(Edit_Speed.Text)='' then begin Error(Edit_Speed,TxtError,'傳動速度不能為空');Exit;end;
|
||||
if Trim(Edit_Pressure.Text)='' then begin Error(Edit_Pressure,TxtError,'壓膜壓力不能為空');Exit;end;
|
||||
if Trim(Edit_DRY_FILM_TYPE.Text)='' then begin Error(Edit_DRY_FILM_TYPE,TxtError,'幹膜型號不能為空');Exit;end;
|
||||
|
||||
if not TryStrToFloat(Edit_Speed.Text,aa) then begin Error(Edit_Speed,TxtError,'傳動速度類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit_Pressure.Text,aa) then begin Error(Edit_Pressure,TxtError,'壓膜壓力類型錯誤,請重新輸入.');Exit;end;
|
||||
|
||||
// if (not Ksoap.Thread_cm_mtl_trace_in_f(Edit_DRY_FILM_TYPE.Text,'DF',sError)) then //判断油墨
|
||||
// begin
|
||||
// Error(Edit_DRY_FILM_TYPE,TxtError,sError);
|
||||
// Exit;
|
||||
// end;
|
||||
|
||||
Result:=true;
|
||||
if Result then Error(Edit_DRY_FILM_TYPE,TxtError,'');
|
||||
end;
|
||||
|
||||
procedure TFrame_Moldpress.FillDefaultValue(sPartnumValue,sDefaultTxt:string);
|
||||
var
|
||||
tmpList:TStrings;
|
||||
begin
|
||||
if sDefaultTxt='' then Exit;
|
||||
tmpList:=TStringList.Create;
|
||||
try
|
||||
tmpList.DelimitedText:=sDefaultTxt;
|
||||
if tmpList.Count>13 then
|
||||
begin
|
||||
Edit_Speed.Text:=tmpList.Strings[0]; //傳動速度
|
||||
Edit_Pressure.Text:=tmpList.Strings[3]; //壓膜壓力
|
||||
end;
|
||||
finally
|
||||
tmpList.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFrame_Moldpress.DoExec():boolean;
|
||||
var
|
||||
LotNoRecord:TLotNoRecord;
|
||||
vId:Integer;
|
||||
sTxt:string;
|
||||
sError:string;
|
||||
vP_ID:Double;
|
||||
begin
|
||||
Result:=false;
|
||||
if CheckValid(sTxt) then //上传数据
|
||||
begin
|
||||
LotNoRecord:=TLotNoRecord.Create('-1'); //初始化记录
|
||||
LotNoRecord.P_LOT:=ksoap.P_Lot;
|
||||
LotNoRecord.P_LOT_TYPE:='正常板';
|
||||
LotNoRecord.P_Enable:='Y';
|
||||
LotNoRecord.P_ID:=0;
|
||||
LotNoRecord.P_ORG_CODE:=ksoap.P_ORG_CODE; //廠區
|
||||
LotNoRecord.P_NUM:=ksoap.P_WORK_NUM; //工號
|
||||
LotNoRecord.P_PC:=ksoap.P_PC; //製程
|
||||
LotNoRecord.P_LINE:=ksoap.P_LINE; //線別
|
||||
LotNoRecord.P_LINE_NUM:=ksoap.P_LINE_NUM; //線別編號
|
||||
|
||||
LotNoRecord.P_LINE_SPEED:=StrToFloat(Edit_Speed.Text); //傳動速度
|
||||
LotNoRecord.P_ELE_CUR_DENSITY:=StrToFloat(Edit_Pressure.Text); //壓膜壓力
|
||||
LotNoRecord.P_DIE_NAME:=Edit_DRY_FILM_TYPE.Text;//幹膜型號
|
||||
LotNoRecord.P_CREATION_DATE:=FormatDateTime('yyyymmdd hh:mm:ss',Now);
|
||||
|
||||
sError:='';
|
||||
vP_ID:=Ksoap.Thread_cf_traceability_seq_f(ksoap.P_ORG_CODE,sError);
|
||||
LotNoRecord.P_ID:=vP_ID;
|
||||
if vP_ID=0 then
|
||||
BEGIN
|
||||
dm.InsertMain(vId,LotNoRecord,false);
|
||||
Result:=true;
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
//直接调用API,出错再保存本地
|
||||
if not Ksoap.Thread_Insert_CM_WIP_PROCESS_LINE_HISTORY_NEW(LotNoRecord,sError) then //提交主表不成功
|
||||
begin
|
||||
if sError='連接數據庫服務器失败' then
|
||||
begin
|
||||
dm.InsertMain(vId,LotNoRecord,false);
|
||||
Result:=true;
|
||||
end
|
||||
else
|
||||
ShowError(sError);
|
||||
end
|
||||
else
|
||||
begin
|
||||
dm.InsertMain(vId,LotNoRecord,false);
|
||||
dm.UpdateMainId(vId,vP_ID.ToString,True);
|
||||
Result:=true;
|
||||
end;
|
||||
END;
|
||||
|
||||
//打开窗体
|
||||
if Result then
|
||||
begin
|
||||
frmInkPrinterConent:=TfrmInkPrinterConent.Create(nil);
|
||||
try
|
||||
frmInkPrinterConent.LotNoRecord:=LotNoRecord;
|
||||
frmInkPrinterConent.vP_ID:=LotNoRecord.P_ID;
|
||||
frmInkPrinterConent.vId:=vId;
|
||||
frmInkPrinterConent.Rectangle001.Visible:=false;
|
||||
frmInkPrinterConent.ShowModal;
|
||||
finally
|
||||
frmInkPrinterConent.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user