Initial commit - Delphi MES client project
This commit is contained in:
@@ -0,0 +1,313 @@
|
||||
unit uFrame_yamaha;
|
||||
|
||||
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
|
||||
TFrame_yamaha = class(TFrameBase)
|
||||
ImageList1: TImageList;
|
||||
Rectangle13: TRectangle;
|
||||
Rectangle9: TRectangle;
|
||||
Rectangle12: TRectangle;
|
||||
Glyph11: TGlyph;
|
||||
Text21: TText;
|
||||
Text22: TText;
|
||||
Edit9: TEdit;
|
||||
Text23: TText;
|
||||
Rectangle2: TRectangle;
|
||||
Glyph3: TGlyph;
|
||||
Text3: TText;
|
||||
Text4: TText;
|
||||
Edit2: TEdit;
|
||||
Rectangle14: TRectangle;
|
||||
Rectangle10: TRectangle;
|
||||
Glyph8: TGlyph;
|
||||
Text16: TText;
|
||||
Text17: TText;
|
||||
Edit7: TEdit;
|
||||
Option2: TRectangle;
|
||||
Glyph2: TGlyph;
|
||||
OptionLabel3: TText;
|
||||
Text6: TText;
|
||||
Edit_ChengShi: TEdit;
|
||||
Rectangle88: TRectangle;
|
||||
Rectangle4: TRectangle;
|
||||
Option1: TRectangle;
|
||||
Glyph9: TGlyph;
|
||||
OptionLabel1: TText;
|
||||
Text19: TText;
|
||||
Edit_KuangJi: TEdit;
|
||||
Rectangle1: TRectangle;
|
||||
Glyph1: TGlyph;
|
||||
Text1: TText;
|
||||
Text2: TText;
|
||||
Edit1: TEdit;
|
||||
Text8: TText;
|
||||
Rectangle5: TRectangle;
|
||||
Rectangle7: TRectangle;
|
||||
Glyph6: TGlyph;
|
||||
Text11: TText;
|
||||
Edit5: TEdit;
|
||||
Text12: TText;
|
||||
Rectangle8: TRectangle;
|
||||
Glyph7: TGlyph;
|
||||
Text13: TText;
|
||||
Text14: TText;
|
||||
Edit6: TEdit;
|
||||
Text15: TText;
|
||||
TxtError: TText;
|
||||
Rectangle11: TRectangle;
|
||||
Rectangle15: TRectangle;
|
||||
Glyph10: TGlyph;
|
||||
Text18: TText;
|
||||
Text20: TText;
|
||||
Edit8: TEdit;
|
||||
Text25: TText;
|
||||
Rectangle16: TRectangle;
|
||||
Glyph12: TGlyph;
|
||||
Text26: TText;
|
||||
Text27: TText;
|
||||
Edit10: TEdit;
|
||||
Rectangle17: TRectangle;
|
||||
Rectangle19: TRectangle;
|
||||
Glyph14: TGlyph;
|
||||
Text31: TText;
|
||||
Text32: TText;
|
||||
Edit12: TEdit;
|
||||
Rectangle20: TRectangle;
|
||||
Rectangle21: TRectangle;
|
||||
Glyph15: TGlyph;
|
||||
Text33: TText;
|
||||
Text34: TText;
|
||||
Edit13: TEdit;
|
||||
Rectangle22: TRectangle;
|
||||
Glyph16: TGlyph;
|
||||
Text36: TText;
|
||||
Text37: TText;
|
||||
Edit14: TEdit;
|
||||
Rectangle23: TRectangle;
|
||||
Rectangle24: TRectangle;
|
||||
Glyph17: TGlyph;
|
||||
Text38: TText;
|
||||
Text39: TText;
|
||||
Edit15: TEdit;
|
||||
Rectangle25: TRectangle;
|
||||
Glyph18: TGlyph;
|
||||
Text41: TText;
|
||||
Text42: TText;
|
||||
Edit16: TEdit;
|
||||
Text5: TText;
|
||||
Rectangle3: TRectangle;
|
||||
Glyph4: TGlyph;
|
||||
Text7: TText;
|
||||
Text9: TText;
|
||||
Edit3: TEdit;
|
||||
Rectangle6: TRectangle;
|
||||
Glyph5: TGlyph;
|
||||
Text10: TText;
|
||||
Text24: TText;
|
||||
Edit4: 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, uBla_yamaha_Conent, uSafeLog;
|
||||
{
|
||||
285090
|
||||
D3007585AG
|
||||
}
|
||||
|
||||
function TFrame_yamaha.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(Edit16.Text)='' then begin Error(Edit16,TxtError,'檢查判定值上限不能為空');Exit;end;
|
||||
if Trim(Edit15.Text)='' then begin Error(Edit15,TxtError,'模板测试结果不能為空');Exit;end;
|
||||
if Trim(Edit10.Text)='' then begin Error(Edit10,TxtError,'絕緣1檢查電壓不能為空');Exit;end;
|
||||
if Trim(Edit8.Text)='' then begin Error(Edit8,TxtError,'絕緣1檢查判定值不能為空');Exit;end;
|
||||
if Trim(Edit1.Text)='' then begin Error(Edit1,TxtError,'絕緣2檢查電壓不能為空');Exit;end;
|
||||
if Trim(Edit_KuangJi.Text)='' then begin Error(Edit_KuangJi,TxtError,'絕緣2檢查判定值不能為空');Exit;end;
|
||||
if Trim(Edit2.Text)='' then begin Error(Edit2,TxtError,'絕緣3電壓不能為空');Exit;end;
|
||||
if Trim(Edit9.Text)='' then begin Error(Edit9,TxtError,'絕緣3檢查判定值不能為空');Exit;end;
|
||||
if Trim(Edit14.Text)='' then begin Error(Edit14,TxtError,'火花設定電流阙值不能為空');Exit;end;
|
||||
if Trim(Edit13.Text)='' then begin Error(Edit13,TxtError,'火花設定保持時間不能為空');Exit;end;
|
||||
if Trim(Edit12.Text)='' then begin Error(Edit12,TxtError,'絕緣3-2nd檢查判定值不能為空');Exit;end;
|
||||
if Trim(Edit_ChengShi.Text)='' then begin Error(Edit_ChengShi,TxtError,'模具料號名稱不能為空');Exit;end;
|
||||
// if Trim(Edit7.Text)='' then begin Error(Edit7,TxtError,'絕緣4檢查判定值不能為空');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(Edit16.Text,aa) then begin Error(Edit16,TxtError,'檢查判定值上限類型錯誤,請重新輸入.');Exit;end;
|
||||
// if not TryStrToFloat(Edit15.Text,aa) then begin Error(Edit15,TxtError,'檢查判定值下限類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit10.Text,aa) then begin Error(Edit10,TxtError,'絕緣1檢查電壓類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit8.Text,aa) then begin Error(Edit8,TxtError,'絕緣1檢查判定值類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit1.Text,aa) then begin Error(Edit1,TxtError,'絕緣2檢查電壓類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit_KuangJi.Text,aa) then begin Error(Edit_KuangJi,TxtError,'絕緣2檢查判定值類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit2.Text,aa) then begin Error(Edit2,TxtError,'絕緣3電壓類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit9.Text,aa) then begin Error(Edit9,TxtError,'絕緣3檢查判定值類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit14.Text,aa) then begin Error(Edit14,TxtError,'火花設定電流阙值類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit13.Text,aa) then begin Error(Edit13,TxtError,'火花設定保持時間號類型錯誤,請重新輸入.');Exit;end;
|
||||
if not TryStrToFloat(Edit12.Text,aa) then begin Error(Edit12,TxtError,'絕緣3-2nd檢查判定值類型錯誤,請重新輸入.');Exit;end;
|
||||
// if not TryStrToFloat(Edit_ChengShi.Text,aa) then begin Error(Edit_ChengShi,TxtError,'絕緣4檢查電壓類型錯誤,請重新輸入.');Exit;end;
|
||||
// if not TryStrToFloat(Edit7.Text,aa) then begin Error(Edit7,TxtError,'絕緣4檢查判定值類型錯誤,請重新輸入.');Exit;end;
|
||||
if (Edit4.Text<>'') and (StrToInt(Edit4.Text)>1000000) then
|
||||
begin
|
||||
Error(Edit4,TxtError,'模具最大使用壽命到');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
Result:=true;
|
||||
if Result then Error(Edit7,TxtError,'');
|
||||
end;
|
||||
|
||||
procedure TFrame_yamaha.FillDefaultValue(sPartnumValue,sDefaultTxt:string);
|
||||
begin
|
||||
with TStringList.Create do
|
||||
try
|
||||
// a:= TStringList.Create;
|
||||
Delimiter:= ',';
|
||||
DelimitedText:= sDefaultTxt;
|
||||
|
||||
if Count>0 then Edit6.Text:=Strings[0];
|
||||
if Count>3 then Edit5.Text:=Strings[3];
|
||||
if Count>4 then Edit16.Text:=Strings[4];
|
||||
if Count>24 then Edit15.Text:=Strings[24];
|
||||
if Count>20 then Edit10.Text:=Strings[20];
|
||||
if Count>21 then Edit8.Text:=Strings[21];
|
||||
if Count>22 then Edit1.Text:=Strings[22];
|
||||
if Count>23 then Edit_KuangJi.Text:=Strings[23];
|
||||
if Count>31 then Edit2.Text:=Strings[31];
|
||||
if Count>33 then Edit9.Text:=Strings[33];
|
||||
if Count>34 then Edit14.Text:=Strings[34];
|
||||
if Count>1 then Edit13.Text:=Strings[1];
|
||||
if Count>2 then Edit12.Text:=Strings[2];
|
||||
if Count>32 then Edit_ChengShi.Text:=Strings[32];
|
||||
// if Count>10 then Edit7.Text:=Strings[10];
|
||||
|
||||
if (Strings[10]<>'') and (StrToInt(Strings[10])>950000) then
|
||||
Edit4.TextSettings.FontColor:= TAlphaColorRec.Red;
|
||||
|
||||
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFrame_yamaha.DoExec():boolean;
|
||||
var
|
||||
LotNoRecord:TLotNoRecord;
|
||||
vId:Integer;
|
||||
sTxt:string;
|
||||
sError:string;
|
||||
vP_ID:Double;
|
||||
begin
|
||||
Result:=False;
|
||||
WorkLog.MessageInfo('yamaha.DoExec点击');
|
||||
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; //程式選擇
|
||||
|
||||
LotNoRecord.P_LINE_SPEED:=StrToFloat(Edit6.Text);
|
||||
LotNoRecord.P_ELE_CUR_DENSITY:=StrToFloat(Edit5.Text);
|
||||
LotNoRecord.P_ELE_AREA1:=StrToFloat(Edit16.Text);
|
||||
LotNoRecord.P_BKfile:=(Edit15.Text); //模板测试结果: P_ELE_AREA2
|
||||
LotNoRecord.P_COM_TEMPERATURE:=StrToFloat(Edit10.Text);
|
||||
LotNoRecord.P_PRODUCT_PRESSURE:=StrToFloat(Edit8.Text);
|
||||
LotNoRecord.P_PREHEATING_SEC:=StrToFloat(Edit1.Text);
|
||||
LotNoRecord.P_COMPRESS_SEC:=StrToFloat(Edit_KuangJi.Text);
|
||||
LotNoRecord.P_STAMPING_DEPTH:=StrToFloat(Edit2.Text);
|
||||
LotNoRecord.P_DIE_USE_NUM:=StrToFloat(Edit9.Text);
|
||||
LotNoRecord.P_NUM_PER_ARR:=StrToFloat(Edit14.Text);
|
||||
LotNoRecord.P_UPPER_PRESSURE:=StrToFloat(Edit13.Text);
|
||||
LotNoRecord.P_DOWN_PRESSURE:=StrToFloat(Edit12.Text);
|
||||
LotNoRecord.P_DIE_NAME:=Edit_ChengShi.Text; //模具料號名稱 P_SLICKER_ANGLE
|
||||
// LotNoRecord.P_INK_KNIFE_ANGLE:=StrToFloat(Edit7.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
|
||||
// WorkLog.MessageInfo('frmBlandPrinterConent');
|
||||
fBla_yamaha_Conent:=TfBla_yamaha_Conent.Create(nil);
|
||||
try
|
||||
fBla_yamaha_Conent.LotNoRecord:=LotNoRecord; //记录
|
||||
fBla_yamaha_Conent.vP_ID:=LotNoRecord.P_ID; //ID號,需與主檔的ID號相同
|
||||
fBla_yamaha_Conent.vId:=vId; //本地表记录ID
|
||||
// fBla_yamaha_Conent.Text6.Text:='更改烤架編號';
|
||||
fBla_yamaha_Conent.ShowModal;
|
||||
finally
|
||||
fBla_yamaha_Conent.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user