909 lines
25 KiB
ObjectPascal
909 lines
25 KiB
ObjectPascal
unit U_YarnElasticityWeighing;
|
||
|
||
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, cxContainer, cxTextEdit, cxMaskEdit,
|
||
cxButtonEdit, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, U_BaseList;
|
||
|
||
type
|
||
TfrmYarnElasticityWeighing = class(TfrmBaseList)
|
||
CPInfo: TRichEdit;
|
||
ADOQueryTemp: TADOQuery;
|
||
Panel3: TPanel;
|
||
Panel4: TPanel;
|
||
Panel2: TPanel;
|
||
SQty: TEdit;
|
||
Label4: TLabel;
|
||
Button3: TButton;
|
||
Panel9: TPanel;
|
||
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;
|
||
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;
|
||
Label9: TLabel;
|
||
edt_BoxCount: TEdit;
|
||
Label3: TLabel;
|
||
Grade: TComboBox;
|
||
Panel11: TPanel;
|
||
Label5: TLabel;
|
||
edt_YarnRackNo: TEdit;
|
||
Label6: TLabel;
|
||
edt_YarnRackWeight: TEdit;
|
||
Label7: TLabel;
|
||
ClientDataSetYS: TClientDataSet;
|
||
Panel8: TPanel;
|
||
ZG5C1: TLabel;
|
||
ZG5C2: TLabel;
|
||
ZG4C2: TLabel;
|
||
ZG4C1: TLabel;
|
||
ZG6C2: TLabel;
|
||
ZG6C1: TLabel;
|
||
ZG1C1: TLabel;
|
||
ZG1C2: TLabel;
|
||
ZG2C1: TLabel;
|
||
ZG2C2: TLabel;
|
||
ZG3C1: TLabel;
|
||
ZG3C2: TLabel;
|
||
ZG1: TEdit;
|
||
ZG2: TEdit;
|
||
ZG5: TEdit;
|
||
ZG4: TEdit;
|
||
ZG3: TEdit;
|
||
ZG6: TEdit;
|
||
Panel12: TPanel;
|
||
Label8: TLabel;
|
||
edt_YarnTubeWeight: TEdit;
|
||
Tv3Column2: TcxGridDBColumn;
|
||
Label1: TLabel;
|
||
PacketType: TEdit;
|
||
Label10: TLabel;
|
||
btn_YarnTubeType: TcxButtonEdit;
|
||
Button7: TButton;
|
||
Panel13: TPanel;
|
||
btnSampleSel: TButton;
|
||
Button4: TButton;
|
||
Button5: TButton;
|
||
Button6: TButton;
|
||
Button1: TButton;
|
||
Button8: TButton;
|
||
Button9: TButton;
|
||
Button10: TButton;
|
||
Tv3Column3: TcxGridDBColumn;
|
||
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 Button4Click(Sender: TObject);
|
||
procedure ZG1Click(Sender: TObject);
|
||
procedure edt_YarnRackNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Button5Click(Sender: TObject);
|
||
procedure Button6Click(Sender: TObject);
|
||
procedure cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure Button7Click(Sender: TObject);
|
||
procedure Button9Click(Sender: TObject);
|
||
procedure Button10Click(Sender: TObject);
|
||
procedure Button8Click(Sender: TObject);
|
||
private
|
||
FMainid, FOrderNo, FFtyNO, FFtyName, FY_Code, FY_Name, FY_Spec, FY_Color, FBatchNo, FYE_Code, FYE_Name: string;
|
||
FYarnTubeColor, FPaperBoxWeight, FBoxCount, FYarnRackCount: string;
|
||
FFFMJID: string;
|
||
IsCommopen: boolean;
|
||
procedure InitYarnTubeColor(MColor: string);//ˢ<><CBA2>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ɫ
|
||
function TestData(): Boolean; //<2F><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>
|
||
procedure GetYarnTube(MTube: string);//<2F><>ȡɴ<C8A1><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
procedure InitJP(FName: string); //ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>
|
||
function SaveData(DataType: string): Boolean; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
procedure InitGrid(); //ˢ<>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
function TSInfo(MOKNOFlag, MTSStr: string): Boolean; //<2F><>ʾ<EFBFBD><CABE><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>
|
||
procedure PrtData(MYIID: string); //<2F><>ӡ<EFBFBD><D3A1>ǩ
|
||
procedure OpenCom(DllName: string);
|
||
procedure CloseCom(DllName: string);
|
||
procedure On1201(var Message: Tmessage); message 1201; //<2F><><EFBFBD>ӳ<EFBFBD>
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmYarnElasticityWeighing: TfrmYarnElasticityWeighing;
|
||
newh, newh1: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_iniParam, U_RTFun, U_SCPerson, U_SCPersonColor, U_TSOKNO,
|
||
U_ZDYHelp, U_CPSelBig;
|
||
|
||
{$R *.dfm} procedure TfrmYarnElasticityWeighing.GetYarnTube(MTube: string);
|
||
begin
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,ZJM=dbo.getPinYin(A.ZdyName) from KH_ZDY A where A.Type=''YarnTubeType'' and ZDYName=' + quotedstr(MTube));
|
||
Open;
|
||
end;
|
||
btn_YarnTubeType.Text := Trim(ADOQueryTemp.fieldbyname('ZDYName').AsString);
|
||
edt_YarnTubeWeight.Text := Trim(ADOQueryTemp.fieldbyname('Note').AsString);
|
||
end;
|
||
|
||
function TfrmYarnElasticityWeighing.TestData(): Boolean;
|
||
begin
|
||
try
|
||
if Trim(edt_YarnRackNo.Text) = '' then
|
||
raise Exception.Create('˿<>ܺŲ<DCBA><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
if Self.edt_YarnRackNo.Text <> 'ľ<><C4BE>' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select YRNo,YRWeight from YE_YarnRack where YRNo= ' + QuotedStr(Self.edt_YarnRackNo.Text));
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
raise Exception.Create('˿<>ܺŲ<DCBA><C5B2><EFBFBD><EFBFBD>ڣ<EFBFBD>');
|
||
end;
|
||
if Trim(CPInfo.Text) = '' then
|
||
raise Exception.Create('û<><C3BB>ѡ<EFBFBD><D1A1>Ʒ<EFBFBD><C6B7>!');
|
||
if (Trim(ZG1.Text) = '') and (Trim(ZG2.Text) = '') and (Trim(ZG3.Text) = '') and (Trim(ZG4.Text) = '') and (Trim(ZG5.Text) = '') and (Trim(ZG6.Text) = '') then
|
||
raise Exception.Create('û<><C3BB>ѡ<EFBFBD><D1A1>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ɫ!');
|
||
if Trim(btn_YarnTubeType.Text) = '' then
|
||
raise Exception.Create('ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
if Trim(edt_YarnTubeWeight.Text) = '' then
|
||
raise Exception.Create('ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
if StrToFloatdef(edt_BoxCount.Text, 0) = 0 then
|
||
begin
|
||
InitJP('edt_BoxCount');
|
||
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0!');
|
||
end;
|
||
if StrToFloatdef(SQty.Text, 0) = 0 then
|
||
begin
|
||
InitJP('SQty');
|
||
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0!');
|
||
end;
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
TSInfo('<27><>ʾ', Exception(ExceptObject).Message);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.InitYarnTubeColor(MColor: string);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
|
||
sql.Add('select * from YE_YarnTube_Color ');
|
||
if trim(MColor) = '' then
|
||
sql.Add(' where IsUse=1')
|
||
else
|
||
sql.Add(' where ColorName=' + QuotedStr(MColor));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, ClientDataSetYS);
|
||
SInitCDSData(ADOQueryTemp, ClientDataSetYS);
|
||
FYarnTubeColor := '';
|
||
for i := 1 to 6 do
|
||
begin
|
||
if ClientDataSetYS.Locate('Sindex', i, []) then
|
||
begin
|
||
TEdit(FindComponent('ZG' + inttostr(i))).Visible := True;
|
||
TLabel(FindComponent('ZG' + inttostr(i) + 'C1')).Visible := True;
|
||
TLabel(FindComponent('ZG' + inttostr(i) + 'C2')).Visible := True;
|
||
TEdit(FindComponent('ZG' + inttostr(i))).Hint := ClientDataSetYS.fieldbyname('ColorName').AsString;
|
||
TLabel(FindComponent('ZG' + inttostr(i) + 'C1')).Color := ClientDataSetYS.fieldbyname('ColorData1').AsInteger;
|
||
TLabel(FindComponent('ZG' + inttostr(i) + 'C2')).Color := ClientDataSetYS.fieldbyname('ColorData2').AsInteger;
|
||
if (trim(MColor) <> '') and (i = 1) then
|
||
begin
|
||
TEdit(FindComponent('ZG' + inttostr(i))).Text := '<27><>';
|
||
FYarnTubeColor := ClientDataSetYS.fieldbyname('ColorName').AsString;
|
||
end
|
||
else
|
||
TEdit(FindComponent('ZG' + inttostr(i))).Text := '';
|
||
end
|
||
else
|
||
begin
|
||
TEdit(FindComponent('ZG' + inttostr(i))).Visible := False;
|
||
TLabel(FindComponent('ZG' + inttostr(i) + 'C1')).Visible := False;
|
||
TLabel(FindComponent('ZG' + inttostr(i) + 'C2')).Visible := False;
|
||
TEdit(FindComponent('ZG' + inttostr(i))).Text := '';
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmYarnElasticityWeighing := nil;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.btnSampleSelClick(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
FYarnTubeColor := '';
|
||
try
|
||
frmCPSelBig := TfrmCPSelBig.Create(Self);
|
||
with frmCPSelBig do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
CPInfo.Hint := FHMainId;
|
||
btn_YarnTubeType.Text := '';
|
||
edt_YarnTubeWeight.Text := '';
|
||
end;
|
||
end;
|
||
finally
|
||
frmCPSelBig.Close;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YE_Plan_Main where Mainid=''' + Trim(CPInfo.Hint) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
FOrderNo := Trim(fieldbyname('OrderNo').AsString);
|
||
FMainid := Trim(fieldbyname('Mainid').AsString);
|
||
FFtyNo := Trim(fieldbyname('FtyNo').AsString);
|
||
FFtyName := Trim(fieldbyname('FtyName').AsString);
|
||
FY_Code := Trim(fieldbyname('Y_Code').AsString);
|
||
FY_Name := Trim(fieldbyname('Y_Name').AsString);
|
||
FYE_Code := Trim(fieldbyname('YE_Code').AsString);
|
||
FYE_Name := Trim(fieldbyname('YE_Name').AsString);
|
||
FY_Spec := Trim(fieldbyname('Y_Spec').AsString);
|
||
FY_Color := Trim(fieldbyname('Y_Color').AsString);
|
||
FBatchNo := Trim(fieldbyname('BatchNo').AsString);
|
||
|
||
FBoxCount := Trim(fieldbyname('BoxCount').AsString);
|
||
FYarnRackCount := Trim(fieldbyname('YarnRackCount').AsString);
|
||
FPaperBoxWeight := Trim(fieldbyname('PaperBoxWeight').AsString);
|
||
|
||
end;
|
||
ADOQueryTemp.Close;
|
||
CPInfo.Text := ' ' + #13 + 'ԭ˿Ʒ<CBBF><C6B7><EFBFBD><EFBFBD>' + Trim(FY_Name) + #13 + #13;
|
||
CPInfo.Text := CPInfo.Text + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(FY_Spec) + #13 + #13;
|
||
CPInfo.Text := CPInfo.Text + 'ԭ˿<D4AD><CBBF>ɫ<EFBFBD><C9AB>' + Trim(FY_Color) + #13 + #13;
|
||
CPInfo.Text := CPInfo.Text + '<27><>ƷƷ<C6B7><C6B7><EFBFBD><EFBFBD>' + Trim(FYE_Name) + #13 + #13;
|
||
CPInfo.Text := CPInfo.Text + '<27><><EFBFBD>ţ<EFBFBD>' + #13 + Trim(FBatchNo) + #13 + #13;
|
||
CPInfo.Text := CPInfo.Text + 'ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(FPaperBoxWeight) + #13 + #13;
|
||
CPInfo.Text := CPInfo.Text + 'ֽ<>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD>' + Trim(FBoxCount);
|
||
|
||
edt_BoxCount.Text := FBoxCount;
|
||
|
||
|
||
////////////////////////////////
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YE_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;
|
||
|
||
InitYarnTubeColor('');
|
||
|
||
edt_YarnRackNo.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
CloseCom(DZCDYDllName);
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.Button1Click(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.SQtyClick(Sender: TObject);
|
||
begin
|
||
InitJP(Trim(TEdit(Sender).Name));
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.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;
|
||
TEdit(FindComponent(FName)).SetFocus;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.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, 'YE' + Trim(SCXFlag), 'YE_Yarn_Inspect', 4, 1) = False then
|
||
raise Exception.Create(pchar('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>'));
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from YE_Yarn_Inspect where YIID=''' + Trim(FMJID) + '''');
|
||
Open;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('FillID').Value := Trim(DCode);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
FieldByName('YIID').Value := Trim(maxno);
|
||
FieldByName('OrderNo').Value := Trim(FOrderNo);
|
||
FieldByName('Mainid').Value := Trim(FMainid);
|
||
FieldByName('FtyNo').value := FFtyNo;
|
||
FieldByName('FtyName').value := FFtyName;
|
||
FieldByName('Y_Code').value := Trim(FY_Code);
|
||
FieldByName('Y_Name').value := Trim(FY_Name);
|
||
FieldByName('Y_Spec').value := Trim(FY_Spec);
|
||
FieldByName('Y_Color').value := Trim(FY_Color);
|
||
FieldByName('BatchNo').value := Trim(FBatchNo);
|
||
FieldByName('YE_Code').value := Trim(FYE_Code);
|
||
FieldByName('YE_Name').value := Trim(FYE_Name);
|
||
FieldByName('MachNO').value := Trim(MachNO.Text);
|
||
FieldByName('Grade').value := Trim(Grade.Text);
|
||
|
||
FieldByName('YarnTubeColor').value := Trim(FYarnTubeColor);
|
||
FieldByName('YIIOFlag').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
||
FieldByName('YarnTubeType').Value := trim(btn_YarnTubeType.Text); //ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FieldByName('YarnTubeWeight').Value := StrToFloatdef(trim(edt_YarnTubeWeight.Text), 0); //ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FieldByName('BoxCount').Value := StrToFloatdef(trim(edt_BoxCount.Text), 0); //װ<><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FieldByName('PaperBoxWeight').Value := StrToFloatdef(trim(FPaperBoxWeight), 0); //ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FieldByName('YarnRackWeight').Value := StrToFloatdef(trim(edt_YarnRackWeight.Text), 0); //˿<><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
FieldByName('YarnRackNo').Value := trim(edt_YarnRackNo.Text);
|
||
FieldByName('PacketType').Value := trim(PacketType.Text);
|
||
|
||
FieldByName('GrossWeight').Value := StrToFloatdef(trim(SQty.Text), 0);
|
||
FieldByName('NetWeight').Value := 0;
|
||
FieldByName('YIMachNo').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_YE_Insp_In_Stk @YIID=''' + trim(FMJID) + '''');
|
||
open;
|
||
end;
|
||
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(pchar(trim(ADOCmd.FieldByName('ShowMsg').AsString)));
|
||
////////////////////////<2F><><EFBFBD>ء<EFBFBD><D8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⼰<EFBFBD><E2BCB0><EFBFBD><EFBFBD>/////////////////////////////////////
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from YE_Yarn_Inspect where YIID=''' + Trim(maxno) + '''');
|
||
Open;
|
||
end;
|
||
with ClientDataSet1 do
|
||
begin
|
||
Append;
|
||
FieldByName('YIID').Value := Trim(maxno);
|
||
FieldByName('BoxCount').Value := trim(edt_BoxCount.Text);
|
||
FieldByName('YarnTubeType').Value := trim(btn_YarnTubeType.Text);
|
||
FieldByName('YarnTubeColor').value := FYarnTubeColor;
|
||
FieldByName('YarnTubeWeight').Value := trim(edt_YarnTubeWeight.Text);
|
||
FieldByName('GrossWeight').Value := ADOQueryTemp.fieldbyname('GrossWeight').Value;
|
||
FieldByName('NetWeight').Value := ADOQueryTemp.fieldbyname('NetWeight').Value;
|
||
FieldByName('MachNO').Value := ADOQueryTemp.fieldbyname('MachNO').Value;
|
||
Post;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.PrtData(MYIID: string);
|
||
var
|
||
fPrintFile: string;
|
||
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_YE_Insp_Prt_Lab ''' + Trim(MYIID) + '''');
|
||
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;
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
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 TfrmYarnElasticityWeighing.Button3Click(Sender: TObject);
|
||
var
|
||
FReal: Double;
|
||
FStr: string;
|
||
begin
|
||
if TestData() = false then
|
||
exit;
|
||
if TSInfo('ѡ<><D1A1>', 'ȷ<><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>') then
|
||
begin
|
||
if SaveData('<27><><EFBFBD><EFBFBD>') then
|
||
begin
|
||
PrtData(Trim(FFFMJID));
|
||
SQty.Text := '';
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
function TfrmYarnElasticityWeighing.TSInfo(MOKNOFlag, MTSStr: string): Boolean;
|
||
begin
|
||
try
|
||
frmTSOKNO := TfrmTSOKNO.Create(Application);
|
||
with frmTSOKNO do
|
||
begin
|
||
frmTSOKNO.TSStr := MTSStr;
|
||
frmTSOKNO.OKNOFlag := MOKNOFlag;
|
||
if ShowModal = 1 then
|
||
begin
|
||
Result := retbol;
|
||
end;
|
||
end;
|
||
finally
|
||
frmTSOKNO.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.InitGrid();
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YE_Yarn_Inspect where Convert(varchar(10),FillTime,120)=Convert(varchar(10),Getdate(),120)');
|
||
sql.Add(' and Filler=''' + Trim(DName) + ''' order by FillTime desc ');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, ClientDataSet1);
|
||
SInitCDSData(ADOQueryTemp, ClientDataSet1);
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.FormShow(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
inherited;
|
||
fsj := 'select Name=ZdyName from KH_Zdy where Type=''Grade'' ';
|
||
SInitComBoxBySql(ADOQueryTemp, Grade, True, fsj);
|
||
InitYarnTubeColor('');
|
||
FYarnTubeColor := '';
|
||
InitGrid();
|
||
if DZCDYDllName <> '' then
|
||
begin
|
||
OpenCom(DZCDYDllName);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.Edit13Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit13.Text) = '' then
|
||
begin
|
||
Edit13.Text := '<27><>';
|
||
OpenCom(DZCDYDllName);
|
||
end
|
||
else
|
||
begin
|
||
Edit13.Text := '';
|
||
CloseCom(DZCDYDllName)
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.OpenCom(DllName: string);
|
||
type
|
||
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
|
||
var
|
||
Tf: TMyFunc;
|
||
Tp: TFarProc;
|
||
Th: Thandle;
|
||
begin
|
||
// closeCom(FComFile);
|
||
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
|
||
application.MessageBox(Pchar('<27><EFBFBD><F2BFAAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>'), '<27><>ʾ');
|
||
end
|
||
else
|
||
IsCommOpen := true;
|
||
end
|
||
else
|
||
begin
|
||
IsCommOpen := false;
|
||
end;
|
||
finally
|
||
// FreeLibrary(Th);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
IsCommOpen := false;
|
||
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.CloseCom(DllName: string);
|
||
type
|
||
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
|
||
var
|
||
Tf1: TMyFunc;
|
||
Tp1: TFarProc;
|
||
Th1: Thandle;
|
||
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 TfrmYarnElasticityWeighing.Button2Click(Sender: TObject);
|
||
begin
|
||
if ClientDataSet1.IsEmpty then
|
||
Exit;
|
||
if TSInfo('ѡ<><D1A1>', 'ȷ<><C8B7>Ҫ<EFBFBD>ش<EFBFBD><D8B4><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>') then
|
||
begin
|
||
PrtData(Trim(ClientDataSet1.fieldbyname('YIID').AsString));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.Button4Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson := TfrmSCPerson.Create(self);
|
||
with frmSCPerson do
|
||
begin
|
||
FType := 'ɴ<><C9B4>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.edt_YarnRackWeight.Text := FYarnRackWeight;
|
||
Self.edt_YarnRackNo.Text := FYarnRackNo;
|
||
Self.PacketType.Text := 'ɴ<><C9B4>';
|
||
self.edt_BoxCount.Text := '60';
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.close;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.ZG1Click(Sender: TObject);
|
||
var
|
||
Fint, i: Integer;
|
||
begin
|
||
TEdit(Sender).Text := '<27><>';
|
||
|
||
FYarnTubeColor := TEdit(Sender).Hint;
|
||
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 TfrmYarnElasticityWeighing.edt_YarnRackNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select YRNo,YRWeight from YE_YarnRack where YRNo= ' + QuotedStr(Self.edt_YarnRackNo.Text));
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
Self.edt_YarnRackWeight.Text := '';
|
||
Self.edt_YarnRackNo.Text := '';
|
||
self.edt_BoxCount.Text := '';
|
||
end
|
||
else
|
||
begin
|
||
Self.edt_YarnRackWeight.Text := ADOQueryTemp.fieldbyname('YRWeight').asstring;
|
||
Self.edt_YarnRackNo.Text := ADOQueryTemp.fieldbyname('YRNo').asstring;
|
||
self.edt_BoxCount.Text := '60';
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.Button5Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson := TfrmSCPerson.Create(self);
|
||
with frmSCPerson do
|
||
begin
|
||
FType := '<27><>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.edt_YarnRackWeight.Text := FYarnRackWeight;
|
||
Self.edt_YarnRackNo.Text := FYarnRackNo;
|
||
Self.PacketType.Text := '<27><>';
|
||
self.edt_BoxCount.Text := '120';
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.close;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.Button6Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson := TfrmSCPerson.Create(self);
|
||
with frmSCPerson do
|
||
begin
|
||
FType := 'ֽ<><D6BD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.edt_YarnRackWeight.Text := FYarnRackWeight;
|
||
Self.edt_YarnRackNo.Text := FYarnRackNo;
|
||
Self.PacketType.Text := 'ֽ<><D6BD>';
|
||
self.edt_BoxCount.Text := '';
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.close;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'YarnTubeType';
|
||
flagname := 'ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
V1Name.Caption := 'ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
V1Note.Caption := 'ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fnote := True;
|
||
if ShowModal = 1 then
|
||
begin
|
||
btn_YarnTubeType.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
edt_YarnTubeWeight.Text := Trim(ClientDataSet1.fieldbyname('Note').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.Button7Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPersonColor := TfrmSCPersonColor.Create(self);
|
||
with frmSCPersonColor do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
FYarnTubeColor := FColor;
|
||
InitYarnTubeColor(FColor);
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPersonColor.close;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.Button8Click(Sender: TObject);
|
||
begin
|
||
GetYarnTube('<27><><EFBFBD>Ϲ<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.Button9Click(Sender: TObject);
|
||
begin
|
||
GetYarnTube('<27>¹<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmYarnElasticityWeighing.Button10Click(Sender: TObject);
|
||
begin
|
||
GetYarnTube('<27><><EFBFBD>ι<EFBFBD>');
|
||
end;
|
||
|
||
end.
|
||
|