352 lines
10 KiB
ObjectPascal
352 lines
10 KiB
ObjectPascal
|
|
unit U_PurClothEnterInput;
|
|||
|
|
|
|||
|
|
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, dxDateRanges, dxBarBuiltInMenu, U_BaseInput, System.ImageList,
|
|||
|
|
Vcl.ImgList, cxContainer, cxMemo, dxScrollbarAnnotations, dxCore, cxDateUtils,
|
|||
|
|
cxCurrencyEdit, dxSkinsCore, dxSkinsDefaultPainters, cxImageList;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmPurClothEnterInput = class(TfrmBaseInput)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
ScrollBox1: TScrollBox;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
BatchNo: TcxTextEdit;
|
|||
|
|
C_Code: TcxTextEdit;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
StkPosition: TcxButtonEdit;
|
|||
|
|
FromCoName: TcxButtonEdit;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
Note: TcxMemo;
|
|||
|
|
lbl5: TLabel;
|
|||
|
|
IOTime: TcxDateEdit;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
Qty: TcxCurrencyEdit;
|
|||
|
|
Piece: TcxCurrencyEdit;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
StkCoName: TcxButtonEdit;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
C_Name: TcxTextEdit;
|
|||
|
|
QtyUnit: TcxTextEdit;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
C_Color: TcxTextEdit;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
FromPurNo: TcxTextEdit;
|
|||
|
|
FromPurSId: TcxTextEdit;
|
|||
|
|
FromPurMId: TcxTextEdit;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
C_Composition: TcxTextEdit;
|
|||
|
|
Label13: TLabel;
|
|||
|
|
C_Spec: TcxTextEdit;
|
|||
|
|
C_Degree: TcxTextEdit;
|
|||
|
|
C_Width: TcxTextEdit;
|
|||
|
|
C_GramWeight: TcxTextEdit;
|
|||
|
|
Price: TcxTextEdit;
|
|||
|
|
GC_Name: TcxTextEdit;
|
|||
|
|
CraftCode: TcxTextEdit;
|
|||
|
|
CraftName: TcxTextEdit;
|
|||
|
|
FromConNo: TcxTextEdit;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
FtyPCId: TcxTextEdit;
|
|||
|
|
Label15: TLabel;
|
|||
|
|
Label16: TLabel;
|
|||
|
|
Label17: TLabel;
|
|||
|
|
SettlementType: TcxButtonEdit;
|
|||
|
|
Downgrade: TcxButtonEdit;
|
|||
|
|
Grade: TcxButtonEdit;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
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 StkCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
procedure InitGrid();
|
|||
|
|
function SaveData(MSaveType: string): Boolean;
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
FBCIOID, FPurSId: string;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmPurClothEnterInput: TfrmPurClothEnterInput;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.InitGrid();
|
|||
|
|
begin
|
|||
|
|
if trim(FBCIOID) <> '' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
sql.Add(' from BS_Cloth_IO A');
|
|||
|
|
sql.Add(' where BCIOID=''' + Trim(FBCIOID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
FromCoName.Properties.LookupItems.Text := ADOQueryTemp.FieldByName('FromCoNo').ASString;
|
|||
|
|
StkCoName.Properties.LookupItems.Text := ADOQueryTemp.FieldByName('StkCoNo').ASString;
|
|||
|
|
SCSHData(ADOQueryTemp, ScrollBox1, 0);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.*,B.* ');
|
|||
|
|
sql.Add(' from Pur_ClothPlan_Main A inner join Pur_ClothPlan_Sub B on A.PurMId=B.PurMId ');
|
|||
|
|
sql.Add(' where PurSId=''' + Trim(FPurSId) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
FromCoName.Properties.LookupItems.Text := trim(ADOQueryTemp.FieldByName('SellNo').ASString);
|
|||
|
|
// ShowMessage(ADOQueryTemp.FieldByName('SellNo').ASString + ';');
|
|||
|
|
// ShowMessage(FromCoName.Properties.LookupItems.Text + ';');
|
|||
|
|
|
|||
|
|
FromCoName.Text := ADOQueryTemp.FieldByName('SellName').ASString;
|
|||
|
|
FromPurNo.Text := ADOQueryTemp.FieldByName('PurNo').ASString;
|
|||
|
|
FromPurMId.Text := ADOQueryTemp.FieldByName('PurMId').ASString;
|
|||
|
|
FromPurSId.Text := ADOQueryTemp.FieldByName('PurSId').ASString;
|
|||
|
|
|
|||
|
|
FromConNo.Text := ADOQueryTemp.FieldByName('ConNo').ASString;
|
|||
|
|
|
|||
|
|
C_Spec.Text := ADOQueryTemp.FieldByName('C_Spec').ASString;
|
|||
|
|
QtyUnit.Text := ADOQueryTemp.FieldByName('QtyUnit').ASString;
|
|||
|
|
C_Composition.Text := ADOQueryTemp.FieldByName('C_Composition').ASString;
|
|||
|
|
C_Code.Text := ADOQueryTemp.FieldByName('C_Code').ASString;
|
|||
|
|
C_Name.Text := ADOQueryTemp.FieldByName('C_Name').ASString;
|
|||
|
|
GC_Name.Text := ADOQueryTemp.FieldByName('GC_Name').ASString;
|
|||
|
|
CraftCode.Text := ADOQueryTemp.FieldByName('CraftCode').ASString;
|
|||
|
|
CraftName.Text := ADOQueryTemp.FieldByName('CraftName').ASString;
|
|||
|
|
C_Color.Text := ADOQueryTemp.FieldByName('C_Color').ASString;
|
|||
|
|
C_Degree.Text := ADOQueryTemp.FieldByName('C_Degree').ASString;
|
|||
|
|
C_GramWeight.Text := ADOQueryTemp.FieldByName('C_GramWeight').ASString;
|
|||
|
|
C_Width.Text := ADOQueryTemp.FieldByName('C_Width').ASString;
|
|||
|
|
Price.Text := ADOQueryTemp.FieldByName('Price').ASString;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frmPurClothEnterInput := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.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 TfrmPurClothEnterInput.CoBusinessTypeDblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TcxButtonEdit(Sender).Text := '';
|
|||
|
|
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
IOTime.Date := SGetServerDate(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.FormShow(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i: integer;
|
|||
|
|
a: string;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
InitGrid();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmPurClothEnterInput.SaveData(MSaveType: string): Boolean;
|
|||
|
|
var
|
|||
|
|
Maxno: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
Sql.Clear;
|
|||
|
|
|
|||
|
|
Sql.Add('exec P_BS_Cloth_In_Del ');
|
|||
|
|
Sql.Add(' @BCIOIDS=' + quotedstr(FBCIOID));
|
|||
|
|
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)));
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
Sql.Clear;
|
|||
|
|
|
|||
|
|
Sql.Add('exec P_BS_Cloth_IOALL ');
|
|||
|
|
Sql.Add(' @Operation=' + quotedstr(Trim(MSaveType)));
|
|||
|
|
Sql.Add(' ,@PurSId=' + quotedstr(Trim(FPurSId)));
|
|||
|
|
Sql.Add(' ,@IOTime=' + quotedstr(Trim(Trim(FormatDateTime('yyyy-MM-dd', IOTime.Date)))));
|
|||
|
|
Sql.Add(' ,@StkPosition=' + quotedstr(Trim(StkPosition.Text)));
|
|||
|
|
Sql.Add(' ,@FtyPCId=' + quotedstr(Trim(FtyPCId.Text)));
|
|||
|
|
Sql.Add(' ,@BatchNo=' + quotedstr(Trim(BatchNo.Text)));
|
|||
|
|
Sql.Add(' ,@SettlementType=' + quotedstr(Trim(SettlementType.Text)));
|
|||
|
|
Sql.Add(' ,@Downgrade=' + quotedstr(Trim(Downgrade.Text)));
|
|||
|
|
Sql.Add(' ,@Grade=' + quotedstr(Trim(Grade.Text)));
|
|||
|
|
Sql.Add(' ,@StkCoNo=' + quotedstr(Trim(StkCoName.Properties.LookupItems.Text)));
|
|||
|
|
Sql.Add(' ,@StkCoName=' + quotedstr(Trim(StkCoName.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)));
|
|||
|
|
|
|||
|
|
// ShowMessage(SQL.Text);
|
|||
|
|
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 TfrmPurClothEnterInput.StkCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
|
with frmCompanySel do
|
|||
|
|
begin
|
|||
|
|
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
self.StkCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
|
self.StkCoName.Properties.LookupItems.Text := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCompanySel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if SaveData('<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>Ⲣ<EFBFBD><E2B2A2><EFBFBD><EFBFBD>') then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPurClothEnterInput.ToolButton3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if Trim(BatchNo.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(Piece.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(Qty.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(StkCoName.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ŵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if SaveData('<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>') then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|