200 lines
7.1 KiB
ObjectPascal
200 lines
7.1 KiB
ObjectPascal
|
unit U_TradeClothProcessInput;
|
|||
|
|
|||
|
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
|
|||
|
TfrmTradeClothProcessInput = class(TfrmBaseInput)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
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;
|
|||
|
DS_2: TDataSource;
|
|||
|
ADO_2: TADOQuery;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
DS_1: TDataSource;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
ADO_1: TADOQuery;
|
|||
|
TV2Column6: TcxGridDBColumn;
|
|||
|
TV2Column7: TcxGridDBColumn;
|
|||
|
TV2Column10: TcxGridDBColumn;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure TV2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
private
|
|||
|
{ Private declarations } procedure InitGrid1();
|
|||
|
procedure InitGrid2();
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
FBCId, FStkName, FMasterOrderNo: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmTradeClothProcessInput: TfrmTradeClothProcessInput;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_TradeFinishClothStkSel, U_CompanySel,
|
|||
|
U_TradePlanSel, U_TradeClothProcessCastingInput;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmTradeClothProcessInput.InitGrid1();
|
|||
|
begin
|
|||
|
with ADO_1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(' from BS_Cloth_IO A ');
|
|||
|
SQL.Add(' where A.IOFlag=''<27><><EFBFBD><EFBFBD>'' and A.IOType=''Ͷ<><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' and isnull(stkName,'''')=''ó<>ײ<EFBFBD>ƥ'' ');
|
|||
|
sql.Add(' and ToSubId= ' + QuotedStr(TRIM(CDS_2.FieldByName('SubId').AsString)));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADO_1, CDS_1);
|
|||
|
SInitCDSData(ADO_1, CDS_1);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeClothProcessInput.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=isnull( (select SUM(X.Piece) from BS_Cloth_IO X where X.ToSubid = B.Subid and IOFlag=''<27><><EFBFBD><EFBFBD>'' and IOType=''Ͷ<><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ) ,0) ');
|
|||
|
sql.Add(',LJOutQty= isnull((select SUM(X.Qty) from BS_Cloth_IO X where X.ToSubid = B.Subid and IOFlag=''<27><><EFBFBD><EFBFBD>'' and IOType=''Ͷ<><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ,0) ');
|
|||
|
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 TfrmTradeClothProcessInput.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeClothProcessInput.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeClothProcessInput.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 TfrmTradeClothProcessInput.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(trim(Self.Caption) + 'TV1', Tv1, 'ó<><EFBFBD><D7BB>ֿܲ<DCB2>');
|
|||
|
WriteCxGrid(trim(Self.Caption) + 'TV2', Tv2, 'ó<><EFBFBD><D7BB>ֿܲ<DCB2>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeClothProcessInput.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmTradeClothProcessCastingInput := TfrmTradeClothProcessCastingInput.Create(Application);
|
|||
|
with frmTradeClothProcessCastingInput do
|
|||
|
begin
|
|||
|
FSubid := Trim(Self.CDS_2.fieldbyname('Subid').AsString);
|
|||
|
FMasterOrderNo := Trim(Self.CDS_2.fieldbyname('MasterOrderNo').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid2();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTradeClothProcessCastingInput.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeClothProcessInput.TV2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
ToolButton3.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeClothProcessInput.TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitGrid1();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|