D7szYidui/布匹检验(FabricInspection.dll)/U_GreyInspection.pas
DESKTOP-E401PHE\Administrator ef99fc8b5e 移交
2025-07-19 09:32:10 +08:00

2438 lines
64 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_GreyInspection;
interface
uses
Windows, Messages, SysUtils, 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, IniFiles, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
StrUtils, dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter;
type
TfrmGreyInspection = class(TForm)
cxGridPopupMenu1: TcxGridPopupMenu;
DataSource1: TDataSource;
Order_MJ: TClientDataSet;
ADOCmd: TADOQuery;
RMDB_Main: TRMDBDataSet;
RM2: TRMGridReport;
DS_MJCD: TDataSource;
CDS_MJCD: TClientDataSet;
DS_MJID: TDataSource;
CDS_MJID: TClientDataSet;
ADOQueryPrint: 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;
cxGridPopupMenu2: TcxGridPopupMenu;
ADOQueryMainDSC: TADOQuery;
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;
Panel2: TPanel;
Label9: TLabel;
JYLen1: TEdit;
Label4: TLabel;
Label5: TLabel;
Label11: TLabel;
BTPrint: TButton;
Button5: TButton;
Edit3: TEdit;
Label10: TLabel;
Edit4: TEdit;
Label12: TLabel;
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;
SpeedButton49: TSpeedButton;
Label30: TLabel;
JYTare: TEdit;
Label31: TLabel;
Label32: TLabel;
JYNW: TEdit;
Label33: TLabel;
Panel7: TPanel;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
tv2CDType: TcxGridDBColumn;
ZZPerson: TcxGridDBColumn;
Tv2CDReason: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
OrdNote: TRichEdit;
SpeedButton19: TSpeedButton;
SpeedButton20: TSpeedButton;
SpeedButton27: TSpeedButton;
SpeedButton28: TSpeedButton;
SpeedButton35: TSpeedButton;
SpeedButton36: TSpeedButton;
Label36: TLabel;
RM3: TRMGridReport;
JYxh: TEdit;
ADOTmp: TADOQuery;
Panel5: TPanel;
Panel6: TPanel;
Label1: TLabel;
Label35: TLabel;
Label39: TLabel;
Scan: TEdit;
Edit7: TEdit;
Edit8: TEdit;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
TBCD: TToolButton;
TBClose: TToolButton;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
v3Column1: TcxGridDBColumn;
v3Column2: TcxGridDBColumn;
v3Column3: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
Label2: TLabel;
Label13: TLabel;
JYXS: TEdit;
ToolButton2: TToolButton;
BatchNo: TEdit;
Label3: TLabel;
person1: TEdit;
person2: TEdit;
Label14: TLabel;
Label6: TLabel;
Label15: TLabel;
JYLen2: TEdit;
ToolButton3: TToolButton;
Label16: TLabel;
Label19: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
JYLen3: TEdit;
person3: TEdit;
person4: TEdit;
JYLen4: TEdit;
Label25: TLabel;
Label27: TLabel;
Label28: TLabel;
person5: TEdit;
JYLen5: TEdit;
QryCheckNet: TADOQuery;
Label29: TLabel;
edtDel: TEdit;
lblJYPS: TLabel;
MovePanel1: TMovePanel;
Label7: TLabel;
Button1: TButton;
Button4: TButton;
JXiuPrice: TEdit;
Label8: TLabel;
ToolButton4: TToolButton;
lblJYLen: TLabel;
JXiuKouK: TEdit;
Label17: TLabel;
Label18: TLabel;
DCheKouK: TEdit;
Label37: TLabel;
ToolButton5: TToolButton;
v2Column2: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
SpeedButton84: TSpeedButton;
lbl1: TLabel;
lbl2: TLabel;
JYGW: TEdit;
Tv3Column1: TcxGridDBColumn;
Label40: TLabel;
Edit1: TEdit;
Tv3Column2: TcxGridDBColumn;
Label41: TLabel;
WXPH: TEdit;
Label20: TLabel;
Label38: TLabel;
Label42: TLabel;
Label43: TLabel;
Label44: TLabel;
Label45: TLabel;
DChePrice: TEdit;
DCGKaiJ: TEdit;
Tv2Column1: TcxGridDBColumn;
SpeedButton43: TSpeedButton;
Panel1: TPanel;
Label26: TLabel;
Label34: TLabel;
Edit6: TEdit;
ComboBox1: TComboBox;
Label46: TLabel;
kaijian: TEdit;
CDLEN: TEdit;
Label48: TLabel;
Label47: TLabel;
Tv2Column2: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure TBCDClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BTPrintClick(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
procedure cxGridDBColumn2PropertiesChange(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure SpeedButton49Click(Sender: TObject);
procedure ScanKeyPress(Sender: TObject; var Key: Char);
procedure Edit3Click(Sender: TObject);
procedure Edit4Click(Sender: TObject);
procedure Edit6Click(Sender: TObject);
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
procedure JYGWChange(Sender: TObject);
procedure ScanClick(Sender: TObject);
procedure Edit7Click(Sender: TObject);
procedure JYNWKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure Edit8Click(Sender: TObject);
procedure JYLen1Change(Sender: TObject);
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure person1Click(Sender: TObject);
procedure person2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure person5Click(Sender: TObject);
procedure person4Click(Sender: TObject);
procedure person3Click(Sender: TObject);
procedure edtDelClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure DCheKouKClick(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure JXiuKouKClick(Sender: TObject);
procedure Label9Click(Sender: TObject);
procedure Label6Click(Sender: TObject);
procedure Label16Click(Sender: TObject);
procedure Label23Click(Sender: TObject);
procedure Label27Click(Sender: TObject);
procedure Edit1Click(Sender: TObject);
procedure SpeedButton43Click(Sender: TObject);
procedure JYLen1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure JYLen2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure JYLen3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure JYLen4MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure JYLen5MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
FColumn, FFFMJID, FOperationStatus: string;
FAPID, FSPID, FMainId, FSubId, FMJCode, FMJName, FMJSpec, FMJMF, FMJKZ, FMJColor, FAPBatchNo, FCarNo, FISJSKZ: string; // <20><>Ʒ<EFBFBD><C6B7>Ϣ
FMF_Wai, FJSKZ, FKONGJIA, fkongjiawei: Double;
FCDName: string; //<2F>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>
isCommopen, IsJsMessage: boolean;
fxsType, fRollType: string;
procedure InitBatchNo(); //ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
procedure InitDefectOptions(); //ˢ<>´õ<C2B4>ѡ<EFBFBD><D1A1>
procedure InitCDGrid(); //ˢ<>´õ<C2B4><C3B5><EFBFBD>Ϣ
procedure InitInspectionRecord(); //ˢ<>¼<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>
function SelfConnData(): Boolean; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure ScanOrder(); //ɨ<><EFBFBD><E8B6A9>
procedure ScanSample(); //ɨ<><C9A8><EFBFBD><EFBFBD>Ʒ
procedure ScanAnPai(); //ɨ<>貼Ʊ
procedure ClearGlobal(MStatus: string); //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ID
procedure PrintCKMDG(MRKOrdID: string); //<2F><>ӡ<EFBFBD><D3A1><EFBFBD>
procedure PrtData(FMJID: string); //<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>ǩ
procedure QuantityConversion(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure OpenCom(DllName: string);
procedure CloseCom(DllName: string);
procedure DelDate(FMJID: string); //ɾ<><C9BE><EFBFBD><EFBFBD>ǩ
procedure On1201(var Message: Tmessage); message 1201;
procedure On1301(var Message: Tmessage); message 1301;
public
fmanage: string;
I3: Double;
{ Public declarations }
end;
var
frmGreyInspection: TfrmGreyInspection;
newh, newh1: hwnd;
IniFile: TIniFile;
implementation
uses
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_SCPerson,
U_FinishedClothStatistical;
{$R *.dfm}
procedure TfrmGreyInspection.DelDate(FMJID: string);
var
FJYID: string;
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_Cloth_CR where APID=''' + Trim(FMJID) + '''');
sql.Add('and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
Open;
end;
if ADOTmp.RecordCount >= 1 then
begin
Application.MessageBox('<27>ѳ<EFBFBD><D1B3><EFBFBD><E2B2BB>ɨ<EFBFBD><C9A8>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select top 1 * from CK_Cloth_CR where APID=''' + Trim(FMJID) + '''');
Open;
end;
FJYID := Trim(ADOTmp.fieldbyname('JYID').AsString);
try
ADOCmd.Connection.BeginTrans;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_Cloth_CR Set CRTime=NULL,CRType=NULL,CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ,RKNo=NULL where CK_Cloth_CR.CRFlag=''<27><><EFBFBD><EFBFBD>'' and CK_Cloth_CR.JYID=''' + Trim(FJYID) + '''');
sql.Add('UPDATE CK_Cloth_KC Set Valid=''N'' where CK_Cloth_KC.JYID=''' + Trim(FJYID) + '''');
sql.Add('UPDATE JY_Cloth Set JYCRType='<><CEB4><EFBFBD><EFBFBD>'',RKNo=null where JY_Cloth.JYID=''' + Trim(FJYID) + '''');
sql.Add('delete JY_Cloth where JYID=''' + Trim(FJYID) + '''');
sql.Add('delete CK_Cloth_CR where JYID=''' + Trim(FJYID) + '''');
sql.Add('delete CK_Cloth_KC where JYID=''' + Trim(FJYID) + '''');
sql.Add('delete JY_Cloth_CD where JYID=''' + Trim(FJYID) + '''');
sql.Add('update PD_Plan_AnPai set jyflag=(case when isnull((select count(*) from JY_Cloth where apid=''' + trim(FMJID) + '''),0)>0 then 1 else 0 end)');
sql.Add('where apid =''' + trim(FMJID) + ''' ');
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ϳ<EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
sql.Add(',' + quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD>룺' + trim(FMJID)));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
ExecSQL;
end;
if not CDS_MJID.IsEmpty then
begin
if CDS_MJID.Locate('JYID', FJYID, []) then
CDS_MJID.Delete;
end;
FAPID := FMJID;
FFFMJID := FJYID;
InitInspectionRecord();
InitCDGrid();
ADOCmd.Connection.CommitTrans;
Application.MessageBox(<><C9BE><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
except
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C9BE>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
end;
edtDel.Text := '';
end;
function TfrmGreyInspection.SelfConnData(): Boolean;
begin
try
with QryCheckNet do
begin
Close;
sql.Clear;
//<2F><>ѯһ<D1AF><D2BB>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SQL.Add('select getdate()');
Open;
end;
Result := true;
except
// if Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>磡','<27><>ʾ',32+4)<>IDYES then Exit;
if not Assigned(DataLink_FabricInspection) then
DataLink_FabricInspection := DataLink_FabricInspection.Create(Application);
try
with DataLink_FabricInspection.ADOLink do
begin
//if not Connected then
begin
Connected := false;
ConnectionString := DConString;
LoginPrompt := false;
Connected := true;
end;
end;
Result := true;
except
Result := false;
end;
end;
end;
procedure TfrmGreyInspection.InitBatchNo();
var
fsj: string;
begin
// fsj := 'select distinct(ZdyName) name from KH_ZDY A where A.Type=''GreyBatchNo'' ';
// SInitComBoxBySql(ADOTmp, BatchNo, False, fsj);
end;
procedure TfrmGreyInspection.QuantityConversion();
var
MLen, MNWet, MGWet, MPWet, MCC, XiShu, MGreyLen: Double;
begin
// MLen := StrToFloatdef(trim(JYLen.Text), 0);
// MNWet := StrToFloatdef(trim(JYNW.Text), 0);
// MPWet := StrToFloatdef(trim(JYTare.Text), 0);
// MGWet := StrToFloatdef(trim(JYGW.Text), 0);
// MCC := StrToFloatdef(trim(JYXS.Text), 0);
// if MCC > 0 then
// begin
// MGWet := StrToFloat(format('%.1f', [MLen * MCC]));
// MNWet := MGWet - MPWet;
// JYGW.Text := FloatToStr(MGWet);
// JYNW.Text := FloatToStr(MNWet);
// end;
//
// MNWet := MGWet - MPWet;
// JYNW.Text := FloatToStr(MNWet);
end;
function TfrmGreyInspection.CheckData(CKType: string): Boolean;
var
mvalue, i4: Double;
begin
try
if Trim(FMainId) = '' then
raise Exception.Create('<27>˲<EFBFBD>Ʊ<EFBFBD>Ѽ<EFBFBD><D1BC><EFBFBD>,<2C><>ɨ<EFBFBD><C9A8><EFBFBD>²<EFBFBD>Ʊ<EFBFBD><C6B1>');
if Trim(CKType) = '<27>ύ' then
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add(' select * from JY_Cloth where APID=' + QuotedStr(Trim(FAPID)));
Open;
end;
if ADOTmp.IsEmpty = FALSE then
begin
raise Exception.Create('<27>˲<EFBFBD>Ʊ<EFBFBD>Ѽ<EFBFBD><D1BC><EFBFBD>,<2C><>ɨ<EFBFBD><C9A8><EFBFBD>²<EFBFBD>Ʊ<EFBFBD><C6B1>');
end;
// if (strtofloatdef(trim(JYLen1.Text), 0) < 0.00) or (strtofloatdef(trim(JYLen2.Text), 0) < 0.00) or (strtofloatdef(trim(JYLen3.Text), 0) < 0.00) or (strtofloatdef(trim(JYLen4.Text), 0) < 0.00) or (strtofloatdef(trim(JYLen5.Text), 0) < 0.00) then
// raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>0!');
if (strtofloatdef(trim(JYLen1.Text), 0) + strtofloatdef(trim(JYLen2.Text), 0) + strtofloatdef(trim(JYLen3.Text), 0) + strtofloatdef(trim(JYLen4.Text), 0) + strtofloatdef(trim(JYLen5.Text), 0)) <= 0.00 then
raise Exception.Create('<27>ܳ<EFBFBD><DCB3>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>0!');
if (Trim(JYLen1.Text) <> '') or (Trim(JYLen2.Text) <> '') or (Trim(JYLen3.Text) <> '') or (Trim(JYLen4.Text) <> '') or (Trim(JYLen5.Text) <> '') then
begin
if (strtofloatdef(trim(JYLen1.Text), 0) > 400) or (strtofloatdef(trim(JYLen2.Text), 0) > 400) or (strtofloatdef(trim(JYLen3.Text), 0) > 400) or (strtofloatdef(trim(JYLen4.Text), 0) > 400) or (strtofloatdef(trim(JYLen5.Text), 0) > 400) then
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2>ܴ<EFBFBD><DCB4><EFBFBD>400!');
end;
if (strtofloatdef(trim(JYLen1.Text), 0) = 0) and (strtofloatdef(trim(JYLen2.Text), 0) = 0) and (strtofloatdef(trim(JYLen3.Text), 0) = 0) and (strtofloatdef(trim(JYLen4.Text), 0) = 0) and (strtofloatdef(trim(JYLen5.Text), 0) = 0) then
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ0!!');
if (strtofloatdef(trim(JYGW.Text), 0) > 100) then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>100!!');
if Edit7.Text <> '' then
begin
i4 := RoundFloat(I3 + 0.1, 0);
if (JYLen5.Text <> '') and (JYLen4.Text <> '') and (JYLen3.Text <> '') and (JYLen2.Text <> '') and (JYLen1.Text <> '') then
begin
JYLen5.Text := FloatToStr(i4 - strtofloat(jylen4.Text) - strtofloat(jylen3.Text) - strtofloat(jylen2.Text) - strtofloat(jylen1.Text));
end
else if (JYLen4.Text <> '') and (JYLen3.Text <> '') and (JYLen2.Text <> '') and (JYLen1.Text <> '') then
begin
JYLen4.Text := FloatToStr(i4 - strtofloat(jylen3.Text) - strtofloat(jylen2.Text) - strtofloat(jylen1.Text));
end
else if (JYLen3.Text <> '') and (JYLen2.Text <> '') and (JYLen1.Text <> '') then
begin
JYLen3.Text := FloatToStr(i4 - strtofloat(jylen2.Text) - strtofloat(jylen1.Text));
end
else if (JYLen2.Text <> '') and (JYLen1.Text <> '') then
begin
JYLen2.Text := FloatToStr(i4 - strtofloat(jylen1.Text));
end
else if (JYLen1.Text <> '') then
begin
JYLen1.Text := FloatToStr(i4);
end;
end;
end;
//ShowMessage(JYLen2.Text);
Result := True;
except
Result := false;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmGreyInspection.ClearGlobal(MStatus: string);
begin
if MStatus = <><C9A8>' then
begin
FAPID := '';
FSPID := '';
FMainId := '';
FSubId := '';
FFFMJID := '';
FMJCode := '';
FMJName := '';
FMJSpec := '';
FMJMF := '';
FMJKZ := '';
FMJColor := '';
FAPBatchNo := '';
FCarNo := '';
FMF_Wai := 0;
FJSKZ := 0;
FISJSKZ := '';
JYxh.Text := '';
JYXS.Text := '';
JYGW.Text := '';
JYNW.Text := '';
JYLen1.Text := '';
JYLen2.Text := '';
BatchNo.Text := '';
end;
if MStatus = '<27>ύ' then
begin
JYLen1.Text := '';
JYLen2.Text := '';
JYGW.Text := '';
JYNW.Text := '';
FOperationStatus := '';
FFFMJID := '';
//FAPID := '';
end;
end;
procedure TfrmGreyInspection.PrintCKMDG(MRKOrdID: string);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' exec P_Print_RKMDGangNo ');
SQL.Add(' @RKOrdID=''' + Trim(MRKOrdID) + '''');
Open;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(ADOQueryPrint.fieldbyname('RKOrdID').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;
ExportFtErpFile('<27><EFBFBD><E9B2BC><EFBFBD>ֿ<EFBFBD><D6BF>뵥.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><EFBFBD><E9B2BC><EFBFBD>ֿ<EFBFBD><D6BF>뵥.rmf';
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM2.LoadFromFile(fPrintFile);
Rm2.DefaultCopies := 1;
RM2.ShowReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
Exit;
end;
end;
procedure TfrmGreyInspection.ScanSample();
var
MFromMJLen: Double;
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from CP_YDang ');
sql.Add('where CYID=''' + Trim(Scan.Text) + '''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
FMJCode := Trim(ADOTmp.fieldbyname('SPCode').AsString);
FMJName := Trim(ADOTmp.fieldbyname('SPName').AsString);
FMJSpec := Trim(ADOTmp.fieldbyname('SPSpec').AsString);
FMJMF := Trim(ADOTmp.fieldbyname('SPMF').AsString);
FMJKZ := Trim(ADOTmp.fieldbyname('SPKZ').AsString);
FMJColor := trim(ADOTmp.fieldbyname('SPColor').AsString);
JYxh.Text := '1';
OrdNote.Text := '<27><><EFBFBD><EFBFBD>:' + FMJCode + #13;
OrdNote.Text := OrdNote.Text + 'Ʒ<><C6B7>:' + FMJName + #13;
OrdNote.Text := OrdNote.Text + '<27>ŷ<EFBFBD>:' + FMJMF + #13;
OrdNote.Text := OrdNote.Text + '<27><><EFBFBD><EFBFBD>:' + FMJKZ + #13;
OrdNote.Text := OrdNote.Text + '<27><>ɫ:' + FMJColor + #13;
end
else
begin
ClearGlobal(<><C9A8>');
end;
InitInspectionRecord();
InitCDGrid();
Scan.Text := '';
end;
procedure TfrmGreyInspection.ScanOrder();
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select A.*,B.* ');
sql.Add(',maxRoll=1+isnull((select cast (max(mjxh) as int) from FinishedCloth_Inspect X where X.subid=B.subid and X.MJType =''<27><>Ʒ'' ),0)');
sql.Add('from Cloth_Main A ');
sql.Add('inner join Cloth_Sub B on A.MainId=B.MainId');
sql.Add('where A.MainID=''' + Trim(Scan.Text) + '''');
sql.Add(' and A.OrderType=''<27><>֯֯<D6AF>쵥''');
//ShowMessage(SQL.Text);
Open;
end;
if not ADOTmp.IsEmpty then
begin
FAPID := '';
// FSPID := Trim(ADOTmp.fieldbyname('SPID').AsString);
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
FMJCode := Trim(ADOTmp.fieldbyname('C_Code').AsString);
FMJName := Trim(ADOTmp.fieldbyname('C_CodeName').AsString);
FMJSpec := Trim(ADOTmp.fieldbyname('C_Spec').AsString);
FMJMF := Trim(ADOTmp.fieldbyname('MF').AsString);
FMJKZ := Trim(ADOTmp.fieldbyname('KZ').AsString);
FMJColor := trim(ADOTmp.fieldbyname('C_Color').AsString);
JYxh.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString);
OrdNote.Text := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + Trim(ADOTmp.fieldbyname('ConNo').AsString) + #13;
OrdNote.Text := OrdNote.Text + '<27><><EFBFBD><EFBFBD>:' + FMJCode + #13;
OrdNote.Text := OrdNote.Text + 'Ʒ<><C6B7>:' + FMJName + #13;
OrdNote.Text := OrdNote.Text + '<27>ŷ<EFBFBD>:' + FMJMF + #13;
OrdNote.Text := OrdNote.Text + '<27><><EFBFBD><EFBFBD>:' + FMJKZ + #13;
OrdNote.Text := OrdNote.Text + '<27><>ɫ:' + FMJColor + #13;
OrdNote.Text := OrdNote.Text + '<27>ر<EFBFBD><D8B1><EFBFBD>ʾ:' + Trim(ADOTmp.fieldbyname('Note').AsString);
end
else
begin
ClearGlobal(<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>');
end;
InitInspectionRecord();
InitCDGrid();
Scan.Text := '';
end;
procedure TfrmGreyInspection.ScanAnPai();
var
FAPXH, FCAPXH: string;
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from JY_Cloth where APID = ''' + Trim(Scan.Text) + '''');
Open;
end;
if not ADOCmd.IsEmpty then
begin
application.MessageBox('<27>ظ<EFBFBD>ɨ<EFBFBD>貼Ʊ<E8B2BC><C6B1>', '<27><>ʾ', 0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select PCID,APXH from PD_Plan_AnPai where APID = ''' + Trim(Scan.Text) + '''');
Open;
end;
if not ADOCmd.IsEmpty then
begin
if ADOCmd.fieldbyname('APXH').AsInteger - 1 <> 0 then
begin
FAPXH := IntToStr(ADOCmd.fieldbyname('APXH').AsInteger - 1);
FCAPXH := ADOCmd.fieldbyname('APXH').AsString;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select JYFlag from PD_Plan_AnPai where PCID = ''' + Trim(ADOCmd.fieldbyname('PCID').AsString) + '''');
SQL.Add(' and APXH=' + QuotedStr(Trim(FAPXH)));
Open;
end;
if Trim(ADOTmp.fieldbyname('JYFlag').AsString) <> 'True' then
begin
FAPXH := '<27><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>: ' + FCAPXH + #13 + FAPXH + '<27>Ų<EFBFBD><C5B2><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if MessageBox(self.Handle, PChar(FAPXH), '<27><>ʾ', MB_OKCANCEL or MB_ICONINFORMATION) = IDOK then
begin
Next;
end
else
begin
Exit;
end;
end;
end;
end;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('exec P_Get_ScanAnPai ''' + Trim(Scan.Text) + '''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
FAPID := Trim(ADOTmp.fieldbyname('APID').AsString);
// FSPID := Trim(ADOTmp.fieldbyname('SPID').AsString);
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
FMJCode := Trim(ADOTmp.fieldbyname('P_Code').AsString);
FMJName := Trim(ADOTmp.fieldbyname('P_CodeName').AsString);
FMJSpec := Trim(ADOTmp.fieldbyname('P_Spec').AsString);
FMJMF := Trim(ADOTmp.fieldbyname('P_MF').AsString);
FMF_Wai := ADOTmp.fieldbyname('MF_Wai').AsFloat;
FJSKZ := ADOTmp.fieldbyname('JSKZ').AsFloat;
FISJSKZ := Trim(ADOTmp.fieldbyname('ISJSKZ').AsString);
FMJKZ := Trim(ADOTmp.fieldbyname('P_KZ').AsString);
FMJColor := trim(ADOTmp.fieldbyname('P_Color').AsString);
JYxh.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString);
BatchNo.Text := Trim(ADOTmp.fieldbyname('APBatchNo').AsString);
FKONGJIA := StrToFloatDEF(ADOTmp.fieldbyname('KONGJIA').AsString, 0);
fkongjiawei := StrToFloatDEF(ADOTmp.fieldbyname('kongjiawei').AsString, 0);
OrdNote.Text := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + Trim(ADOTmp.fieldbyname('orderno').AsString) + #13;
OrdNote.Text := OrdNote.Text + '<27><><EFBFBD><EFBFBD>:' + FMJCode + #13;
OrdNote.Text := OrdNote.Text + 'Ʒ<><C6B7>:' + FMJName + #13;
OrdNote.Text := OrdNote.Text + '<27>ŷ<EFBFBD>:' + FMJMF + #13;
OrdNote.Text := OrdNote.Text + '<27><><EFBFBD><EFBFBD>:' + FMJKZ + #13;
OrdNote.Text := OrdNote.Text + '<27><>ɫ:' + FMJColor + #13;
OrdNote.Text := OrdNote.Text + '<27>ر<EFBFBD><D8B1><EFBFBD>ʾ:' + Trim(ADOTmp.fieldbyname('P_Note').AsString);
end
else
begin
ClearGlobal(<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>');
end;
InitInspectionRecord();
InitCDGrid();
Scan.Text := '';
end;
procedure TfrmGreyInspection.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 TfrmGreyInspection.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 TfrmGreyInspection.FormDestroy(Sender: TObject);
begin
frmGreyInspection := nil;
end;
procedure TfrmGreyInspection.On1301(var Message: Tmessage);
var
i1, i2: Double;
unitname: string;
fdata: double;
begin
i1 := Message.WParam;
I3 := strtofloat(format('%.3f', [i1 / 100000]));
i2 := Message.LParam;
if IsJsMessage then
begin
if (trim(Edit7.Text) = '<27><>') then
begin
if person2.Text = '' then
begin
if StrToFloat(format('%.1f', [i1 / 100000])) >= 0 then
begin
JYLen1.Text := format('%.1f', [i1 / 100000]);
end
else
JYLen1.Text := '0';
end
else
begin
if person3.Text = '' then
begin
if JYLen1.Text <> '' then
begin
if (strtofloat(format('%.1f', [i1 / 100000])) - strtofloat(jylen1.Text)) >= 0 then
begin
JYLen2.Text := FloatToStr(strtofloat(format('%.1f', [i1 / 100000])) - strtofloat(jylen1.Text));
end
else
JYLen2.Text := '0';
end
else
begin
JYLen2.Text := format('%.1f', [i1 / 100000]);
end;
end
else
begin
if person4.Text = '' then
begin
if (JYLen2.Text <> '') and (JYLen1.Text <> '') then
begin
if (strtofloat(format('%.1f', [i1 / 100000])) - strtofloat(jylen2.Text) - strtofloat(jylen1.Text)) >= 0 then
begin
JYLen3.Text := FloatToStr(strtofloat(format('%.1f', [i1 / 100000])) - strtofloat(jylen2.Text) - strtofloat(jylen1.Text));
end
else
JYLen3.Text := '0';
end
else
begin
JYLen3.Text := format('%.1f', [i1 / 100000]);
end;
end
else
begin
if person5.Text = '' then
begin
if (JYLen3.Text <> '') and (JYLen2.Text <> '') and (JYLen1.Text <> '') then
begin
if (strtofloat(format('%.1f', [i1 / 100000])) - strtofloat(jylen3.Text) - strtofloat(jylen2.Text) - strtofloat(jylen1.Text)) >= 0 then
begin
JYLen4.Text := FloatToStr(strtofloat(format('%.1f', [i1 / 100000])) - strtofloat(jylen3.Text) - strtofloat(jylen2.Text) - strtofloat(jylen1.Text));
end
else
JYLen4.Text := '0';
end
else
begin
JYLen4.Text := format('%.1f', [i1 / 100000]);
end;
end
else
begin
if (JYLen4.Text <> '') and (JYLen3.Text <> '') and (JYLen2.Text <> '') and (JYLen1.Text <> '') then
begin
if (strtofloat(format('%.1f', [i1 / 100000])) - strtofloat(jylen4.Text) - strtofloat(jylen3.Text) - strtofloat(jylen2.Text) - strtofloat(jylen1.Text)) >= 0 then
begin
JYLen5.Text := FloatToStr(strtofloat(format('%.1f', [i1 / 100000])) - strtofloat(jylen4.Text) - strtofloat(jylen3.Text) - strtofloat(jylen2.Text) - strtofloat(jylen1.Text));
end
else
JYLen5.Text := '0';
end
else
begin
JYLen5.Text := format('%.1f', [i1 / 100000]);
end;
end;
end;
end;
end;
// if i2 = 0 then
// begin
// Label9.Caption := 'M';
// Label6.Caption := 'M';
// Label16.Caption := 'M';
// Label23.Caption := 'M';
// Label27.Caption := 'M';
// end
// else
// begin
// Label9.Caption := 'Y';
// Label6.Caption := 'Y';
// Label16.Caption := 'Y';
// Label23.Caption := 'Y';
// Label27.Caption := 'Y';
// end;
end;
end;
end;
procedure TfrmGreyInspection.On1201(var Message: Tmessage);
var
i1, i2: integer;
unitname: string;
fdata: double;
begin
i1 := Message.WParam;
i2 := Message.LParam;
if IsJsMessage then
begin
if trim(Edit1.Text) = '<27><>' then
begin
JYGW.Text := format('%.1f', [i1 / 100000]);
end;
end;
end;
procedure TfrmGreyInspection.FormClose(Sender: TObject; var Action: TCloseAction);
begin
//DataLink_WFBProducttion.ADOLink.Connected:=False;
if isCommopen then
begin
closeCom(DZCDYDllName);
closeCom(MBDYDllName);
end;
Action := caFree;
end;
procedure TfrmGreyInspection.InitCDGrid();
begin
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add('select * from JY_Cloth_CD where JYID=' + quotedstr(Trim(FFFMJID)));
//ShowMessage(SQL.Text);
Open;
end;
SCreateCDS20(ADOTmp, CDS_MJCD);
SInitCDSData20(ADOTmp, CDS_MJCD);
end;
procedure TfrmGreyInspection.InitInspectionRecord();
begin
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add('select JYPS=count(JYId),JYLen=isnull(sum(JYLen),0) from JY_Cloth where Filler=''' + Trim(DName) + ''' ');
sql.Add(' and DateDiff(dd,FillTime,getdate())=0 ');
// ShowMessage(SQL.Text);
Open;
end;
lblJYPS.Caption := '<27>ռ<EFBFBD><D5BC><EFBFBD>:' + trim(ADOTmp.fieldbyname('JYPS').AsString) + 'ƥ';
lblJYLen.Caption := '<27>ռ<EFBFBD><D5BC><EFBFBD>:' + trim(ADOTmp.fieldbyname('JYLen').AsString) + '<27><>';
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add('select JYPS=count(JYId),JYLen=isnull(sum(JYLen),0) from JY_Cloth where Filler=''' + Trim(DName) + ''' ');
sql.Add(' and datediff(month,FillTime,getdate())=0 ');
//ShowMessage(SQL.Text);
Open;
end;
lblJYPS.Caption := lblJYPS.Caption + ' <20>¼<EFBFBD><C2BC><EFBFBD>:' + trim(ADOTmp.fieldbyname('JYPS').AsString) + 'ƥ';
lblJYLen.Caption := lblJYLen.Caption + ' <20>¼<EFBFBD><C2BC><EFBFBD>:' + trim(ADOTmp.fieldbyname('JYLen').AsString) + '<27><>';
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add('select A.*');
sql.Add(',SJKZ=(CASE WHEN JYLen>0 THEN ROUND((JYnW/JYLen),0) ELSE 0 END) ');
sql.Add('from JY_Cloth A where A.JYCRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
SQL.Add(' and A.APID=''' + Trim(FAPID) + ''' ');
sql.Add(' and A.Filler=''' + Trim(DName) + '''');
sql.Add(' and DATEDIFF(HH,Filltime,GETDATE())<5');
//ShowMessage(SQL.Text);
Open;
end;
SCreateCDS20(ADOTmp, CDS_MJID);
SInitCDSData20(ADOTmp, CDS_MJID);
end;
procedure TfrmGreyInspection.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmGreyInspection.TBCDClick(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'GreyCD';
flagname := '<27>õ<EFBFBD>';
fnote := True;
V1Note.Caption := <><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
Self.InitDefectOptions();
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmGreyInspection.FormShow(Sender: TObject);
begin
InitDefectOptions();
InitCDGrid();
InitBatchNo();
if IsINIFile() then
ReadINIFile()
else
WriteINIFile;
if trim(Edit7.Text) = '<27><>' then
IsJsMessage := true;
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
begin
if trim(DZCDYDllName) <> '' then
OpenCom(DZCDYDllName);
if trim(MBDYDllName) <> '' then
OpenCom(MBDYDllName);
Edit7.Visible := true;
Label35.Visible := true;
end;
end;
procedure TfrmGreyInspection.InitDefectOptions();
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=''GreyCD'' 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 > 54 then
begin
i := 54;
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]) > 6 then
begin
if Length(AA[j]) < 12 then
begin
TSpeedButton(Controls[j]).Caption := MidStr(Trim(AA[j]), 1, 3) + #13 + MidStr(Trim(AA[j]), 4, Length(AA[j]) - 3);
end
else
begin
TSpeedButton(Controls[j]).Caption := MidStr(Trim(AA[j]), 1, 3) + #13 + MidStr(Trim(AA[j]), 4, 3) + #13 + MidStr(Trim(AA[j]), 7, Length(AA[j]) - 6);
end;
end
else
begin
TSpeedButton(Controls[j]).Caption := AA[j];
end;
end;
end;
end;
function TfrmGreyInspection.SaveData(): Boolean;
var
maxno, FMJID, BZID, strsql: string;
FMJLen: Double;
FJYLEN, FJSLEN: Double;
begin
FMJID := '';
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from JY_Cloth where JYId=''' + Trim(FMJID) + '''');
Open;
end;
with ADOCmd do
begin
if Trim(FMJID) = '' then
begin
Append;
if GetLSNo(ADOTmp, maxno, 'G' + Trim(SCXFlag), 'JY_Cloth', 4, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
BTPrint.Enabled := True;
exit;
end;
end
else
begin
maxno := Trim(FMJID);
Edit;
end;
FieldByName('MainId').value := Trim(FMainId);
FieldByName('SubId').value := Trim(FSubId);
FieldByName('APId').value := Trim(FAPID);
FieldByName('P_Code').value := Trim(FMJCode);
FieldByName('P_CodeName').value := Trim(FMJName);
FieldByName('P_Spec').value := Trim(FMJSpec);
FieldByName('P_Color').value := Trim(FMJColor);
FieldByName('P_MF').value := Trim(FMJMF);
FieldByName('P_KZ').value := Trim(FMJKZ);
FieldByName('BatchNo').value := Trim(BatchNo.Text);
FieldByName('WXPH').value := Trim(WXPH.Text) + '';
FieldByName('MachNo').value := Trim(FCarNo) + '';
FieldByName('JYID').Value := Trim(maxno);
FieldByName('JYCRType').Value := <><CEB4><EFBFBD><EFBFBD>';
FieldByName('Valie').Value := 'Y';
FieldByName('kaijian').Value := StrToFloatDef(kaijian.Text, 0);
FieldByName('JYXH').Value := strtointdef(trim(JYxh.Text), 0);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FieldByName('Person1').Value := trim(Person1.Text);
FieldByName('Person2').Value := trim(Person2.Text);
FieldByName('Person3').Value := trim(Person3.Text);
FieldByName('Person4').Value := trim(Person4.Text);
FieldByName('Person5').Value := trim(Person5.Text);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FieldByName('JYLen1').Value := StrToFloatdef(trim(JYLen1.Text), 0);
FieldByName('JYLen2').Value := StrToFloatdef(trim(JYLen2.Text), 0);
FieldByName('JYLen3').Value := StrToFloatdef(trim(JYLen3.Text), 0);
FieldByName('JYLen4').Value := StrToFloatdef(trim(JYLen4.Text), 0);
FieldByName('JYLen5').Value := StrToFloatdef(trim(JYLen5.Text), 0);
//<2F><><EFBFBD><EFBFBD>
FieldByName('JYLen').Value := StrToFloatdef(trim(JYLen1.Text), 0) + StrToFloatdef(trim(JYLen2.Text), 0) + StrToFloatdef(trim(JYLen3.Text), 0) + StrToFloatdef(trim(JYLen4.Text), 0) + StrToFloatdef(trim(JYLen5.Text), 0) + FKONGJIA;
//Ƥ<><C6A4>
FieldByName('JYTare').Value := 0;
//StrToFloatdef(trim(JYTare.Text), 0)
// ë<><C3AB>
FieldByName('JYGW').Value := StrToFloatdef(trim(JYGW.Text), 0) + fkongjiawei;
// <20><><EFBFBD><EFBFBD>
FieldByName('JYNW').Value := StrToFloatdef(trim(JYGW.Text), 0);
//- StrToFloatdef(trim(JYTare.Text), 0);
//ϵ<><CFB5>
FieldByName('JYXS').Value := StrToFloatdef(trim(JYXS.Text), 0);
FieldByName('kongjia').Value := FKONGJIA;
FieldByName('kongjiaWEI').Value := FKONGJIAWEI;
FieldByName('JSKZ').Value := FJSKZ;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (FJSKZ > 0) then
begin
FieldByName('JSLen').Value := RoundFloat(((StrToFloatdef(trim(JYGW.Text), 0)) * 1000 / FJSKZ + FKONGJIA), 1);
end
else
begin
FieldByName('JSLen').Value := RoundFloat((StrToFloatdef(trim(JYLen1.Text), 0) + StrToFloatdef(trim(JYLen2.Text), 0) + StrToFloatdef(trim(JYLen3.Text), 0) + StrToFloatdef(trim(JYLen4.Text), 0) + StrToFloatdef(trim(JYLen5.Text), 0)), 1) + FKONGJIA;
end;
if Trim(Edit3.Text) <> '' then
begin
FieldByName('JYType').Value := '<27><>Ʒ';
end;
if Trim(Edit4.Text) <> '' then
begin
FieldByName('JYType').Value := '<27><>Ʒ';
end;
if Trim(FMJID) = '' then
begin
FieldByName('Filler').Value := Trim(DName);
FieldByName('FillCode').Value := Trim(DCode);
FieldByName('FillTime').Value := SGetServerDateTime(ADOTmp);
end
else
begin
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditCode').Value := Trim(DCode);
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
end;
FieldByName('JTType').Value := Trim(SCXFlag);
Post;
end;
/////////////////////////<2F><><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>/////////////////////////////////////
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('update JY_Cloth SET ');
sql.Add('JYXH= (select isnull(MAX(JYXH),0)+1 from JY_Cloth X where X.JYID<>JY_Cloth.JYID and X.subid=JY_Cloth.subid and X.BatchNo=JY_Cloth.BatchNo )');
sql.Add('where JYID=''' + Trim(maxno) + ''' ');
execsql;
end;
//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD>޸Ľ<DEB8><C4BD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select JYXH from JY_Cloth');
sql.Add('where JYID=''' + Trim(maxno) + '''');
open;
if not IsEmpty then
begin
JYxh.Text := fieldbyname('JYxh').AsString;
end;
end;
//////////////////////////<2F><><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>////////////////////////////////////
FMJID := Trim(maxno);
FFFMJID := Trim(maxno);
////////////////////////<2F><><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>//////////////////////////////////////
with CDS_MJCD do
begin
First;
while not Eof do
begin
if Trim(CDS_MJCD.fieldbyname('JCID').AsString) = '' then
begin
if GetLSNo(ADOTmp, maxno, 'GC', 'JY_Cloth_CD', 5, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
BTPrint.Enabled := True;
Exit;
end;
end
else
begin
maxno := Trim(CDS_MJCD.fieldbyname('JCID').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from JY_Cloth_CD ');
sql.Add(' where JCID=''' + Trim(maxno) + '''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_MJCD.fieldbyname('JCID').AsString) = '' then
Append
else
Edit;
FieldByName('JYId').Value := Trim(FMJID);
FieldByName('JCID').Value := Trim(maxno);
SSetSaveDataCDSNew(ADOCmd, Tv2, CDS_MJCD, 'JY_Cloth_CD', 0);
// FieldByName('DChePrice').Value := CDS_MJCD.fieldbyname('DChePrice').Value;
// FieldByName('JXiuPrice').Value := CDS_MJCD.fieldbyname('JXiuPrice').Value;
Post;
end;
CDS_MJCD.Edit;
CDS_MJCD.FieldByName('JCID').Value := Trim(maxno);
Next;
end;
end;
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('update JY_Cloth SET ');
sql.Add('CDList=cast((select CDName+CAST(CDQty as varchar)+''M;'' from JY_Cloth_CD where JY_Cloth_CD.JYID=JY_Cloth.JYID for xml path('''')) as varchar(200))');
sql.Add('where JYID=''' + Trim(FMJID) + ''' ');
execsql;
end;
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('update JY_Cloth SET ');
sql.Add('jslen=jylen');
sql.Add('where JYID=''' + Trim(FMJID) + ''' ');
sql.Add('and jslen<jylen');
execsql;
end;
////////////////////////<2F><><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>//////////////////////////////////////
////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BCB0><EFBFBD><EFBFBD>/////////////////////////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_CK_Cloth_CRK @JYID=''' + trim(FMJID) + '''');
execsql;
end;
////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BCB0><EFBFBD><EFBFBD>/////////////////////////////////////
////////////////////////<2F>޸IJ<DEB8>Ʊ״̬/////////////////////////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('update PD_Plan_AnPai SET jyflag=''1'' ');
sql.Add('where APID=''' + trim(fapid) + ''' ');
execsql;
end;
////////////////////////<2F>޸IJ<DEB8>Ʊ״̬/////////////////////////////////////
ADOCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
BTPrint.Enabled := True;
end;
end;
procedure TfrmGreyInspection.BTPrintClick(Sender: TObject);
var
fPrintFile: string;
mvalue: Double;
i: Integer;
begin
BTPrint.Enabled := False;
Scan.SetFocus;
if SelfConnData() = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>,<2C><><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if CheckData('<27>ύ') = False then
begin
BTPrint.Enabled := True;
exit;
end;
if SaveData() then
begin
if StrToFloatDef(kaijian.Text, 0) <> 0 then
begin
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('exec P_JY_ChaiPi ');
sql.Add(' @OrgJYID=' + quotedstr(FFFMJID));
sql.Add(',@KJLen=' + kaijian.text);
open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
application.MessageBox(PChar(trim(ADOCmd.FieldByName('ShowMsg').AsString)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
ADOCmd.Connection.RollbackTrans;
end;
end;
JYxh.Text := inttostr(strTointdef(trim(JYXH.Text), 0) + 1);
if Trim(Edit6.Text) = '<27><>' then
begin
PrtData(FFFMJID);
end;
end
else
begin
BTPrint.Enabled := True;
end;
InitInspectionRecord();
InitCDGrid();
ClearGlobal('<27>ύ');
JYLen1.SetFocus;
jylen1.Text := '';
jylen2.Text := '';
jylen3.Text := '';
jylen4.Text := '';
jylen5.Text := '';
person1.Text := '';
person2.Text := '';
person3.Text := '';
person4.Text := '';
person5.Text := '';
FMainId := '';
BTPrint.Enabled := True;
end;
procedure TfrmGreyInspection.PrtData(FMJID: string);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_JY_Print_Lab ');
SQL.Add(' @JYID=''' + 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);
BTPrint.Enabled := True;
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);
BTPrint.Enabled := True;
exit;
end;
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('LabName').AsString), ADOTmp);
if Trim(ADOQueryPrint.fieldbyname('LabName').AsString) <> '' then
begin
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('LabName').AsString) + '.rmf';
end
else
begin
ExportFtErpFile(<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.rmf';
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 TfrmGreyInspection.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 TfrmGreyInspection.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 TfrmGreyInspection.SpeedButton13Click(Sender: TObject);
var
i: Integer;
begin
if CheckData('<27>õ<EFBFBD>') = False then
exit;
FCDName := Trim(TSpeedButton(Sender).Hint);
MovePanel1.Visible := True;
Label7.Caption := Trim(FCDName);
if FCDName = '<27><><EFBFBD><EFBFBD>' then
begin
DCGKaiJ.text := '4';
end;
//<2F><>ʾ<EFBFBD><CABE><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>
// DChePrice.SetFocus;
// 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(DChePrice.Name);
// end;
// end;
// end;
end;
procedure TfrmGreyInspection.cxGridDBColumn2PropertiesChange(Sender: TObject);
var
fsj: string;
begin
fsj := Trim(Order_MJ.fieldbyname('SubId').AsString);
Order_MJ.DisableControls;
with Order_MJ do
begin
First;
while not Eof do
begin
if Trim(Order_MJ.fieldbyname('SubId').AsString) <> fsj then
begin
Edit;
FieldByName('SSel').Value := False;
end;
Next;
end;
end;
Order_MJ.EnableControls;
Order_MJ.Locate('SubId', fsj, []);
end;
procedure TfrmGreyInspection.Button5Click(Sender: TObject);
var
fPrintFile: string;
i: Integer;
mvalue: Double;
begin
if CDS_MJID.IsEmpty then
Exit;
PrtData(CDS_MJID.fieldbyname('JYID').AsString);
end;
procedure TfrmGreyInspection.SpeedButton49Click(Sender: TObject);
begin
Panel3.Visible := False;
end;
procedure TfrmGreyInspection.ScanKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
// if Pos('CM', Trim(Scan.Text)) > 0 then
// begin
// FOperationStatus := 'ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>';
// ClearGlobal('ɨ<><C9A8>');
// ScanOrder();
// end
// else
// begin
// FOperationStatus := 'ɨ<><C9A8><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ';
// ClearGlobal('ɨ<><C9A8>');
// ScanSample();
// end;
if edtDel.Text = '<27><>' then
begin
DelDate(Trim(Scan.Text));
end
else
begin
FOperationStatus := <>貼Ʊ';
ClearGlobal(<><C9A8>');
ScanAnpai();
end;
JYLen1.SetFocus;
Scan.Text := '';
end;
end;
procedure TfrmGreyInspection.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 TfrmGreyInspection.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 TfrmGreyInspection.Edit6Click(Sender: TObject);
begin
if Trim(Edit6.Text) = '' then
begin
Edit6.Text := '<27><>';
end
else
begin
Edit6.Text := '';
end;
end;
procedure TfrmGreyInspection.MJstr3KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmGreyInspection.JYGWChange(Sender: TObject);
begin
QuantityConversion();
end;
procedure TfrmGreyInspection.ScanClick(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 TfrmGreyInspection.Edit7Click(Sender: TObject);
begin
if Trim(Edit7.Text) = '' then
begin
Edit7.Text := '<27><>';
end
else
begin
Edit7.Text := '';
end;
end;
procedure TfrmGreyInspection.JYNWKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
BTPrint.Click;
end;
end;
procedure TfrmGreyInspection.FormCreate(Sender: TObject);
begin
IsCommopen := false;
IsJsMessage := false;
end;
procedure TfrmGreyInspection.Edit8Click(Sender: TObject);
begin
if Trim(Edit8.Text) = '' then
begin
Edit8.Text := '<27><>';
Button5.Visible := true;
end
else
begin
Edit8.Text := '';
Button5.Visible := false;
end;
end;
procedure TfrmGreyInspection.JYLen1Change(Sender: TObject);
var
XiShu, FMJLen, FMJMaShu: Double;
begin
QuantityConversion();
end;
procedure TfrmGreyInspection.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
if CDS_MJCD.IsEmpty then
Exit;
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
CDS_MJCD.Delete;
end;
end;
procedure TfrmGreyInspection.ToolButton1Click(Sender: TObject);
begin
InitDefectOptions();
end;
procedure TfrmGreyInspection.ToolButton2Click(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'GreyBatchNo';
flagname := '<27><><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
InitBatchNo();
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmGreyInspection.person1Click(Sender: TObject);
var
i: Integer;
begin
Panel3.Visible := false;
// 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;
try
frmSCPerson := TfrmSCPerson.Create(self);
with frmSCPerson do
begin
FlagStr := 'SCPerson';
if ShowModal = 1 then
begin
Person1.Text := frmSCPerson.FSDPerson;
end;
end;
finally
frmSCPerson.Free;
end;
end;
procedure TfrmGreyInspection.person2Click(Sender: TObject);
var
i: Integer;
begin
Panel3.Visible := false;
// 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;
try
frmSCPerson := TfrmSCPerson.Create(self);
with frmSCPerson do
begin
FlagStr := 'SCPerson';
if ShowModal = 1 then
begin
Person2.Text := frmSCPerson.FSDPerson;
end;
end;
finally
frmSCPerson.Free;
end;
end;
procedure TfrmGreyInspection.ToolButton3Click(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'SCPerson';
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
V1Note.Caption := '<27><><EFBFBD><EFBFBD>';
fnote := True;
if ShowModal = 1 then
begin
end;
end;
finally
frmZDYHelp.free;
end;
end;
procedure TfrmGreyInspection.person5Click(Sender: TObject);
var
i: Integer;
begin
Panel3.Visible := false;
// 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;
try
frmSCPerson := TfrmSCPerson.Create(self);
with frmSCPerson do
begin
FlagStr := 'SCPerson';
if ShowModal = 1 then
begin
Person5.Text := frmSCPerson.FSDPerson;
end;
end;
finally
frmSCPerson.Free;
end;
end;
procedure TfrmGreyInspection.person4Click(Sender: TObject);
var
i: Integer;
begin
Panel3.Visible := false;
// 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;
try
frmSCPerson := TfrmSCPerson.Create(self);
with frmSCPerson do
begin
FlagStr := 'SCPerson';
if ShowModal = 1 then
begin
Person4.Text := frmSCPerson.FSDPerson;
end;
end;
finally
frmSCPerson.Free;
end;
end;
procedure TfrmGreyInspection.person3Click(Sender: TObject);
var
i: Integer;
begin
Panel3.Visible := false;
// 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;
try
frmSCPerson := TfrmSCPerson.Create(self);
with frmSCPerson do
begin
FlagStr := 'SCPerson';
if ShowModal = 1 then
begin
Person3.Text := frmSCPerson.FSDPerson;
end;
end;
finally
frmSCPerson.Free;
end;
end;
procedure TfrmGreyInspection.edtDelClick(Sender: TObject);
begin
if Trim(TEdit(Sender).Text) = '' then
begin
TEdit(Sender).Text := '<27><>';
Edit7.Text := '';
end
else
begin
TEdit(Sender).Text := '';
Edit7.Text := '<27><>';
end;
end;
procedure TfrmGreyInspection.Button1Click(Sender: TObject);
var
mvalue: Double;
begin
if (DCheKouK.Text = '') or (DCheKouK.Text = null) then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Label7.Caption <> '<27><><EFBFBD><EFBFBD>' then
begin
if TryStrToFloat(DChePrice.Text, mvalue) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if mvalue = 0 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD><EEB2BB>Ϊ0!', '<27><>ʾ', 0);
Exit;
end;
end
else if Label7.Caption = '<27><><EFBFBD><EFBFBD>' then
begin
if TryStrToFloat(DCGKaiJ.Text, mvalue) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if mvalue = 0 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB2BB>Ϊ0!', '<27><>ʾ', 0);
Exit;
end;
end;
with CDS_MJCD do
begin
Append;
FieldByName('CDName').Value := Trim(FCDName);
FieldByName('DChePrice').Value := StrToFloatDef(DChePrice.Text, 0);
FieldByName('JXiuPrice').Value := StrToFloatDef(JXiuPrice.Text, 0);
FieldByName('CDLEN').Value := StrToFloatDef(CDLEN.Text, 0);
FieldByName('DCGKaiJ').Value := StrToFloatDef(DCGKaiJ.Text, 0);
FieldByName('DCheKouK').Value := Trim(DCheKouK.Text);
FieldByName('JXiuKouK').Value := Trim(JXiuKouK.Text);
Post;
end;
DChePrice.Text := '';
JXiuPrice.Text := '';
DCGKaiJ.Text := '';
CDLEN.Text := '';
DCheKouK.Text := '';
JXiuKouK.Text := '';
MovePanel1.Visible := False;
Panel3.Visible := False;
end;
procedure TfrmGreyInspection.Button4Click(Sender: TObject);
begin
DChePrice.Text := '';
JXiuPrice.Text := '';
DCGKaiJ.Text := '';
DCheKouK.Text := '';
JXiuKouK.Text := '';
MovePanel1.Visible := False;
Panel3.Visible := False;
end;
procedure TfrmGreyInspection.ToolButton4Click(Sender: TObject);
begin
try
frmFinishedClothStatistical := TfrmFinishedClothStatistical.Create(self);
with frmFinishedClothStatistical do
begin
if ShowModal = 1 then
begin
end;
end;
finally
frmFinishedClothStatistical.Free;
end;
end;
procedure TfrmGreyInspection.DCheKouKClick(Sender: TObject);
var
i: Integer;
FDCheKouK: string;
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;
try
frmSCPerson := TfrmSCPerson.Create(self);
with frmSCPerson do
begin
FlagStr := 'SCPerson';
if ShowModal = 1 then
begin
FDCheKouK := frmSCPerson.FSDPerson;
if (Trim(FDCheKouK) = Trim(person1.text)) or (Trim(FDCheKouK) = Trim(person2.text)) or (Trim(FDCheKouK) = Trim(person3.text)) or (Trim(FDCheKouK) = Trim(person4.text)) or (Trim(FDCheKouK) = Trim(person5.text)) then
begin
DCheKouK.Text := FDCheKouK;
end
else
begin
raise Exception.Create('<27><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><35>!');
end;
end;
end;
finally
frmSCPerson.Free;
end;
end;
procedure TfrmGreyInspection.ToolButton5Click(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'JXiuG';
flagname := '<27><><EFBFBD>޹<EFBFBD>';
V1Note.Caption := '<27><><EFBFBD><EFBFBD>';
fnote := True;
if ShowModal = 1 then
begin
end;
end;
finally
frmZDYHelp.free;
end;
end;
procedure TfrmGreyInspection.JXiuKouKClick(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;
try
frmSCPerson := TfrmSCPerson.Create(self);
with frmSCPerson do
begin
FlagStr := 'JXiuG';
if ShowModal = 1 then
begin
JXiuKouK.Text := frmSCPerson.FSDPerson;
end;
end;
finally
frmSCPerson.Free;
end;
end;
procedure TfrmGreyInspection.Label9Click(Sender: TObject);
begin
if Label9.Caption = 'Y' then
begin
Label9.Caption := 'M';
Label6.Caption := 'M';
Label16.Caption := 'M';
Label23.Caption := 'M';
Label27.Caption := 'M';
end
else
begin
Label9.Caption := 'Y';
Label6.Caption := 'Y';
Label16.Caption := 'Y';
Label23.Caption := 'Y';
Label27.Caption := 'Y';
end;
end;
procedure TfrmGreyInspection.Label6Click(Sender: TObject);
begin
if Label6.Caption = 'Y' then
begin
Label9.Caption := 'M';
Label6.Caption := 'M';
Label16.Caption := 'M';
Label23.Caption := 'M';
Label27.Caption := 'M';
end
else
begin
Label9.Caption := 'Y';
Label6.Caption := 'Y';
Label16.Caption := 'Y';
Label23.Caption := 'Y';
Label27.Caption := 'Y';
end;
end;
procedure TfrmGreyInspection.Label16Click(Sender: TObject);
begin
if Label16.Caption = 'Y' then
begin
Label9.Caption := 'M';
Label6.Caption := 'M';
Label16.Caption := 'M';
Label23.Caption := 'M';
Label27.Caption := 'M';
end
else
begin
Label9.Caption := 'Y';
Label6.Caption := 'Y';
Label16.Caption := 'Y';
Label23.Caption := 'Y';
Label27.Caption := 'Y';
end;
end;
procedure TfrmGreyInspection.Label23Click(Sender: TObject);
begin
if Label23.Caption = 'Y' then
begin
Label9.Caption := 'M';
Label6.Caption := 'M';
Label16.Caption := 'M';
Label23.Caption := 'M';
Label27.Caption := 'M';
end
else
begin
Label9.Caption := 'Y';
Label6.Caption := 'Y';
Label16.Caption := 'Y';
Label23.Caption := 'Y';
Label27.Caption := 'Y';
end;
end;
procedure TfrmGreyInspection.Label27Click(Sender: TObject);
begin
if Label27.Caption = 'Y' then
begin
Label9.Caption := 'M';
Label6.Caption := 'M';
Label16.Caption := 'M';
Label23.Caption := 'M';
Label27.Caption := 'M';
end
else
begin
Label9.Caption := 'Y';
Label6.Caption := 'Y';
Label16.Caption := 'Y';
Label23.Caption := 'Y';
Label27.Caption := 'Y';
end;
end;
procedure TfrmGreyInspection.Edit1Click(Sender: TObject);
begin
if Trim(Edit1.Text) = '' then
begin
Edit1.Text := '<27><>';
end
else
begin
Edit1.Text := '';
end;
end;
procedure TfrmGreyInspection.SpeedButton43Click(Sender: TObject);
begin
if edtDel.Text = '<27><>' then
begin
DelDate(Trim(Scan.Text));
end
else
begin
FOperationStatus := <>貼Ʊ';
ClearGlobal(<><C9A8>');
ScanAnpai();
end;
JYLen1.SetFocus;
Scan.Text := '';
end;
procedure TfrmGreyInspection.JYLen1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Trim(person1.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB5B2><EFBFBD><EFBFBD>1!');
end;
end;
procedure TfrmGreyInspection.JYLen2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Trim(person2.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB5B2><EFBFBD><EFBFBD>2!');
end;
end;
procedure TfrmGreyInspection.JYLen3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Trim(person3.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB5B2><EFBFBD><EFBFBD>3!');
end;
end;
procedure TfrmGreyInspection.JYLen4MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Trim(person4.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB5B2><EFBFBD><EFBFBD>4!');
end;
end;
procedure TfrmGreyInspection.JYLen5MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Trim(person5.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB5B2><EFBFBD><EFBFBD>5!');
end;
end;
end.