623 lines
17 KiB
ObjectPascal
623 lines
17 KiB
ObjectPascal
![]() |
unit U_TatWBCardInPut;
|
|||
|
|
|||
|
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, cxPC,
|
|||
|
Menus, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu,
|
|||
|
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, BtnEdit, U_BaseInput,
|
|||
|
System.ImageList, Vcl.ImgList;
|
|||
|
|
|||
|
type
|
|||
|
TfrmTatWBCardInPut = class(TfrmBaseInput)
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
RMDB_1: TRMDBDataSet;
|
|||
|
Panel2: TPanel;
|
|||
|
DS_Card: TDataSource;
|
|||
|
CDS_Card: TClientDataSet;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N2: TMenuItem;
|
|||
|
N3: TMenuItem;
|
|||
|
Panel4: TPanel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV2: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
V2Column4: TcxGridDBColumn;
|
|||
|
V2Column1: TcxGridDBColumn;
|
|||
|
V2Column3: TcxGridDBColumn;
|
|||
|
TV2Column4: TcxGridDBColumn;
|
|||
|
cxGridDBColumn15: TcxGridDBColumn;
|
|||
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
TV2Column1: TcxGridDBColumn;
|
|||
|
TV2Column2: TcxGridDBColumn;
|
|||
|
TV2Column3: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBSave: TToolButton;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton8: TToolButton;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
Label8: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
Label11: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
Label15: TLabel;
|
|||
|
Label3: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
WB_YarnQty: TEdit;
|
|||
|
edtCardQty: TEdit;
|
|||
|
WB_Spec: TEdit;
|
|||
|
WB_Type: TComboBox;
|
|||
|
WB_ClothPiece: TEdit;
|
|||
|
WB_MachNo: TBtnEditC;
|
|||
|
WB_Macher: TBtnEditC;
|
|||
|
WB_YarnLen: TEdit;
|
|||
|
Note: TRichEdit;
|
|||
|
GPM_2: TcxGridPopupMenu;
|
|||
|
TV2Column5: TcxGridDBColumn;
|
|||
|
Label7: TLabel;
|
|||
|
WBData: TDateTimePicker;
|
|||
|
Label10: TLabel;
|
|||
|
FtyCoName: TBtnEditC;
|
|||
|
Label13: TLabel;
|
|||
|
WB_BatchNo: TEdit;
|
|||
|
Label14: TLabel;
|
|||
|
WB_ClothName: TBtnEditC;
|
|||
|
Label16: TLabel;
|
|||
|
WB_YarnWidth: TEdit;
|
|||
|
TV2Column6: TcxGridDBColumn;
|
|||
|
Label17: TLabel;
|
|||
|
WB_YarnBatchNo: TBtnEditC;
|
|||
|
Label18: TLabel;
|
|||
|
WBCNO: TEdit;
|
|||
|
TV2Column8: TcxGridDBColumn;
|
|||
|
TV2Column9: TcxGridDBColumn;
|
|||
|
Label19: TLabel;
|
|||
|
WB_Code: TBtnEditC;
|
|||
|
Label1: TLabel;
|
|||
|
WB_YarnArrQty: TEdit;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
TV2Column10: TcxGridDBColumn;
|
|||
|
TV2Column7: TcxGridDBColumn;
|
|||
|
WB_Len: TBtnEditC;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure WB_MachNoBtnDnClick(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure ToolButton8Click(Sender: TObject);
|
|||
|
procedure FtyCoNameBtnUpClick(Sender: TObject);
|
|||
|
procedure FtyCoNameBtnDnClick(Sender: TObject);
|
|||
|
procedure WB_ClothNameBtnUpClick(Sender: TObject);
|
|||
|
procedure WB_ClothNameBtnDnClick(Sender: TObject);
|
|||
|
procedure WB_CodeBtnUpClick(Sender: TObject);
|
|||
|
procedure WB_CodeBtnDnClick(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure WB_MachNoBtnUpClick(Sender: TObject);
|
|||
|
procedure WB_YarnBatchNoBtnUpClick(Sender: TObject);
|
|||
|
private
|
|||
|
function TestData(): Boolean;
|
|||
|
procedure PrtDate(MWBCID: string);
|
|||
|
|
|||
|
procedure InitCard();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FWBCNO: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmTatWBCardInPut: TfrmTatWBCardInPut;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint, U_TatPlanSel, U_CompanySel,
|
|||
|
U_TatClothInfoSel, U_YarnInfoSel, U_WBSpecEditSel, U_YarnStkSel;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
function TfrmTatWBCardInPut.TestData(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
|
|||
|
// if StrToIntDef(edtCardQty.Text, 0) = 0 then
|
|||
|
// raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if StrToIntDef(WB_YarnQty.Text, 0) = 0 then
|
|||
|
raise Exception.Create('ͷ<>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
// if Trim(WB_YarnArr.Text) = '' then
|
|||
|
// raise Exception.Create('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Trim(WB_YarnBatchNo.Text) = '' then
|
|||
|
raise Exception.Create('ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Trim(WB_Len.Text) = '' then
|
|||
|
raise Exception.Create('<27>᳤<EFBFBD><E1B3A4><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if StrToIntDef(WB_YarnLen.Text, 0) = 0 then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Trim(WB_Macher.Text) = '' then
|
|||
|
raise Exception.Create('Ǥ<><C7A4><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Trim(WB_MachNo.Text) = '' then
|
|||
|
raise Exception.Create('Ǩ<><C7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if StrToIntDef(WB_ClothPiece.Text, 0) = 0 then
|
|||
|
begin
|
|||
|
WB_ClothPiece.Text := '0';
|
|||
|
end;
|
|||
|
// if Trim(WB_Type.Text) = '' then
|
|||
|
// raise Exception.Create('<27><><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.InitCard();
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.* ');
|
|||
|
sql.Add('from Tat_WB_Card A ');
|
|||
|
sql.Add('where isnull(Status,''0'')<>''-1'' and WBCNO=' + quotedstr(Trim(FWBCNO)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_Card);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_Card);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.PrtDate(MWBCID: string);
|
|||
|
var
|
|||
|
fPrintFile, FFCYID: string;
|
|||
|
DPS, i, j: Integer;
|
|||
|
begin
|
|||
|
|
|||
|
ExportFtErpFile('<27>Ῠ<EFBFBD><E1BFA8>ǩ.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>Ῠ<EFBFBD><E1BFA8>ǩ.rmf';
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Tat_WB_Card set PrtFlag=PrtFlag+1 ');
|
|||
|
sql.Add(' where WBCID=' + quotedstr(MWBCID));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.*,D.* ');
|
|||
|
sql.Add(' from PD_Plan_Main A inner join PD_Plan_Sub B on A.Mainid=B.MainId');
|
|||
|
sql.Add(' inner join Tat_WB_Card_MS C on C.Subid=B.Subid ');
|
|||
|
sql.Add(' inner join Tat_WB_Card D on C.WBCID=D.WBCID ');
|
|||
|
sql.Add(' where D.WBCID=' + quotedstr(MWBCID));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('select Y.* from PD_Plan_Yarn Y INNER JOIN Tat_WB_Card_MS M ON M.MainId=Y.MainId where Y.PYType=''<27><>˿'' and M.WBCID=' + Quotedstr(Trim(MWBCID)));
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// SCreateCDS(ADOQueryTemp, CDS_PJS);
|
|||
|
// SInitCDSData(ADOQueryTemp, CDS_PJS);
|
|||
|
//
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('select Y.* from PD_Plan_Yarn Y INNER JOIN Tat_WB_Card_MS M ON M.MainId=Y.MainId where Y.PYType=''γ˿'' and M.WBCID=' + Quotedstr(Trim(MWBCID)));
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// SCreateCDS(ADOQueryTemp, CDS_PWS);
|
|||
|
// SInitCDSData(ADOQueryTemp, CDS_PWS);
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.DefaultCopies := 1;
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(Trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD>Ῠ');
|
|||
|
WBData.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
if Trim(FWBCNO) = '' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryTemp, FWBCNO, 'QJ', 'Tat_WB_Card', 3, 1) = False then
|
|||
|
begin
|
|||
|
raise Exception.Create('Ǩ<><C7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
|||
|
end;
|
|||
|
end;
|
|||
|
WBCNO.Text := FWBCNO;
|
|||
|
InitCard();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.FtyCoNameBtnDnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
TBtnEditC(Sender).TxtCode := '';
|
|||
|
TBtnEditC(Sender).Text := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.FtyCoNameBtnUpClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
with frmCompanySel do
|
|||
|
begin
|
|||
|
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
FtyCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
FtyCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCompanySel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Card, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.N3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Card, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.TBSaveClick(Sender: TObject);
|
|||
|
var
|
|||
|
MWBCID: string;
|
|||
|
i, j: integer;
|
|||
|
begin
|
|||
|
if TestData() = false then
|
|||
|
exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>Ῠ //////////////////////
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' insert into Tat_WB_Card(WBCID, WBCNO,WB_YarnBatchNo,WB_Code,WB_Spec,WB_YarnQty,WB_YarnArrQty,WB_Len,WB_YarnLen,WB_Macher ');
|
|||
|
sql.Add(' ,WBData,FtyCoNo,FtyCoName,WB_YarnWidth,WB_ClothName,WB_BatchNo');
|
|||
|
sql.Add(' ,WB_MachNo,WB_ClothPiece,WB_Type,Note,FillId,Filler) values');
|
|||
|
|
|||
|
for i := 1 to StrToIntdef(edtCardQty.Text, 1) do
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryTemp, MWBCID, 'ZK', 'Tat_WB_Card', 3, 1) = False then
|
|||
|
begin
|
|||
|
raise Exception.Create('ȡ<><C8A1>Ʊ<EFBFBD><C6B1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!');
|
|||
|
end;
|
|||
|
if i > 1 then
|
|||
|
sql.Add(',');
|
|||
|
sql.Add(' (' + Quotedstr(Trim(MWBCID)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WBCNO.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_YarnBatchNo.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_Code.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_Spec.Text)));
|
|||
|
sql.Add(',' + (Trim(WB_YarnQty.Text)));
|
|||
|
sql.Add(',' + Trim(WB_YarnArrQty.Text));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_Len.Text)));
|
|||
|
sql.Add(',' + (Trim(WB_YarnLen.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_Macher.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(FormatDateTime('yyyy-MM-dd', WBData.DateTime))));
|
|||
|
sql.Add(',' + Quotedstr(Trim(FtyCoName.TxtCode)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(FtyCoName.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_YarnWidth.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_ClothName.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_BatchNo.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_MachNo.Text)));
|
|||
|
sql.Add(',' + (Trim(WB_ClothPiece.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(WB_Type.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(Note.Text)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(DCode)));
|
|||
|
sql.Add(',' + Quotedstr(Trim(DName)));
|
|||
|
sql.Add(' )');
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>Ῠ //////////////////////
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
InitCard();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
WSql: string;
|
|||
|
begin
|
|||
|
|
|||
|
if CDS_Card.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDS_Card.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
WSql := '';
|
|||
|
CDS_Card.DisableControls;
|
|||
|
|
|||
|
with CDS_Card do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Card.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
if WSql <> '' then
|
|||
|
begin
|
|||
|
WSql := WSql + ',' + QuotedStr(Trim(CDS_Card.fieldbyname('WBCID').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
WSql := QuotedStr(Trim(CDS_Card.fieldbyname('WBCID').AsString));
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_Card.Locate('SSel', True, []);
|
|||
|
CDS_Card.EnableControls;
|
|||
|
|
|||
|
try
|
|||
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
with frmLabelPrint do
|
|||
|
begin
|
|||
|
FPreviewPrint := False;
|
|||
|
FLMType := 'TatWBCard';
|
|||
|
FFiltration1 := WSql;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Tat_WB_Card ');
|
|||
|
sql.Add(' set PRTer=' + quotedstr(DName));
|
|||
|
sql.Add(', PRTCount=PRTCount+1');
|
|||
|
sql.Add(', PRTDate=getdate()');
|
|||
|
sql.Add(' where WBCID in (' + WSql + ')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelPrint.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(Trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD>Ῠ');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
if GetLSNo(ADOQueryTemp, FWBCNO, 'QJ', 'Tat_WB_Card', 3, 1) = False then
|
|||
|
begin
|
|||
|
raise Exception.Create('Ǩ<><C7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
|||
|
end;
|
|||
|
WBCNO.Text := FWBCNO;
|
|||
|
InitCard();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.ToolButton8Click(Sender: TObject);
|
|||
|
var
|
|||
|
WSql: string;
|
|||
|
begin
|
|||
|
if CDS_Card.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDS_Card.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
WSql := '';
|
|||
|
CDS_Card.DisableControls;
|
|||
|
|
|||
|
while CDS_Card.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
if CDS_Card.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
if WSql <> '' then
|
|||
|
begin
|
|||
|
WSql := WSql + ',' + (Trim(CDS_Card.fieldbyname('WBCID').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
WSql := (Trim(CDS_Card.fieldbyname('WBCID').AsString));
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Card.Delete;
|
|||
|
end;
|
|||
|
CDS_Card.EnableControls;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('insert into Knit_Need_Up(UOperation,UType,UDataId) values(''<27><><EFBFBD><EFBFBD>'',''<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>'',' + quotedstr(MCIIDS) + ') ');
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Sql.Clear;
|
|||
|
Sql.Add('exec P_TatWB_Card_Del ');
|
|||
|
Sql.Add('@WBCIDS=' + quotedstr(Trim(WSql)));
|
|||
|
Sql.Add(',@DCode=' + Quotedstr(DCode));
|
|||
|
Sql.Add(',@DName=' + Quotedstr(DName));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
begin
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
|||
|
application.MessageBox('ɾ<><C9BE><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.WB_ClothNameBtnDnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Self.WB_ClothName.Text := '';
|
|||
|
Self.WB_YarnWidth.Text := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.WB_ClothNameBtnUpClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmTatClothInfoSel := TfrmTatClothInfoSel.Create(Application);
|
|||
|
with frmTatClothInfoSel do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.WB_ClothName.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Name').AsString;
|
|||
|
Self.WB_YarnWidth.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Width').AsString;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTatClothInfoSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.WB_CodeBtnDnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
TBtnEditC(Sender).Text := '';
|
|||
|
TBtnEditC(Sender).TxtCode := '';
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.WB_CodeBtnUpClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmWBSpecEditSel := TfrmWBSpecEditSel.Create(Application);
|
|||
|
with frmWBSpecEditSel do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.WB_Code.Text := CDS_Main.FieldByName('WB_Code').AsString;
|
|||
|
Self.WB_Spec.Text := CDS_Main.FieldByName('WB_Spec').AsString;
|
|||
|
Self.WB_YarnQty.Text := CDS_Main.FieldByName('WB_YarnQty').AsString;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmWBSpecEditSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.WB_MachNoBtnDnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
TBtnEditC(Sender).Text := '';
|
|||
|
TBtnEditC(Sender).TxtCode := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.WB_MachNoBtnUpClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatWBCardInPut.WB_YarnBatchNoBtnUpClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmYarnStkSel := TfrmYarnStkSel.Create(Application);
|
|||
|
with frmYarnStkSel do
|
|||
|
begin
|
|||
|
FstkName := 'ɴ<><C9B4>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.WB_YarnBatchNo.Text := rtvalues[0];
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmYarnStkSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|