D7szChenfeng/布匹检验(FabricInspection.dll)/U_GreyInspection.pas

2414 lines
66 KiB
ObjectPascal
Raw Permalink Normal View History

2025-07-22 15:51:47 +08:00
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, dxSkinBlack,
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinValentine, dxSkinVS2010,
dxSkinWhiteprint, dxSkinXmas2008Blue;
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;
cxGridPopupMenu2: TcxGridPopupMenu;
ADOQueryMainDSC: TADOQuery;
Panel2: TPanel;
Label9: TLabel;
JYLen1: TEdit;
Label4: TLabel;
Label5: TLabel;
Label11: TLabel;
BTPrint: TButton;
Button5: TButton;
Edit3: TEdit;
Label10: TLabel;
Edit4: TEdit;
Label12: TLabel;
Label30: TLabel;
JYTare: TEdit;
Label31: TLabel;
Label32: TLabel;
JYNW: TEdit;
Label33: TLabel;
Panel7: TPanel;
OrdNote: TRichEdit;
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;
Label13: TLabel;
JYXS: TEdit;
ToolButton2: TToolButton;
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;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
lbl1: TLabel;
lbl2: TLabel;
JYGW: TEdit;
Tv3Column1: TcxGridDBColumn;
Label40: TLabel;
Edit1: TEdit;
Tv3Column2: TcxGridDBColumn;
Panel1: TPanel;
Label26: TLabel;
Label34: TLabel;
Edit6: TEdit;
ComboBox1: TComboBox;
Label46: TLabel;
kaijian: TEdit;
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;
SpeedButton84: TSpeedButton;
SpeedButton43: TSpeedButton;
lblJYPS: TLabel;
lblJYLen: TLabel;
Label2: TLabel;
Label7: TLabel;
jylen: TEdit;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
Tv3Column3: TcxGridDBColumn;
Tv3Column4: TcxGridDBColumn;
ToolButton6: TToolButton;
Tv3Column5: 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 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 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 ToolButton4Click(Sender: TObject);
procedure ToolButton5Click(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);
procedure Label2Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
private
{ Private declarations }
FColumn, FFFMJID, FOperationStatus: string;
FAPID, FSPID, FMainId, FSubId, FMJCode, FPCID, 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 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 ScanbpAnPai(); //ɨ<>貼Ʊ<E8B2BC><C6B1><EFBFBD><EFBFBD>
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 clearCom(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, newh2: hwnd;
IniFile: TIniFile;
implementation
uses
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_SCPerson,
U_FinishedClothStatistical;
{$R *.dfm}
procedure TfrmGreyInspection.clearCom(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, 'CommClear');
if Tp1 <> nil then
begin
Tf1 := TMyFunc(Tp1);
newh2 := 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.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, FCD: Double;
begin
try
if Trim(CKType) = '<27>ύ' then
begin
FCD := (strtofloatdef(trim(JYLen2.Text), 0) + strtofloatdef(trim(JYLen1.Text), 0) + strtofloatdef(trim(JYLen3.Text), 0) + strtofloatdef(trim(JYLen4.Text), 0) + strtofloatdef(trim(JYLen5.Text), 0));
if RoundFloat(FCD, 2) <> RoundFloat(StrToFloatDef(JYLen.Text, 0), 2) then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><E9B3A4>!!,<2C><>ǰ<EFBFBD><C7B0><EFBFBD>Ⱥ<EFBFBD>Ϊ' + FloatToStr(FCD) + <>ʳ<EFBFBD><CAB3><EFBFBD>Ϊ' + trim(JYLen.Text));
if (FPCID = '') and (FapID = '') then
raise Exception.Create('<27><><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>ɨ<EFBFBD>貼Ʊ!');
// 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 (person1.Text <> '') and (JYLen1.Text = '') then
begin
raise Exception.Create('ѡ<>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ0!');
end;
if (person2.Text <> '') and (JYLen2.Text = '') then
begin
raise Exception.Create('ѡ<>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ0!');
end;
if (person3.Text <> '') and (JYLen3.Text = '') then
begin
raise Exception.Create('ѡ<>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ0!');
end;
if (person4.Text <> '') and (JYLen4.Text = '') then
begin
raise Exception.Create('ѡ<>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ0!');
end;
if (person5.Text <> '') and (JYLen5.Text = '') then
begin
raise Exception.Create('ѡ<>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><35><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ0!');
end;
if (strtofloatdef(trim(JYGW.Text), 0) > 100) then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>100!!');
if (strtofloatdef(trim(JYLen.Text), 0) <= 0.00) then
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>0!!');
// if Edit7.Text <> '' then
// begin
// if I3 <> 0 then
// begin
// i4 := RoundFloat(I3 + 0.1, 0);
// end
// else
// begin
// i4 := StrToFloatDEF(JYLen1.TEXT, 0);
// end;
//
// 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 := '';
JYLen3.Text := '';
person1.Text := '';
person2.Text := '';
person3.Text := '';
person4.Text := '';
person5.Text := '';
person1.hint := '';
person2.hint := '';
person3.hint := '';
person4.hint := '';
person5.hint := '';
end;
if MStatus = '<27>ύ' then
begin
JYLen1.Text := '';
JYLen2.Text := '';
JYGW.Text := '';
JYNW.Text := '';
// FOperationStatus := '';
FFFMJID := '';
FAPID := '';
if FOperationStatus = <>貼Ʊ' then
begin
FOperationStatus := '';
FPCID := '';
end;
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 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);
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);
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);
FPCID := trim(ADOTmp.fieldbyname('PCID2').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><E1BFA8>:' + FPCID + #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.ScanBPAnPai();
var
FAPXH, FCAPXH: string;
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_YgCl where mjid=(select pcid from PD_Plan_AnPai e where e.APID= ''' + Trim(Scan.Text) + '''');
sql.Add(')and cltype=''<27><><EFBFBD><EFBFBD>''');
// ShowMessage(SQL.Text);
Open;
end;
if ADOTmp.IsEmpty then
begin
application.MessageBox(Pchar('<27>ÿ<EFBFBD><C3BF><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>'), '<27><>ʾ');
FPCID := '';
Scan.Text := '';
Exit;
end;
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_ScanBPAnPai ''' + Trim(Scan.Text) + '''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
FAPID := Trim(ADOTmp.fieldbyname('APID').AsString);
FpcID := Trim(ADOTmp.fieldbyname('PCID').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><E1BFA8>:' + FPCID + #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
jylen.Text := format('%.1f', [i1 / 100000]);
// 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(',p_name=(select P_CodeName from pd_plan_sub B WHERE B.SUBID=A.SUBID)');
sql.Add(',JTH=(SELECT MACHNO FROM BS_Machine k where k.machid= (SELECT top 1 e.CarNo FROM CK_YgCl E where a.PCID =E.MJID and E.ClType');
sql.Add('IN (''<27><><EFBFBD><EFBFBD>'',''<27><>ͷ'') and isnull(CarNo,'''')<>'''' order by e.Filltime desc))');
SQL.Add(',APXH=(SELECT APXH FROM PD_Plan_AnPai E WHERE E.APID=A.APID)');
sql.Add('from JY_Cloth A where A.JYCRType in (''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'','<><CEB4><EFBFBD><EFBFBD>'') ');
sql.Add(' and A.Filler=''' + Trim(DName) + '''');
sql.Add(' and CONVERT(VARCHAR(10),FILLTIME,120)=CONVERT(VARCHAR(10),GETDATE(),120)');
sql.Add('order by filltime desc');
//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
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmGreyInspection.FormShow(Sender: TObject);
begin
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;
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 FAPID <> '' then
begin
maxno := FAPID;
Append;
end
else
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;
end;
FieldByName('MainId').value := Trim(FMainId);
FieldByName('SubId').value := Trim(FSubId);
FieldByName('APId').value := Trim(FAPID);
FieldByName('pcid').value := Trim(FPCID);
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('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('group1').Value := trim(Person1.hint);
FieldByName('group2').Value := trim(Person2.hint);
FieldByName('group3').Value := trim(Person3.hint);
FieldByName('group4').Value := trim(Person4.hint);
FieldByName('group5').Value := trim(Person5.hint);
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(JYLen.Text), 0) + FKONGJIA;
// 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>/////////////////////////////////////
if FAPID = '' then
begin
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.PCID=JY_Cloth.PCID )');
sql.Add('where JYID=''' + Trim(maxno) + ''' ');
execsql;
end;
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);
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 FAPID = '' then
begin
with ADOCmd do
begin
close;
sql.Clear;
sql.Add(' select c_pie,YJPS=ISNULL((SELECT COUNT(*) FROM JY_Cloth F WHERE F.PCID=E.PCID ),0) from pd_plan_card e where e.pcid= ' + QuotedStr(FPCID));
open;
end;
if ADOCmd.FieldByName('YJPS').AsFloat >= ADOCmd.FieldByName('c_pie').AsFloat then
begin
if Application.MessageBox('<27>Ѽ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><E1BDBB>', '<27><>ʾ', 32 + 4) <> IDYES then
begin
BTPrint.Enabled := True;
Exit;
end;
end;
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;
if trim(MBDYDllName) <> '' then
begin
if Edit7.Text <> '' then
begin
clearCom(MBDYDllName);
end;
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 := '';
person1.hint := '';
person2.hint := '';
person3.hint := '';
person4.hint := '';
person5.hint := '';
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.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 Scan.Text = '' then
Exit;
// 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 Pos('PC', Trim(Scan.Text)) > 0 then
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from pd_plan_Card where pcid= ''' + Trim(Scan.Text) + '''');
Open;
end;
if ADOTmp.IsEmpty then
begin
application.MessageBox(Pchar('<27><><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD>'), '<27><>ʾ');
FPCID := '';
Scan.Text := '';
Exit;
end;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_YgCl where mjid= ''' + Trim(Scan.Text) + '''');
sql.Add('and cltype=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if ADOTmp.IsEmpty then
begin
application.MessageBox(Pchar('<27>ÿ<EFBFBD><C3BF><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>'), '<27><>ʾ');
FPCID := '';
Scan.Text := '';
Exit;
end;
FOperationStatus := <><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD>';
ClearGlobal(<><C9A8>');
ScanAnpai();
end
else
begin
FOperationStatus := <>貼Ʊ';
ClearGlobal(<><C9A8>');
ScanbpAnpai();
end;
JYLen.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.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(Application);
with frmSCPerson do
begin
FlagStr := 'SCPerson';
if ShowModal = 1 then
begin
Person1.Text := frmSCPerson.FSDPerson;
Person1.Hint := frmSCPerson.CDS_ZB.FieldByName('note').AsString;
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;
Person2.Hint := frmSCPerson.CDS_ZB.FieldByName('note').AsString;
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;
Person5.Hint := frmSCPerson.CDS_ZB.FieldByName('note').AsString;
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;
Person4.Hint := frmSCPerson.CDS_ZB.FieldByName('note').AsString;
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;
Person3.Hint := frmSCPerson.CDS_ZB.FieldByName('note').AsString;
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.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.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.Label9Click(Sender: TObject);
begin
if Label9.Caption = 'Y' then
begin
Label2.Caption := 'M';
Label9.Caption := 'M';
Label6.Caption := 'M';
Label16.Caption := 'M';
Label23.Caption := 'M';
Label27.Caption := 'M';
end
else
begin
Label2.Caption := 'Y';
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
Label2.Caption := 'M';
Label9.Caption := 'M';
Label6.Caption := 'M';
Label16.Caption := 'M';
Label23.Caption := 'M';
Label27.Caption := 'M';
end
else
begin
Label2.Caption := 'Y';
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
Label2.Caption := 'M';
Label9.Caption := 'M';
Label6.Caption := 'M';
Label16.Caption := 'M';
Label23.Caption := 'M';
Label27.Caption := 'M';
end
else
begin
Label2.Caption := 'Y';
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;
procedure TfrmGreyInspection.Label2Click(Sender: TObject);
begin
if Label2.Caption = 'Y' then
begin
Label2.Caption := 'M';
Label9.Caption := 'M';
Label6.Caption := 'M';
Label16.Caption := 'M';
Label23.Caption := 'M';
Label27.Caption := 'M';
end
else
begin
Label2.Caption := 'Y';
Label9.Caption := 'Y';
Label6.Caption := 'Y';
Label16.Caption := 'Y';
Label23.Caption := 'Y';
Label27.Caption := 'Y';
end;
end;
procedure TfrmGreyInspection.ToolButton6Click(Sender: TObject);
begin
if CDS_MJID.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 ADOTmp do
begin
Close;
sql.Clear;
SQL.Add('select * from JY_CLOTH A WHERE A.JYID=' + QuotedStr(trim(CDS_MJID.fieldbyName('JYID').AsString)));
OPEN;
end;
if ADOTmp.FieldByName('JYCRType').AsString = '<27>ѳ<EFBFBD><D1B3><EFBFBD>' then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѷ<EFBFBD><D1B7><EFBFBD>,<2C><>ֹɾ<D6B9><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
exit;
end;
// if ADOTmp.FieldByName('JYCRType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
// begin
// application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ֹɾ<D6B9><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
// exit;
// end;
with ADOTmp do
begin
Close;
sql.Clear;
SQL.Add(' update JY_CLOTH set Deler= ' + QuotedStr(Trim(dname)));
sql.Add(',Deltime=GETDATE() where jyid=' + QuotedStr(trim(CDS_MJID.fieldbyName('JYID').AsString)));
sql.Add(' insert into JY_CLOTH_del select * from JY_CLOTH where jyid=' + QuotedStr(trim(CDS_MJID.fieldbyName('JYID').AsString)));
sql.Add('delete JY_Cloth where JYID=''' + Trim(CDS_MJID.fieldbyname('JYID').AsString) + '''');
sql.Add('delete CK_Cloth_CR where JYID=''' + Trim(CDS_MJID.fieldbyname('JYID').AsString) + '''');
sql.Add('delete CK_Cloth_KC where JYID=''' + Trim(CDS_MJID.fieldbyname('JYID').AsString) + '''');
sql.Add('delete JY_Cloth_CD where JYID=''' + Trim(CDS_MJID.fieldbyname('JYID').AsString) + '''');
sql.Add('update PD_Plan_AnPai SET jyflag=''0'' ');
sql.Add('where APID=''' + trim(CDS_MJID.fieldbyname('apid').AsString) + ''' ');
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(CDS_MJID.fieldbyname('JYID').AsString) + ' <20><><EFBFBD>ţ<EFBFBD>' + trim(CDS_MJID.fieldbyname('JYXH').AsString) + ' <20><><EFBFBD>ţ<EFBFBD>' + trim(CDS_MJID.fieldbyname('pcid').AsString)));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
ExecSQL;
end;
ADOCmd.Connection.CommitTrans;
CDS_MJID.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;
end.