2024-07-07 09:35:27 +08:00
|
|
|
|
unit U_KnitCardMachInPut;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|
|
|
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|
|
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
|
|
|
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|
|
|
|
cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class,
|
|
|
|
|
RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxCheckBox,
|
|
|
|
|
BtnEdit, cxPC, MovePanel, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|
|
|
|
dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
|
|
|
|
U_BaseList, Vcl.Menus, U_BaseInput, System.ImageList, Vcl.ImgList, StrUtils,
|
|
|
|
|
dxSkinWXI, dxScrollbarAnnotations, cxContainer;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
TfrmKnitCardMachInPut = class(TfrmBaselist)
|
|
|
|
|
GPM_1: TcxGridPopupMenu;
|
|
|
|
|
ADOQueryCmd: TADOQuery;
|
|
|
|
|
ADOQueryMain: TADOQuery;
|
|
|
|
|
ADOQueryTemp: TADOQuery;
|
|
|
|
|
DS_1: TDataSource;
|
|
|
|
|
CDS_1: TClientDataSet;
|
|
|
|
|
DS_2: TDataSource;
|
|
|
|
|
CDS_2: TClientDataSet;
|
|
|
|
|
GPM_2: TcxGridPopupMenu;
|
|
|
|
|
PM_1: TPopupMenu;
|
|
|
|
|
PM_2: TPopupMenu;
|
|
|
|
|
N2: TMenuItem;
|
|
|
|
|
cxStyleRepository1: TcxStyleRepository;
|
|
|
|
|
cxStyle1: TcxStyle;
|
|
|
|
|
Panel3: TPanel;
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
Label12: TLabel;
|
|
|
|
|
Label13: TLabel;
|
|
|
|
|
Label21: TLabel;
|
|
|
|
|
Label9: TLabel;
|
2024-08-08 16:35:41 +08:00
|
|
|
|
edtName: TcxTextEdit;
|
|
|
|
|
edtCode: TcxTextEdit;
|
|
|
|
|
edtConNo: TcxTextEdit;
|
|
|
|
|
edtWAPPS: TcxTextEdit;
|
|
|
|
|
edtYAPPS: TcxTextEdit;
|
2024-07-07 09:35:27 +08:00
|
|
|
|
Panel1: TPanel;
|
|
|
|
|
Panel2: TPanel;
|
|
|
|
|
Label10: TLabel;
|
|
|
|
|
Label11: TLabel;
|
|
|
|
|
Label7: TLabel;
|
|
|
|
|
Label8: TLabel;
|
|
|
|
|
Label4: TLabel;
|
|
|
|
|
Label2: TLabel;
|
2024-08-08 16:35:41 +08:00
|
|
|
|
edtMachNo: TcxTextEdit;
|
|
|
|
|
edtCardQty: TcxTextEdit;
|
2024-07-07 09:35:27 +08:00
|
|
|
|
Repairer: TBtnEditC;
|
2024-08-08 16:35:41 +08:00
|
|
|
|
BatchNo: TcxTextEdit;
|
2024-07-07 09:35:27 +08:00
|
|
|
|
isDY: TComboBox;
|
2024-08-08 16:35:41 +08:00
|
|
|
|
Edit1: TcxTextEdit;
|
2024-07-07 09:35:27 +08:00
|
|
|
|
ToolBar1: TToolBar;
|
|
|
|
|
ToolButton1: TToolButton;
|
|
|
|
|
ToolButton12: TToolButton;
|
|
|
|
|
TBClose: TToolButton;
|
|
|
|
|
ToolButton2: TToolButton;
|
|
|
|
|
ToolButton3: TToolButton;
|
|
|
|
|
Button3: TButton;
|
|
|
|
|
cxGrid1: TcxGrid;
|
|
|
|
|
Tv1: TcxGridDBTableView;
|
|
|
|
|
v3Column8: TcxGridDBColumn;
|
|
|
|
|
v3Column1: TcxGridDBColumn;
|
|
|
|
|
Tv1Column9: TcxGridDBColumn;
|
|
|
|
|
v3Column6: TcxGridDBColumn;
|
|
|
|
|
v3Column2: TcxGridDBColumn;
|
|
|
|
|
v3Column14: TcxGridDBColumn;
|
|
|
|
|
v3Column15: TcxGridDBColumn;
|
|
|
|
|
v3Column16: TcxGridDBColumn;
|
|
|
|
|
Tv1Column1: TcxGridDBColumn;
|
|
|
|
|
Tv1Column8: TcxGridDBColumn;
|
|
|
|
|
Tv1Column2: TcxGridDBColumn;
|
|
|
|
|
Tv1Column7: TcxGridDBColumn;
|
|
|
|
|
Tv1Column3: TcxGridDBColumn;
|
|
|
|
|
Tv1Column4: TcxGridDBColumn;
|
|
|
|
|
Tv1Column5: TcxGridDBColumn;
|
|
|
|
|
Tv1Column6: TcxGridDBColumn;
|
|
|
|
|
cxGridLevel2: TcxGridLevel;
|
|
|
|
|
cxCheckBox1: TcxCheckBox;
|
|
|
|
|
Timer1: TTimer;
|
|
|
|
|
ADO_Print: TADOQuery;
|
|
|
|
|
RMDB_1: TRMDBDataSet;
|
|
|
|
|
RM_1: TRMGridReport;
|
|
|
|
|
procedure FormDestroy(Sender: TObject);
|
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
procedure TBCloseClick(Sender: TObject);
|
|
|
|
|
procedure TBFindClick(Sender: TObject);
|
|
|
|
|
procedure TBRafreshClick(Sender: TObject);
|
|
|
|
|
procedure MCNOChange(Sender: TObject);
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|
|
|
|
procedure Tv1DblClick(Sender: TObject);
|
|
|
|
|
procedure ToolButton12Click(Sender: TObject);
|
|
|
|
|
procedure N2Click(Sender: TObject);
|
|
|
|
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|
|
|
|
procedure RepairerBtnDnClick(Sender: TObject);
|
|
|
|
|
procedure RepairerBtnUpClick(Sender: TObject);
|
|
|
|
|
procedure ToolButton1Click(Sender: TObject);
|
|
|
|
|
procedure ToolButton3Click(Sender: TObject);
|
|
|
|
|
procedure ToolButton2Click(Sender: TObject);
|
|
|
|
|
procedure Timer1Timer(Sender: TObject);
|
|
|
|
|
private
|
|
|
|
|
procedure InitOrd();
|
|
|
|
|
procedure InitGrid1();
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
public
|
|
|
|
|
FMainId, FSubId: string;
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frmKnitCardMachInPut: TfrmKnitCardMachInPut;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint, U_KnitPlanSel, U_LoomSel,
|
|
|
|
|
U_EmployeeSel;
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.InitOrd();
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add(' select A.*,B.*');
|
|
|
|
|
sql.Add(' ,YAPPS=ISNULL((select count(*) from Knit_Plan_Card X where X.MainId=A.MainId),0)');
|
|
|
|
|
sql.Add(' ,WAPPS=OrdPiece-ISNULL((select count(*) from Knit_Plan_Card X where X.MainId=A.MainId),0)');
|
|
|
|
|
sql.Add(' from knit_Plan_Main A');
|
|
|
|
|
sql.Add(' inner join knit_Plan_Sub B on A.MainId=B.MainId ');
|
|
|
|
|
sql.Add(' where B.SubId=' + QuotedStr(FSubId));
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
edtConNo.Text := ADOQueryTemp.FieldByName('OrderNo').AsString;
|
|
|
|
|
edtCode.Text := ADOQueryTemp.FieldByName('C_Code').AsString;
|
|
|
|
|
edtName.Text := ADOQueryTemp.FieldByName('C_Name').AsString;
|
|
|
|
|
edtYAPPS.Text := ADOQueryTemp.FieldByName('YAPPS').AsString;
|
|
|
|
|
edtWAPPS.Text := ADOQueryTemp.FieldByName('WAPPS').AsString;
|
|
|
|
|
|
|
|
|
|
// Repairer.Text := ADOQueryTemp.FieldByName('Repairer').AsString;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.N2Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add(' select * from knit_Plan_Card A where A.PRTCount>1 and A.PMID=' + quotedstr(trim(CDS_2.fieldbyname('PMID').AsString)));
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
if not ADOQueryTemp.IsEmpty then
|
|
|
|
|
begin
|
|
|
|
|
Application.MessageBox('<27>Ѵ<EFBFBD>ӡ<EFBFBD><D3A1>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
|
|
|
|
Exit;
|
|
|
|
|
end;
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add('delete knit_Plan_Mach ');
|
|
|
|
|
sql.Add('where PMID=' + quotedstr(trim(CDS_2.fieldbyname('PMID').AsString)));
|
|
|
|
|
sql.Add('delete knit_Plan_Card ');
|
|
|
|
|
sql.Add('where PMID=' + quotedstr(trim(CDS_2.fieldbyname('PMID').AsString)));
|
|
|
|
|
execsql;
|
|
|
|
|
end;
|
|
|
|
|
CDS_2.Delete;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.RepairerBtnDnClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
Repairer.Text := '';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.RepairerBtnUpClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|
|
|
|
with frmZDYHelp do
|
|
|
|
|
begin
|
|
|
|
|
flag := 'Repairer';
|
|
|
|
|
flagname := '<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
begin
|
|
|
|
|
Repairer.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
frmZDYHelp.Free;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.InitGrid1();
|
|
|
|
|
var
|
|
|
|
|
fwhere: string;
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
ADOQueryMain.DisableControls;
|
|
|
|
|
with ADOQueryMain do
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add('select A.*,C.*,D.* ');
|
|
|
|
|
sql.Add(' from Knit_Plan_Card A ');
|
|
|
|
|
sql.Add(' inner join knit_Plan_Sub C on A.SubId=C.SubId');
|
|
|
|
|
sql.Add(' inner join knit_Plan_Main D on A.MainId=D.MainId');
|
|
|
|
|
|
|
|
|
|
sql.Add(' where A.MainId =''' + trim(FMainId) + '''');
|
|
|
|
|
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|
|
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|
|
|
|
finally
|
|
|
|
|
ADOQueryMain.EnableControls;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.FormDestroy(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
frmKnitCardMachInPut := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
Action := caFree;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.TBCloseClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.TBFindClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if ADOQueryMain.Active = False then
|
|
|
|
|
Exit;
|
|
|
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|
|
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|
|
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.TBRafreshClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
InitGrid1();
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.Timer1Timer(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
fPrintFile, MPCID: string;
|
|
|
|
|
begin
|
|
|
|
|
if cxCheckBox1.Checked then
|
|
|
|
|
begin
|
|
|
|
|
with ADO_Print do
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add(' select TOP 1 A.* ');
|
|
|
|
|
sql.Add(' from Knit_Plan_Card A');
|
|
|
|
|
sql.Add(' where isnull(PRTCount,0)=0');
|
|
|
|
|
sql.Add(' order by pcid ');
|
|
|
|
|
Open;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if ADO_Print.IsEmpty then
|
|
|
|
|
Exit;
|
|
|
|
|
MPCID := ADO_Print.FieldByName('PCID').AsString;
|
|
|
|
|
with ADO_Print do
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add(' EXEC P_knit_Card_Prt1 ' + QuotedStr(QuotedStr(MPCID)));
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
ExportFtErpFile('<27><>֯<EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>Ʊ.rmf', ADOQueryTemp);
|
|
|
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>֯<EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>Ʊ.rmf';
|
|
|
|
|
if FileExists(fPrintFile) then
|
|
|
|
|
begin
|
|
|
|
|
RM_1.LoadFromFile(fPrintFile);
|
|
|
|
|
RM_1.PrintReport;
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add('update Knit_Plan_Card ');
|
|
|
|
|
sql.Add('set PRTer=' + quotedstr(DName));
|
|
|
|
|
sql.Add(', PRTCount=PRTCount+1');
|
|
|
|
|
sql.Add(', PRTDate=getdate()');
|
|
|
|
|
sql.Add(' where PCID =' + QuotedStr(MPCID));
|
|
|
|
|
ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD>ҵ<EFBFBD>' + trim(fPrintFile)), '<27><>ʾ', 0);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.MCNOChange(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if ADOQueryMain.Active = False then
|
|
|
|
|
Exit;
|
|
|
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|
|
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|
|
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.FormShow(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, 'ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
|
|
|
|
|
InitOrd();
|
|
|
|
|
InitGrid1();
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.cxTabControl1Change(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
InitGrid1();
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
if '0' = AViewInfo.GridRecord.Values[Tv1Column2.Index] then
|
|
|
|
|
ACanvas.Brush.Color := $66ff66;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.Tv1DblClick(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
FStrs: TStringList;
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
FStrs := TStringList.Create();
|
|
|
|
|
ExtractStrings([';'], [' '], PChar(edtMachNo.Text), FStrs);
|
|
|
|
|
if FStrs.IndexOf(Trim(CDS_1.FieldByName('MCNO').AsString)) < 0 then
|
|
|
|
|
edtMachNo.Text := edtMachNo.Text + TRIM(CDS_1.FieldByName('MCNO').AsString) + ';';
|
|
|
|
|
finally
|
|
|
|
|
FStrs.Free
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.ToolButton12Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, 'ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.ToolButton1Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
// try
|
|
|
|
|
// frmKnitPlanSel := TfrmKnitPlanSel.Create(Application);
|
|
|
|
|
// with frmKnitPlanSel do
|
|
|
|
|
// begin
|
|
|
|
|
// if ShowModal = 1 then
|
|
|
|
|
// begin
|
|
|
|
|
// // self.FMainId := Trim(frmKnitPlanSel.CDS_1.fieldbyname('MainId').AsString);
|
|
|
|
|
// self.FSubId := Trim(frmKnitPlanSel.CDS_1.fieldbyname('SubId').AsString);
|
|
|
|
|
// end;
|
|
|
|
|
// end;
|
|
|
|
|
// finally
|
|
|
|
|
// frmKnitPlanSel.Free;
|
|
|
|
|
// end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
frmLoomSel := TfrmLoomSel.Create(self);
|
|
|
|
|
with frmLoomSel do
|
|
|
|
|
begin
|
|
|
|
|
FMCType := '222';
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
begin
|
|
|
|
|
self.edtMachNo.Text := frmLoomSel.FMCNO;
|
|
|
|
|
|
|
|
|
|
with self.ADOQueryTemp do
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add('select B.MainId,B.SubId from Knit_Plan_Main A ');
|
|
|
|
|
sql.Add(' inner join Knit_Plan_Sub B on A.MainId=B.MainId ');
|
|
|
|
|
sql.Add(' inner join Bs_Machine C on A.OrderNo=C.OrderNo ');
|
|
|
|
|
sql.Add(' where C.MCNO= ' + QuotedStr(self.edtMachNo.Text));
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
if self.ADOQueryTemp.IsEmpty then
|
|
|
|
|
begin
|
|
|
|
|
Application.MessageBox('<27><>̨δ<CCA8>ƻ<F3B6A8BC><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>ŵ<EFBFBD>Ա!', '<27><>ʾ', 0);
|
|
|
|
|
Exit;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
self.FMainId := self.ADOQueryTemp.FieldByName('MainId').AsString;
|
|
|
|
|
self.FSubId := self.ADOQueryTemp.FieldByName('SubId').AsString;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
frmLoomSel.Free;
|
|
|
|
|
end;
|
|
|
|
|
InitOrd();
|
|
|
|
|
InitGrid1();
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.ToolButton2Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
frmEmployeeSel := TfrmEmployeeSel.Create(self);
|
|
|
|
|
with frmEmployeeSel do
|
|
|
|
|
begin
|
|
|
|
|
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
begin
|
|
|
|
|
self.Edit1.Text := frmEmployeeSel.FRName;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
frmEmployeeSel.Free;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmKnitCardMachInPut.ToolButton3Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
maxno, maxPCId, WSql: string;
|
|
|
|
|
FStrs: TStringList;
|
|
|
|
|
i, j, MPCNo: integer;
|
|
|
|
|
begin
|
|
|
|
|
if edtMachNo.Text = '' then
|
|
|
|
|
Exit;
|
|
|
|
|
|
|
|
|
|
if StrToIntdef(edtCardQty.Text, 0) = 0 then
|
|
|
|
|
edtCardQty.Text := '1';
|
|
|
|
|
try
|
|
|
|
|
FStrs := TStringList.Create();
|
|
|
|
|
ExtractStrings([';'], [' '], PChar(edtMachNo.Text), FStrs);
|
|
|
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|
|
|
|
|
|
|
|
|
if FStrs.Count * StrToIntdef(edtCardQty.Text, 0) > StrToIntdef(edtWAPPS.text, 0) then
|
|
|
|
|
begin
|
|
|
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
|
|
|
|
end;
|
|
|
|
|
///////////////<2F>ж<EFBFBD><D0B6>Ƿ<C7B7><F1B3ACB3><EFBFBD><EFBFBD><EFBFBD>//////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i := 0 to FStrs.Count - 1 do
|
|
|
|
|
begin
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add('select PCNo=isnull(Max(PCNo),0) ');
|
|
|
|
|
sql.Add('from Knit_Plan_Card A ');
|
|
|
|
|
sql.Add('where A.MainID=' + Quotedstr(Trim(FMainID)));
|
|
|
|
|
sql.Add('and A.Loom=' + Quotedstr(Trim(FStrs[i])));
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
if ADOQueryTemp.IsEmpty then
|
|
|
|
|
MPCNo := 1
|
|
|
|
|
else
|
|
|
|
|
MPCNo := ADOQueryTemp.FieldByName('PCNo').AsInteger + 1;
|
|
|
|
|
////////////////// <20><><EFBFBD>벼Ʊ //////////////////////
|
|
|
|
|
if GetLSNo(ADOQueryTemp, maxno, 'PC', 'knit_Plan_Mach', 2, 1) = False then
|
|
|
|
|
begin
|
|
|
|
|
raise Exception.Create('ȡ<><C8A1>Ʊ<EFBFBD><C6B1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!');
|
|
|
|
|
end;
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add(' insert into Knit_Plan_Card(MainId,SubId,Loom,PCId,PCNo,PCDate,Filler,BatchNo) values');
|
|
|
|
|
for j := 1 to StrToIntdef(edtCardQty.Text, 0) do
|
|
|
|
|
begin
|
|
|
|
|
maxPCId := maxno + RightStr('00' + inttostr(j), 3);
|
|
|
|
|
if j > 1 then
|
|
|
|
|
sql.Add(',');
|
|
|
|
|
sql.Add(' (' + Quotedstr(Trim(FMainId)));
|
|
|
|
|
sql.Add(',' + Quotedstr(Trim(FSubId)));
|
|
|
|
|
sql.Add(',' + Quotedstr(Trim(FStrs[i])));
|
|
|
|
|
sql.Add(',' + Quotedstr(maxPCId));
|
|
|
|
|
sql.Add(',' + Quotedstr(IntToStr(MPCNo)));
|
|
|
|
|
sql.Add(',getdate() ');
|
|
|
|
|
sql.Add(',' + Quotedstr(Trim(Edit1.Text)));
|
|
|
|
|
sql.Add(',' + Quotedstr(Trim(BatchNo.Text)));
|
|
|
|
|
sql.Add(' )');
|
|
|
|
|
MPCNo := MPCNo + 1;
|
|
|
|
|
|
|
|
|
|
if WSql <> '' then
|
|
|
|
|
begin
|
|
|
|
|
WSql := WSql + ',' + QuotedStr(Trim(maxPCId));
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
WSql := QuotedStr(Trim(maxPCId));
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
////////////////// <20><><EFBFBD>벼Ʊ //////////////////////
|
|
|
|
|
///
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add('update knit_Plan_Main SET status=''9'',chker=''' + trim(DName) + ''',Chktime=getdate() ');
|
|
|
|
|
sql.Add('where isnull(status,''0'')=''0'' and mainID=' + quotedstr(trim(FMainID)));
|
|
|
|
|
|
|
|
|
|
// 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><EFBFBD><EFBFBD><EFBFBD>ʼ')));
|
|
|
|
|
// sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(edtConNo.Text))));
|
|
|
|
|
// sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|
|
|
|
// sql.Add(')');
|
|
|
|
|
execsql;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|
|
|
|
FStrs.Free;
|
|
|
|
|
except
|
|
|
|
|
FStrs.Free;
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
if GetLSNo(ADOQueryTemp, maxPCId, 'PC', 'knit_Plan_Mach', 3, 1) = False then
|
|
|
|
|
begin
|
|
|
|
|
// raise Exception.Create('ȡ<><C8A1>Ʊ<EFBFBD><C6B1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!');
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if trim(isDY.text) = '<27><>' then
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|
|
|
|
with frmLabelPrint do
|
|
|
|
|
begin
|
|
|
|
|
FPreviewPrint := False;
|
|
|
|
|
FLMType := 'KnitPlanCard';
|
|
|
|
|
FFiltration1 := WSql;
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
begin
|
|
|
|
|
// Self.InitGrid();
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
begin
|
|
|
|
|
Close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add('update Knit_Plan_Card ');
|
|
|
|
|
sql.Add('set PRTer=' + quotedstr(DName));
|
|
|
|
|
sql.Add(', PRTCount=PRTCount+1');
|
|
|
|
|
sql.Add(', PRTDate=getdate()');
|
|
|
|
|
sql.Add(' where PCID in (' + WSql + ')');
|
|
|
|
|
ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
frmLabelPrint.Free;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
InitGrid1();
|
|
|
|
|
edtMachNo.text := '';
|
|
|
|
|
Edit1.text := '';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|