2025-08-12 13:37:49 +08:00
unit U_TatWBCardInPut2;
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,
dxDateRanges, BtnEdit, U_BaseInput, System. ImageList, Vcl. ImgList, cxContainer,
cxMaskEdit, cxDropDownEdit, cxRichEdit, cxMemo, dxScrollbarAnnotations,
dxSkinsCore, dxSkinsDefaultPainters, cxImageList, dxSkinOffice2013White,
dxSkinSharpPlus, dxSkinWXI;
type
TfrmTatWBCardInPut2 = 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;
V2Column3: TcxGridDBColumn;
TV2Column4: TcxGridDBColumn;
TV2Column3: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
ToolBar1: TToolBar;
TBSave: TToolButton;
ToolButton1: TToolButton;
ToolButton8: TToolButton;
ToolButton2: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
Label15: TLabel;
GPM_2: TcxGridPopupMenu;
Label7: TLabel;
Label1: TLabel;
PM_1: TPopupMenu;
N1: TMenuItem;
TWPId: TcxTextEdit;
WB_Code: TcxButtonEdit;
Label5: TLabel;
WB_Name: TcxTextEdit;
Label11: TLabel;
Label13: TLabel;
Label14: TLabel;
WB_YarnQty: TcxTextEdit;
Z_FJGENSHU: TcxTextEdit;
WB_Width: TcxTextEdit;
Label18: TLabel;
Label19: TLabel;
Z_FENJIAO: TcxTextEdit;
Z_BINGSHU: TcxTextEdit;
TV2Column2: TcxGridDBColumn;
DS_3: TDataSource;
GPM_3: TcxGridPopupMenu;
CDS_3: TClientDataSet;
ADO_3: TADOQuery;
TV2Column18: TcxGridDBColumn;
ToolButton3: TToolButton;
TV2Column1: TcxGridDBColumn;
TV2Column5: TcxGridDBColumn;
Panel3: TPanel;
Label2: TLabel;
Label6: TLabel;
Label10: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
WBType1: TcxButtonEdit;
WB_YarnLen1: TcxTextEdit;
edtCardQty1: TcxTextEdit;
WBType2: TcxButtonEdit;
edtCardQty2: TcxTextEdit;
WBType3: TcxButtonEdit;
edtCardQty3: TcxTextEdit;
WB_YarnLen2: TcxTextEdit;
WB_YarnLen3: TcxTextEdit;
Label4: TLabel;
Note: TcxMemo;
Label21: TLabel;
Label30: TLabel;
WB_ProcessType: TcxComboBox;
WBFtyName: TcxButtonEdit;
Label9: TLabel;
Label3: TLabel;
WB_MachNo: TcxButtonEdit;
WB_Macher: TcxButtonEdit;
Label31: TLabel;
WBBelong1: TcxComboBox;
Label32: TLabel;
WBBelongCoName1: TcxButtonEdit;
Label33: TLabel;
WBBelong2: TcxComboBox;
Label34: TLabel;
WBBelongCoName2: TcxButtonEdit;
Label35: TLabel;
WBBelong3: TcxComboBox;
Label36: TLabel;
WBBelongCoName3: TcxButtonEdit;
TV2Column6: TcxGridDBColumn;
TV2Column7: TcxGridDBColumn;
TV2Column8: TcxGridDBColumn;
TV2Column9: TcxGridDBColumn;
Label38: TLabel;
GYNo: TcxButtonEdit;
Label47: TLabel;
CustName: TcxButtonEdit;
Label20: TLabel;
Label39: TLabel;
WB_ReedNo: TcxTextEdit;
GKBH: TcxButtonEdit;
WB_TYPE: TcxTextEdit;
Label40: TLabel;
C_NAME: TcxTextEdit;
Label8: TLabel;
Label12: TLabel;
Label16: TLabel;
Label17: TLabel;
Z_SJKESHU1: TcxTextEdit;
Z_SJKESHU2: TcxTextEdit;
Z_ZHOUSHU1: TcxTextEdit;
Z_ZHOUSHU2: TcxTextEdit;
Label22: TLabel;
Label23: TLabel;
BSQTY: TcxTextEdit;
DCRQTY: TcxTextEdit;
Label37: TLabel;
C_KCQTY: TcxTextEdit;
Label41: TLabel;
WB_ReedNote: TcxTextEdit;
Label42: TLabel;
C_CODE: TcxTextEdit;
Label43: TLabel;
XZ_GS: TcxTextEdit;
Label44: TLabel;
XZ_YarnQty: TcxTextEdit;
procedure FormClose( Sender: TObject; var Action: TCloseAction) ;
procedure FormShow( Sender: TObject) ;
procedure N2Click( Sender: TObject) ;
procedure N3Click( Sender: TObject) ;
procedure ToolButton1Click( Sender: TObject) ;
procedure TBCloseClick( Sender: TObject) ;
procedure ToolButton2Click( Sender: TObject) ;
procedure ToolButton8Click( Sender: TObject) ;
procedure WBNoPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
procedure WB_MachNoPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
procedure WB_CodePropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
procedure TBSaveClick( Sender: TObject) ;
procedure cxButtonEdit1PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
procedure WBFtyNameDblClick( Sender: TObject) ;
procedure ToolButton3Click( Sender: TObject) ;
procedure TV2Column5PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
procedure TV2Column2PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
procedure TV2Column8PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
procedure CustNamePropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
procedure GYNoDblClick( Sender: TObject) ;
procedure GKBHPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
private
function TestData( ) : Boolean ;
procedure PrtDate( MWBCID: string ) ;
procedure InitCard( ) ;
procedure InitCardGrop( ) ;
procedure InitCard3( ) ;
procedure KaiKa( MWBType, MWBBelong, MWBBelongCoNo, MWBBelongCoName: string ; MCardQty: Integer ; MWB_YarnLen: Double ) ;
{ Private declarations }
public
FWBCNO, FTWPId, FWB_Type: string ;
{ Public declarations }
end ;
var
frmTatWBCardInPut2: TfrmTatWBCardInPut2;
implementation
uses
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint, U_WBTatPlanSel, U_WBSpecSel,
U_WarpBeamInfoSel, U_WBTypeSel, U_CompanySel, U_TatGYSel, U_GKManageSel,
U_TatPlanSel2;
{$R *.dfm} procedure TfrmTatWBCardInPut2. InitCard3( ) ;
begin
with ADO_3 do
begin
Close;
sql. Clear;
sql. Add( ' select A.* from Tat_WB_Formula A inner join Tat_WB_Spec B on A.WBSID=B.WBSID ' ) ;
sql. Add( ' where WB_Code=' '' + Trim( WB_Code. Text ) + '' '' ) ;
Open;
end ;
SCreateCDS( ADO_3, CDS_3) ;
SInitCDSData( ADO_3, CDS_3) ;
end ;
procedure TfrmTatWBCardInPut2. InitCardGrop( ) ;
begin
with ADOQueryTemp do
begin
Close;
SQL. Clear;
sql. Add( 'select * from Tat_WB_Plan A where A.TWPId=' '' + Trim( FTWPId) + '' '' ) ;
Open;
end ;
SCSHData( ADOQueryTemp, Panel1, 1 ) ;
if FWB_Type = 'ϡ<> <CFA1> ' then
begin
edtCardQty1. Text : = Trim( ADOQueryTemp. fieldbyname( 'Z_BINGSHU' ) . AsString) ;
WB_YarnLen1. Text : = Trim( ADOQueryTemp. fieldbyname( 'WB_Qty_YJMJZMS' ) . AsString) ;
XZ_YarnQty. Text : = Trim( ADOQueryTemp. fieldbyname( 'WB_Qty_YJMJZMS' ) . AsString) ;
XZ_GS. Text : = Trim( ADOQueryTemp. fieldbyname( 'WB_Qty_YJJZZS' ) . AsString) ;
edtCardQty1. Properties. ReadOnly : = true ;
Label44. Caption : = '<27> ƻ<EFBFBD> ϡ<EFBFBD> ᾭ<EFBFBD> <E1BEAD> ' ;
Label43. Caption : = '<27> ƻ<EFBFBD> ϡ<EFBFBD> <CFA1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
WB_ProcessType. Properties. Items. Clear;
WB_ProcessType. Properties. Items. Add( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ) ;
WB_ProcessType. Properties. Items. Add( '<27> ⳧<EFBFBD> <E2B3A7> <EFBFBD> <EFBFBD> ' ) ;
WB_ProcessType. ItemIndex : = 0 ;
end
else
begin
edtCardQty1. Properties. ReadOnly : = false ;
Label44. Caption : = '<27> ƻ<EFBFBD> ֯<EFBFBD> ᾭ<EFBFBD> <E1BEAD> ' ;
Label43. Caption : = '<27> ƻ<EFBFBD> ֯<EFBFBD> <D6AF> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
WB_ProcessType. Properties. Items. Clear;
2025-08-23 14:29:45 +08:00
XZ_YarnQty. Text : = Trim( ADOQueryTemp. fieldbyname( 'WB_YarnLen' ) . AsString) ;
XZ_GS. Text : = Trim( ADOQueryTemp. fieldbyname( 'WB_Qty' ) . AsString) ;
2025-08-12 13:37:49 +08:00
WB_ProcessType. Properties. Items. Add( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɴ' ) ;
WB_ProcessType. Properties. Items. Add( '<27> <> ɴ<EFBFBD> ɹ<EFBFBD> ' ) ;
WB_ProcessType. Properties. Items. Add( '<27> ⳧<EFBFBD> <E2B3A7> ɴ' ) ;
WB_ProcessType. ItemIndex : = 0 ;
end ;
GYNo. Properties. LookupItems. Text : = Trim( ADOQueryTemp. fieldbyname( 'GYSubid' ) . AsString) ;
CustName. Properties. LookupItems. Text : = Trim( ADOQueryTemp. fieldbyname( 'CustNo' ) . AsString) ;
end ;
function TfrmTatWBCardInPut2. TestData( ) : Boolean ;
begin
try
if Trim( FTWPId) = '' then
begin
if GetLSNo( ADOQueryTemp, FTWPId, 'QJ' , 'Tat_WB_Card' , 3 , 1 ) = False then
begin
raise Exception. Create( 'Ǩ<> <C7A8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> <CAA7> !' ) ;
end ;
TWPId. Text : = FTWPId;
end ;
// if Trim(WB_ProcessType.Text) = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' then
// begin
// if Trim(WB_Macher.Text) = '' then
// raise Exception.Create('Ǥ<> <C7A4> <EFBFBD> <EFBFBD> λ<EFBFBD> <CEBB> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> գ <EFBFBD> ');
// end;
if trim( WB_Code. Text ) = '' then
raise Exception. Create( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> Ų<EFBFBD> <C5B2> <EFBFBD> Ϊ<EFBFBD> գ <EFBFBD> ' ) ;
// 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_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_ProcessType.Text) = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' then
// begin
// if Trim(WB_MachNo.Text) = '' then
// raise Exception.Create('Ǩ<> <C7A8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> գ <EFBFBD> ');
// end;
// if StrToIntDef(WB_ClothPiece.Text, 0) = 0 then
// WB_ClothPiece.Text := '0';
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 TfrmTatWBCardInPut2. 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 TWPId=' + quotedstr( Trim( FTWPId) ) ) ;
SQL. Add( 'AND WB_TYPE=' + quotedstr( Trim( FWB_Type) ) ) ;
Open;
end ;
SCreateCDS( ADOQueryTemp, CDS_Card) ;
SInitCDSData( ADOQueryTemp, CDS_Card) ;
end ;
procedure TfrmTatWBCardInPut2. 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 TfrmTatWBCardInPut2. WBFtyNameDblClick( Sender: TObject) ;
begin
self. WBFtyName. Properties. LookupItems. Text : = '' ;
self. WBFtyName. Text : = '' ;
end ;
procedure TfrmTatWBCardInPut2. WBNoPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
begin
try
frmWBTypeSel : = TfrmWBTypeSel. Create( Application) ;
with frmWBTypeSel do
begin
if ShowModal = 1 then
begin
TcxTextEdit( Sender) . Text : = Trim( frmWBTypeSel. CDS_Main. fieldbyname( 'WBType' ) . AsString) ;
end ;
end ;
finally
frmWBTypeSel. Free;
end ;
end ;
procedure TfrmTatWBCardInPut2. WB_CodePropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
begin
try
frmWBSpecSel : = TfrmWBSpecSel. Create( Application) ;
with frmWBSpecSel do
begin
if ShowModal = 1 then
begin
Self. WB_Code. Text : = Trim( frmWBSpecSel. CDS_1. fieldbyname( 'WB_Code' ) . AsString) ;
Self. WB_Name. Text : = Trim( frmWBSpecSel. CDS_1. fieldbyname( 'WB_Name' ) . AsString) ;
Self. WB_YarnQty. Text : = frmWBSpecSel. CDS_1. fieldbyname( 'WB_YarnQty' ) . value;
Self. WB_Width. Text : = Trim( frmWBSpecSel. CDS_1. fieldbyname( 'WB_Width' ) . AsString) ;
Self. WB_ReedNo. Text : = Trim( frmWBSpecSel. CDS_1. fieldbyname( 'WB_ReedNo' ) . AsString) ;
Self. WB_ReedNote. Text : = Trim( frmWBSpecSel. CDS_1. fieldbyname( 'WB_ReedNote' ) . AsString) ;
Self. Note. Text : = Trim( frmWBSpecSel. CDS_1. fieldbyname( 'Note' ) . AsString) ;
Self. gkbh. Text : = Trim( frmWBSpecSel. CDS_1. fieldbyname( 'gkbh' ) . AsString) ;
Self. InitCard3( ) ;
end ;
end ;
finally
frmWBSpecSel. Free;
end ;
end ;
procedure TfrmTatWBCardInPut2. WB_MachNoPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
var
fsj: string ;
FWZ: Integer ;
begin
fsj : = Trim( TcxButtonEdit( Sender) . Hint) ;
FWZ : = Pos( '/' , fsj) ;
try
frmZDYHelp : = TfrmZDYHelp. Create( Application) ;
with frmZDYHelp do
begin
// MainType := 'SalesCon';
flag : = Copy( fsj, 1 , FWZ - 1 ) ;
flagname : = Copy( fsj, FWZ + 1 , Length( fsj) - FWZ) ;
if ShowModal = 1 then
begin
TcxButtonEdit( Sender) . Text : = Trim( ClientDataSet1. fieldbyname( 'ZDYName' ) . AsString) ;
end ;
end ;
finally
frmZDYHelp. Free;
end ;
end ;
procedure TfrmTatWBCardInPut2. CustNamePropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
begin
inherited ;
try
frmCompanySel : = TfrmCompanySel. Create( Application) ;
with frmCompanySel do
begin
FCoType : = '<27> ͻ<EFBFBD> ' ;
if ShowModal = 1 then
begin
CustName. Properties. LookupItems. Text : = Trim( CDS_1. fieldbyname( 'CoCode' ) . AsString) ;
CustName. Text : = Trim( CDS_1. fieldbyname( 'CoAbbrName' ) . AsString) ;
end ;
end ;
finally
frmCompanySel. Free;
end ;
end ;
procedure TfrmTatWBCardInPut2. cxButtonEdit1PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
begin
try
frmCompanySel : = TfrmCompanySel. Create( Application) ;
with frmCompanySel do
begin
FCoType : = '<27> <> Ӧ<EFBFBD> <D3A6> ' ;
if ShowModal = 1 then
begin
tcxbuttonedit( Sender) . Properties. LookupItems. Text : = Trim( frmCompanySel. CDS_1. fieldbyname( 'CoCode' ) . AsString) ;
tcxbuttonedit( Sender) . Text : = Trim( frmCompanySel. CDS_1. fieldbyname( 'CoAbbrName' ) . AsString) ;
end ;
end ;
finally
frmCompanySel. Free;
end ;
end ;
procedure TfrmTatWBCardInPut2. FormClose( Sender: TObject; var Action: TCloseAction) ;
begin
inherited ;
Action : = caFree;
end ;
procedure TfrmTatWBCardInPut2. FormShow( Sender: TObject) ;
begin
inherited ;
ReadCxGrid( Trim( self. Caption) + 'Tv2' , Tv2, '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> Ῠ' ) ;
InitCardGrop( ) ;
InitCard( ) ;
InitCard3( ) ;
WB_TYPE. Text : = FWB_Type;
end ;
procedure TfrmTatWBCardInPut2. GKBHPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
begin
try
frmGKManageSel : = tfrmGKManageSel. Create( Application) ;
with frmGKManageSel do
begin
if ShowModal = 1 then
begin
SELF. GKBH. Text : = CDS_HZ. FieldByName( 'GKBH' ) . AsString;
SELF. WB_ReedNo. Text : = CDS_HZ. FieldByName( 'GKKH' ) . AsString;
end ;
end ;
finally
frmGKManageSel. Free;
end ;
end ;
procedure TfrmTatWBCardInPut2. GYNoDblClick( Sender: TObject) ;
begin
inherited ;
TcxButtonEdit( Sender) . Properties. LookupItems. Text : = '' ;
TcxButtonEdit( Sender) . Text : = '' ;
end ;
procedure TfrmTatWBCardInPut2. N2Click( Sender: TObject) ;
begin
SelOKNo( CDS_Card, True ) ;
end ;
procedure TfrmTatWBCardInPut2. N3Click( Sender: TObject) ;
begin
SelOKNo( CDS_Card, False ) ;
end ;
procedure TfrmTatWBCardInPut2. TBCloseClick( Sender: TObject) ;
begin
ModalResult : = 1 ;
end ;
procedure TfrmTatWBCardInPut2. TBSaveClick( Sender: TObject) ;
begin
if TestData( ) = false then
exit;
KaiKa( WBType1. Text , WBBelong1. Text , WBBelongCoName1. Properties. LookupItems. Text , WBBelongCoName1. Text , StrToIntdef( edtCardQty1. Text , 0 ) , StrToFloatdef( WB_YarnLen1. Text , 0 ) ) ;
// KaiKa(WBType2.Text, WBBelong2.Text, WBBelongCoName2.Properties.LookupItems.Text, WBBelongCoName2.Text, StrToIntdef(edtCardQty2.Text, 0), StrToFloatdef(WB_YarnLen2.Text, 0));
// KaiKa(WBType3.Text, WBBelong3.Text, WBBelongCoName3.Properties.LookupItems.Text, WBBelongCoName3.Text, StrToIntdef(edtCardQty3.Text, 0), StrToFloatdef(WB_YarnLen3.Text, 0));
end ;
procedure TfrmTatWBCardInPut2. KaiKa( MWBType, MWBBelong, MWBBelongCoNo, MWBBelongCoName: string ; MCardQty: Integer ; MWB_YarnLen: Double ) ;
var
MWBCID: string ;
i, j: integer ;
fDate: string ;
begin
if MCardQty = 0 then
EXIT;
if ( WB_ProcessType. Text = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ɹ<EFBFBD> ' ) or ( WB_ProcessType. Text = '<27> ⳧<EFBFBD> <E2B3A7> ɴ' ) then
begin
if WBFtyName. Text = '' then
begin
Application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> д<EFBFBD> ӹ<EFBFBD> <D3B9> <EFBFBD> λ' , '<27> <> ʾ ' , 0 ) ;
Exit;
end ;
end ;
try
ADOQueryCmd. Connection. BeginTrans;
fDate : = FormatDateTime( 'yyMM' , SGetServerDate( ADOQueryTemp) ) ;
with ADOQueryCmd do
begin
Close;
sql. Clear;
////////////////// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> Ῠ //////////////////////
sql. Add( ' insert into Tat_WB_Card(WBCNO,TWPId,WBCID,WBType,WB_ProcessType,WB_Code,WB_Name,WB_YarnQty,WB_YARNARR,WB_YarnLen,WB_Macher,WB_MachNo,WB_Type,Note,FillId,Filler' ) ;
sql. Add( ' ,WB_Width,WB_ReedNo,WB_ReedNote,WBFtyNo,WBFtyName,WBBelong,WBBelongCoNo,WBBelongCoName ' ) ;
sql. Add( ' ,GYSubid,GYNo,CustNo,CustName,GKBH,C_NAME,C_CODE,Z_FENJIAO,Z_FJGENSHU,Z_BINGSHU' ) ;
SQL. Add( ' ,BSQTY,DCRQTY,C_KCQTY,XZ_GS,XZ_YarnQty' ) ;
sql. Add( ' ) values' ) ;
for i : = 1 to MCardQty do
begin
2025-09-01 15:38:00 +08:00
if FWB_Type = 'ϡ<> <CFA1> ' then
begin
if GetLSNo( ADOQueryTemp, MWBCID, 'XZK' + fDate, 'Tat_WB_Card' , 2 , 0 ) = False then
begin
raise Exception. Create( 'ȡ<> <C8A1> Ʊ<EFBFBD> <C6B1> ˮ<EFBFBD> <CBAE> ʧ<EFBFBD> <CAA7> !' ) ;
end ;
end
else
2025-08-12 13:37:49 +08:00
begin
2025-09-01 15:38:00 +08:00
if GetLSNo( ADOQueryTemp, MWBCID, 'JZK' + fDate, 'Tat_WB_Card' , 2 , 0 ) = False then
begin
raise Exception. Create( 'ȡ<> <C8A1> Ʊ<EFBFBD> <C6B1> ˮ<EFBFBD> <CBAE> ʧ<EFBFBD> <CAA7> !' ) ;
end ;
2025-08-12 13:37:49 +08:00
end ;
if i > 1 then
sql. Add( ',' ) ;
sql. Add( ' (' + Quotedstr( Trim( FTWPId) ) ) ;
sql. Add( ',' + Quotedstr( Trim( FTWPId) ) ) ;
sql. Add( ',' + Quotedstr( Trim( MWBCID) ) ) ;
sql. Add( ',' + Quotedstr( Trim( MWBType) ) ) ;
sql. Add( ',' + Quotedstr( Trim( WB_ProcessType. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( WB_Code. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( WB_Name. Text ) ) ) ;
if FWB_Type = 'ϡ<> <CFA1> ' then
begin
2025-09-30 17:22:36 +08:00
if ( i = MCardQty) and ( Z_ZHOUSHU2. Text < > '' ) and ( Z_ZHOUSHU2. Text < > '0' ) then
2025-08-12 13:37:49 +08:00
begin
sql. Add( ',' + ( Trim( Z_FJGENSHU. Text ) ) ) ;
sql. Add( ',' + ( Trim( Z_SJKESHU2. Text ) ) ) ;
end
else
begin
sql. Add( ',' + ( Trim( Z_FJGENSHU. Text ) ) ) ;
sql. Add( ',' + ( Trim( Z_SJKESHU1. Text ) ) ) ;
end ;
end
else
begin
sql. Add( ',' + ( Trim( WB_YarnQty. Text ) ) ) ;
sql. Add( ',' + ( Trim( Z_SJKESHU1. Text ) ) ) ;
end ;
sql. Add( ',' + FloatToStr( MWB_YarnLen) ) ;
sql. Add( ',' + Quotedstr( Trim( WB_Macher. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( WB_MachNo. 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( ',' + Quotedstr( Trim( WB_Width. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( WB_ReedNo. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( WB_ReedNote. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( WBFtyName. Properties. LookupItems. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( WBFtyName. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( MWBBelong) ) ) ;
sql. Add( ',' + Quotedstr( Trim( MWBBelongCoNo) ) ) ;
sql. Add( ',' + Quotedstr( Trim( MWBBelongCoName) ) ) ;
sql. Add( ',' + Quotedstr( Trim( GYNo. Properties. LookupItems. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( GYNo. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( CustName. Properties. LookupItems. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( CustName. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( GKBH. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( C_NAME. Text ) ) ) ;
sql. Add( ',' + Quotedstr( Trim( C_CODE. Text ) ) ) ;
2025-08-24 15:16:44 +08:00
/////cai<61> <69>
if Z_FENJIAO. Text < > '' then
begin
sql. Add( ',' + ( Trim( Z_FENJIAO. Text ) ) ) ;
end
else
begin
sql. Add( ',0' ) ;
end ;
if Z_FJGENSHU. Text < > '' then
begin
sql. Add( ',' + ( Trim( Z_FJGENSHU. Text ) ) ) ;
end
else
begin
sql. Add( ',0' ) ;
end ;
if Z_BINGSHU. Text < > '' then
begin
sql. Add( ',' + ( Trim( Z_BINGSHU. Text ) ) ) ;
end
else
begin
sql. Add( ',0' ) ;
end ;
if BSQTY. Text < > '' then
begin
sql. Add( ',' + ( Trim( BSQTY. Text ) ) ) ;
end
else
begin
sql. Add( ',0' ) ;
end ;
if DCRQTY. Text < > '' then
begin
sql. Add( ',' + ( Trim( DCRQTY. Text ) ) ) ;
end
else
begin
sql. Add( ',0' ) ;
end ;
// sql.Add(',' + (Trim(Z_FENJIAO.Text)));
// sql.Add(',' + (Trim(Z_FJGENSHU.Text)));
// sql.Add(',' + (Trim(Z_BINGSHU.Text)));
// sql.Add(',' + (Trim(BSQTY.Text)));
// sql.Add(',' + (Trim(DCRQTY.Text)));
2025-08-12 13:37:49 +08:00
sql. Add( ',' + Quotedstr( Trim( C_KCQTY. Text ) ) ) ;
if XZ_GS. Text < > '' then
begin
sql. Add( ',' + ( Trim( XZ_GS. Text ) ) ) ;
end
else
begin
sql. Add( ',0' ) ;
end ;
if XZ_YarnQty. Text < > '' then
begin
sql. Add( ',' + ( Trim( XZ_YarnQty. Text ) ) ) ;
end
else
begin
sql. Add( ',0' ) ;
end ;
sql. Add( ' )' ) ;
end ;
////////////////// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> Ῠ //////////////////////
///
////////////////// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> Ῠ<EFBFBD> ƻ<EFBFBD> <C6BB> <EFBFBD> //////////////////////
// if not CDS_1.IsEmpty then
// begin
// with CDS_1 do
// begin
// First;
// sql.Add(' delete Tat_WB_Card_Link where WBCNO=' + Quotedstr(Trim(FWBCNO)));
//
// while not Eof do
// begin
// sql.Add(' insert into Tat_WB_Card_Link(MainId,SubID,WBCNO) values');
// sql.Add(' (' + Quotedstr(Trim(CDS_1.FieldByName('MainId').AsString)));
// sql.Add(',' + Quotedstr(Trim(CDS_1.FieldByName('SubID').AsString)));
// sql.Add(',' + Quotedstr(Trim(FWBCNO)));
// sql.Add(' )');
// Next;
// end;
// end;
// end;
////////////////// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> Ῠ<EFBFBD> ƻ<EFBFBD> <C6BB> <EFBFBD> //////////////////////
2025-08-24 15:16:44 +08:00
// showMessage(sql.Text);
2025-08-12 13:37:49 +08:00
ExecSQL;
end ;
with ADOQueryTemp do
begin
Close;
SQL. Clear;
sql. Add( 'select * from V_Tat_WB_CardGrop A where A.WBCNO=' '' + Trim( FWBCNO) + '' '' ) ;
Open;
end ;
if ADOQueryTemp. RecordCount > 1 then
raise Exception. Create( '<27> ƻ<EFBFBD> <C6BB> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ<EFBFBD> <CFA2> <EFBFBD> ܱ<EFBFBD> <DCB1> <EFBFBD> !' ) ;
ADOQueryCmd. Connection. CommitTrans;
except
ADOQueryCmd. Connection. RollbackTrans;
application. MessageBox( PChar( Exception( ExceptObject) . Message ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
end ;
InitCard( ) ;
end ;
procedure TfrmTatWBCardInPut2. 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
2025-09-30 17:22:36 +08:00
WSql : = WSql + ',' + Trim( CDS_Card. fieldbyname( 'WBCID' ) . AsString) ;
2025-08-12 13:37:49 +08:00
end
else
begin
2025-09-30 17:22:36 +08:00
WSql : = Trim( CDS_Card. fieldbyname( 'WBCID' ) . AsString) ;
2025-08-12 13:37:49 +08:00
end ;
end ;
Next;
end ;
end ;
CDS_Card. Locate( 'SSel' , True , [ ] ) ;
CDS_Card. EnableControls;
try
frmLabelPrint : = TfrmLabelPrint. Create( Application) ;
with frmLabelPrint do
begin
FPreviewPrint : = False ;
2025-09-30 17:22:36 +08:00
if FWB_Type = 'ϡ<> <CFA1> ' then
begin
FLMType : = 'TatWBCardXZ' ;
end
else if FWB_Type = '<27> <> <EFBFBD> <EFBFBD> ' then
begin
FLMType : = 'TatWBCardJZ' ;
end ;
// FLMType := 'TatWBCard';
2025-08-12 13:37:49 +08:00
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 TfrmTatWBCardInPut2. ToolButton2Click( Sender: TObject) ;
begin
WriteCxGrid( Trim( self. Caption) + 'Tv2' , Tv2, '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> Ῠ' ) ;
end ;
procedure TfrmTatWBCardInPut2. ToolButton3Click( Sender: TObject) ;
begin
Note. SetFocus;
try
CDS_Card. DisableControls;
CDS_Card. First;
while not CDS_Card. Eof do
begin
ADOQueryCmd. Connection. BeginTrans;
try
with ADOQueryCmd do
begin
close;
sql. Clear;
sql. Add( 'select * from Tat_WB_Card A' ) ;
sql. Add( 'where WBCID=' '' + trim( CDS_Card. fieldbyname( 'WBCID' ) . AsString) + '' '' ) ;
open;
edit;
FieldByName( 'Editer' ) . Value : = Trim( DName) ;
FieldByName( 'EditTime' ) . Value : = SGetServerDateTime( ADOQueryTemp) ;
RTSetsavedata( ADOQueryCmd, 'Tat_WB_Card' , Panel1, 1 ) ;
RTSetSaveDataCDS( ADOQueryCmd, Tv2, CDS_Card, 'Tat_WB_Card' , 0 ) ;
post;
end ;
ADOQueryCmd. Connection. CommitTrans;
except
ADOQueryCmd. Connection. RollbackTrans;
raise Exception. Create( PChar( Exception( ExceptObject) . Message ) ) ;
end ;
CDS_Card. Next;
end ;
CDS_Card. EnableControls;
except
CDS_Card. EnableControls;
application. MessageBox( PChar( Exception( ExceptObject) . Message ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
end ;
end ;
procedure TfrmTatWBCardInPut2. 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 TfrmTatWBCardInPut2. TV2Column2PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
begin
try
frmWBTypeSel : = TfrmWBTypeSel. Create( Application) ;
with frmWBTypeSel do
begin
if ShowModal = 1 then
begin
with CDS_Card do
begin
Edit;
FieldByName( 'WBType' ) . Value : = Trim( frmWBTypeSel. CDS_Main. fieldbyname( 'WBType' ) . AsString) ;
Post;
end ;
end ;
end ;
finally
frmWBTypeSel. Free;
end ;
end ;
procedure TfrmTatWBCardInPut2. TV2Column5PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
begin
try
frmCompanySel : = TfrmCompanySel. Create( Application) ;
with frmCompanySel do
begin
FCoType : = '<27> <> Ӧ<EFBFBD> <D3A6> ' ;
if ShowModal = 1 then
begin
with CDS_Card do
begin
Edit;
FieldByName( 'WBFtyNo' ) . Value : = Trim( frmCompanySel. CDS_1. fieldbyname( 'CoCode' ) . AsString) ;
FieldByName( 'WBFtyName' ) . Value : = Trim( frmCompanySel. CDS_1. fieldbyname( 'CoAbbrName' ) . AsString) ;
Post;
end ;
end ;
end ;
finally
frmCompanySel. Free;
end ;
end ;
procedure TfrmTatWBCardInPut2. TV2Column8PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer ) ;
begin
try
frmCompanySel : = TfrmCompanySel. Create( Application) ;
with frmCompanySel do
begin
FCoType : = '<27> <> Ӧ<EFBFBD> <D3A6> ' ;
if ShowModal = 1 then
begin
with CDS_Card do
begin
Edit;
FieldByName( 'WBBelongCoNo' ) . Value : = Trim( frmCompanySel. CDS_1. fieldbyname( 'CoCode' ) . AsString) ;
FieldByName( 'WBBelongCoName' ) . Value : = Trim( frmCompanySel. CDS_1. fieldbyname( 'CoAbbrName' ) . AsString) ;
Post;
end ;
end ;
end ;
finally
frmCompanySel. Free;
end ;
end ;
end .