RTFormwork/项目代码/RTBasicsV1/F05染色检验/U_DyeMachInsp.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

2114 lines
57 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_DyeMachInsp;
interface
uses
Windows, Messages, SysUtils, StrUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport,
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu,
ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox,
MovePanel, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, Menus,
U_BaseList, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
dxBarBuiltInMenu, cxContainer, cxImage, cxDBEdit, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, ShellAPI, IdFTP,
FireDAC.Stan.StorageXML, cxPC, XMLDoc, XMLIntf, DateUtils;
type
TfrmDyeMachInsp = class(TfrmBaseList)
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyle2: TcxStyle;
GPM_1: TcxGridPopupMenu;
ADOQueryMain: TADOQuery;
ADOCmd: TADOQuery;
RMDB_1: TRMDBDataSet;
DS_2: TDataSource;
CDS_2: TClientDataSet;
ADOQueryPrint: TADOQuery;
GPM_2: TcxGridPopupMenu;
ADOQueryMainDSC: TADOQuery;
Panel7: TPanel;
AOrdDefNote1: TRichEdit;
RM1: TRMGridReport;
ADOTmp: TADOQuery;
ScrollBox1: TScrollBox;
SpeedButton13: TSpeedButton;
SpeedButton14: TSpeedButton;
SpeedButton15: TSpeedButton;
SpeedButton16: TSpeedButton;
SpeedButton17: TSpeedButton;
SpeedButton18: TSpeedButton;
SpeedButton21: TSpeedButton;
SpeedButton22: TSpeedButton;
SpeedButton23: TSpeedButton;
SpeedButton24: TSpeedButton;
SpeedButton25: TSpeedButton;
SpeedButton26: TSpeedButton;
SpeedButton29: TSpeedButton;
SpeedButton30: TSpeedButton;
SpeedButton31: TSpeedButton;
SpeedButton32: TSpeedButton;
SpeedButton33: TSpeedButton;
SpeedButton34: TSpeedButton;
SpeedButton37: TSpeedButton;
SpeedButton38: TSpeedButton;
SpeedButton39: TSpeedButton;
SpeedButton40: TSpeedButton;
SpeedButton41: TSpeedButton;
SpeedButton42: TSpeedButton;
SpeedButton45: TSpeedButton;
SpeedButton46: TSpeedButton;
SpeedButton47: TSpeedButton;
SpeedButton48: TSpeedButton;
SpeedButton50: TSpeedButton;
SpeedButton51: TSpeedButton;
SpeedButton54: TSpeedButton;
SpeedButton55: TSpeedButton;
SpeedButton56: TSpeedButton;
SpeedButton57: TSpeedButton;
SpeedButton58: TSpeedButton;
SpeedButton59: TSpeedButton;
SpeedButton62: TSpeedButton;
SpeedButton63: TSpeedButton;
SpeedButton64: TSpeedButton;
SpeedButton65: TSpeedButton;
SpeedButton66: TSpeedButton;
SpeedButton67: TSpeedButton;
SpeedButton70: TSpeedButton;
SpeedButton71: TSpeedButton;
SpeedButton72: TSpeedButton;
SpeedButton73: TSpeedButton;
SpeedButton74: TSpeedButton;
SpeedButton75: TSpeedButton;
SpeedButton19: TSpeedButton;
SpeedButton20: TSpeedButton;
SpeedButton27: TSpeedButton;
SpeedButton28: TSpeedButton;
SpeedButton35: TSpeedButton;
SpeedButton36: TSpeedButton;
SpeedButton43: TSpeedButton;
SpeedButton44: TSpeedButton;
SpeedButton52: TSpeedButton;
SpeedButton53: TSpeedButton;
SpeedButton60: TSpeedButton;
SpeedButton61: TSpeedButton;
SpeedButton68: TSpeedButton;
SpeedButton69: TSpeedButton;
SpeedButton76: TSpeedButton;
SpeedButton77: TSpeedButton;
SpeedButton78: TSpeedButton;
SpeedButton79: TSpeedButton;
SpeedButton80: TSpeedButton;
SpeedButton81: TSpeedButton;
SpeedButton82: TSpeedButton;
SpeedButton83: TSpeedButton;
CDS_3: TClientDataSet;
DS_3: TDataSource;
ADOQueryImage: TADOQuery;
DataSource2: TDataSource;
IdFTP1: TIdFTP;
Panel4: TPanel;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
v3Column1: TcxGridDBColumn;
v3Column4: TcxGridDBColumn;
v3Column5: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
Panel3: 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;
Panel1: TPanel;
Pic_Image1: TcxDBImage;
Tv3Column1: TcxGridDBColumn;
MovePanel1: TMovePanel;
Label17: TLabel;
Label18: TLabel;
lblLenUnit1: TLabel;
CIFBeg: TEdit;
Button1: TButton;
Button4: TButton;
CIFEnd: TEdit;
CIFQty: TEdit;
RadioGroup1: TRadioGroup;
Button2: TButton;
Panel8: TPanel;
cxDBImage1: TcxDBImage;
DS_ImgHX: TDataSource;
Qry_ImgHX: TADOQuery;
Tv3Column3: TcxGridDBColumn;
Tv3Column4: TcxGridDBColumn;
cxStyle4: TcxStyle;
cxPageControl1: TcxPageControl;
cxTabSheet1: TcxTabSheet;
<EFBFBD>: TcxTabSheet;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
tv2CDType: TcxGridDBColumn;
tv2CDWZ: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
Tv2CDQty: TcxGridDBColumn;
Tv2CDReason: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridLevel3: TcxGridLevel;
DS_1: TDataSource;
CDS_1: TClientDataSet;
lblCIFName: TLabel;
Label2: TLabel;
Label8: TLabel;
CIFNumber: TEdit;
Panel9: TPanel;
Panel2: TPanel;
lblLenUnit: TLabel;
Label4: TLabel;
Label5: TLabel;
Label11: TLabel;
Label31: TLabel;
InputLen: TEdit;
InputWeight: TEdit;
BTPrint: TButton;
Button6: TButton;
Button8: TButton;
ToolBar2: TToolBar;
ToolButton3: TToolButton;
btnDel: TToolButton;
ToolButton6: TToolButton;
Label10: TLabel;
Edit3: TEdit;
Label12: TLabel;
Edit4: TEdit;
GPM_3: TcxGridPopupMenu;
Panel6: TPanel;
Label35: TLabel;
Label16: TLabel;
Label26: TLabel;
edtChen: TEdit;
edtMaBiao: TEdit;
ComboBox1: TComboBox;
Edit6: TEdit;
Label6: TLabel;
Panel10: TPanel;
Label22: TLabel;
Label13: TLabel;
Label14: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label1: TLabel;
Piece: TEdit;
Qty: TEdit;
PCId: TEdit;
Color: TEdit;
ColorNo: TEdit;
CodeName: TEdit;
edtScan: TEdit;
ToolButton4: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
Label7: TLabel;
edtMBDW: TEdit;
ToolBar1: TToolBar;
btnRK: TToolButton;
ToolButton2: TToolButton;
btnCXRK: TToolButton;
Label3: TLabel;
Coefficient: TEdit;
Label9: TLabel;
MinLen: TEdit;
Label15: TLabel;
MinWeight: TEdit;
MaxLen: TEdit;
MaxWeight: TEdit;
Label19: TLabel;
MPlace: TEdit;
Label20: TLabel;
Label21: TLabel;
YPlace: TEdit;
Label27: TLabel;
KgPlace: TEdit;
Label28: TLabel;
Label33: TLabel;
Label34: TLabel;
edtaixun: TEdit;
lblRuleConversion: TLabel;
Tare: TEdit;
Button3: TButton;
SpeedButton49: TSpeedButton;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure BTPrintClick(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure btnRKClick(Sender: TObject);
procedure edtScanKeyPress(Sender: TObject; var Key: Char);
procedure CIFBegClick(Sender: TObject);
procedure CIFEndChange(Sender: TObject);
procedure Edit3Click(Sender: TObject);
procedure Edit4Click(Sender: TObject);
procedure Edit6Click(Sender: TObject);
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
procedure Button2Click(Sender: TObject);
procedure InputWeightChange(Sender: TObject);
procedure edtScanClick(Sender: TObject);
procedure NetWeightKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure edtChenClick(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure edtYJClick(Sender: TObject);
procedure cxDBImage1DblClick(Sender: TObject);
procedure Pic_Image1DblClick(Sender: TObject);
procedure Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure lblLenUnitClick(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure btnDelClick(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure btnCXRKClick(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure MinLenExit(Sender: TObject);
procedure edtaixunClick(Sender: TObject);
procedure InputLenChange(Sender: TObject);
procedure SpeedButton49Click(Sender: TObject);
private
{ Private declarations }
FCIID, FOperationStatus, FCIFName, FWorkshop: string;
FOrderNo, FMainId, FSubId, FPCId, FConNo, FConMId, FConSId: string;
FBatchNO, FC_Code, FC_Name, FC_Spec, FC_Width, FC_GramWeight: string;
FC_Color, FC_ColorNo, FC_StyleNo, FC_Pattern, FC_CustPattern, FC_ColorDepth, FFtyPCId, FGangNo: string;
FLenUnit, FAddLen, FAddWet, FRuleBeforeTare, FRuleLaterTare: string;
FPieceNo: Integer;
IsCommopen: boolean;
procedure SetINIFile(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
procedure GetINIFile(); //<2F><><EFBFBD>ó<EFBFBD><C3B3>ȵ<EFBFBD>λ
procedure SetUnit(MUnit: string); //<2F><><EFBFBD>ó<EFBFBD><C3B3>ȵ<EFBFBD>λ
procedure SetDdetails(); //ˢ<><CBA2><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ
procedure InitCDPanel(); //ˢ<>´õ<C2B4>ѡ<EFBFBD><D1A1>
procedure InitCDGrid(MCIID: string); //ˢ<>´õ<C2B4><C3B5>Ǽ<EFBFBD><C7BC><EFBFBD>Ϣ
procedure InitCDGridCX(MCIID: string); //ˢ<>´õ<C2B4><C3B5><EFBFBD>ѯ<EFBFBD><D1AF>Ϣ
procedure InitJYGrid(); //ˢ<>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>Ϣ
function CheckData(CKType: string): Boolean; //У<><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function SaveData(): Boolean; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure InitLCK(MPCId: string); //ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD>
procedure InitJTM(MCIID: string); //ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure ClearGlobal(); //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ID
procedure PrtData(MCIID: string); //<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>ǩ
procedure QuantityConversion(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure PrtMD(MInNo: string); //<2F><><EFBFBD><EFBFBD><E2B5A5>ӡ
procedure InitImage(YFTPName: string); //ͼƬ
procedure InitImageHX(HXSID: string);
procedure LookImage(FileName: string);
procedure OpenCom(DllName: string); //<2F>򿪴<EFBFBD><F2BFAAB4><EFBFBD>
procedure CloseCom(DllName: string); //<2F>رմ<D8B1><D5B4><EFBFBD>
procedure On1201(var Message: Tmessage); message 1201; //<2F><><EFBFBD>ӳ<EFBFBD>
procedure On1301(var Message: Tmessage); message 1301; //<2F><><EFBFBD><EFBFBD>
procedure PrtAiXunData(MCIID: string); //<2F><>Ѷ
public
fmanage: string;
fFlileFlag: string;
{ Public declarations }
end;
var
frmDyeMachInsp: TfrmDyeMachInsp;
newh, newh1: hwnd;
implementation
uses
U_DataLink, U_RTFun, U_ZDYHelp, U_iniParam;
{$R *.dfm}
procedure TfrmDyeMachInsp.PrtMD(MInNo: string);
var
fPrintFile, FLBName: string;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_Dye_Cloth_In_Prt11 ');
SQL.Add(' @Filtration=''' + Trim(MInNo) + '''');
Open;
end;
FLBName := 'ӡȾ<D3A1><C8BE>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⵥ';
ExportFtErpFile(FLBName + '.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLBName + '.rmf';
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
RM1.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
RM1.PrintReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
procedure TfrmDyeMachInsp.PrtAiXunData(MCIID: string);
var
xml: TXmlDocument;
xmlNode: IxmlNode;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_Dye_Insp_Prt_Lab ');
SQL.Add(' @CIID=''' + Trim(MCIID) + '''');
Open;
end;
xml := TXmlDocument.Create(nil);
try
xml.Active := True;
// xml.Version := '1.0';
// xml.Encoding := 'UTF-8';
xml.DocumentElement := xml.CreateElement('Barcode', '');
/////////////////////////////XMLģ<4C><C4A3>/////////////////////////////////////////////
xmlNode := xml.DocumentElement.AddChild('TemplateNumber');
xmlNode.ChildNodes.Add(xml.CreateNode('035', ntText)); //ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
xmlNode := xml.DocumentElement.AddChild('BarcodeTitle');
xmlNode.ChildNodes.Add(xml.CreateNode('Eͬ<45><CDAC>ҵ', ntText)); //̧ͷ
xmlNode := xml.DocumentElement.AddChild('ProductName');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('C_Name').AsString), ntText)); //Ʒ<><C6B7>
xmlNode := xml.DocumentElement.AddChild('ColorCode');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('C_ColorNo').AsString) + Trim(ADOQueryPrint.FieldByName('C_Color').AsString), ntText)); //<2F><>ɫ
xmlNode := xml.DocumentElement.AddChild('ColorNumber');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('C_ColorNo').AsString), ntText)); //ɫ<><C9AB>
xmlNode := xml.DocumentElement.AddChild('BatchNO');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('BatchNO').AsString), ntText)); //<2F><><EFBFBD><EFBFBD>
xmlNode := xml.DocumentElement.AddChild('Quantity');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('GrossWeight').AsString), ntText)); //<2F><><EFBFBD><EFBFBD>
xmlNode := xml.DocumentElement.AddChild('ProductUnit');
xmlNode.ChildNodes.Add(xml.CreateNode('Kg', ntText)); //<2F><>λ
xmlNode := xml.DocumentElement.AddChild('VolumeNumber');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('PieceNo').AsString), ntText)); //<2F><><EFBFBD><EFBFBD>
xmlNode := xml.DocumentElement.AddChild('Breadth');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('C_Width').AsString), ntText)); //<2F><><EFBFBD><EFBFBD>
xmlNode := xml.DocumentElement.AddChild('Grammage');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('C_GramWeight').AsString), ntText)); //<2F><><EFBFBD><EFBFBD>
xmlNode := xml.DocumentElement.AddChild('Composition');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('C_composition').AsString), ntText)); //<2F>ɷ<EFBFBD>
xmlNode := xml.DocumentElement.AddChild('DateMark');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('Filltime').AsString), ntText)); //ʱ<><CAB1>
xmlNode := xml.DocumentElement.AddChild('OrderNumber');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('PCID').AsString), ntText)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
xmlNode := xml.DocumentElement.AddChild('FirstRemark');
xmlNode.ChildNodes.Add(xml.CreateNode('<27><>ע!', ntText)); //<2F><>ע
xmlNode := xml.DocumentElement.AddChild('Remark');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('C_Width').AsString) + Trim(ADOQueryPrint.FieldByName('C_GramWeight').AsString), ntText)); //<2F>б<EFBFBD>ע
xml.SaveToFile('D:\aixun\' + inttostr(DateTimeToUnix(Now)) + '.xml');
// xml.SaveToFile('D:\aixun1\' + inttostr(DateTimeToUnix(Now)) + '.xml');
finally
xmlNode := nil;
xml.Free;
end;
end;
procedure TfrmDyeMachInsp.SetINIFile();
begin
if edtChen.Text = '<27><>' then
IsDZCDYDll := '1'
else
IsDZCDYDll := '0';
if edtMaBiao.Text = '<27><>' then
IsMBDYDll := '1'
else
IsMBDYDll := '0';
if edtMBDW.Text = '<27><>' then
IsMBDYDllUnit := '1'
else
IsMBDYDllUnit := '0';
LabQty := ComboBox1.Text;
FMinLen := MinLen.Text;
FMaxLen := MaxLen.Text;
FMinWeight := MinWeight.Text;
FMaxWeight := MaxWeight.Text;
FMPlace := MPlace.Text;
FYPlace := YPlace.Text;
FKgPlace := KgPlace.Text;
WriteINIFile();
end;
procedure TfrmDyeMachInsp.GetINIFile();
begin
if IsDZCDYDll = '1' then
edtChen.Text := '<27><>'
else
edtChen.Text := '';
if IsMBDYDll = '1' then
edtMaBiao.Text := '<27><>'
else
edtMaBiao.Text := '';
if IsMBDYDllUnit = '1' then
edtMBDW.Text := '<27><>'
else
edtMBDW.Text := '';
ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(trim(LabQty));
MinLen.Text := FMinLen;
MaxLen.Text := FMaxLen;
MinWeight.Text := FMinWeight;
MaxWeight.Text := FMaxWeight;
MPlace.Text := FMPlace;
YPlace.Text := FYPlace;
KgPlace.Text := FKgPlace;
end;
procedure TfrmDyeMachInsp.SetDdetails();
begin
AOrdDefNote1.Text := '';
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD><EFBFBD>:' + FPCId + #13;
AOrdDefNote1.Text := AOrdDefNote1.Text + 'Ʒ<><C6B7>:' + FC_Name + #13;
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><>ɫ:' + FC_Color + #13;
AOrdDefNote1.Text := AOrdDefNote1.Text + <><C9AB>:' + FC_ColorNo + #13;
end;
procedure TfrmDyeMachInsp.SetUnit(MUnit: string);
begin
lblLenUnit.Caption := MUnit;
lblLenUnit1.Caption := MUnit;
end;
procedure TfrmDyeMachInsp.InitImage(YFTPName: string);
begin
// with ADOQueryImage do
// begin
// close;
// sql.Clear;
// sql.Add('select * from TC_File A');
// sql.Add('where isnull(WBID,'''')<>'''' and WBID=' + quotedstr(YFTPName));
//// showmessage(sql.text);
// open;
// end;
end;
procedure TfrmDyeMachInsp.InitImageHX(HXSID: string);
begin
// with Qry_ImgHX do
// begin
// close;
// sql.Clear;
// sql.Add('select * from TC_File A');
// sql.Add('where isnull(WBID,'''')<>'''' and WBID=' + quotedstr(HXSID));
//// ShowMessage(SQL.Text);
// open;
// end;
end;
procedure TfrmDyeMachInsp.QuantityConversion();
begin
if lblRuleConversion.Caption = '<27><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>' then
begin
InputWeight.Text := floattostr(StrToFloatdef(trim(InputLen.Text), 0) * StrToFloatdef(trim(Coefficient.Text), 0) + StrToFloatdef(FRuleBeforeTare, 0));
end;
if lblRuleConversion.Caption = <><C3AB>ת<EFBFBD><D7AA>' then
begin
InputLen.Text := floattostr((StrToFloatdef(trim(InputWeight.Text), 0) + StrToFloatdef(FAddWet, 0) + StrToFloatdef(FRuleLaterTare, 0)) * StrToFloatdef(trim(Coefficient.Text), 0));
end;
if lblRuleConversion.Caption = '<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>' then
begin
InputLen.Text := floattostr((RoundFloat(StrToFloatdef(trim(InputWeight.Text), 0), 1) - StrToFloatdef(FRuleBeforeTare, 0)) * StrToFloatdef(trim(Coefficient.Text), 0));
end;
end;
function TfrmDyeMachInsp.CheckData(CKType: string): Boolean;
var
mvalue: Double;
begin
try
if Trim(FPCId) = '' then
raise Exception.Create('<27><>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>');
if Trim(CKType) = '<27>ύ' then
begin
if trim(lblLenUnit.Caption) = '' then
raise Exception.Create('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if Trim(InputWeight.Text) <> '' then
begin
if TryStrToFloat(InputWeight.Text, mvalue) = False then
raise Exception.Create('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
if strtofloatdef(trim(InputWeight.Text), 0) < Strtofloatdef(MinWeight.Text, 0) then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>' + MinWeight.Text + '!');
if strtofloatdef(trim(InputWeight.Text), 0) > Strtofloatdef(MaxWeight.Text, 0) then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>' + MaxWeight.Text + '!');
end;
if Trim(InputLen.Text) <> '' then
begin
if TryStrToFloat(InputLen.Text, mvalue) = False then
raise Exception.Create('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
if strtofloatdef(trim(InputLen.Text), 0) < Strtofloatdef(MinLen.Text, 0) then
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>' + MinLen.Text + '<27><>!');
if strtofloatdef(trim(InputLen.Text), 0) > Strtofloatdef(MaxLen.Text, 0) then
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2>ܴ<EFBFBD><DCB4><EFBFBD>' + MaxLen.Text + '<27><>!');
end;
if (strtofloatdef(trim(InputLen.Text), 0) = 0) and (strtofloatdef(trim(InputWeight.Text), 0) = 0) then
raise Exception.Create('<27><><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ϊ0!!');
end;
Result := True;
except
Result := false;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmDyeMachInsp.ClearGlobal();
begin
FOrderNo := '';
FConNo := '';
FConMId := '';
FConSId := '';
FMainId := '';
FSubId := '';
FPCId := '';
FC_CustPattern := '';
FC_ColorDepth := '';
FFtyPCId := '';
FGangNo := '';
FC_Code := '';
FC_Name := '';
FBatchNO := '';
FC_Spec := '';
FC_Color := '';
FC_ColorNo := '';
FC_StyleNo := '';
FC_Width := '';
FC_GramWeight := '';
FC_Pattern := '';
FCIID := '';
FWorkshop := '';
InputLen.Text := '';
InputWeight.Text := '';
Coefficient.Text := '';
AOrdDefNote1.Text := '';
Tare.Text := '';
FAddLen := '';
FAddWet := '';
FRuleBeforeTare := '';
FRuleLaterTare := '';
FLenUnit := '';
end;
procedure TfrmDyeMachInsp.LookImage(FileName: string);
var
sFieldName: string;
begin
sFieldName := leftbstr(ExtractFilePath(Application.ExeName), 1) + ':\ͼƬ<CDBC>鿴';
if not DirectoryExists(pchar(sFieldName)) then
CreateDirectory(pchar(sFieldName), nil);
sFieldName := sFieldName + '\' + trim(FileName);
try
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI', 'SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
IdFTP1.Username := 'three';
IdFTP1.Password := '641010';
IdFTP1.Connect();
except
;
end;
if IdFTP1.Connected then
begin
try
IdFTP1.Get(fFlileFlag + '\' + Trim(FileName), sFieldName, true, false);
except
Application.MessageBox('<27>ͻ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
IdFTP1.Quit;
Exit;
end;
end
else
begin
Application.MessageBox('<27>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
IdFTP1.Quit;
Exit;
end;
if IdFTP1.Connected then
IdFTP1.Quit;
ShellExecute(Handle, 'open', PChar(sFieldName), '', '', SW_SHOWNORMAL);
end;
procedure TfrmDyeMachInsp.Pic_Image1DblClick(Sender: TObject);
begin
if TcxDBImage(Sender).Picture.Height = 0 then
exit;
LookImage(ADOQueryImage.fieldbyname(TcxDBImage(Sender).Hint).asstring);
end;
procedure TfrmDyeMachInsp.InitLCK(MPCId: string);
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('EXEC P_Dye_Insp_Get_PlanCard @PCID=''' + Trim(MPCId) + '''');
Open;
end;
if ADOTmp.IsEmpty = False then
begin
if Trim(ADOTmp.fieldbyname('Status').AsString) <> '9' then
begin
application.MessageBox('<27><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
ClearGlobal();
end
else
begin
// InitImage(Trim(ADOTmp.fieldbyname('YFTPName').AsString));
// InitImageHX(Trim(ADOTmp.fieldbyname('HXSID').AsString));
FLenUnit := Trim(ADOTmp.fieldbyname('LenUnit').AsString);
SetUnit(FLenUnit);
FConNo := Trim(ADOTmp.fieldbyname('ConNo').AsString);
FOrderNo := Trim(ADOTmp.fieldbyname('OrderNo').AsString);
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
FPCId := Trim(ADOTmp.fieldbyname('PCId').AsString);
FC_ColorDepth := Trim(ADOTmp.fieldbyname('C_ColorDepth').AsString);
FWorkshop := Trim(ADOTmp.fieldbyname('Workshop').AsString);
FC_Code := Trim(ADOTmp.fieldbyname('C_Code').AsString);
FC_Name := Trim(ADOTmp.fieldbyname('C_Name').AsString);
FC_Spec := Trim(ADOTmp.fieldbyname('C_Spec').AsString);
FC_Color := Trim(ADOTmp.fieldbyname('C_Color').AsString);
FC_ColorNo := Trim(ADOTmp.fieldbyname('C_ColorNo').AsString);
FC_Width := Trim(ADOTmp.fieldbyname('C_Width').AsString);
FC_GramWeight := Trim(ADOTmp.fieldbyname('C_GramWeight').AsString);
FC_Pattern := Trim(ADOTmp.fieldbyname('C_Pattern').AsString);
Coefficient.Text := Trim(ADOTmp.fieldbyname('Coefficient').AsString);
CodeName.Text := FC_Name;
ColorNo.Text := FC_ColorNo;
Color.Text := FC_Color;
PCId.Text := FPCId;
Piece.Text := Trim(ADOTmp.fieldbyname('PCPiece').AsString);
Qty.Text := Trim(ADOTmp.fieldbyname('PCQty').AsString) + Trim(ADOTmp.fieldbyname('PCUnit').AsString);
Tare.Text := Trim(ADOTmp.fieldbyname('RuleLaterTare').AsString);
lblRuleConversion.Caption := Trim(ADOTmp.fieldbyname('RuleConversion').AsString);
FAddLen := ADOTmp.fieldbyname('AddLen').AsString;
FAddWet := ADOTmp.fieldbyname('AddWet').AsString;
FRuleBeforeTare := ADOTmp.fieldbyname('RuleBeforeTare').AsString;
FRuleLaterTare := ADOTmp.fieldbyname('RuleLaterTare').AsString;
SetDdetails();
InputWeight.SetFocus;
CIFBegClick(InputWeight);
end;
end
else
begin
application.MessageBox('<27><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
ClearGlobal();
end;
InitJYGrid();
InitCDGrid(FCIID);
edtScan.Text := '';
end;
procedure TfrmDyeMachInsp.InitJTM(MCIID: string);
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Dye_Cloth_IO where StkId=''' + Trim(MCIID) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Dye_Cloth_IO where StkId=''' + Trim(MCIID) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Dye_Cloth_Inspect where CIID=''' + Trim(MCIID) + '''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
FOperationStatus := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FCIID := MCIID;
InitCDGrid(MCIID);
end;
end;
procedure TfrmDyeMachInsp.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 TfrmDyeMachInsp.ComboBox1Change(Sender: TObject);
begin
SetINIFile();
end;
procedure TfrmDyeMachInsp.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 TfrmDyeMachInsp.FormDestroy(Sender: TObject);
begin
inherited;
frmDyeMachInsp := nil;
end;
procedure TfrmDyeMachInsp.On1301(var Message: Tmessage);
var
i1, i2: integer;
unitname: string;
fdata: double;
begin
i1 := Message.WParam;
i2 := Message.LParam;
if (trim(edtMaBiao.Text) = '<27><>') then
begin
InputLen.Text := format('%.2f', [i1 / 100000]);
end;
if (trim(edtMBDW.Text) = '<27><>') then
begin
if i2 = 0 then
begin
SetUnit('M');
end
else
begin
SetUnit('Y');
end;
end;
end;
procedure TfrmDyeMachInsp.On1201(var Message: Tmessage);
var
i1, i2: integer;
unitname: string;
fdata: double;
begin
i1 := Message.WParam;
i2 := Message.LParam;
if trim(edtChen.Text) = '<27><>' then
begin
InputWeight.Text := format('%.2f', [i1 / 100000]);
end;
end;
procedure TfrmDyeMachInsp.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
if isCommopen then
begin
closeCom(DZCDYDllName);
closeCom(MBDYDllName);
end;
Action := caFree;
end;
procedure TfrmDyeMachInsp.InitCDGrid(MCIID: string);
begin
cxPageControl1.ActivePageIndex := 0;
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add('select * from Dye_Cloth_Inspect_Flaw where CIID=' + quotedstr(Trim(MCIID)));
Open;
end;
SCreateCDS(ADOTmp, CDS_2);
SInitCDSData(ADOTmp, CDS_2);
end;
procedure TfrmDyeMachInsp.InitCDGridCX(MCIID: string);
begin
cxPageControl1.ActivePageIndex := 1;
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add('select * from Dye_Cloth_Inspect_Flaw where CIID=' + quotedstr(Trim(MCIID)));
Open;
end;
SCreateCDS(ADOTmp, CDS_1);
SInitCDSData(ADOTmp, CDS_1);
end;
procedure TfrmDyeMachInsp.InitJYGrid();
var
MNetWeight, MJYLen: double;
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('select A.*');
sql.Add('from Dye_Cloth_Inspect A where PCId=''' + Trim(FPCId) + '''');
// sql.Add('and convert(varchar(10),filltime,120)=convert(varchar(10),getdate(),120)');
sql.Add('order by filltime desc');
// ShowMessage(SQL.Text);
Open;
end;
SCreateCDS(ADOQueryMain, CDS_3);
SInitCDSData(ADOQueryMain, CDS_3);
end;
procedure TfrmDyeMachInsp.FormShow(Sender: TObject);
begin
inherited;
ReadCxGrid(trim(Self.Caption) + 'Tv1', Tv1, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid(trim(Self.Caption) + 'Tv2', Tv2, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid(trim(Self.Caption) + 'Tv3', Tv3, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
fFlileFlag := UserDataFlag + 'HX';
InitCDPanel();
InitCDGrid(FCIID);
if IsINIFile() then
ReadINIFile()
else
WriteINIFile;
GetINIFile();
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
begin
if trim(DZCDYDllName) <> '' then
OpenCom(DZCDYDllName);
if trim(MBDYDllName) <> '' then
OpenCom(MBDYDllName);
edtScan.SetFocus;
end;
end;
procedure TfrmDyeMachInsp.InitCDPanel();
var
AA: array[0..100] of string;
i, j: Integer;
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select ZDYName from KH_Zdy where Type=''WFBCD'' order by ZDYNO ');
Open;
end;
if ADOTmp.IsEmpty then
begin
Application.MessageBox(<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>õ㣡', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
First;
i := 0;
while not Eof do
begin
AA[i] := Trim(fieldbyname('ZDYName').AsString);
i := i + 1;
Next;
end;
end;
i := i - 1;
if i > 69 then
begin
i := 69;
end;
for j := 0 to i do
begin
with ScrollBox1 do
begin
TSpeedButton(Controls[j]).Visible := True;
TSpeedButton(Controls[j]).Hint := AA[j];
if Length(AA[j]) > 4 then
begin
TSpeedButton(Controls[j]).Caption := Copy(Trim(AA[j]), 1, 4) + #13 + Copy(Trim(AA[j]), 5, Length(AA[j]) - 4);
end
else
TSpeedButton(Controls[j]).Caption := AA[j];
end;
end;
end;
procedure TfrmDyeMachInsp.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
if CDS_2.IsEmpty then
Exit;
// if FOperationStatus = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
// Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
if Trim(CDS_2.fieldbyname('CIFID').AsString) = '' then
begin
CDS_2.Delete;
end
else
begin
with ADOCmd do
begin
Close;
SQL.Clear;
// sql.Add('insert ZDel_Dye_Cloth_Inspect_Flaw into select * from Dye_Cloth_Inspect_Flaw where CIFID=''' + Trim(CDS_2.fieldbyname('CIFID').AsString) + '''');
sql.Add('delete Dye_Cloth_Inspect_Flaw where CIFID=''' + Trim(CDS_2.fieldbyname('CIFID').AsString) + '''');
ExecSQL;
end;
//<2F><><EFBFBD>´õ<C2B4><C3B5><EFBFBD>Ϣ
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Insp_Up @CIID=''' + Trim(CDS_2.fieldbyname('CIID').AsString) + '''');
sql.Add(',@InspType=' + QuotedStr('<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>'));
execsql;
end;
CDS_2.Delete;
end;
end;
procedure TfrmDyeMachInsp.Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('Grade').Index] = '<27><>Ʒ' then
ACanvas.Brush.Color := clRed;
end;
procedure TfrmDyeMachInsp.Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if CDS_3.isEmpty then
exit;
InitCDGridCX(CDS_3.FieldByName('CIID').AsString);
end;
function TfrmDyeMachInsp.SaveData(): Boolean;
var
maxno, MCIID, BZID, strsql: string;
MInputLen, MMeter, MYardage: Double;
MInputWeight, MGrossWeight, MNetWeight, MTare, MRuleBeforeTare, MRuleLaterTare, MAddWet: Double;
begin
if FOperationStatus = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
MCIID := FCIID;
end
else
begin
MCIID := '';
end;
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from Dye_Cloth_Inspect where CIID=''' + Trim(MCIID) + '''');
Open;
end;
with ADOCmd do
begin
if Trim(MCIID) = '' then
begin
if not GetLSNo(ADOTmp, maxno, 'D' + Trim(SCXFlag), 'Dye_Cloth_Inspect', 4, 1) then
raise Exception.Create('<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
Append;
FieldByName('Filler').Value := Trim(DName);
FieldByName('CIID').Value := Trim(maxno);
end
else
begin
maxno := Trim(MCIID);
Edit;
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
end;
FieldByName('Coefficient').Value := StrToFloatdef(trim(Coefficient.Text), 0); //ϵ<><CFB5>
///////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /////////////////////////
MRuleBeforeTare := StrToFloatdef(FRuleBeforeTare, 0);
MRuleLaterTare := StrToFloatdef(FRuleLaterTare, 0);
MAddWet := StrToFloatdef(FAddWet, 0);
MTare := MRuleBeforeTare + MRuleLaterTare + MAddWet; //Ƥ<><C6A4>
MInputWeight := RoundFloat(StrToFloatdef(trim(InputWeight.Text), 0), StrTointdef(KgPlace.Text, 0)); //ë<><C3AB>
MGrossWeight := MInputWeight + MRuleLaterTare + MAddWet; //ë<><C3AB>
MNetWeight := MInputWeight - MRuleBeforeTare; //<2F><><EFBFBD><EFBFBD>
FieldByName('InputWeight').Value := MInputWeight;
FieldByName('GrossWeight').Value := MGrossWeight;
FieldByName('NetWeight').Value := MNetWeight;
FieldByName('Tare').Value := MTare;
///////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /////////////////////////
///
///////////////////////// <20><><EFBFBD><EFBFBD><E6B3A4> /////////////////////////
MInputLen := RoundFloat(StrToFloatdef(trim(InputLen.Text), 0), 2);
if lblLenUnit.Caption = 'M' then
begin
MMeter := RoundFloat(StrToFloatdef(trim(InputLen.Text), 0), StrTointdef(MPlace.Text, 0));
MYardage := RoundFloat(MMeter / 0.9144, StrTointdef(YPlace.Text, 0));
end
else
begin
MYardage := RoundFloat((StrToFloatdef(trim(InputLen.Text), 0)), StrTointdef(YPlace.Text, 0));
MMeter := RoundFloat(MYardage * 0.9144, StrTointdef(MPlace.Text, 0));
end;
FieldByName('InputLen').Value := RoundFloat(StrToFloatdef(trim(InputLen.Text), 0), 2);
FieldByName('Meter').Value := MMeter;
FieldByName('Yardage').Value := MYardage;
FieldByName('LenUnit').Value := TRIM(lblLenUnit.Caption);
///////////////////////// <20><><EFBFBD><EFBFBD><E6B3A4> /////////////////////////
if FOperationStatus <> '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
if Trim(Edit3.Text) <> '' then
begin
FieldByName('Grade').Value := '<27><>Ʒ';
end;
if Trim(Edit4.Text) <> '' then
begin
FieldByName('Grade').Value := '<27><>Ʒ';
end;
FieldByName('PieceNo').Value := 0;
end;
FieldByName('OrderNo').value := Trim(FOrderNo);
FieldByName('MainId').value := Trim(FMainId);
FieldByName('SubId').value := Trim(FSubId);
FieldByName('ConNo').value := Trim(FConNo);
FieldByName('ConMId').value := Trim(FConMId);
FieldByName('ConSId').value := Trim(FConSId);
FieldByName('Workshop').value := Trim(FWorkshop);
FieldByName('CIIOFlag').Value := <><CEB4><EFBFBD><EFBFBD>';
FieldByName('PCId').value := FPCId;
FieldByName('C_Code').value := FC_Code;
FieldByName('C_Name').value := FC_Name;
FieldByName('BatchNO').value := FBatchNO;
FieldByName('C_Spec').value := FC_Spec;
FieldByName('C_Color').value := FC_Color;
FieldByName('C_ColorNo').value := FC_ColorNo;
FieldByName('C_StyleNo').value := FC_StyleNo;
FieldByName('C_Width').value := FC_Width;
FieldByName('C_GramWeight').value := FC_GramWeight;
FieldByName('C_Pattern').value := FC_Pattern;
FieldByName('C_CustPattern').value := FC_CustPattern;
FieldByName('C_ColorDepth').value := FC_ColorDepth;
FieldByName('CIMachNo').Value := Trim(SCXFlag);
Post;
end;
MCIID := Trim(maxno);
FCIID := Trim(maxno);
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ //////////////////
with CDS_2 do
begin
First;
while not Eof do
begin
if Trim(CDS_2.fieldbyname('CIFID').AsString) = '' then
begin
if not GetLSNo(ADOTmp, maxno, 'JC', 'Dye_Cloth_Inspect_Flaw', 5, 1) then
raise Exception.Create('<27><>ȡ<EFBFBD>õ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
end
else
begin
maxno := Trim(CDS_2.fieldbyname('CIFID').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from Dye_Cloth_Inspect_Flaw ');
sql.Add(' where CIFID=''' + Trim(maxno) + '''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_2.fieldbyname('CIFID').AsString) = '' then
Append
else
Edit;
RTSetSaveDataCDS(ADOCmd, Tv2, CDS_2, 'Dye_Cloth_Inspect_Flaw', 0);
FieldByName('CIID').Value := Trim(MCIID);
FieldByName('CIFID').Value := Trim(maxno);
Post;
end;
CDS_2.Edit;
CDS_2.FieldByName('CIID').Value := Trim(MCIID);
CDS_2.FieldByName('CIFID').Value := Trim(maxno);
Next;
end;
end;
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ //////////////////
///
////////////////// <20><><EFBFBD>¾<EFBFBD><C2BE>Ŵõ<C5B4><C3B5><EFBFBD>Ϣ //////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Insp_Up @CIID=''' + trim(MCIID) + '''');
if FOperationStatus = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
sql.Add(',@InspType=' + QuotedStr('<27><><EFBFBD>̿<EFBFBD>'))
else
sql.Add(',@InspType=' + QuotedStr('<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>'));
execsql;
end;
////////////////// <20><><EFBFBD>¾<EFBFBD><C2BE>Ŵõ<C5B4><C3B5><EFBFBD>Ϣ //////////////////
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Dye_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''ӡȾ<D3A1><C8BE>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(FPCId));
sql.Add(','<><C9BE>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(maxno));
sql.Add(') ');
execsql;
end;
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
///
ADOCmd.Connection.CommitTrans;
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BCB0><EFBFBD><EFBFBD> //////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Insp_In_Stk @CIID=''' + trim(MCIID) + '''');
Open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
application.MessageBox(PChar(trim(ADOCmd.FieldByName('ShowMsg').AsString)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Result := False;
end
else
begin
Result := True;
end;
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BCB0><EFBFBD><EFBFBD> //////////////////
except
ADOCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Result := False;
end;
end;
procedure TfrmDyeMachInsp.BTPrintClick(Sender: TObject);
var
fPrintFile: string;
mvalue: Double;
i: Integer;
begin
edtScan.SetFocus;
if CheckData('<27>ύ') = False then
exit;
if SaveData() then
begin
InputLen.Text := '';
InputWeight.Text := '';
Edit3.Text := '<27><>';
Edit4.Text := '';
if Trim(Edit6.Text) = '<27><>' then
begin
PrtData(FCIID);
end;
if Trim(edtaixun.Text) = '<27><>' then
begin
PrtAiXunData(FCIID);
end;
end;
InputLen.SetFocus;
CIFBegClick(InputLen);
FOperationStatus := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
InitJYGrid();
InitCDGrid('');
FCIID := '';
btnDel.Enabled := True;
end;
procedure TfrmDyeMachInsp.PrtData(MCIID: string);
var
fPrintFile, FLBName: string;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_Dye_Insp_Prt_Lab ');
SQL.Add(' @CIID=''' + Trim(MCIID) + '''');
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;
FLBName := Trim(ADOQueryPrint.fieldbyname('LBName').AsString);
ExportFtErpFile(FLBName + '.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLBName + '.rmf';
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
RM1.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
RM1.PrintReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
procedure TfrmDyeMachInsp.SpeedButton1Click(Sender: TObject);
var
fsj: string;
begin
fsj := Trim(TSpeedButton(Sender).Hint);
if Trim(fsj) = '' then
Exit;
if TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Name = 'KuangHao' 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 TfrmDyeMachInsp.SpeedButton49Click(Sender: TObject);
var
Key: Char;
begin
Key := #13;
if TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Name = 'edtScan' then
begin
edtScanKeyPress(edtScan, Key);
end;
end;
procedure TfrmDyeMachInsp.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;
procedure TfrmDyeMachInsp.SpeedButton13Click(Sender: TObject);
var
i: Integer;
begin
if CheckData('<27>õ<EFBFBD>') = False then
exit;
FCIFName := Trim(TSpeedButton(Sender).Hint);
MovePanel1.Visible := True;
lblCIFName.Caption := Trim(FCIFName);
//<2F><>ʾ<EFBFBD><CABE><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>
CIFBeg.Text := InputLen.Text;
with Panel3 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(CIFBeg.Name);
end;
end;
end;
end;
procedure TfrmDyeMachInsp.cxDBImage1DblClick(Sender: TObject);
begin
if TcxDBImage(Sender).Picture.Height = 0 then
exit;
LookImage(Qry_ImgHX.fieldbyname(TcxDBImage(Sender).Hint).asstring);
end;
procedure TfrmDyeMachInsp.Button1Click(Sender: TObject);
var
mvalue: Double;
begin
if Trim(CIFBeg.Text) <> '' then
begin
if Trim(CIFEnd.Text) <> '' then
begin
if StrToFloat(CIFEnd.Text) < StrToFloat(CIFBeg.Text) then
begin
Application.MessageBox('<27>õ<EFBFBD>λ<EFBFBD><CEBB>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
end;
if CIFQty.Text <> '' then
begin
if TryStrToFloat(CIFQty.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
with CDS_2 do
begin
Append;
if RadioGroup1.ItemIndex = 5 then
FieldByName('CIFName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(FCIFName)
else if RadioGroup1.ItemIndex = 4 then
FieldByName('CIFName').Value := '<27><>ƥ' + Trim(FCIFName)
else
FieldByName('CIFName').Value := Trim(FCIFName);
FieldByName('CIFbeg').Value := Trim(CIFBeg.Text);
FieldByName('CIFEnd').Value := Trim(CIFEnd.Text);
FieldByName('CIFPoints').Value := 0;
if RadioGroup1.ItemIndex > -1 then
begin
if RadioGroup1.ItemIndex < 3 then
begin
FieldByName('CIFPoints').Value := RadioGroup1.ItemIndex + 1;
end
else
begin
FieldByName('CIFPoints').Value := 4;
end;
end;
FieldByName('CIFQty').Value := StrToFloatdef(trim(CIFQty.Text), 0);
Post;
end;
CIFBeg.Text := '';
CIFEnd.Text := '';
CIFQty.Text := '';
MovePanel1.Visible := False;
cxPageControl1.ActivePageIndex := 0;
end;
procedure TfrmDyeMachInsp.btnRKClick(Sender: TObject);
var
MINo, MStkIds, MPOSNO, MPCIDS: string;
begin
if CDS_3.IsEmpty then
exit;
btnRK.Enabled := False;
if CDS_3.Locate('CIIOFlag', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', []) then
begin
Application.MessageBox('<27><><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if CDS_3.Locate('CIIOFlag', '<27>ѳ<EFBFBD><D1B3><EFBFBD>', []) then
begin
Application.MessageBox('<27><><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD><EFBFBD><EBB3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with CDS_3 do
begin
DisableControls;
First;
while not eof do
begin
if CDS_3.FieldByName('CIIOFlag').Value = <><CEB4><EFBFBD><EFBFBD>' then
begin
MStkIds := MStkIds + Trim(CDS_3.FieldByName('CIID').AsString) + ',';
MPCIDS := MPCIDS + Trim(CDS_3.FieldByName('PCID').AsString) + ',';
end;
next;
end;
EnableControls;
end;
MStkIds := copy(MStkIds, 1, Length(MStkIds) - 1);
if GetLSNo(ADOCmd, MINo, '9', 'Dye_Cloth_IO', 4, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><E2B5A5>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
ADOCmd.Connection.BeginTrans;
try
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Dye_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''ӡȾ<D3A1><C8BE>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(MPCIDS));
sql.Add(',''<27><><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(MStkIds));
sql.Add(') ');
execsql;
end;
with ADOCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_Cloth_In ');
Sql.Add('@StkIds=' + quotedstr(trim(MStkIds)));
Sql.Add(',@IOTime=' + Quotedstr(FormatDateTime('yyyy-MM-dd', SGetServerDate(ADOTmp))));
Sql.Add(',@IOType=' + Quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'));
Sql.Add(',@IONO=' + Quotedstr(MINo));
Sql.Add(',@StkPosition=' + Quotedstr(''));
Sql.Add(',@FillId=' + Quotedstr(DCode));
Sql.Add(',@Filler=' + Quotedstr(DName));
Open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOCmd.FieldByName('ShowMsg').AsString)));
end;
ADOCmd.Connection.CommitTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
btnRK.Enabled := True;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Card_PSC ');
execsql;
end;
except
btnRK.Enabled := True;
ADOCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmDyeMachInsp.ToolButton2Click(Sender: TObject);
begin
if CDS_3.IsEmpty then
exit;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD>´<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
try
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add(' select * from Dye_Cloth_IO A where IOFlag=''<27><><EFBFBD><EFBFBD>'' ');
SQL.Add(' and A.StkId=''' + trim(CDS_3.fieldbyName('CIID').AsString) + '''');
Open;
end;
PrtMD(ADOTmp.fieldbyName('IONo').AsString);
except
application.MessageBox('<27><><EFBFBD>´<EFBFBD>ӡʧ<D3A1><CAA7>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
end;
end;
procedure TfrmDyeMachInsp.edtScanKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
if trim(edtScan.Text) = '' then
exit;
if pos('SM', edtScan.Text) = 0 then
begin
edtScan.Text := 'SM' + trim(edtScan.Text);
end;
if trim(edtScan.Text) = FPCId then
exit;
ClearGlobal();
FOperationStatus := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
InitLCK(edtScan.Text);
InitJYGrid();
InputLen.SetFocus;
end;
end;
procedure TfrmDyeMachInsp.CIFBegClick(Sender: TObject);
var
i: Integer;
begin
with Panel3 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 TfrmDyeMachInsp.CIFEndChange(Sender: TObject);
var
mvalue: Double;
begin
if Trim(CIFBeg.Text) <> '' then
begin
if TryStrToFloat(CIFBeg.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
Exit;
end;
if Trim(CIFEnd.Text) <> '' then
begin
if TryStrToFloat(CIFEnd.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
Exit;
end;
CIFQty.Text := FloatToStr(StrToFloat(CIFEnd.Text) - StrToFloat(CIFBeg.Text));
end;
procedure TfrmDyeMachInsp.Edit3Click(Sender: TObject);
begin
if Trim(Edit3.Text) = '' then
begin
Edit3.Text := '<27><>';
Edit4.Text := '';
end
else
begin
Edit3.Text := '';
Edit4.Text := '<27><>';
end;
end;
procedure TfrmDyeMachInsp.Edit4Click(Sender: TObject);
begin
if Trim(Edit4.Text) = '' then
begin
Edit4.Text := '<27><>';
Edit3.Text := '';
end
else
begin
Edit4.Text := '';
Edit3.Text := '<27><>';
end;
end;
procedure TfrmDyeMachInsp.Edit6Click(Sender: TObject);
begin
if Trim(Edit6.Text) = '' then
begin
Edit6.Text := '<27><>';
end
else
begin
Edit6.Text := '';
end;
end;
procedure TfrmDyeMachInsp.MinLenExit(Sender: TObject);
begin
SetINIFile();
end;
procedure TfrmDyeMachInsp.MJstr3KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmDyeMachInsp.Button2Click(Sender: TObject);
begin
RadioGroup1.ItemIndex := -1;
end;
procedure TfrmDyeMachInsp.Button3Click(Sender: TObject);
begin
if Panel6.Visible then
Panel6.Visible := False
else
Panel6.Visible := True;
end;
procedure TfrmDyeMachInsp.InputLenChange(Sender: TObject);
begin
QuantityConversion();
end;
procedure TfrmDyeMachInsp.InputWeightChange(Sender: TObject);
begin
QuantityConversion();
end;
procedure TfrmDyeMachInsp.edtScanClick(Sender: TObject);
var
i: Integer;
begin
Panel3.Visible := True;
with Panel3 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 TfrmDyeMachInsp.NetWeightKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
BTPrint.Click;
end;
end;
procedure TfrmDyeMachInsp.FormCreate(Sender: TObject);
begin
inherited;
IsCommopen := false;
end;
procedure TfrmDyeMachInsp.lblLenUnitClick(Sender: TObject);
begin
if Trim(lblLenUnit.Caption) = 'M' then
SetUnit('Y')
else
SetUnit('M');
end;
procedure TfrmDyeMachInsp.Button4Click(Sender: TObject);
begin
MovePanel1.Visible := false;
end;
procedure TfrmDyeMachInsp.ToolButton3Click(Sender: TObject);
begin
if CDS_3.IsEmpty then
Exit;
PrtData(CDS_3.fieldbyname('CIID').AsString);
end;
procedure TfrmDyeMachInsp.ToolButton4Click(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'WFBCD';
flagname := '<27>õ<EFBFBD>';
fnote := True;
V1Note.Caption := <><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
Self.InitCDPanel();
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmDyeMachInsp.btnDelClick(Sender: TObject);
begin
if CDS_3.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
ADOCmd.Connection.BeginTrans;
try
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Dye_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''ӡȾ<D3A1><C8BE>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(Trim(CDS_3.fieldbyname('PCID').AsString)));
sql.Add(','<><C9BE>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(Trim(CDS_3.fieldbyname('CIID').AsString)));
sql.Add(') ');
execsql;
end;
with ADOCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_Insp_Del ');
Sql.Add('@CIIDS=' + quotedstr(Trim(CDS_3.fieldbyname('CIID').AsString)));
Sql.Add(',@DCode=' + Quotedstr(DCode));
Sql.Add(',@DName=' + Quotedstr(DName));
Open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOCmd.FieldByName('ShowMsg').AsString)));
end;
ADOCmd.Connection.CommitTrans;
CDS_3.Delete;
application.MessageBox(<><C9BE><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
except
ADOCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmDyeMachInsp.ToolButton6Click(Sender: TObject);
begin
if CDS_3.IsEmpty then
Exit;
btnDel.Enabled := False;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Dye_Cloth_IO where StkId=''' + Trim(CDS_3.fieldbyname('CIID').AsString) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Dye_Cloth_IO where StkId=''' + Trim(CDS_3.fieldbyname('CIID').AsString) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
Exit;
end;
InitJTM(CDS_3.fieldbyname('CIID').AsString);
end;
procedure TfrmDyeMachInsp.ToolButton7Click(Sender: TObject);
begin
WriteCxGrid(trim(Self.Caption) + 'Tv1', Tv1, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid(trim(Self.Caption) + 'Tv2', Tv2, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid(trim(Self.Caption) + 'Tv3', Tv3, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmDyeMachInsp.ToolButton8Click(Sender: TObject);
begin
Close;
end;
procedure TfrmDyeMachInsp.btnCXRKClick(Sender: TObject);
var
MStkIds, MPCIDS: string;
begin
if CDS_3.IsEmpty then
exit;
btnCXRK.Enabled := False;
with CDS_3 do
begin
DisableControls;
First;
while not eof do
begin
MStkIds := MStkIds + Trim(CDS_3.FieldByName('CIID').AsString) + ',';
MPCIDS := MPCIDS + Trim(CDS_3.FieldByName('PCID').AsString) + ',';
next;
end;
EnableControls;
end;
MStkIds := copy(MStkIds, 1, Length(MStkIds) - 1);
try
ADOCmd.Connection.BeginTrans;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Dye_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''ӡȾ<D3A1><C8BE>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(MPCIDS));
sql.Add(',''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(MStkIds));
sql.Add(') ');
execsql;
end;
with ADOCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_Cloth_ReIn ');
Sql.Add(' @StkIds=' + quotedstr(trim(MStkIds)));
Sql.Add(',@IOIDS='''' ');
Sql.Add(',@FillId=' + Quotedstr(DCode));
Sql.Add(',@Filler=' + Quotedstr(DName));
Open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOCmd.FieldByName('ShowMsg').AsString)));
end;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
ADOCmd.Connection.CommitTrans;
btnCXRK.Enabled := True;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Card_PSC ');
execsql;
end;
except
ADOCmd.Connection.RollbackTrans;
btnCXRK.Enabled := True;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmDyeMachInsp.edtaixunClick(Sender: TObject);
begin
if Trim(edtaixun.Text) = '' then
begin
edtaixun.Text := '<27><>';
end
else
begin
edtaixun.Text := '';
end;
end;
procedure TfrmDyeMachInsp.edtChenClick(Sender: TObject);
begin
if Trim(TEdit(Sender).Text) = '' then
begin
TEdit(Sender).Text := '<27><>';
end
else
begin
TEdit(Sender).Text := '';
end;
SetINIFile();
end;
procedure TfrmDyeMachInsp.edtYJClick(Sender: TObject);
begin
if Trim(TEdit(Sender).Text) = '' then
begin
TEdit(Sender).Text := '<27><>';
end
else
begin
TEdit(Sender).Text := '';
end;
end;
procedure TfrmDyeMachInsp.Button6Click(Sender: TObject);
begin
if ScrollBox1.Visible then
ScrollBox1.Visible := False
else
ScrollBox1.Visible := True;
end;
procedure TfrmDyeMachInsp.Button8Click(Sender: TObject);
begin
if Panel7.Visible then
Panel7.Visible := False
else
Panel7.Visible := True;
end;
end.