267 lines
8.3 KiB
ObjectPascal
267 lines
8.3 KiB
ObjectPascal
unit U_TradePlanClothEnterInput;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
||
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
||
cxTextEdit, cxDropDownEdit, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
||
cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
||
dxBarBuiltInMenu, U_BaseInput, System.ImageList, Vcl.ImgList, cxContainer,
|
||
cxMemo, dxSkinWXI, dxScrollbarAnnotations, dxCore, cxDateUtils, cxCurrencyEdit,
|
||
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
|
||
TfrmTradePlanClothEnterInput = class(TfrmBaseInput)
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton3: TToolButton;
|
||
ScrollBox1: TScrollBox;
|
||
Label2: TLabel;
|
||
Label7: TLabel;
|
||
Label1: TLabel;
|
||
FtyPCId: TcxTextEdit;
|
||
C_Code: TcxTextEdit;
|
||
Label8: TLabel;
|
||
StkPosition: TcxButtonEdit;
|
||
Note: TcxMemo;
|
||
lbl5: TLabel;
|
||
IOTime: TcxDateEdit;
|
||
Label10: TLabel;
|
||
Label11: TLabel;
|
||
Qty: TcxCurrencyEdit;
|
||
Piece: TcxCurrencyEdit;
|
||
Label6: TLabel;
|
||
C_Name: TcxTextEdit;
|
||
QtyUnit: TcxTextEdit;
|
||
Label3: TLabel;
|
||
C_Color: TcxTextEdit;
|
||
Label9: TLabel;
|
||
OrderNo: TcxTextEdit;
|
||
Label12: TLabel;
|
||
C_Composition: TcxTextEdit;
|
||
Label4: TLabel;
|
||
GC_Name: TcxTextEdit;
|
||
Label5: TLabel;
|
||
CraftCode: TcxTextEdit;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure BuyNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure CoBusinessTypeDblClick(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
function SaveData(): Boolean;
|
||
public
|
||
{ Public declarations }
|
||
FSubId: string;
|
||
end;
|
||
|
||
var
|
||
frmTradePlanClothEnterInput: TfrmTradePlanClothEnterInput;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmTradePlanClothEnterInput.InitGrid();
|
||
begin
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.*,B.* ');
|
||
sql.Add(' from Trade_Plan_Main A inner join Trade_Plan_Sub B on A.MainId=B.MainId ');
|
||
sql.Add(' inner join Trade_Plan_Fty C on A.MainId=C.MainId ');
|
||
sql.Add(' where B.SubId=''' + Trim(FSubId) + '''');
|
||
Open;
|
||
end;
|
||
CraftCode.Text := ADOQueryTemp.FieldByName('CraftCode').ASString;
|
||
GC_Name.Text := ADOQueryTemp.FieldByName('GC_Name').ASString;
|
||
OrderNo.Text := ADOQueryTemp.FieldByName('OrderNo').ASString;
|
||
QtyUnit.Text := ADOQueryTemp.FieldByName('OrdUnit').ASString;
|
||
C_Composition.Text := ADOQueryTemp.FieldByName('C_Composition').ASString;
|
||
C_Code.Text := ADOQueryTemp.FieldByName('C_Code').ASString;
|
||
C_Name.Text := ADOQueryTemp.FieldByName('C_Code').ASString;
|
||
C_Color.Text := ADOQueryTemp.FieldByName('C_Color').ASString;
|
||
end;
|
||
|
||
procedure TfrmTradePlanClothEnterInput.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmTradePlanClothEnterInput := nil;
|
||
end;
|
||
|
||
procedure TfrmTradePlanClothEnterInput.BuyNamePropertiesButtonClick(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 := 'Cust';
|
||
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 TfrmTradePlanClothEnterInput.CoBusinessTypeDblClick(Sender: TObject);
|
||
begin
|
||
TcxButtonEdit(Sender).Text := '';
|
||
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
||
end;
|
||
|
||
procedure TfrmTradePlanClothEnterInput.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmTradePlanClothEnterInput.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
IOTime.Date := SGetServerDate(ADOQueryTemp);
|
||
end;
|
||
|
||
procedure TfrmTradePlanClothEnterInput.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
close;
|
||
end;
|
||
|
||
procedure TfrmTradePlanClothEnterInput.FormShow(Sender: TObject);
|
||
var
|
||
i: integer;
|
||
a: string;
|
||
begin
|
||
inherited;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmTradePlanClothEnterInput.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
function TfrmTradePlanClothEnterInput.SaveData(): Boolean;
|
||
var
|
||
MBCIOID, Maxno: string;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
if not GetLSNo(ADOQueryCmd, Maxno, 'Z', 'BS_Cloth_IO', 4, 1) then
|
||
raise Exception.Create('ȡȾɫ<C8BE><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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(''ó<>״<EFBFBD><D7B4>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',' + quotedstr(Maxno));
|
||
sql.Add(',''<27><><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',' + quotedstr(DName));
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(Maxno));
|
||
sql.Add(') ');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
Sql.Clear;
|
||
Sql.Add('exec P_BS_Cloth_OutComplete ');
|
||
Sql.Add(' @BCIOID=' + quotedstr(Trim(Maxno)));
|
||
Sql.Add(' ,@SubId=' + quotedstr(Trim(FSubId)));
|
||
|
||
Sql.Add(' ,@IOTime=' + quotedstr(Trim(Trim(FormatDateTime('yyyy-MM-dd', IOTime.Date)))));
|
||
Sql.Add(' ,@FtyPCId=' + quotedstr(Trim(FtyPCId.Text)));
|
||
Sql.Add(' ,@Piece=' + Trim(Piece.Text));
|
||
Sql.Add(' ,@Qty=' + Trim(Qty.Text));
|
||
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;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradePlanClothEnterInput.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
|
||
// if Trim(CoAbbrName.Text) = '' then
|
||
// begin
|
||
// Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
// if Trim(CoName.Text) = '' then
|
||
// begin
|
||
// Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|