819 lines
24 KiB
ObjectPascal
819 lines
24 KiB
ObjectPascal
unit U_ClothScheduleList;
|
||
|
||
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, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
||
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxPC, cxButtonEdit,
|
||
cxTextEdit, cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
|
||
dxSkinsDefaultPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu,
|
||
U_BaseList, RM_e_Graphic, RM_e_Jpeg, RM_E_llPDF, Vcl.Clipbrd, dxSkinWXI,
|
||
dxScrollbarAnnotations, FrameDateSel, cxContainer, dxSkinBasic, dxSkinBlack,
|
||
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkroom,
|
||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinOffice2013White, dxSkinOffice2016Colorful, dxSkinOffice2016Dark,
|
||
dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray,
|
||
dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust,
|
||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier, dxSkinValentine,
|
||
dxSkinVisualStudio2013Blue, dxSkinVisualStudio2013Dark,
|
||
dxSkinVisualStudio2013Light, dxSkinVS2010, dxSkinWhiteprint,
|
||
dxSkinXmas2008Blue;
|
||
|
||
type
|
||
TfrmClothScheduleList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBClose: TToolButton;
|
||
GPM_1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DS_1: TDataSource;
|
||
Panel1: TPanel;
|
||
Label9: TLabel;
|
||
MasterOrderNo: TcxTextEdit;
|
||
CDS_1: TClientDataSet;
|
||
Label3: TLabel;
|
||
FtyName: TcxTextEdit;
|
||
pm1: TPopupMenu;
|
||
ADOQueryImage: TADOQuery;
|
||
ToolButton7: TToolButton;
|
||
N3: TMenuItem;
|
||
cxGrid1: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
VC_SCSCode: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
N5: TMenuItem;
|
||
N6: TMenuItem;
|
||
frmFrameDateSel1: TfrmFrameDateSel;
|
||
TV1Column1: TcxGridDBColumn;
|
||
TV1Column2: TcxGridDBColumn;
|
||
TV1Column3: TcxGridDBColumn;
|
||
TV1Column7: TcxGridDBColumn;
|
||
TV1Column8: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
ToolBar2: TToolBar;
|
||
ToolButton2: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
DS_2: TDataSource;
|
||
CDS_2: TClientDataSet;
|
||
GPM_2: TcxGridPopupMenu;
|
||
ADO_2: TADOQuery;
|
||
TV1Column4: TcxGridDBColumn;
|
||
TV1Column5: TcxGridDBColumn;
|
||
TV1Column6: TcxGridDBColumn;
|
||
TV1Column9: TcxGridDBColumn;
|
||
TV1Column12: TcxGridDBColumn;
|
||
ToolButton5: TToolButton;
|
||
ToolButton6: TToolButton;
|
||
cxPageControl1: TcxPageControl;
|
||
cxTabSheet2: TcxTabSheet;
|
||
cxTabSheet3: TcxTabSheet;
|
||
cxTabSheet1: TcxTabSheet;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
TV2Column1: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
cxGridDBColumn14: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
TV2Column2: TcxGridDBColumn;
|
||
ADO_3: TADOQuery;
|
||
GPM_3: TcxGridPopupMenu;
|
||
CDS_3: TClientDataSet;
|
||
DS_3: TDataSource;
|
||
ADO_4: TADOQuery;
|
||
GPM_4: TcxGridPopupMenu;
|
||
CDS_4: TClientDataSet;
|
||
DS_4: TDataSource;
|
||
cxGrid3: TcxGrid;
|
||
TV3: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridDBColumn10: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
cxGridDBColumn12: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
cxGrid4: TcxGrid;
|
||
TV4: TcxGridDBTableView;
|
||
cxGridDBColumn17: TcxGridDBColumn;
|
||
cxGridDBColumn18: TcxGridDBColumn;
|
||
cxGridDBColumn19: TcxGridDBColumn;
|
||
cxGridDBColumn20: TcxGridDBColumn;
|
||
cxGridDBColumn21: TcxGridDBColumn;
|
||
cxGridDBColumn22: TcxGridDBColumn;
|
||
cxGridDBColumn23: TcxGridDBColumn;
|
||
cxGridDBColumn24: TcxGridDBColumn;
|
||
cxGridDBColumn25: TcxGridDBColumn;
|
||
cxGridDBColumn26: TcxGridDBColumn;
|
||
cxGridLevel3: TcxGridLevel;
|
||
TV3Column1: TcxGridDBColumn;
|
||
TV3Column2: TcxGridDBColumn;
|
||
TV4Column1: TcxGridDBColumn;
|
||
TV4Column2: TcxGridDBColumn;
|
||
TV1Column10: TcxGridDBColumn;
|
||
TV1Column11: TcxGridDBColumn;
|
||
TV1Column13: TcxGridDBColumn;
|
||
TV1Column14: TcxGridDBColumn;
|
||
ToolButton3: TToolButton;
|
||
cxTabSheet4: TcxTabSheet;
|
||
cxGrid5: TcxGrid;
|
||
TV5: TcxGridDBTableView;
|
||
cxGridDBColumn15: TcxGridDBColumn;
|
||
cxGridDBColumn16: TcxGridDBColumn;
|
||
cxGridDBColumn27: TcxGridDBColumn;
|
||
cxGridDBColumn28: TcxGridDBColumn;
|
||
cxGridDBColumn29: TcxGridDBColumn;
|
||
cxGridDBColumn30: TcxGridDBColumn;
|
||
cxGridDBColumn31: TcxGridDBColumn;
|
||
cxGridDBColumn32: TcxGridDBColumn;
|
||
cxGridDBColumn33: TcxGridDBColumn;
|
||
cxGridDBColumn34: TcxGridDBColumn;
|
||
cxGridDBColumn35: TcxGridDBColumn;
|
||
cxGridDBColumn36: TcxGridDBColumn;
|
||
cxGridLevel4: TcxGridLevel;
|
||
TV5Column1: TcxGridDBColumn;
|
||
TV5Column2: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
ADO_5: TADOQuery;
|
||
GPM_5: TcxGridPopupMenu;
|
||
CDS_5: TClientDataSet;
|
||
DS_5: TDataSource;
|
||
ToolButton8: TToolButton;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
procedure CheckBox2Click(Sender: TObject);
|
||
procedure BuyNameChange(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
procedure N3Click(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure N5Click(Sender: TObject);
|
||
procedure N6Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure TV1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure cxPageControl1Change(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure SellNamePropertiesChange(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton8Click(Sender: TObject);
|
||
private
|
||
fFlileFlag: string;
|
||
procedure InitGrid();
|
||
procedure SetStatus();
|
||
procedure InitImage();
|
||
procedure InitGridIO();
|
||
procedure DelGrid2IO();
|
||
procedure DelGridIO();
|
||
procedure DelGrid4IO();
|
||
{ Private declarations }
|
||
public
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_LabelPrint, U_TradeClothTransferInput,
|
||
U_TradeClothProcessInput, U_TradeClothCompleteInput,
|
||
U_TradeClothProcessOutInput;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmClothScheduleList.DelGrid2IO();
|
||
var
|
||
MBCIOID: string;
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
MBCIOID := SelCDSKey(CDS_2, ['FromBCIOID'])[0];
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Fin_Flow_Judge ');
|
||
Sql.Add(' @FFIDS=' + quotedstr(MBCIOID));
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
Open;
|
||
end;
|
||
|
||
if ADOQueryTemp.FieldByName('intReturn').AsInteger = -1 then
|
||
begin
|
||
Application.MessageBox(PChar(ADOQueryTemp.fieldbyname('ShowMsg').AsString), '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
Sql.Clear;
|
||
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
||
sql.Add('values(''ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',' + quotedstr(MBCIOID));
|
||
sql.Add(',''ɾ<><C9BE>'' ');
|
||
sql.Add(',' + quotedstr(DName));
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(MBCIOID));
|
||
sql.Add(') ');
|
||
|
||
Sql.Add('exec P_BS_Cloth_Out_Del ');
|
||
Sql.Add(' @BCIOIDS=' + quotedstr(MBCIOID));
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
InitGridIO();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
InitGridIO();
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.DelGridIO();
|
||
var
|
||
MBCIOID: string;
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
case cxPageControl1.ActivePageIndex of
|
||
|
||
1:
|
||
begin
|
||
MBCIOID := SelCDSKey(CDS_3, ['BCIOID'])[0];
|
||
end;
|
||
|
||
3:
|
||
begin
|
||
MBCIOID := SelCDSKey(CDS_5, ['BCIOID'])[0];
|
||
end;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Fin_Flow_Judge ');
|
||
Sql.Add(' @FFIDS=' + quotedstr(MBCIOID));
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
Open;
|
||
end;
|
||
|
||
if ADOQueryTemp.FieldByName('intReturn').AsInteger = -1 then
|
||
begin
|
||
Application.MessageBox(PChar(ADOQueryTemp.fieldbyname('ShowMsg').AsString), '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
Sql.Clear;
|
||
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
||
sql.Add('values(''ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',' + quotedstr(MBCIOID));
|
||
sql.Add(',''ɾ<><C9BE>'' ');
|
||
sql.Add(',' + quotedstr(DName));
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(MBCIOID));
|
||
sql.Add(') ');
|
||
|
||
Sql.Add('exec P_BS_Cloth_Out_Del ');
|
||
Sql.Add(' @BCIOIDS=' + quotedstr(MBCIOID));
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
InitGridIO();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
InitGridIO();
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.DelGrid4IO();
|
||
var
|
||
MBCIOID: string;
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
MBCIOID := SelCDSKey(CDS_4, ['BCIOID'])[0];
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Fin_Flow_Judge ');
|
||
Sql.Add(' @FFIDS=' + quotedstr(MBCIOID));
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
Open;
|
||
end;
|
||
|
||
if ADOQueryTemp.FieldByName('intReturn').AsInteger = -1 then
|
||
begin
|
||
Application.MessageBox(PChar(ADOQueryTemp.fieldbyname('ShowMsg').AsString), '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
Sql.Clear;
|
||
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
||
sql.Add('values(''ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',' + quotedstr(MBCIOID));
|
||
sql.Add(',''ɾ<><C9BE>'' ');
|
||
sql.Add(',' + quotedstr(DName));
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(MBCIOID));
|
||
sql.Add(') ');
|
||
|
||
Sql.Add('exec P_BS_Cloth_in_Del ');
|
||
Sql.Add(' @BCIOIDS=' + quotedstr(MBCIOID));
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
InitGridIO();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
InitGridIO();
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.InitGridIO();
|
||
var
|
||
SqlStr: string;
|
||
begin
|
||
case cxPageControl1.ActivePageIndex of
|
||
0:
|
||
begin
|
||
SqlStr := ' select A.*';
|
||
SqlStr := SqlStr + ' from BS_Cloth_IO A ';
|
||
SqlStr := SqlStr + 'where A.STKName = ''ó<>ײ<EFBFBD>ƥ'' and A.IOFlag = ''<27><><EFBFBD><EFBFBD>'' and A.IOType = ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
||
SqlStr := SqlStr + 'and A.FromMasterOrdNo = ' + quotedstr(Trim(CDS_1.fieldbyname('MasterOrderNo').AsString));
|
||
InitCDSData(ADO_2, CDS_2, Tv2, SqlStr, '', '');
|
||
end;
|
||
1:
|
||
begin
|
||
SqlStr := ' select A.*';
|
||
SqlStr := SqlStr + ' from BS_Cloth_IO A ';
|
||
SqlStr := SqlStr + 'where A.STKName = ''ó<>ײ<EFBFBD>ƥ'' and A.IOFlag = ''<27><><EFBFBD><EFBFBD>'' and A.IOType = ''Ͷ<><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
||
SqlStr := SqlStr + 'and A.ToMasterOrdNo = ' + quotedstr(Trim(CDS_1.fieldbyname('MasterOrderNo').AsString));
|
||
InitCDSData(ADO_3, CDS_3, Tv3, SqlStr, '', '');
|
||
end;
|
||
2:
|
||
begin
|
||
SqlStr := ' select A.*';
|
||
SqlStr := SqlStr + ' from BS_Cloth_IO A ';
|
||
SqlStr := SqlStr + 'where A.STKName = ''ó<>ײ<EFBFBD>ƥ'' and A.IOFlag = ''<27><><EFBFBD><EFBFBD>'' and A.IOType = ''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'' ';
|
||
SqlStr := SqlStr + 'and A.FromMasterOrdNo = ' + quotedstr(Trim(CDS_1.fieldbyname('MasterOrderNo').AsString));
|
||
InitCDSData(ADO_4, CDS_4, Tv4, SqlStr, '', '');
|
||
end;
|
||
3:
|
||
begin
|
||
SqlStr := ' select A.*';
|
||
SqlStr := SqlStr + ' from BS_Cloth_IO A ';
|
||
SqlStr := SqlStr + 'where A.STKName = ''ó<>ײ<EFBFBD>ƥ'' and A.IOFlag = ''<27><><EFBFBD><EFBFBD>'' and A.IOType <> ''Ͷ<><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
||
SqlStr := SqlStr + 'and A.FromMasterOrdNo = ' + quotedstr(Trim(CDS_1.fieldbyname('MasterOrderNo').AsString));
|
||
InitCDSData(ADO_5, CDS_5, Tv5, SqlStr, '', '');
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.InitImage();
|
||
begin
|
||
|
||
ADOQueryImage.Close;
|
||
if CDS_1.IsEmpty then
|
||
exit;
|
||
with ADOQueryImage do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from TP_File A');
|
||
sql.Add('where WBID=' + quotedstr(trim(CDS_1.fieldbyname('SubId').AsString)));
|
||
sql.Add('and TFType=' + quotedstr(trim('HX')));
|
||
open;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNoFiler(Tv1, True); //ȫѡ
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNoFiler(Tv1, False); //ȫ<><C8AB>
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.N3Click(Sender: TObject);
|
||
begin
|
||
Clipboard.SetTextBuf(PChar(Trim(CDS_1.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.N5Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_1, True);
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.N6Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_1, False);
|
||
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.SellNamePropertiesChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.SetStatus();
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmFrameDateSel1.EndDate.Date := SGetServerDate(ADOQueryTemp);
|
||
frmFrameDateSel1.BegDate.Date := frmFrameDateSel1.EndDate.Date - 90;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.InitGrid();
|
||
var
|
||
SqlStr: string;
|
||
begin
|
||
|
||
SqlStr := ' exec P_Trade_Plan_MasterSchedule ';
|
||
|
||
SqlStr := SqlStr + ' @BegDate=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.BegDate.Date)));
|
||
SqlStr := SqlStr + ' ,@enddate=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.enddate.Date + 1)));
|
||
|
||
InitCDSData(ADOQueryMain, CDS_1, Tv1, SqlStr, SGetFilters(Panel1, 1, 2), 'MasterOrderNo');
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.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 TfrmClothScheduleList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
fFlileFlag := UserDataFlag + 'HX';
|
||
readCxGrid(trim(Self.Caption) + 'tv1', Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
readCxGrid(trim(Self.Caption) + 'tv2', Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
readCxGrid(trim(Self.Caption) + 'tv3', Tv3, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
readCxGrid(trim(Self.Caption) + 'tv4', Tv4, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
readCxGrid(trim(Self.Caption) + 'tv5', Tv5, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.BuyNameChange(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 TfrmClothScheduleList.cxPageControl1Change(Sender: TObject);
|
||
begin
|
||
InitGridIO();
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.ToolButton1Click(Sender: TObject);
|
||
var
|
||
Maxno: string;
|
||
begin
|
||
|
||
ToolBar1.SetFocus;
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
CDS_1.DisableControls;
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if CDS_1.fieldbyname('BCHCQty').AsFloat > 0 then
|
||
begin
|
||
|
||
if not GetLSNo(ADOQueryCmd, Maxno, 'YR', 'BS_Yarn_IO', 3, 1) then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
Sql.Clear;
|
||
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
||
sql.Add('values(''ó<>ײɹ<D7B2><C9B9><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',' + quotedstr(Trim(CDS_1.fieldbyname('BYIOID').AsString)));
|
||
sql.Add(',''ɾ<><C9BE>'' ');
|
||
sql.Add(',' + quotedstr(DName));
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(Trim(CDS_1.fieldbyname('BYIOID').AsString)));
|
||
sql.Add(') ');
|
||
|
||
Sql.Add('exec P_BS_Yarn_OutReturn ');
|
||
|
||
Sql.Add(' @BYIOID=' + quotedstr(CDS_1.fieldbyname('BYIOID').AsString));
|
||
Sql.Add(',@Piece=' + CDS_1.fieldbyname('BCHCPiece').AsString);
|
||
Sql.Add(',@Qty=' + CDS_1.fieldbyname('BCHCQty').AsString);
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
Sql.Add(',@Maxno=' + quotedstr(Trim(Maxno)));
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_1.EnableControls;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
InitGrid();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmTradeClothTransferInput := TfrmTradeClothTransferInput.Create(Application);
|
||
with frmTradeClothTransferInput do
|
||
begin
|
||
// FBCIOID := '';
|
||
FMasterOrderNo := Trim(CDS_1.fieldbyname('MasterOrderNo').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradeClothTransferInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmTradeClothProcessOutInput := TfrmTradeClothProcessOutInput.Create(Application);
|
||
with frmTradeClothProcessOutInput do
|
||
begin
|
||
FMasterOrderNo := Trim(Self.CDS_1.fieldbyname('MasterOrderNo').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradeClothProcessOutInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
case cxPageControl1.ActivePageIndex of
|
||
0:
|
||
begin
|
||
DelGrid2IO();
|
||
end;
|
||
1:
|
||
begin
|
||
DelGridIO();
|
||
end;
|
||
2:
|
||
begin
|
||
DelGrid4IO();
|
||
end;
|
||
3:
|
||
begin
|
||
DelGridIO();
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmTradeClothProcessInput := TfrmTradeClothProcessInput.Create(Application);
|
||
with frmTradeClothProcessInput do
|
||
begin
|
||
FMasterOrderNo := Trim(Self.CDS_1.fieldbyname('MasterOrderNo').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradeClothProcessInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.ToolButton6Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmTradeClothCompleteInput := TfrmTradeClothCompleteInput.Create(Application);
|
||
with frmTradeClothCompleteInput do
|
||
begin
|
||
FMasterOrderNo := Trim(CDS_1.fieldbyname('MasterOrderNo').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradeClothCompleteInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.ToolButton7Click(Sender: TObject);
|
||
begin
|
||
writeCxGrid(trim(Self.Caption) + 'tv1', Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
writeCxGrid(trim(Self.Caption) + 'tv2', Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
writeCxGrid(trim(Self.Caption) + 'tv3', Tv3, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
writeCxGrid(trim(Self.Caption) + 'tv4', Tv4, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
writeCxGrid(trim(Self.Caption) + 'tv5', Tv5, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.ToolButton8Click(Sender: TObject);
|
||
var
|
||
MBCIOID: string;
|
||
begin
|
||
case cxPageControl1.ActivePageIndex of
|
||
0:
|
||
begin
|
||
MBCIOID := SelCDSKey(CDS_2, ['BCIOID'])[0];
|
||
end;
|
||
1:
|
||
begin
|
||
MBCIOID := SelCDSKey(CDS_3, ['BCIOID'])[0];
|
||
end;
|
||
2:
|
||
begin
|
||
MBCIOID := SelCDSKey(CDS_4, ['BCIOID'])[0];
|
||
end;
|
||
3:
|
||
begin
|
||
MBCIOID := SelCDSKey(CDS_5, ['BCIOID'])[0];
|
||
end;
|
||
end;
|
||
|
||
if Trim(MBCIOID) = '' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
try
|
||
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
||
with frmLabelPrint do
|
||
begin
|
||
FLMType := 'TradeClothSchedule' + IntToStr(Self.cxPageControl1.ActivePageIndex);
|
||
FFiltration1 := MBCIOID;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update BS_Cloth_IO ');
|
||
sql.Add(' set PRTer=' + quotedstr(DName));
|
||
sql.Add(', PRTCount=isnull(PRTCount,0)+1');
|
||
sql.Add(', PRTDate=getdate()');
|
||
sql.Add(' where EXISTS (select SP.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(MBCIOID) + ','','') SP where SP.RTValue=BS_Cloth_IO.BCIOID )');
|
||
ExecSQL;
|
||
end;
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmLabelPrint.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothScheduleList.TV1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
InitGridIO();
|
||
end;
|
||
|
||
end.
|
||
|