unit uFrameM6; 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 TFrameM6 = 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; Text7: TText; Rectangle4: TRectangle; Text8: TText; Edit3: TEdit; Text5: TText; Rectangle5: TRectangle; Rectangle6: TRectangle; Glyph5: TGlyph; Text9: TText; Text10: TText; Edit4: TEdit; Rectangle7: TRectangle; Glyph6: TGlyph; Text11: TText; Edit5: TEdit; Text12: TText; Rectangle8: TRectangle; Glyph7: TGlyph; Text13: TText; Text14: TText; Edit6: TEdit; Text15: TText; Rectangle9: TRectangle; Rectangle10: TRectangle; Glyph8: TGlyph; Text16: TText; Text17: TText; Edit7: TEdit; Rectangle12: TRectangle; Glyph11: TGlyph; Text21: TText; Text22: TText; Edit9: TEdit; Text23: TText; Rectangle13: TRectangle; Rectangle14: TRectangle; Text24: TText; procedure Edit6Click(Sender: TObject); 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, uPucFun; { 285090 D3007585AG } function TFrameM6.CheckValid(var sTxt:string):boolean; //返回面次数据 var aa:Extended; begin Result:=false; // if not GetRadioTxt(sTxt) then //没有选择,提示出错信息 // begin // ErrorLayout(GridLayout,TxtError,'请选择TOP面/BOT面'); // Exit; // end; if Trim(Edit6.Text)='' then begin Error(Edit6,TxtError,'值不能為空');Exit;end; if Trim(Edit5.Text)='' then begin Error(Edit5,TxtError,'值不能為空');Exit;end; if Trim(Edit4.Text)='' then begin Error(Edit4,TxtError,'值不能為空');Exit;end; if Trim(Edit2.Text)='' then begin Error(Edit2,TxtError,'值不能為空');Exit;end; if Trim(Edit9.Text)='' then begin Error(Edit9,TxtError,'值不能為空');Exit;end; if Trim(Edit1.Text)='' then begin Error(Edit1,TxtError,'值不能為空');Exit;end; if Trim(Edit3.Text)='' then begin Error(Edit3,TxtError,'OPEN檢查判定阻抗值輸入不能為空');Exit;end; if Trim(Edit_KuangJi.Text)='' then begin Error(Edit_KuangJi,TxtError,'OPEN檢查判定阻抗值輸入不能為空');Exit;end; // if Trim(Edit_ChengShi.Text)='' then begin Error(Edit_ChengShi,TxtError,'uSHORT检查判定阻抗值輸入不能為空');Exit;end; if Trim(Edit7.Text)='' then begin Error(Edit7,TxtError,'uSHORT检查判定阻抗值輸入不能為空');Exit;end; if not TryStrToFloat(Edit6.Text,aa) then begin Error(Edit6,TxtError,'類型錯誤,請重新輸入。');Exit;end; if not TryStrToFloat(Edit5.Text,aa) then begin Error(Edit5,TxtError,'類型錯誤,請重新輸入。');Exit;end; if not TryStrToFloat(Edit4.Text,aa) then begin Error(Edit4,TxtError,'類型錯誤,請重新輸入。');Exit;end; if not TryStrToFloat(Edit2.Text,aa) then begin Error(Edit2,TxtError,'類型錯誤,請重新輸入。');Exit;end; if not TryStrToFloat(Edit9.Text,aa) then begin Error(Edit9,TxtError,'類型錯誤,請重新輸入。');Exit;end; if not TryStrToFloat(Edit1.Text,aa) then begin Error(Edit1,TxtError,'類型錯誤,請重新輸入。');Exit;end; if not TryStrToFloat(Edit3.Text,aa) then begin Error(Edit3,TxtError,'OPEN檢查判定阻抗值輸入類型錯誤,請重新輸入。');Exit;end; if not TryStrToFloat(Edit_KuangJi.Text,aa) then begin Error(Edit_KuangJi,TxtError,'OPEN檢查判定阻抗值輸入類型錯誤,請重新輸入。');Exit;end; // if not TryStrToFloat(Edit_ChengShi.Text,aa) then begin Error(Edit_ChengShi,TxtError,'uSHORT检查判定阻抗值輸入類型錯誤,請重新輸入。');Exit;end; if not TryStrToFloat(Edit7.Text,aa) then begin Error(Edit7,TxtError,'uSHORT检查判定阻抗值輸入類型錯誤,請重新輸入。');Exit;end; Result:=true; if Result then Error(Edit6,TxtError,''); end; procedure TFrameM6.FillDefaultValue(sPartnumValue,sDefaultTxt:string); //取默认值 //var // a: TStrings; begin with TStringList.Create do try // a:= TStringList.Create; Delimiter:= ','; DelimitedText:= sDefaultTxt; if Count>=4 then Edit6.Text:=Strings[4]; if Count>=3 then Edit5.Text:=Strings[3]; if Count>=0 then Edit4.Text:=Strings[0]; if Count>=21 then Edit2.Text:=Strings[21]; if Count>=29 then Edit9.Text:=Strings[20]; if Count>=5 then Edit1.Text:=Strings[5]; if Count>=22 then Edit3.Text:=Strings[22]; if Count>=23 then Edit_KuangJi.Text:=Strings[23]; if Count>=9 then Edit_ChengShi.Text:=Strings[9]; //没要了 if Count>=2 then Edit7.Text:=Strings[2]; finally Free; end; end; function TFrameM6.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_TROLLEY_NUM:=Edit_KuangJi.Text; //框架編號 // LotNoRecord.P_BKfile:=Edit_ChengShi.Text; //程式選擇 //LEAK1检查: LotNoRecord.P_ELE_AREA1:=StrToFloat(Edit6.Text); //火花判定电压下降(V) LotNoRecord.P_ELE_CUR_DENSITY:=StrToFloat(Edit5.Text); //判定阻抗值(MΩ) LotNoRecord.P_LINE_SPEED:=StrToFloat(Edit4.Text); // 检测电压值(V) //LEAK2检查: LotNoRecord.P_PRODUCT_PRESSURE:=StrToFloat(Edit2.Text); //火花判定电压下降(V) LotNoRecord.P_COM_TEMPERATURE:=StrToFloat(Edit9.Text); // 判定阻抗值(MΩ) LotNoRecord.P_ELE_AREA2:=StrToFloat(Edit1.Text); // 检测电压值(V) //OPEN檢查: LotNoRecord.P_PREHEATING_SEC:=StrToFloat(Edit3.Text); // 判定阻抗值:Ω LotNoRecord.P_COMPRESS_SEC:=StrToFloat(Edit_KuangJi.Text); // 检查电流值(mA) //uSHORT检查: LotNoRecord.P_SLICKER_ANGLE:=StrToFloat(Edit_ChengShi.Text); // 检测电压值(V) LotNoRecord.P_DOWN_PRESSURE:=StrToFloat(Edit7.Text); // 判定阻抗值MΩ 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 // 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; end; procedure TFrameM6.Edit6Click(Sender: TObject); begin inherited; ShowTouchKeyBoard(); end; end.