201 lines
7.1 KiB
ObjectPascal
201 lines
7.1 KiB
ObjectPascal
unit U_TradeClothCompleteInput;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit, ComCtrls, ToolWin,
|
||
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
||
cxClasses, cxControls, cxGridCustomView, cxGrid, cxGridCustomPopupMenu,
|
||
cxGridPopupMenu, ADODB, DBClient, cxButtonEdit, cxTextEdit, cxSpinEdit,
|
||
StdCtrls, ExtCtrls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
|
||
dxSkinsDefaultPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu,
|
||
U_BaseInput, System.ImageList, Vcl.ImgList, cxPC, dxSkinWXI,
|
||
dxScrollbarAnnotations, cxCheckBox, 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
|
||
TfrmTradeClothCompleteInput = class(TfrmBaseInput)
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
DS_1: TDataSource;
|
||
CDS_Sub: TClientDataSet;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADO_1: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
GPM_1: TcxGridPopupMenu;
|
||
ToolButton1: TToolButton;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
Tv1Column10: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
TV2Column3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
TV2Column1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
VC_PRTPs: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
TV2Column4: TcxGridDBColumn;
|
||
TV2Column5: TcxGridDBColumn;
|
||
TV2Column2: TcxGridDBColumn;
|
||
TV2Column8: TcxGridDBColumn;
|
||
TV2Column9: TcxGridDBColumn;
|
||
GPM_2: TcxGridPopupMenu;
|
||
CDS_2: TClientDataSet;
|
||
ADO_2: TADOQuery;
|
||
DS_2: TDataSource;
|
||
TV2Column10: TcxGridDBColumn;
|
||
TV2Column11: TcxGridDBColumn;
|
||
TV2Column12: TcxGridDBColumn;
|
||
ToolButton3: TToolButton;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure TV2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid1();
|
||
procedure InitGrid2();
|
||
public
|
||
{ Public declarations }
|
||
FBCId, FStkName, FMasterOrderNo: string;
|
||
end;
|
||
|
||
var
|
||
frmTradeClothCompleteInput: TfrmTradeClothCompleteInput;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_TradeFinishClothStkSel, U_CompanySel,
|
||
U_TradePlanSel, U_TradePlanClothEnterInput;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmTradeClothCompleteInput.InitGrid1();
|
||
begin
|
||
with ADO_1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.* ');
|
||
sql.Add(',OutPiece=cast(0 as DECIMAL(18,2)),OutQty=cast(0 as DECIMAL(18,2)) ');
|
||
sql.Add(' from BS_Cloth_IO A ');
|
||
SQL.Add(' where A.IOFlag=''<27><><EFBFBD><EFBFBD>'' and A.IOType=''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(' and isnull(stkName,'''')=''ó<>ײ<EFBFBD>ƥ'' ');
|
||
sql.Add(' and FromSubId= ' + QuotedStr(TRIM(CDS_2.FieldByName('SubId').AsString)));
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADO_1, CDS_Sub);
|
||
SInitCDSData(ADO_1, CDS_Sub);
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeClothCompleteInput.InitGrid2();
|
||
begin
|
||
with ADO_2 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.*,B.* ');
|
||
sql.Add(',OutPiece=cast(0 as DECIMAL(18,2)),OutQty=cast(0 as DECIMAL(18,2)),StkID=cast(null as varchar(60)) ');
|
||
sql.Add(',LJOutPiece= (select SUM(X.Piece) from BS_Cloth_IO X where X.FromSubId = B.SubId and IOFlag=''<27><><EFBFBD><EFBFBD>'' and IOType=''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'' ) ');
|
||
sql.Add(',LJOutQty= (select SUM(X.Qty) from BS_Cloth_IO X where X.FromSubId = B.SubId and IOFlag=''<27><><EFBFBD><EFBFBD>'' and IOType=''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
||
sql.Add(' from Trade_Plan_Main A inner join Trade_Plan_Sub B on A.MainId=B.MainId');
|
||
sql.Add(' where A.MasterOrderNo= ' + QuotedStr(TRIM(FMasterOrderNo)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADO_2, CDS_2);
|
||
SInitCDSData(ADO_2, CDS_2);
|
||
end;
|
||
|
||
procedure TfrmTradeClothCompleteInput.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmTradeClothCompleteInput.TBCloseClick(Sender: TObject);
|
||
begin
|
||
ModalResult := 1;
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmTradeClothCompleteInput.FormShow(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
inherited;
|
||
ReadCxGrid(trim(Self.Caption) + 'TV1', Tv1, 'ó<><EFBFBD><D7BB>ֿܲ<DCB2>');
|
||
ReadCxGrid(trim(Self.Caption) + 'TV2', Tv2, 'ó<><EFBFBD><D7BB>ֿܲ<DCB2>');
|
||
InitGrid2();
|
||
end;
|
||
|
||
procedure TfrmTradeClothCompleteInput.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(trim(Self.Caption) + 'TV1', Tv1, 'ó<><EFBFBD><D7BB>ֿܲ<DCB2>');
|
||
WriteCxGrid(trim(Self.Caption) + 'TV2', Tv2, 'ó<><EFBFBD><D7BB>ֿܲ<DCB2>');
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeClothCompleteInput.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmTradePlanClothEnterInput := TfrmTradePlanClothEnterInput.Create(Application);
|
||
with frmTradePlanClothEnterInput do
|
||
begin
|
||
FSubId := Trim(self.CDS_2.fieldbyname('SubId').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid1();
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradePlanClothEnterInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeClothCompleteInput.TV2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
ToolButton3.Click;
|
||
end;
|
||
|
||
procedure TfrmTradeClothCompleteInput.TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
InitGrid1();
|
||
end;
|
||
|
||
end.
|
||
|