D7gmYongjin/纱线加弹管理(YarnTexturing.dll)/U_JTSJY220318.pas
DESKTOP-E401PHE\Administrator 8452f471f5 新建3-04
2026-03-04 09:51:44 +08:00

615 lines
15 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_JTSJY220318;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, DB, ADODB, Buttons,
cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
DBClient, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
type
TfrmJTSJY220318 = class(TForm)
CPInfo: TRichEdit;
ADOQueryTemp: TADOQuery;
Panel3: TPanel;
Panel4: TPanel;
Panel1: TPanel;
Label2: TLabel;
Panel2: TPanel;
Button2: TButton;
SQty: TEdit;
Label4: TLabel;
Button3: TButton;
DQty: TEdit;
Panel8: TPanel;
Panel9: TPanel;
Label1: TLabel;
ZGH: TEdit;
Label3: TLabel;
ZGL: TEdit;
Label5: TLabel;
Label7: TLabel;
ZGQty: TEdit;
Label9: TLabel;
Panel5: TPanel;
BZX: TEdit;
BZB: TEdit;
Label6: TLabel;
Label8: TLabel;
Label10: TLabel;
Panel6: TPanel;
btnSampleSel: TButton;
Button1: TButton;
Panel10: TPanel;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
v3Column1: TcxGridDBColumn;
v3Column2: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
Panel7: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
v3Column4: TcxGridDBColumn;
Panel11: TPanel;
Label11: TLabel;
Label12: TLabel;
SJZL: TEdit;
ADOCmd: TADOQuery;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
Button4: TButton;
procedure FormDestroy(Sender: TObject);
procedure btnSampleSelClick(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
procedure ZGHClick(Sender: TObject);
procedure ZGLClick(Sender: TObject);
procedure BZXClick(Sender: TObject);
procedure BZBClick(Sender: TObject);
procedure ZGQtyClick(Sender: TObject);
procedure SQtyClick(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
ZGKS,SJKS,ZGZL,ZXZL,FactoryName,Y_CodeName ,Y_Spec,BatchNo,FFFMJID:String;
function SaveData(DataType:String): Boolean;
procedure InitGrid();
procedure InitJP(FName:string);
{ Private declarations }
public
{ Public declarations }
end;
var
frmJTSJY220318: TfrmJTSJY220318;
implementation
uses
U_DataLink, U_RTFun,U_CPSel,U_iniParam,U_SCPerson;
{$R *.dfm}
procedure TfrmJTSJY220318.FormDestroy(Sender: TObject);
begin
frmJTSJY220318:=nil;
end;
procedure TfrmJTSJY220318.btnSampleSelClick(Sender: TObject);
begin
try
frmCPSel:=TfrmCPSel.Create(Self);
with frmCPSel do
begin
if ShowModal=1 then
begin
CPInfo.Hint:=FHMainId;
end;
end;
finally
frmCPSel.Close;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YT_Plan_Main where Mainid='''+Trim(CPInfo.Hint)+'''');
Open;
end;
with ADOQueryTemp do
begin
FactoryName:=Trim(fieldbyname('FactoryName').AsString);
Y_CodeName:=Trim(fieldbyname('Y_CodeName').AsString);
Y_Spec:=Trim(fieldbyname('Y_Spec').AsString);
BatchNo:=Trim(fieldbyname('BatchNo').AsString);
ZGKS:=Trim(fieldbyname('ZGKS').AsString);
SJKS:=Trim(fieldbyname('SJKS').AsString);
ZGZL:=Trim(fieldbyname('ZGZL').AsString);
ZXZL:=Trim(fieldbyname('ZXZL').AsString);
end;
ADOQueryTemp.Close;
CPInfo.Text:= ' '+ #13
+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+Trim(FactoryName) + #13+ #13
+'Ʒ<><C6B7><EFBFBD><EFBFBD>'+Trim(Y_CodeName) + #13 + #13
+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+Trim(Y_Spec) + #13 + #13
+'<27><><EFBFBD>ţ<EFBFBD>'+Trim(BatchNo)+ #13 + #13
+<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+Trim(ZGZL)+ #13 + #13
+<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+Trim(ZXZL)+ #13 + #13
+<>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD>'+Trim(ZGKS)+ #13 + #13
+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+Trim(SJKS);
if Trim(BZX.Text)<>'' then
begin
ZGQty.Text:=ZGKS;
end;
if Trim(BZB.Text)<>'' then
begin
ZGQty.Text:=SJKS;
end;
end;
procedure TfrmJTSJY220318.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmJTSJY220318.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmJTSJY220318.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TfrmJTSJY220318.ZGHClick(Sender: TObject);
begin
if Trim(ZGH.Text)='' then
begin
ZGH.Text:='<27><>';
ZGL.Text:='';
end else
begin
ZGL.Text:='<27><>';
ZGH.Text:='';
end;
end;
procedure TfrmJTSJY220318.ZGLClick(Sender: TObject);
begin
if Trim(ZGL.Text)='' then
begin
ZGL.Text:='<27><>';
ZGH.Text:='';
end else
begin
ZGH.Text:='<27><>';
ZGL.Text:='';
end;
end;
procedure TfrmJTSJY220318.BZXClick(Sender: TObject);
begin
if Trim(BZX.Text)='' then
begin
BZX.Text:='<27><>';
BZB.Text:='';
DQty.Text:='35';
ZGQty.Text:=ZGKS;
SJZL.Text:='';
SJZL.ReadOnly:=True;
end else
begin
BZB.Text:='<27><>';
DQty.Text:='985';
BZX.Text:='';
ZGQty.Text:=SJKS;
SJZL.ReadOnly:=False;
end;
end;
procedure TfrmJTSJY220318.BZBClick(Sender: TObject);
begin
if Trim(BZB.Text)='' then
begin
BZB.Text:='<27><>';
BZX.Text:='';
DQty.Text:='985';
ZGQty.Text:=SJKS;
SJZL.ReadOnly:=False;
end else
begin
BZX.Text:='<27><>';
DQty.Text:='35';
BZB.Text:='';
ZGQty.Text:=ZGKS;
SJZL.ReadOnly:=True;
SJZL.Text:='';
end;
end;
procedure TfrmJTSJY220318.ZGQtyClick(Sender: TObject);
var
i:Integer;
begin
{with Panel7 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
end;
end;
end; }
end;
procedure TfrmJTSJY220318.SQtyClick(Sender: TObject);
var
i:Integer;
begin
with Panel7 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
end;
end;
end;
end;
procedure TfrmJTSJY220318.InitJP(FName:string);
var
i:Integer;
begin
with Panel7 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(FName);
end;
end;
end;
end;
procedure TfrmJTSJY220318.SpeedButton1Click(Sender: TObject);
var
fsj: string;
begin
fsj := Trim(TSpeedButton(Sender).Hint);
if Trim(fsj)='SJZL' then
begin
if BZX.Text<>'' then Exit;
end;
if Trim(fsj) = '' then
Exit;
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := fsj + Trim(TSpeedButton(Sender).Caption);
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
end;
procedure TfrmJTSJY220318.SpeedButton12Click(Sender: TObject);
var
fsj: string;
begin
if Trim(TSpeedButton(Sender).Hint)='SJZL' then
begin
if BZX.Text<>'' then Exit;
end;
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
if Trim(fsj) = '' then
Exit;
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := Copy(fsj, 1, Length(fsj) - 1);
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
end;
function TfrmJTSJY220318.SaveData(DataType:String): Boolean;
var
maxno,FMJID: string;
begin
FMJID:='';
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if GetLSNo(ADOCmd, maxno, 'T' + Trim(SCXFlag), 'JY_YT', 4, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from JY_YT where JYId=''' + Trim(FMJID) + '''');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('JYID').Value := Trim(maxno);
FieldByName('FactoryName').value :=FactoryName;
FieldByName('Y_CodeName').value := Trim(Y_CodeName);
FieldByName('Y_Spec').value := Trim(Y_Spec);
FieldByName('BatchNo').value := Trim(BatchNo);
if Trim(ZGH.Text)<>'' then
begin
FieldByName('ZGColor').value :='<27><>ɫ';
end;
if Trim(ZGL.Text)<>'' then
begin
FieldByName('ZGColor').value :='<27><>ɫ';
end;
FieldByName('CRType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('Valie').Value := 'Y';
FieldByName('ZGZL').Value := StrToFloatdef(trim(ZGZL), 0);
FieldByName('ZGKS').Value := StrToFloatdef(trim(ZGQty.Text), 0);
if Trim(BZB.Text)<>'' then
begin
FieldByName('SJZL').Value := StrToFloatdef(trim(SJZL.Text), 0);
FieldByName('BZType').Value :='<27><>';
FieldByName('SJNO').Value :=Trim(SJZL.Hint);
end else
begin
FieldByName('SJZL').Value :=null;
FieldByName('SJNO').Value :=Null;
end;
if Trim(BZX.Text)<>'' then
begin
FieldByName('ZXZL').Value := StrToFloatdef(trim(ZXZL), 0);
FieldByName('BZType').Value :='<27><>';
end else
begin
FieldByName('ZXZL').Value :=null;
end;
if Trim(DataType)='<27><><EFBFBD><EFBFBD>' then
begin
FieldByName('JYGW').Value := StrToFloatdef(trim(DQty.Text), 0);
end;
if Trim(DataType)='<27><><EFBFBD><EFBFBD>' then
begin
FieldByName('JYGW').Value := StrToFloatdef(trim(SQty.Text), 0);
end;
if Trim(FMJID) = '' then
begin
FieldByName('Filler').Value := Trim(DName);
FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
FieldByName('FillCode').Value := Trim(DCode);
end
else
begin
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditCode').Value := Trim(DCode);
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
end;
FieldByName('JTType').Value := Trim(SCXFlag);
Post;
end;
FMJID := trim(maxno);
FFFMJID := FMJID;
with ClientDataSet1 do
begin
Append;
FieldByName('JYID').Value:=Trim(maxno);
FieldByName('ZGKS').Value:=trim(ZGQty.Text);
if Trim(ZGH.Text)<>'' then
begin
FieldByName('ZGColor').value :='<27><>ɫ';
end;
if Trim(ZGL.Text)<>'' then
begin
FieldByName('ZGColor').value :='<27><>ɫ';
end;
if Trim(DataType)='<27><><EFBFBD><EFBFBD>' then
begin
FieldByName('JYGW').Value :=trim(DQty.Text);
end;
if Trim(DataType)='<27><><EFBFBD><EFBFBD>' then
begin
FieldByName('JYGW').Value := trim(SQty.Text);
end;
Post;
end;
////////////////////////<2F><><EFBFBD>ء<EFBFBD><D8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BCB0><EFBFBD><EFBFBD>/////////////////////////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_JY_Insert_JTS @JYID=''' + trim(FMJID) + '''');
execsql;
end;
////////////////////////<2F><><EFBFBD>ء<EFBFBD><D8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BCB0><EFBFBD><EFBFBD>/////////////////////////////////////
ADOCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end;
end;
procedure TfrmJTSJY220318.Button2Click(Sender: TObject);
var
FReal:Double;
begin
if Trim(CPInfo.Text)='' then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1>Ʒ<EFBFBD><C6B7>!','<27><>ʾ',0);
exit;
end;
if Trim(Trim(ZGH.Text)+Trim(ZGL.Text))='' then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ɫ!','<27><>ʾ',0);
exit;
end;
if Trim(Trim(BZX.Text)+Trim(BZB.Text))='' then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>ʽ!','<27><>ʾ',0);
exit;
end;
if Trim(ZGQty.Text)='' then
begin
InitJP('ZGQty');
ZGQty.SetFocus;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if TryStrToFloat(ZGQty.Text,FReal)=False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
if Trim(BZB.Text)<>'' then
begin
if Trim(SJZL.Text)='' then
begin
//InitJP('SJZL');
//SJZL.SetFocus;
Application.MessageBox('˿<><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if TryStrToFloat(SJZL.Text,FReal)=False then
begin
Application.MessageBox('˿<><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
end;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>!','',32+4)<>IDYES then Exit;
if SaveData('<27><><EFBFBD><EFBFBD>') then
begin
SJZL.Text:='';
SJZL.Hint:='';
end;
end;
procedure TfrmJTSJY220318.Button3Click(Sender: TObject);
var
FReal:Double;
begin
if Trim(CPInfo.Text)='' then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1>Ʒ<EFBFBD><C6B7>!','<27><>ʾ',0);
exit;
end;
if Trim(Trim(ZGH.Text)+Trim(ZGL.Text))='' then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ɫ!','<27><>ʾ',0);
exit;
end;
if Trim(Trim(BZX.Text)+Trim(BZB.Text))='' then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>ʽ!','<27><>ʾ',0);
exit;
end;
if Trim(ZGQty.Text)='' then
begin
InitJP('ZGQty');
ZGQty.SetFocus;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if TryStrToFloat(ZGQty.Text,FReal)=False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
if Trim(BZB.Text)<>'' then
begin
if Trim(SJZL.Text)='' then
begin
// InitJP('SJZL');
//SJZL.SetFocus;
Application.MessageBox('˿<><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if TryStrToFloat(SJZL.Text,FReal)=False then
begin
Application.MessageBox('˿<><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
end;
if Trim(SQty.Text)='' then
begin
InitJP('SQty');
SQty.SetFocus;
Application.MessageBox('<27><><EFBFBD><EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if TryStrToFloat(SQty.Text,FReal)=False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>!','',32+4)<>IDYES then Exit;
if SaveData('<27><><EFBFBD><EFBFBD>') then
begin
SJZL.Text:='';
SJZL.Hint:='';
SQty.Text:='';
//ZGQty.Text:='';
end;
end;
procedure TfrmJTSJY220318.InitGrid();
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from JY_YT where Convert(varchar(10),FillTime,120)=Convert(varchar(10),Getdate(),120)');
sql.Add(' and Filler='''+Trim(DName)+''' order by FillTime desc ');
Open;
end;
SCreateCDS20(ADOQueryTemp,ClientDataSet1);
SInitCDSData20(ADOQueryTemp,ClientDataSet1);
end;
procedure TfrmJTSJY220318.FormShow(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmJTSJY220318.Button4Click(Sender: TObject);
begin
try
frmSCPerson := TfrmSCPerson.Create(self);
with frmSCPerson do
begin
if ShowModal = 1 then
begin
Self.SJZL.Text :=FSJZL;
Self.SJZL.hint := FSJNO;
end;
end;
finally
frmSCPerson.close;
end;
end;
end.