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

919 lines
23 KiB
ObjectPascal
Raw Permalink 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_JTSJY220725;
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, RM_Dataset,
RM_System, RM_Common, RM_Class, RM_GridReport, IniFiles, cxLookAndFeels,
cxLookAndFeelPainters, cxNavigator;
type
TfrmJTSJY220725 = class(TForm)
CPInfo: TRichEdit;
ADOQueryTemp: TADOQuery;
Panel3: TPanel;
Panel4: TPanel;
Panel2: TPanel;
SQty: TEdit;
Label4: TLabel;
Button3: TButton;
Panel8: TPanel;
Panel9: TPanel;
Label1: TLabel;
ZGH: TEdit;
ZGHLab: TLabel;
ZGL: TEdit;
ZGLLab: 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;
ADOCmd: TADOQuery;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
ZGFH: TEdit;
ZGFHLab1: TLabel;
ZGFHLab2: TLabel;
v3Column3: TcxGridDBColumn;
RM2: TRMGridReport;
RMDB_Main: TRMDBDataSet;
ADOQueryPrint: TADOQuery;
Panel1: TPanel;
Label14: TLabel;
ComboBox1: TComboBox;
Edit13: TEdit;
Label15: TLabel;
Button2: TButton;
Panel5: TPanel;
Label2: TLabel;
MachNO: TComboBox;
Tv3Column1: TcxGridDBColumn;
Label7: TLabel;
Label9: TLabel;
ZGQty: TEdit;
Label3: TLabel;
Y_Type: TComboBox;
ZGLH: TEdit;
ZGLH2: TLabel;
ZGLH1: TLabel;
ZGHuangLab: TLabel;
ZGHuangBLab2: TLabel;
ZGHuangBLab1: TLabel;
ZGHuang: TEdit;
ZGHuangB: TEdit;
JTNote: TEdit;
Label5: TLabel;
ZGRYS: TEdit;
Label6: TLabel;
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 SQtyClick(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Edit13Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ZGQtyClick(Sender: TObject);
procedure cxGridDBColumn1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
private
ZGKS, SJKS, ZGZL, ZXZL, FactoryName, Y_CodeName, Y_Spec, Y_CodeNameCP, BatchNo, FFFMJID, DZCDYDllName, FTSStr: string;
FCK, OKInt: Integer;
function SaveData(DataType: string): Boolean;
procedure InitGrid();
procedure InitJP(FName: string);
procedure PrtData(FMJID: string);
procedure OpenCom(DllName: string);
procedure CloseCom(DllName: string);
procedure On1201(var Message: Tmessage); message 1201;
procedure TSInfo(TSStr: string);
{ Private declarations }
public
{ Public declarations }
end;
var
frmJTSJY220725: TfrmJTSJY220725;
newh, newh1: hwnd;
IniFile: TIniFile;
implementation
uses
U_DataLink, U_RTFun, U_Fun, U_CPSel, U_iniParam, U_SCPerson, U_TSOKNO;
{$R *.dfm}
procedure TfrmJTSJY220725.FormDestroy(Sender: TObject);
begin
frmJTSJY220725 := nil;
end;
procedure TfrmJTSJY220725.On1201(var Message: Tmessage);
var
i1, i2: integer;
FMJMaoZ: Double;
begin
i1 := Message.WParam;
i2 := Message.LParam;
FMJMaoZ := RoundFloat(i1 * i2 / 100000, 2);
SQty.Text := floattostr(FMJMaoZ);
end;
procedure TfrmJTSJY220725.btnSampleSelClick(Sender: TObject);
var
i: Integer;
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
Y_CodeName := Trim(fieldbyname('Y_CodeName').AsString);
Y_Spec := Trim(fieldbyname('Y_Spec').AsString);
BatchNo := Trim(fieldbyname('BatchNo').AsString);
Y_CodeNameCP := Trim(fieldbyname('Y_CodeNameCP').AsString);
ZGKS := Trim(fieldbyname('ZGKS').AsString);
SJKS := Trim(fieldbyname('SJKS').AsString);
ZGZL := Trim(fieldbyname('ZGZL').AsString);
ZXZL := Trim(fieldbyname('ZXZL').AsString);
FactoryName := Trim(fieldbyname('FactoryName').AsString);
end;
ADOQueryTemp.Close;
CPInfo.Text := ' ' + #13 + 'ԭ˿Ʒ<CBBF><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 + '<27><>ƷƷ<C6B7><C6B7><EFBFBD><EFBFBD>' + Trim(Y_CodeNameCP) + #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);
ZGQty.Text := ZGKS;
with Panel8 do
begin
for i := 0 to Panel8.ControlCount - 1 do
begin
if Controls[i].Tag = 2 then
begin
Controls[i].Visible := False;
end;
if Controls[i] is TEdit then
begin
TEdit(Controls[i]).Text := '';
end;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YT_Plan_Rule where Mainid=''' + Trim(CPInfo.Hint) + ''' and RType=''<27><>ɫ'' and isnull(RName,'''')<>'''' ');
Open;
end;
i := ADOQueryTemp.RecordCount;
with ADOQueryTemp do
begin
First;
while not Eof do
begin
if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '<27><>' then
begin
ZGH.Visible := True;
ZGHLab.Visible := True;
if i = 1 then
begin
ZGH.Text := '<27><>';
end;
end
else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '<27><>' then
begin
ZGL.Visible := True;
ZGLLab.Visible := True;
if i = 1 then
begin
ZGL.Text := '<27><>';
end;
end
else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '<27><>' then
begin
ZGHuang.Visible := True;
ZGHuangLab.Visible := True;
if i = 1 then
begin
ZGHuang.Text := '<27><>';
end;
end
else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '<27>ۺ<EFBFBD>' then
begin
ZGFH.Visible := True;
ZGFHLab1.Visible := True;
ZGFHLab2.Visible := True;
if i = 1 then
begin
ZGFH.Text := '<27><>';
end;
end
else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '<27>ư<EFBFBD>' then
begin
ZGHuangB.Visible := True;
ZGHuangBLab1.Visible := True;
ZGHuangBLab2.Visible := True;
if i = 1 then
begin
ZGHuangB.Text := '<27><>';
end;
end
else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '<27>̻<EFBFBD>' then
begin
ZGLH.Visible := True;
ZGLH1.Visible := True;
ZGLH2.Visible := True;
if i = 1 then
begin
ZGLH.Text := '<27><>';
end;
end
else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '<27><><EFBFBD><EFBFBD>ɫ' then
begin
ZGRYS.Visible := True;
if i = 1 then
begin
ZGRYS.Text := '<27><>';
end;
end;
Next;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YT_Plan_Rule where Mainid=''' + Trim(CPInfo.Hint) + ''' and RType=''<27><>̨'' and isnull(RName,'''')<>'''' ');
Open;
end;
i := ADOQueryTemp.RecordCount;
if i = 1 then
begin
MachNO.ItemIndex := MachNO.Items.IndexOf(ADOQueryTemp.fieldbyname('RName').AsString);
MachNO.Enabled := False;
end
else
begin
MachNO.Enabled := True;
MachNO.ItemIndex := -1;
end;
ADOQueryTemp.Close;
end;
procedure TfrmJTSJY220725.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmJTSJY220725.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if FCK = 9 then
begin
CloseCom(DZCDYDllName)
end;
Action := caFree;
end;
procedure TfrmJTSJY220725.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TfrmJTSJY220725.ZGHClick(Sender: TObject);
var
Fint, i: Integer;
begin
TEdit(Sender).Text := '<27><>';
Fint := TEdit(Sender).TabOrder;
for i := 0 to Panel8.ControlCount - 1 do
begin
with Panel8 do
begin
if Controls[i] is TEdit then
begin
if TEdit(Controls[i]).TabOrder <> Fint then
begin
TEdit(Controls[i]).Text := '';
end;
end;
end;
end;
end;
procedure TfrmJTSJY220725.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 TfrmJTSJY220725.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 TfrmJTSJY220725.SpeedButton1Click(Sender: TObject);
var
fsj: string;
begin
fsj := Trim(TSpeedButton(Sender).Hint);
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 TfrmJTSJY220725.SpeedButton12Click(Sender: TObject);
var
fsj: string;
begin
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 TfrmJTSJY220725.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_CodeNameCP').value := Trim(Y_CodeNameCP);
FieldByName('Y_Spec').value := Trim(Y_Spec);
FieldByName('BatchNo').value := Trim(BatchNo);
FieldByName('MachNO').value := Trim(MachNO.Text);
FieldByName('Y_Type').value := Trim(Y_Type.Text);
FieldByName('JTNote').value := Trim(JTNote.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(ZGFH.Text) <> '' then
begin
FieldByName('ZGColor').value := '<27>ۺ<EFBFBD>';
end;
if Trim(ZGLH.Text) <> '' then
begin
FieldByName('ZGColor').value := '<27>̻<EFBFBD>';
end;
if Trim(ZGHuang.Text) <> '' then
begin
FieldByName('ZGColor').value := '<27><>';
end;
if Trim(ZGHuangB.Text) <> '' then
begin
FieldByName('ZGColor').value := '<27>ư<EFBFBD>';
end;
if Trim(ZGRYS.Text) <> '' then
begin
FieldByName('ZGColor').value := '<27><><EFBFBD><EFBFBD>ɫ';
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);
FieldByName('ZXZL').Value := StrToFloatdef(trim(ZXZL), 0);
FieldByName('BZType').Value := '<27><>';
FieldByName('JYGW').Value := StrToFloatdef(trim(SQty.Text), 0);
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;
////////////////////////<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>/////////////////////////////////////
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select * from JY_YT where JYID=''' + Trim(maxno) + '''');
Open;
end;
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(ZGFH.Text) <> '' then
begin
FieldByName('ZGColor').value := '<27>ۺ<EFBFBD>';
end;
if Trim(ZGFH.Text) <> '' then
begin
FieldByName('ZGColor').value := '<27>̻<EFBFBD>';
end;
if Trim(ZGHuang.Text) <> '' then
begin
FieldByName('ZGColor').value := '<27><>';
end;
if Trim(ZGHuangB.Text) <> '' then
begin
FieldByName('ZGColor').value := '<27>ư<EFBFBD>';
end;
FieldByName('JYGW').Value := trim(SQty.Text);
FieldByName('MachNO').Value := trim(MachNO.Text);
FieldByName('JYNW').Value := ADOQueryTemp.fieldbyname('JYNW').Value;
Post;
end;
ADOCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end;
end;
procedure TfrmJTSJY220725.PrtData(FMJID: string);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
ExportFtErpFile('<27>ӵ<EFBFBD>˿<EFBFBD><CBBF>ǩ.rmf', ADOQueryTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>ӵ<EFBFBD>˿<EFBFBD><CBBF>ǩ.rmf';
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_JY_Print_YTLab ''' + Trim(FMJID) + '''');
Open;
end;
if ADOQueryPrint.IsEmpty then
begin
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(ADOQueryPrint.fieldbyname('JYID').AsString);
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath) then
DeleteFile(fImagePath);
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM2.LoadFromFile(fPrintFile);
Rm2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
RM2.PrintReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
procedure TfrmJTSJY220725.Button3Click(Sender: TObject);
var
FReal: Double;
FStr: string;
begin
if Trim(CPInfo.Text) = '' then
begin
TSInfo(<><C3BB>ѡ<EFBFBD><D1A1>Ʒ<EFBFBD><C6B7>!');
exit;
end;
if Trim(Trim(ZGRYS.Text) + Trim(ZGH.Text) + Trim(ZGL.Text) + Trim(ZGFH.Text) + Trim(ZGLH.Text) + Trim(ZGHuang.Text) + Trim(ZGHuangB.Text)) = '' then
begin
TSInfo(<><C3BB>ѡ<EFBFBD><D1A1>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ɫ!');
exit;
end;
if Trim(ZGQty.Text) = '' then
begin
InitJP('ZGQty');
ZGQty.SetFocus;
TSInfo('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
Exit;
end;
if TryStrToFloat(ZGQty.Text, FReal) = False then
begin
TSInfo('<27><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!');
Exit;
end;
if Trim(SQty.Text) = '' then
begin
InitJP('SQty');
SQty.SetFocus;
TSInfo('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
Exit;
end;
if TryStrToFloat(SQty.Text, FReal) = False then
begin
TSInfo('<27><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!');
Exit;
end;
FStr := '1';
if StrToFloat(SQty.Text) < 20 then
begin
FStr := '';
try
frmTSOKNO := TfrmTSOKNO.Create(Application);
with frmTSOKNO do
begin
TSStr := '<27><><EFBFBD><EFBFBD>С<EFBFBD><D0A1>20<32><30>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
OKNOFlag := 'ѡ<><D1A1>';
if ShowModal = 1 then
begin
FStr := '1';
end;
end;
finally
frmTSOKNO.Free;
end;
end;
if StrToFloat(SQty.Text) > 45 then
begin
FStr := '';
try
frmTSOKNO := TfrmTSOKNO.Create(Application);
with frmTSOKNO do
begin
TSStr := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>45<34><35>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
OKNOFlag := 'ѡ<><D1A1>';
if ShowModal = 1 then
begin
FStr := '1';
end;
end;
finally
frmTSOKNO.Free;
end;
end;
if StrToInt(ZGQty.Text) <> 6 then
begin
FStr := '';
try
frmTSOKNO := TfrmTSOKNO.Create(Application);
with frmTSOKNO do
begin
TSStr := <>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><36>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
OKNOFlag := 'ѡ<><D1A1>';
if ShowModal = 1 then
begin
FStr := '1';
end;
end;
finally
frmTSOKNO.Free;
end;
end;
if FStr = '1' then
begin
try
frmTSOKNO := TfrmTSOKNO.Create(Application);
with frmTSOKNO do
begin
TSStr := <><C8B7>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8>';
OKNOFlag := 'ѡ<><D1A1>';
if ShowModal = 1 then
begin
if SaveData('<27><><EFBFBD><EFBFBD>') then
begin
PrtData(Trim(FFFMJID));
SQty.Text := '';
end;
end;
end;
finally
frmTSOKNO.Free;
end;
end;
end;
procedure TfrmJTSJY220725.TSInfo(TSStr: string);
var
TSStr10: string;
begin
FTSStr := TSStr;
try
frmTSOKNO := TfrmTSOKNO.Create(Application);
with frmTSOKNO do
begin
frmTSOKNO.TSStr := Self.FTSStr;
frmTSOKNO.OKNOFlag := '<27><>ʾ';
if ShowModal = 1 then
begin
end;
end;
finally
frmTSOKNO.Free;
end;
end;
procedure TfrmJTSJY220725.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 TfrmJTSJY220725.FormShow(Sender: TObject);
begin
try
IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'FileKPZ.INI');
DZCDYDllName := IniFile.ReadString('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD>ӳӵ<D3B3><D3B5><EFBFBD>Dll<6C>ļ<EFBFBD>', '');
finally
IniFile.Free;
end;
InitGrid();
if DZCDYDllName <> '' then
begin
OpenCom(DZCDYDllName);
end;
end;
procedure TfrmJTSJY220725.Edit13Click(Sender: TObject);
begin
if Trim(Edit13.Text) = '' then
begin
Edit13.Text := '<27><>';
OpenCom(DZCDYDllName);
end
else
begin
Edit13.Text := '';
if FCK = 9 then
CloseCom(DZCDYDllName)
else
begin
Exit;
end;
end;
end;
procedure TfrmJTSJY220725.OpenCom(DllName: string);
type
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
var
Tf: TMyFunc;
Tp: TFarProc;
Th: Thandle;
begin
Th := LoadLibrary(Pchar(trim(DllName)));
if Th > 0 then
begin
try
Tp := GetProcAddress(Th, 'CommOpen');
if Tp <> nil then
begin
Tf := TMyFunc(Tp);
newh := Tf(self.Handle, 'Comm1', 500, 1);
if newh < 1 then
begin
FCK := 1;
showmessage('<27><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>ʧ<EFBFBD><CAA7>!');
Exit;
end
else
begin
FCK := 9;
end;
end
else
begin
end;
finally
end;
end
else
begin
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + '<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
end;
end;
procedure TfrmJTSJY220725.CloseCom(DllName: string);
type
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
var
Tf1: TMyFunc;
Tp1: TFarProc;
Th1: Thandle;
//newh1:hwnd;
begin
Th1 := LoadLibrary(Pchar(trim(DllName)));
if Th1 > 0 then
begin
try
Tp1 := GetProcAddress(Th1, 'CommClose');
if Tp1 <> nil then
begin
Tf1 := TMyFunc(Tp1);
newh1 := Tf1('Comm1');
end
else
begin
end;
finally
// FreeLibrary(Th1);
end;
end
else
begin
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
end;
end;
procedure TfrmJTSJY220725.Button2Click(Sender: TObject);
begin
if ClientDataSet1.IsEmpty then
Exit;
try
frmTSOKNO := TfrmTSOKNO.Create(Application);
with frmTSOKNO do
begin
TSStr := <><C8B7>Ҫ<EFBFBD>ش<EFBFBD><D8B4><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>';
OKNOFlag := 'ѡ<><D1A1>';
if ShowModal = 1 then
begin
Self.PrtData(Trim(ClientDataSet1.fieldbyname('JYId').AsString));
end;
end;
finally
frmTSOKNO.Free;
end;
end;
procedure TfrmJTSJY220725.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 TfrmJTSJY220725.cxGridDBColumn1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
id, id10: Integer;
begin
id := TV3.GetColumnByFieldName('JYNW').Index; //;-TV1.GroupedItemCount;
id10 := TV3.GetColumnByFieldName('ZGKS').Index; //;-TV1.GroupedItemCount;
if id < 0 then
Exit;
if AViewInfo.GridRecord.Values[id] < 20 then
begin
ACanvas.Brush.Color := clRed;
end;
if AViewInfo.GridRecord.Values[id] > 45 then
begin
ACanvas.Brush.Color := clRed;
end;
if AViewInfo.GridRecord.Values[id10] <> 6 then
begin
ACanvas.Brush.Color := clRed;
end;
end;
end.