713 lines
21 KiB
ObjectPascal
713 lines
21 KiB
ObjectPascal
|
|
unit U_TatWBCardInPutXIUGAI;
|
|||
|
|
|
|||
|
|
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, dxScrollbarAnnotations, cxImageList;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmTatWBCardInPutXIUGAI = 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;
|
|||
|
|
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_ClothNameL: TBtnEditC;
|
|||
|
|
Label16: TLabel;
|
|||
|
|
WB_YarnWidth: TEdit;
|
|||
|
|
TV2Column6: TcxGridDBColumn;
|
|||
|
|
Label17: TLabel;
|
|||
|
|
WB_YarnBatchNo: TBtnEditC;
|
|||
|
|
Label18: TLabel;
|
|||
|
|
WBCNOL: TEdit;
|
|||
|
|
TV2Column8: TcxGridDBColumn;
|
|||
|
|
TV2Column9: TcxGridDBColumn;
|
|||
|
|
Label19: TLabel;
|
|||
|
|
WB_Code: TBtnEditC;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
WB_YarnArrQty: TEdit;
|
|||
|
|
TV2Column10: TcxGridDBColumn;
|
|||
|
|
TV2Column7: TcxGridDBColumn;
|
|||
|
|
WB_Len: TBtnEditC;
|
|||
|
|
WB_Clothcode: TEdit;
|
|||
|
|
TV2Column11: TcxGridDBColumn;
|
|||
|
|
Panel3: TPanel;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
Label20: TLabel;
|
|||
|
|
Label21: TLabel;
|
|||
|
|
Label22: TLabel;
|
|||
|
|
Label23: TLabel;
|
|||
|
|
Label24: TLabel;
|
|||
|
|
Label25: TLabel;
|
|||
|
|
Label26: TLabel;
|
|||
|
|
ConNo: TEdit;
|
|||
|
|
Edit1: TEdit;
|
|||
|
|
WB_ClothName: TEdit;
|
|||
|
|
OrderNos: TEdit;
|
|||
|
|
BatchNo: TEdit;
|
|||
|
|
WBCID: TEdit;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
Label27: TLabel;
|
|||
|
|
ConNoL: TEdit;
|
|||
|
|
TV2Column12: TcxGridDBColumn;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
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_ClothNameLBtnUpClick(Sender: TObject);
|
|||
|
|
procedure WB_ClothNameLBtnDnClick(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);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
// procedure WB_YarnBatchNo1Change(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
function TestData(): Boolean;
|
|||
|
|
procedure PrtDate(MWBCID: string);
|
|||
|
|
|
|||
|
|
procedure InitCard();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
FWBCNO: string;
|
|||
|
|
WBOrderNo: string;
|
|||
|
|
WBC_Name: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmTatWBCardInPutXIUGAI: TfrmTatWBCardInPutXIUGAI;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint, U_TatPlanSel, U_CompanySel,
|
|||
|
|
U_TatClothInfoSel, U_YarnInfoSel, U_WBSpecEditSel, U_YarnStkSel,
|
|||
|
|
U_SalesContractSel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
function TfrmTatWBCardInPutXIUGAI.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 TfrmTatWBCardInPutXIUGAI.InitCard();
|
|||
|
|
var
|
|||
|
|
WhereStr: string;
|
|||
|
|
i: Integer;
|
|||
|
|
Ctrl: TControl;
|
|||
|
|
EditCtrl: TEdit;
|
|||
|
|
CtrlText: string;
|
|||
|
|
DBField: string; // <20><><EFBFBD>ݿ<EFBFBD><DDBF>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ʹ<EFBFBD>ÿؼ<C3BF>Name<6D><65>
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.ADD('select A.*');
|
|||
|
|
SQL.ADD('from Tat_WB_Card A');
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
WhereStr := 'where isnull(Status,''0'')<>''-1'' and WBCID=' + quotedstr(Trim(WBCID.text)) + ' and A.WBData>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''' + ' and A.WBData<''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + '''';
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>Panel3<6C>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>TEdit<69>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
for i := 0 to Panel3.ControlCount - 1 do
|
|||
|
|
begin
|
|||
|
|
Ctrl := Panel3.Controls[i];
|
|||
|
|
if Ctrl is TEdit then // ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>༭<EFBFBD><E0BCAD>
|
|||
|
|
begin
|
|||
|
|
EditCtrl := TEdit(Ctrl);
|
|||
|
|
CtrlText := Trim(EditCtrl.Text);
|
|||
|
|
if CtrlText = '' then
|
|||
|
|
Continue; // <20><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
// ֱ<><D6B1><EFBFBD>ÿؼ<C3BF>Name<6D><65>Ϊ<EFBFBD><CEAA><EFBFBD>ݿ<EFBFBD><DDBF>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪName<6D><65><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ȫһ<C8AB>£<EFBFBD>
|
|||
|
|
DBField := 'A.' + EditCtrl.Name; // ƴ<>ӱ<EFBFBD><D3B1><EFBFBD><EFBFBD><EFBFBD>A.<2E><><EFBFBD><EFBFBD>A.WB_ClothName
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>Tag<61><67><EFBFBD><EFBFBD><EFBFBD>жϲ<D0B6>ѯ<EFBFBD><D1AF>ʽ<EFBFBD><CABD>Tag=1<><31>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>Tag=0<><30><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>
|
|||
|
|
if EditCtrl.Tag = 1 then
|
|||
|
|
WhereStr := WhereStr + ' and ' + DBField + ' like ' + quotedstr('%' + CtrlText + '%')
|
|||
|
|
else
|
|||
|
|
WhereStr := WhereStr + ' and ' + DBField + ' = ' + quotedstr(CtrlText);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
SQL.Add(WhereStr);
|
|||
|
|
Open;
|
|||
|
|
|
|||
|
|
// ԭ<>и<EFBFBD>ֵ<EFBFBD><EFBFBD>
|
|||
|
|
WBData.Date := Date;
|
|||
|
|
BegDate.DateTime := Date - 6;
|
|||
|
|
enddate.DateTime := Date;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
SCreateCDS(ADOQueryTemp, CDS_Card);
|
|||
|
|
SInitCDSData(ADOQueryTemp, CDS_Card);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.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 TfrmTatWBCardInPutXIUGAI.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 TfrmTatWBCardInPutXIUGAI.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitCard();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
InitCard();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.FtyCoNameBtnDnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBtnEditC(Sender).TxtCode := '';
|
|||
|
|
TBtnEditC(Sender).Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.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 TfrmTatWBCardInPutXIUGAI.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_Card, True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.N3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_Card, False);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitCard();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
//procedure TfrmTatWBCardInPutXIUGAI.TBSaveClick(Sender: TObject);
|
|||
|
|
//var
|
|||
|
|
// rtvalues: TArray<string>;
|
|||
|
|
//begin
|
|||
|
|
// if CDS_Card.IsEmpty then
|
|||
|
|
// Exit;
|
|||
|
|
// Tv2.OnFocusedRecordChanged := nil;
|
|||
|
|
// if CDS_Card.Locate('SSel', True, []) = False then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
// rtvalues := SelCDSKey(CDS_Card, ['WBCID']);
|
|||
|
|
//
|
|||
|
|
// try
|
|||
|
|
// ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
//
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// Sql.Clear;
|
|||
|
|
// Sql.Add('update Tat_WB_Card ');
|
|||
|
|
// Sql.Add('set WB_ClothName=' + Trim(Quotedstr(WB_ClothNameL.text)));
|
|||
|
|
// Sql.Add(', WB_Clothcode=' + Trim(Quotedstr(WB_Clothcode.text)));
|
|||
|
|
// Sql.Add(', WB_YarnArrQty=' + Trim(Quotedstr(WB_YarnArrQty.text)));
|
|||
|
|
// Sql.Add(', WB_BatchNo=' + Trim(Quotedstr(WB_BatchNo.text)));
|
|||
|
|
// Sql.Add(', WB_MachNo=' + Trim(Quotedstr(WB_MachNo.text)));
|
|||
|
|
// Sql.Add(', FtyCoName=' + Trim(Quotedstr(FtyCoName.text)));
|
|||
|
|
// Sql.Add(', WB_YarnQty=' + Trim(Quotedstr(WB_YarnQty.text)));
|
|||
|
|
// Sql.Add(', WB_Len=' + Trim(Quotedstr(WB_Len.text)));
|
|||
|
|
// Sql.Add(', WB_YarnLen=' + Trim(Quotedstr(WB_YarnLen.text)));
|
|||
|
|
// Sql.Add(', WB_Macher=' + Trim(Quotedstr(WB_Macher.text)));
|
|||
|
|
// Sql.Add(', WB_YarnWidth=' + Trim(Quotedstr(WB_YarnWidth.text)));
|
|||
|
|
// Sql.Add(', ConNo=' + Trim(Quotedstr(ConNo.text)));
|
|||
|
|
// Sql.Add('WHERE WBCID ='+ quotedstr(Trim(rtvalues[0])));
|
|||
|
|
//// Sql.Add('@WBCIDS=' + quotedstr(Trim(rtvalues[0])));
|
|||
|
|
//// Sql.Add(',@DCode=' + Quotedstr(DCode));
|
|||
|
|
//// Sql.Add(',@DName=' + Quotedstr(DName));
|
|||
|
|
// EXECSQL;
|
|||
|
|
// end;
|
|||
|
|
// if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
// begin
|
|||
|
|
// raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
// end;
|
|||
|
|
// ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
// application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
// except
|
|||
|
|
// ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
// application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// end;
|
|||
|
|
// InitCard();
|
|||
|
|
//end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
Sql.Clear;
|
|||
|
|
Sql.Add('update Tat_WB_Card ');
|
|||
|
|
Sql.Add('set WB_ClothName=' + Trim(Quotedstr(WB_ClothNameL.text)));
|
|||
|
|
Sql.Add(', WB_Clothcode=' + Trim(Quotedstr(WB_Clothcode.text)));
|
|||
|
|
Sql.Add(', WB_YarnArrQty=' + Trim(Quotedstr(WB_YarnArrQty.text)));
|
|||
|
|
Sql.Add(', WB_BatchNo=' + Trim(Quotedstr(WB_BatchNo.text)));
|
|||
|
|
Sql.Add(', WB_MachNo=' + Trim(Quotedstr(WB_MachNo.text)));
|
|||
|
|
Sql.Add(', FtyCoName=' + Trim(Quotedstr(FtyCoName.text)));
|
|||
|
|
Sql.Add(', WB_YarnQty=' + Trim(Quotedstr(WB_YarnQty.text)));
|
|||
|
|
Sql.Add(', WB_Len=' + Trim(Quotedstr(WB_Len.text)));
|
|||
|
|
Sql.Add(', WB_YarnLen=' + Trim(Quotedstr(WB_YarnLen.text)));
|
|||
|
|
Sql.Add(', WB_Macher=' + Trim(Quotedstr(WB_Macher.text)));
|
|||
|
|
Sql.Add(', WB_YarnWidth=' + Trim(Quotedstr(WB_YarnWidth.text)));
|
|||
|
|
Sql.Add(', Note=' + Trim(Quotedstr(Note.text)));
|
|||
|
|
Sql.Add(', ConNo=' + Trim(Quotedstr(ConNo.text)));
|
|||
|
|
Sql.Add(', WBCNO=' + Trim(Quotedstr(WBCNOL.text)));
|
|||
|
|
|
|||
|
|
Sql.Add('WHERE WBCID ='+ Quotedstr(Trim(CDS_Card.FieldByName('WBCID').AsString)));
|
|||
|
|
// ShowMessage(sql.text);
|
|||
|
|
EXECSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
InitCard();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid(Trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD>Ῠ');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.ToolButton4Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmSalesContractSel := TfrmSalesContractSel.Create(Application);
|
|||
|
|
with frmSalesContractSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
self.ConNoL.Text := frmSalesContractSel.CDS_1.fieldbyname('ConNo').AsString; //<2F><>ͬ<EFBFBD><CDAC>
|
|||
|
|
// self.Custname.Text := frmSalesContractSel.CDS_1.fieldbyname('BuyName').AsString; //<2F>ͻ<EFBFBD>
|
|||
|
|
// self.OurCoName.Text := frmSalesContractSel.CDS_1.fieldbyname('SellName').AsString;
|
|||
|
|
self.WB_Clothcode.Text := frmSalesContractSel.CDS_1.fieldbyname('C_Code').AsString; //<2F><><EFBFBD><EFBFBD>
|
|||
|
|
self.WB_ClothNameL.Text := frmSalesContractSel.CDS_1.fieldbyname('C_Name').AsString; //Ʒ<><C6B7>
|
|||
|
|
// self.OrdQty.Text := frmSalesContractSel.CDS_1.fieldbyname('ConQty').AsString; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmSalesContractSel.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.ToolButton5Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmTatPlanSel := TfrmTatPlanSel.Create(Application);
|
|||
|
|
with frmTatPlanSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.WB_ClothNameL.Text := frmTatPlanSel.CDS_1.fieldbyname('C_Name').AsString;
|
|||
|
|
Self.WB_YarnWidth.Text := frmTatPlanSel.CDS_1.fieldbyname('C_Width').AsString;
|
|||
|
|
Self.WB_Clothcode.Text := frmTatPlanSel.CDS_1.fieldbyname('C_Code').AsString;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmTatPlanSel.Free;
|
|||
|
|
end;
|
|||
|
|
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 TfrmTatWBCardInPutXIUGAI.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 TfrmTatWBCardInPutXIUGAI.WB_ClothNameLBtnDnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Self.WB_ClothName.Text := '';
|
|||
|
|
Self.WB_YarnWidth.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.WB_ClothNameLBtnUpClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmTatClothInfoSel := TfrmTatClothInfoSel.Create(Application);
|
|||
|
|
with frmTatClothInfoSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.ConNoL.Text := '';
|
|||
|
|
end;
|
|||
|
|
begin
|
|||
|
|
Self.WB_ClothNameL.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Name').AsString;
|
|||
|
|
Self.WB_YarnWidth.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Width').AsString;
|
|||
|
|
Self.WB_Clothcode.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Code').AsString;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmTatClothInfoSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.WB_CodeBtnDnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// TBtnEditC(Sender).Text := '';
|
|||
|
|
// TBtnEditC(Sender).TxtCode := '';
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.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 TfrmTatWBCardInPutXIUGAI.WB_MachNoBtnDnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// TBtnEditC(Sender).Text := '';
|
|||
|
|
// TBtnEditC(Sender).TxtCode := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTatWBCardInPutXIUGAI.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 TfrmTatWBCardInPutXIUGAI.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.
|
|||
|
|
|