568 lines
18 KiB
ObjectPascal
568 lines
18 KiB
ObjectPascal
unit U_ClothPurchaseEnterList;
|
||
|
||
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
|
||
TfrmClothPurchaseEnterList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBClose: TToolButton;
|
||
GPM_1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DS_1: TDataSource;
|
||
Panel1: TPanel;
|
||
Label4: TLabel;
|
||
Label9: TLabel;
|
||
BuyName: TcxTextEdit;
|
||
PurNo: TcxTextEdit;
|
||
cxTabControl1: TcxTabControl;
|
||
cxSplitter1: TcxSplitter;
|
||
CDS_1: TClientDataSet;
|
||
Label3: TLabel;
|
||
SellName: TcxTextEdit;
|
||
pm1: TPopupMenu;
|
||
ADOQueryImage: TADOQuery;
|
||
ToolButton7: TToolButton;
|
||
N3: TMenuItem;
|
||
cxGrid1: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
VC_SCSCode: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
v1PRTPrice: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
N5: TMenuItem;
|
||
N6: TMenuItem;
|
||
frmFrameDateSel1: TfrmFrameDateSel;
|
||
TV1Column1: TcxGridDBColumn;
|
||
TV1Column2: TcxGridDBColumn;
|
||
TV1Column3: TcxGridDBColumn;
|
||
TV1Column4: TcxGridDBColumn;
|
||
TV1Column7: TcxGridDBColumn;
|
||
TV1Column8: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
cxGridDBColumn14: TcxGridDBColumn;
|
||
Tv1Column10: TcxGridDBColumn;
|
||
Tv1Column11: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
TV2Column1: TcxGridDBColumn;
|
||
DS_2: TDataSource;
|
||
CDS_2: TClientDataSet;
|
||
GPM_2: TcxGridPopupMenu;
|
||
ADO_2: TADOQuery;
|
||
TV1Column5: TcxGridDBColumn;
|
||
TV1Column6: TcxGridDBColumn;
|
||
TV1Column9: TcxGridDBColumn;
|
||
TV1Column12: TcxGridDBColumn;
|
||
TV1Column13: TcxGridDBColumn;
|
||
TV1Column14: TcxGridDBColumn;
|
||
ToolBar2: TToolBar;
|
||
ToolButton2: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
ToolButton6: 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 ToolButton3Click(Sender: TObject);
|
||
procedure TV1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure PurNoPropertiesChange(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
private
|
||
fFlileFlag: string;
|
||
procedure InitGrid();
|
||
procedure SetStatus();
|
||
procedure InitImage();
|
||
|
||
{ Private declarations }
|
||
public
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_LabelPrint, U_PurClothEnterInput;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmClothPurchaseEnterList.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 TfrmClothPurchaseEnterList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNoFiler(Tv1, True); //ȫѡ
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNoFiler(Tv1, False); //ȫ<><C8AB>
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.N3Click(Sender: TObject);
|
||
begin
|
||
Clipboard.SetTextBuf(PChar(Trim(CDS_1.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.N5Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_1, True);
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.N6Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_1, False);
|
||
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.PurNoPropertiesChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.SetStatus();
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmFrameDateSel1.EndDate.Date := SGetServerDate(ADOQueryTemp);
|
||
frmFrameDateSel1.BegDate.Date := frmFrameDateSel1.EndDate.Date - 90;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.InitGrid();
|
||
var
|
||
SqlStr: string;
|
||
begin
|
||
|
||
SqlStr := ' select A.*,B.*';
|
||
SqlStr := SqlStr + ',LJHCPiece= (select SUM(X.Piece) from BS_Cloth_IO X where X.FromPurSId = B.PurSId and X.IOType =''<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>'' and STKName=''ó<>ײ<EFBFBD>ƥ'')';
|
||
SqlStr := SqlStr + ',LJHCQty= (select SUM(X.Qty) from BS_Cloth_IO X where X.FromPurSId = B.PurSId and X.IOType =''<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>'' and STKName=''ó<>ײ<EFBFBD>ƥ'')';
|
||
SqlStr := SqlStr + ' from Pur_ClothPlan_Main A inner join Pur_ClothPlan_sub B on A.PurMId=B.PurMId ';
|
||
SqlStr := SqlStr + 'where 1=1 ';
|
||
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
SqlStr := SqlStr + ' and isnull(A.status,''0'')=''9''';
|
||
end;
|
||
1:
|
||
begin
|
||
SqlStr := SqlStr + ' and isnull(A.status,''0'')=''10''';
|
||
SqlStr := SqlStr + ' and A.PurDate>=''' + Trim(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.BegDate.Date)) + '''';
|
||
SqlStr := SqlStr + ' and A.PurDate<''' + Trim(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.enddate.Date + 1)) + '''';
|
||
end;
|
||
|
||
end;
|
||
InitCDSData(ADOQueryMain, CDS_1, Tv1, SqlStr, SGetFilters(Panel1, 1, 2), 'PurNo');
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.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 TfrmClothPurchaseEnterList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
fFlileFlag := UserDataFlag + 'HX';
|
||
readCxGrid(trim(Self.Caption) + 'tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>');
|
||
readCxGrid(trim(Self.Caption) + 'tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>');
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.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 TfrmClothPurchaseEnterList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
SetStatus();
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.ToolButton1Click(Sender: TObject);
|
||
var
|
||
Maxno: string;
|
||
begin
|
||
|
||
PurNo.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 TfrmClothPurchaseEnterList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmPurClothEnterInput := TfrmPurClothEnterInput.Create(Application);
|
||
with frmPurClothEnterInput do
|
||
begin
|
||
FBCIOID := '';
|
||
FPurSId := Trim(CDS_1.fieldbyname('PurSId').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmPurClothEnterInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmPurClothEnterInput := TfrmPurClothEnterInput.Create(Application);
|
||
with frmPurClothEnterInput do
|
||
begin
|
||
FBCIOID := Trim(CDS_2.fieldbyname('BCIOID').AsString);
|
||
FPurSId := Trim(CDS_1.fieldbyname('PurSId').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmPurClothEnterInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.ToolButton4Click(Sender: TObject);
|
||
var
|
||
MBCIOID: string;
|
||
begin
|
||
if CDS_2.IsEmpty then
|
||
Exit;
|
||
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
MBCIOID := Trim(CDS_2.fieldbyname('BCIOID').AsString);
|
||
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(''ó<>״<EFBFBD><D7B4>첼<EFBFBD><ECB2BC><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)));
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
InitGrid();
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
InitGrid();
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.ToolButton5Click(Sender: TObject);
|
||
var
|
||
MPurMIdS: string;
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
exit;
|
||
MPurMIdS := trim(CDS_1.fieldbyname('PurMId').AsString);
|
||
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Pur_ClothPlan_SetStatus ');
|
||
sql.Add(' @PurMIdS=' + QuotedStr(MPurMIdS));
|
||
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD><C9B9>ƻ<EFBFBD>ID<49><44>' + trim(MPurMIdS))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
application.MessageBox('<27><><EFBFBD>ɳɹ<C9B3>', '<27><>ʾ');
|
||
InitGrid();
|
||
except
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
InitGrid();
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.ToolButton6Click(Sender: TObject);
|
||
var
|
||
MPurMIdS: string;
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
exit;
|
||
|
||
MPurMIdS := MPurMIdS + trim(CDS_1.fieldbyname('PurMId').AsString) + ',';
|
||
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Pur_ClothPlan_SetStatus ');
|
||
sql.Add(' @PurMIdS=' + QuotedStr(MPurMIdS));
|
||
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD><C9B9>ƻ<EFBFBD>ID<49><44>' + trim(MPurMIdS))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<C9B3>', '<27><>ʾ');
|
||
InitGrid();
|
||
except
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
InitGrid();
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.ToolButton7Click(Sender: TObject);
|
||
begin
|
||
writeCxGrid(trim(Self.Caption) + 'tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>');
|
||
writeCxGrid(trim(Self.Caption) + 'tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmClothPurchaseEnterList.TV1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
var
|
||
SqlStr: string;
|
||
begin
|
||
|
||
SqlStr := ' select A.*';
|
||
|
||
SqlStr := SqlStr + ' from BS_Cloth_IO A ';
|
||
SqlStr := SqlStr + 'where A.FromPurSId = ' + quotedstr(Trim(CDS_1.fieldbyname('PurSId').AsString));
|
||
SqlStr := SqlStr + 'and A.IOType =''<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>'' and STKName=''ó<>ײ<EFBFBD>ƥ'' ';
|
||
|
||
InitCDSData(ADO_2, CDS_2, Tv2, SqlStr, '', '');
|
||
end;
|
||
|
||
end.
|
||
|