unit uFrameBaseBland_lhkyj; 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.ListBox, uksoap, FMX.Controls.Presentation, FMX.Edit, FMX.Objects,uListConent,uShowInfo,uTCPDevice; type TFrameBaseBland_lhkyj = class(TFrameBase) Rectangle88: TRectangle; Option1: TRectangle; Glyph9: TGlyph; OptionLabel1: TText; Text19: TText; Edit_KuangJi: TEdit; Option2: TRectangle; Glyph2: TGlyph; OptionLabel3: TText; Text6: TText; Edit_ChengShi: TEdit; TxtError: TText; ImageList1: TImageList; Rectangle1: TRectangle; Glyph1: TGlyph; Text1: TText; Text2: TText; Edit1: TEdit; Rectangle2: TRectangle; Glyph3: TGlyph; Text3: TText; Text4: TText; Edit2: TEdit; Rectangle3: TRectangle; Glyph4: TGlyph; Text5: TText; Text7: TText; Edit3: TEdit; private { Private declarations } public procedure FillDefaultValue(sPartnumValue,sDefaultTxt:string);override; //填写默认值 function DoExec():boolean;override; //判断输入是否有效,执行插入主表,或打开窗体 function CheckValid(var sTxt:string):boolean;override; // function GetFixture_Code():string;override; //返回治具ID end; //var // Frame_Plasma: TFrame_Plasma; implementation {$R *.fmx} uses uDM, uBlandPrintConent; { 285090 D3007585AG } function TFrameBaseBland_lhkyj.CheckValid(var sTxt:string):boolean; //返回面次数据 var aa:Extended; begin Result:=false; if Trim(Edit_KuangJi.Text)='' then begin Error(Edit_KuangJi,TxtError,'壓合溫度不能為空');Exit;end; if Trim(Edit3.Text)='' then begin Error(Edit3,TxtError,'製品壓力不能為空');Exit;end; if Trim(Edit2.Text)='' then begin Error(Edit2,TxtError,'預熱時間不能為空');Exit;end; if Trim(Edit1.Text)='' then begin Error(Edit1,TxtError,'壓合時間不能為空');Exit;end; if Trim(Edit_ChengShi.Text)='' then begin Error(Edit_ChengShi,TxtError,'緩衝材型號不能為空');Exit;end; if not TryStrToFloat(Edit_KuangJi.Text,aa) then begin Error(Edit_KuangJi,TxtError,'壓合溫度類型錯誤,請重新輸入.');Exit;end; if not TryStrToFloat(Edit3.Text,aa) then begin Error(Edit3,TxtError,'製品壓力類型錯誤,請重新輸入.');Exit;end; if not TryStrToFloat(Edit2.Text,aa) then begin Error(Edit_KuangJi,TxtError,'預熱時間類型錯誤,請重新輸入.');Exit;end; if not TryStrToFloat(Edit1.Text,aa) then begin Error(Edit1,TxtError,'壓合時間類型錯誤,請重新輸入.');Exit;end; // if not TryStrToFloat(Edit_ChengShi.Text,aa) then begin Error(Edit_ChengShi,TxtError,'緩衝材型號類型錯誤,請重新輸入.');Exit;end; Result:=true; if Result then Error(Edit_KuangJi,TxtError,''); end; procedure TFrameBaseBland_lhkyj.FillDefaultValue(sPartnumValue,sDefaultTxt:string); var tmpList:TStrings; begin if sDefaultTxt='' then Exit; tmpList:=TStringList.Create; try tmpList.DelimitedText:=sDefaultTxt; if tmpList.Count>38 then begin Edit_KuangJi.Text:=tmpList.Strings[20]; //壓合溫度 Edit3.Text:=tmpList.Strings[21]; //製品壓力 Edit2.Text:=tmpList.Strings[22]; //預熱時間 Edit1.Text:=tmpList.Strings[23]; //壓合時間 Edit_ChengShi.Text:=tmpList.Strings[30]; //緩衝材型號 end; finally tmpList.Free; end; end; function TFrameBaseBland_lhkyj.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_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_COM_TEMPERATURE:=StrToFloat(Edit_KuangJi.Text); //壓合溫度(°C) LotNoRecord.P_PRODUCT_PRESSURE:=StrToFloat(Edit3.Text); //製品壓力(kg/cm2) LotNoRecord.P_PREHEATING_SEC:=StrToFloat(Edit2.Text); //預熱時間(S) LotNoRecord.P_COMPRESS_SEC:=StrToFloat(Edit1.Text); //壓合時間(Sec) LotNoRecord.P_Buffer:=(Edit_ChengShi.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; end; //打开窗体 if Result then begin if dm.Operate = 1 then begin // WorkLog.MessageInfo('frmBlandPrinterConent'); frmBlandPrinterConent:=TfrmBlandPrinterConent.Create(nil); try frmBlandPrinterConent.LotNoRecord:=LotNoRecord; //记录 frmBlandPrinterConent.vP_ID:=LotNoRecord.P_ID; //ID號,需與主檔的ID號相同 frmBlandPrinterConent.vId:=vId; //本地表记录ID // frmListConent.Text6.Text:='更改烤架編號'; frmBlandPrinterConent.ShowModal; finally frmBlandPrinterConent.Free; end; end else begin ShowInfoOK('上傳成功,正在生產中...'); //退出的时候 dm.InsertQtyTime(vId.ToString,'0',sLotNum,'-1','-1','-1','-1'); Result:=true; end; end; end; end.