Files
dyp/pas/uFrame_bghBlank.pas
T
2026-05-07 20:25:34 +08:00

180 lines
6.2 KiB
ObjectPascal

unit uFrame_bghBlank;
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,uShowInfo,uKsoap,uPucFun, FMX.Controls.Presentation, FMX.Edit,
FMX.Objects, FMX.ImgList, System.ImageList;
type
TFrame_bghBlank = class(TFrameBase)
ImageList1: TImageList;
Rectangle88: TRectangle;
Option1: TRectangle;
Glyph9: TGlyph;
OptionLabel1: TText;
Text19: TText;
Edit_KuangJi: TEdit;
Option2: TRectangle;
Glyph2: TGlyph;
OptionLabel3: TText;
Text6: TText;
Edit_ChengShi: TEdit;
Rectangle1: TRectangle;
Glyph1: TGlyph;
Text1: TText;
Text2: TText;
Edit_Banhou: TEdit;
Rectangle2: TRectangle;
Glyph3: TGlyph;
Text3: TText;
Text4: TText;
Edit2: TEdit;
Rectangle3: TRectangle;
Glyph4: TGlyph;
Text5: TText;
Text7: TText;
Edit_Leise: TEdit;
TxtError: TText;
private
function CheckValid(var sTxt: string): boolean;
procedure FillDefaultValue(sPartnumValue, sDefaultTxt: string);
{ Private declarations }
public
function DoExec():boolean;override;
end;
var
Frame_bghBlank: TFrame_bghBlank;
implementation
{$R *.fmx}
uses uDM, uBland_bghConent;
function TFrame_bghBlank.CheckValid(var sTxt:string):boolean; //返回面次数据
var
aa:Extended;
begin
Result:=false;
if (Trim(Edit_KuangJi.Text)='') or (length(Edit_KuangJi.Text)<3) then begin Error(Edit_KuangJi,TxtError,'烤架編號不能為空');Exit;end;
// if Trim(Edit_Leise.Text)='' then begin Error(Edit_Leise,TxtError,'傳動速度不能為空');Exit;end;
// if Trim(Edit_Banhou.Text)='' then begin Error(Edit_Banhou,TxtError,'顯影槽噴壓不能為空');Exit;end;
// if Trim(Edit2.Text)='' then begin Error(Edit2,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(Edit_Leise.Text,aa) then begin Error(Edit_Leise,TxtError,'傳動速度類型錯誤,請重新輸入.');Exit;end;
// if not TryStrToFloat(Edit_Banhou.Text,aa) then begin Error(Edit_Banhou,TxtError,'顯影槽噴壓類型錯誤,請重新輸入.');Exit;end;
// if not TryStrToFloat(Edit2.Text,aa) then begin Error(Edit2,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_Leise,TxtError,'');
end;
procedure TFrame_bghBlank.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[38]; //烤架編號
// Edit_Leise.Text:=tmpList.Strings[30]; //傳動速度
// Edit_Banhou.Text:=tmpList.Strings[38]; //顯影槽噴壓
// Edit2.Text:=tmpList.Strings[30]; //全線水洗槽上噴壓
// Edit_Leise.Text:=tmpList.Strings[38]; //全線水洗槽下噴壓
end;
finally
tmpList.Free;
end;
end;
function TFrame_bghBlank.DoExec():boolean;
var
LotNoRecord:TLotNoRecord;
vId:Integer;
sTxt:string;
sError:string;
vP_ID:Double;
begin
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_TROLLEY_NUM:=Edit_KuangJi.Text; //烤架編號
// LotNoRecord.P_LINE_SPEED:=StrToFloat(Edit_Leise.Text); //傳動速度(m/min)
// LotNoRecord.P_DEVELOP_PRESSURE:=StrToFloat(Edit_Banhou.Text); //顯影槽噴壓(Mpa)
// LotNoRecord.P_UPPER_PRESSURE:=StrToFloat(Edit2.Text); //全線水洗槽上噴壓(Mpa)
// LotNoRecord.P_DOWN_PRESSURE:=StrToFloat(Edit_ChengShi.Text); //全線水洗槽下噴壓(Mpa)
LotNoRecord.P_TROLLEY_FLAG:= 'Y'; //给下一步带出的数据栏位要传Y
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,true);
ShowInfoOK('連接數據庫服務器失敗數據暫存本地,正在生產中...');
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
frmBgh_CodeConent:=TfrmBgh_CodeConent.Create(nil);
try
frmBgh_CodeConent.LotNoRecord:=LotNoRecord;
frmBgh_CodeConent.vP_ID:=LotNoRecord.P_ID;
frmBgh_CodeConent.vId:=vId;
frmBgh_CodeConent.Text6.Text:='更改烤架編號';
frmBgh_CodeConent.ShowModal;
finally
frmBgh_CodeConent.Free;
end;
end;
end;
end;
end.