1411 lines
48 KiB
ObjectPascal
1411 lines
48 KiB
ObjectPascal
|
|
unit U_TradeReturnClothInEdit;
|
|||
|
|
|
|||
|
|
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, StdCtrls, ExtCtrls,
|
|||
|
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
|||
|
|
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseInput,
|
|||
|
|
System.ImageList, Vcl.ImgList, BtnEdit, Vcl.Menus, RM_Common, RM_Class,
|
|||
|
|
RM_GridReport, RM_Dataset, 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, dxSkinWXI,
|
|||
|
|
dxSkinXmas2008Blue, dxScrollbarAnnotations, cxContainer, dxCore, cxDateUtils,
|
|||
|
|
cxMaskEdit;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmTradeReturnClothInEdit = class(TfrmBaseInput)
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1SPName: TcxGridDBColumn;
|
|||
|
|
v2Column6: TcxGridDBColumn;
|
|||
|
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBSave: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
DataSource3: TDataSource;
|
|||
|
|
CDS_Sub: TClientDataSet;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
v1Column12: TcxGridDBColumn;
|
|||
|
|
v1Column6: TcxGridDBColumn;
|
|||
|
|
v1SPSpec: TcxGridDBColumn;
|
|||
|
|
v1QtyUnit: TcxGridDBColumn;
|
|||
|
|
v1Column5: TcxGridDBColumn;
|
|||
|
|
v1SPMF: TcxGridDBColumn;
|
|||
|
|
v1Column8: TcxGridDBColumn;
|
|||
|
|
v1Column9: TcxGridDBColumn;
|
|||
|
|
v1Column7: TcxGridDBColumn;
|
|||
|
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
|
Tv1Column13: TcxGridDBColumn;
|
|||
|
|
GroupBox1: TGroupBox;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv2: TcxGridDBTableView;
|
|||
|
|
v2Column5: TcxGridDBColumn;
|
|||
|
|
v2Column3: TcxGridDBColumn;
|
|||
|
|
v2Column4: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
InoutNo: TcxTextEdit;
|
|||
|
|
Panel3: TPanel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
QtyMX: TcxTextEdit;
|
|||
|
|
QtyFJ: TcxTextEdit;
|
|||
|
|
ToolBar2: TToolBar;
|
|||
|
|
TBAdd: TToolButton;
|
|||
|
|
TBDel: TToolButton;
|
|||
|
|
ADOMX: TADOQuery;
|
|||
|
|
CDS_MX: TClientDataSet;
|
|||
|
|
DSMX: TDataSource;
|
|||
|
|
Tv2Column1: TcxGridDBColumn;
|
|||
|
|
Tv2Column2: TcxGridDBColumn;
|
|||
|
|
LenUnit: TComboBox;
|
|||
|
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
|
Tv2Column3: TcxGridDBColumn;
|
|||
|
|
edtMJXH: TcxTextEdit;
|
|||
|
|
chkMJJH: TCheckBox;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
ToolBar3: TToolBar;
|
|||
|
|
ToolButton6: TToolButton;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
CountMX: TcxTextEdit;
|
|||
|
|
Tv2Column4: TcxGridDBColumn;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
ADOQueryPrint: TADOQuery;
|
|||
|
|
RMDB_1: TRMDBDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
Tv2Column5: TcxGridDBColumn;
|
|||
|
|
IOTime: TcxDateEdit;
|
|||
|
|
IOType: TcxComboBox;
|
|||
|
|
FromCoName: TcxButtonEdit;
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBAddClick(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBDelClick(Sender: TObject);
|
|||
|
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
|
procedure v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure v2Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure v1Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure Tv1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure ButtonEdit(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
|
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure QtyMXKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure Tv2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
procedure v2Column4PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure chkMJJHClick(Sender: TObject);
|
|||
|
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
|
procedure FromCoName1BtnClick(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure Tv2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
procedure FromCoNamePropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure FromCoNameClick(Sender: TObject);
|
|||
|
|
procedure FromCoNameDblClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
Printsavefalg: Integer;
|
|||
|
|
function SaveCKData(): Boolean;
|
|||
|
|
procedure initMJID();
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
FBCId, canshu3, FSTKName, FKHName: string;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmTradeReturnClothInEdit: TfrmTradeReturnClothInEdit;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel, U_TradePlanSel, U_ClothInfoSel,
|
|||
|
|
U_PurchaseContractSel, U_LabelPrint;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.CheckBox1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if chkMJJH.Checked then
|
|||
|
|
begin
|
|||
|
|
if CDS_MX.IsEmpty then
|
|||
|
|
edtMJXH.Text := '1'
|
|||
|
|
else
|
|||
|
|
edtMJXH.Text := IntToStr(1 + CDS_MX.RecordCount);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
edtMJXH.Text := '';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.chkMJJHClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if chkMJJH.Checked then
|
|||
|
|
begin
|
|||
|
|
if CDS_MX.IsEmpty then
|
|||
|
|
edtMJXH.Text := '1'
|
|||
|
|
else
|
|||
|
|
edtMJXH.Text := IntToStr(1 + CDS_MX.RecordCount);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
edtMJXH.Text := '';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.Edit1KeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if Key = #13 then
|
|||
|
|
QtyMX.SetFocus;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
IOTime.Date := now();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.TBAddClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fSPID: string;
|
|||
|
|
begin
|
|||
|
|
if not CDS_MX.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
if tv2.DataController.Summary.FooterSummaryValues[1] <> cds_sub.fieldByName('piece').AsInteger then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD>ϸƥ<CFB8><C6A5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
CopyAddRowCDS(CDS_Sub);
|
|||
|
|
|
|||
|
|
if GetLSNo(ADOQueryCmd, fSPID, 'DR', 'CK_SXPB_CR', 3, 1) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
CDS_Sub.edit;
|
|||
|
|
CDS_Sub.FieldByName('BCIOID').Value := fSPID;
|
|||
|
|
CDS_Sub.FieldByName('piece').Value := 0;
|
|||
|
|
CDS_Sub.FieldByName('Qty').Value := 0;
|
|||
|
|
CDS_Sub.FieldByName('KGQty').Value := 0;
|
|||
|
|
CDS_Sub.FieldByName('QtyUnit').Value := 'M';
|
|||
|
|
CDS_Sub.Post;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmTradeReturnClothInEdit.SaveCKData(): Boolean;
|
|||
|
|
var
|
|||
|
|
Maxno, MBCIOID: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
CDS_Sub.DisableControls;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from BS_Cloth_IO where BCIOID=''' + Trim(CDS_Sub.fieldbyname('BCIOID').AsString) + '''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
MBCIOID := Trim(ADOQueryTemp.fieldbyname('BCIOID').AsString);
|
|||
|
|
|
|||
|
|
Maxno := Trim(cds_sub.fieldbyname('BCIOID').AsString);
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from BS_Cloth_IO where BCIOID=''' + Trim(Maxno) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(MBCIOID) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Fillid').Value := Trim(Dcode);
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('Editid').Value := Trim(Dcode);
|
|||
|
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
|
FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_Sub, 'BS_Cloth_IO', 0);
|
|||
|
|
|
|||
|
|
FieldByName('IOTime').Value := IOTime.Date;
|
|||
|
|
FieldByName('IOType').Value := IOType.Text;
|
|||
|
|
FieldByName('FromCoName').Value := FromCoName.Text;
|
|||
|
|
|
|||
|
|
FieldByName('FromCoNo').Value := FromCoName.Properties.LookupItems.Text;
|
|||
|
|
FieldByName('StkCoNo').Value := CDS_Sub.fieldbyname('StkCoNo').Value;
|
|||
|
|
|
|||
|
|
FieldByName('FromMainId').Value := CDS_Sub.fieldbyname('FromMainId').Value;
|
|||
|
|
FieldByName('FromSubId').Value := CDS_Sub.fieldbyname('FromSubId').Value;
|
|||
|
|
FieldByName('FromPurMId').Value := CDS_Sub.fieldbyname('FromPurMId').Value;
|
|||
|
|
FieldByName('FromPurSId').Value := CDS_Sub.fieldbyname('FromPurSId').Value;
|
|||
|
|
|
|||
|
|
FieldByName('FromTPNID').Value := CDS_Sub.fieldbyname('FromTPNID').Value;
|
|||
|
|
FieldByName('BCIOID').Value := Trim(Maxno);
|
|||
|
|
FieldByName('STKID').Value := Trim(Maxno);
|
|||
|
|
FieldByName('STKName').Value := FSTKName;
|
|||
|
|
FieldByName('IOFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('IOQtyFlag').Value := 1;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update BS_Cloth_IO Set StkPiece=(select Sum(isnull(Piece,0)*IOQtyFlag) from BS_Cloth_IO A where A.STKID=BS_Cloth_IO.BCIOID )');
|
|||
|
|
sql.Add(',StkQty=(select Sum(isnull(Qty,0)*IOQtyFlag) from BS_Cloth_IO A where A.STKID=BS_Cloth_IO.BCIOID )');
|
|||
|
|
sql.Add(' where BCIOID=''' + Trim(Maxno) + '''');
|
|||
|
|
|
|||
|
|
sql.Add('update Trade_Cloth_Inspect set C_Code=(select C_Code from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID) ');
|
|||
|
|
sql.Add(' ,C_Name=(select C_Name from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,BatchNO=(select BatchNO from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Spec=(select C_Spec from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Color=(select C_Color from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_ColorNo=(select C_ColorNo from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_StyleNo=(select C_StyleNo from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Composition=(select C_Composition from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Width=(select C_Width from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_GramWeight=(select C_GramWeight from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Pattern=(select C_Pattern from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_CustPattern=(select C_CustPattern from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_ColorDepth=(select C_ColorDepth from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,FtyPCId=(select FtyPCId from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,LenUnit=(select QtyUnit from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add('where BCIOID=''' + Trim(Maxno) + '''');
|
|||
|
|
|
|||
|
|
sql.Add('update Trade_Cloth_Stock set C_Code=(select C_Code from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID) ');
|
|||
|
|
sql.Add(' ,C_Name=(select C_Name from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,BatchNO=(select BatchNO from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Spec=(select C_Spec from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Color=(select C_Color from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_ColorNo=(select C_ColorNo from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_StyleNo=(select C_StyleNo from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Composition=(select C_Composition from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Width=(select C_Width from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_GramWeight=(select C_GramWeight from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Pattern=(select C_Pattern from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_CustPattern=(select C_CustPattern from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,FtyPCId=(select FtyPCId from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add('where BCIOID=''' + Trim(Maxno) + '''');
|
|||
|
|
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select stkQty,StkPiece from BS_Cloth_IO where BCIOID=''' + Trim(Maxno) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.FieldByName('stkQty').Value < 0 then
|
|||
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!');
|
|||
|
|
if ADOQueryTemp.FieldByName('StkPiece').Value < 0 then
|
|||
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!');
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
|||
|
|
sql.Add('values(''<27>ֻ<EFBFBD><D6BB>ز<EFBFBD><D8B2><EFBFBD><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(') ');
|
|||
|
|
|
|||
|
|
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('<27>ز<EFBFBD><D8B2><EFBFBD>־')));
|
|||
|
|
if Trim(MBCIOID) = '' then
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ز<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')))
|
|||
|
|
else
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ز<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + quotedstr(Maxno) + 'Ʒ<><C6B7><EFBFBD><EFBFBD>' + cds_sub.FieldByName('c_name').AsString + '<27><><EFBFBD>ͣ<EFBFBD>' + cds_sub.FieldByName('C_Pattern').AsString + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + cds_sub.FieldByName('Qty').AsString)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('BCIOID').Value := Trim(Maxno);
|
|||
|
|
Post;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
Result := False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
ReadCxGrid(FSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>', Tv1, 'ó<><EFBFBD><D7BB>ֿܲ<DCB2>');
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
sql.Add(' from BS_Cloth_IO A');
|
|||
|
|
sql.Add(' where BCIOID=''' + Trim(FBCId) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryTemp, CDS_Sub);
|
|||
|
|
SInitCDSData(ADOQueryTemp, CDS_Sub);
|
|||
|
|
|
|||
|
|
if not CDS_Sub.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
IOTime.Date := CDS_Sub.fieldbyname('IOTime').AsDateTime;
|
|||
|
|
IOType.ItemIndex := IOType.properties.Items.IndexOf(trim(CDS_Sub.fieldbyname('IOType').AsString));
|
|||
|
|
FromCoName.Text := trim(CDS_Sub.fieldbyname('FromCoName').AsString);
|
|||
|
|
FromCoName.Properties.LookupItems.Text := trim(CDS_Sub.fieldbyname('FromCoNo').AsString);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
chkMJJH.Checked := True;
|
|||
|
|
|
|||
|
|
initMJID();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.FromCoName1BtnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if iotype.Text = '<27>ͻ<EFBFBD><CDBB>˻<EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
|
with frmCompanySel do
|
|||
|
|
begin
|
|||
|
|
FCoType := '<27>ͻ<EFBFBD>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
FromCoName.Text := Trim(CDS_1.fieldbyname('CoName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCompanySel.Free;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'GYSName';
|
|||
|
|
flagname := '<27><>Ӧ<EFBFBD><D3A6>';
|
|||
|
|
MainType := FSTKName;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
FromCoName.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.FromCoNameClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TcxButtonEdit(Sender).Text := '';
|
|||
|
|
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.FromCoNameDblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TcxButtonEdit(Sender).Text := '';
|
|||
|
|
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.FromCoNamePropertiesButtonClick(
|
|||
|
|
Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if iotype.Text = '<27>ͻ<EFBFBD><CDBB>˻<EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
|
with frmCompanySel do
|
|||
|
|
begin
|
|||
|
|
FCoType := '<27>ͻ<EFBFBD>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
FromCoName.Text := Trim(CDS_1.fieldbyname('CoName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCompanySel.Free;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'GYSName';
|
|||
|
|
flagname := '<27><>Ӧ<EFBFBD><D3A6>';
|
|||
|
|
MainType := FSTKName;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
FromCoName.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.QtyMXKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
var
|
|||
|
|
fMJID: string;
|
|||
|
|
MMJXH: Integer;
|
|||
|
|
MMXCount: Integer;
|
|||
|
|
I: Integer;
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
MMXCount := StrToIntdef(CountMX.text, 1);
|
|||
|
|
|
|||
|
|
for I := 1 to MMXCount do
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if CDS_Sub.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>Ʒ<EFBFBD><C6B7>Ϣû<CFA2><C3BB><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
if strtofloatdef(QtyMX.Text, 0) = 0 then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Trim(edtMJXH.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
MMJXH := StrToIntDef(edtMJXH.Text, 1);
|
|||
|
|
|
|||
|
|
if chkMJJH.Checked then
|
|||
|
|
begin
|
|||
|
|
edtMJXH.Text := IntToStr(MMJXH + 1);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
edtMJXH.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if GetLSNo(ADOQueryCmd, fMJID, '', 'Trade_Cloth_Inspect', 5, 1) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if trim(CDS_Sub.fieldbyname('BCIOID').AsString) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Trade_Cloth_Inspect A');
|
|||
|
|
sql.Add('where 1=2');
|
|||
|
|
open;
|
|||
|
|
append;
|
|||
|
|
Fieldbyname('mainID').Value := '';
|
|||
|
|
Fieldbyname('subID').Value := '';
|
|||
|
|
Fieldbyname('CIID').Value := trim(fMJID);
|
|||
|
|
Fieldbyname('PieceNo').Value := MMJXH;
|
|||
|
|
|
|||
|
|
if lenunit.Text = 'KG' then
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('InputWeight').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('NetWeight').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('GrossWeight').Value := strtofloatdef(QtyMX.Text, 0) + strtofloatdef(QtyFJ.Text, 0);
|
|||
|
|
Fieldbyname('Tare').Value := strtofloatdef(QtyFJ.Text, 0);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if lenunit.Text = 'M' then
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('InputLen').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('Meter').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('Yardage').Value := RoundFloat(strtofloatdef(QtyMX.Text, 0) / 0.9144, 2);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('InputLen').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('Yardage').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('Meter').Value := RoundFloat(strtofloatdef(QtyMX.Text, 0) * 0.9144, 2);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Fieldbyname('BCIOID').Value := trim(CDS_Sub.fieldbyname('BCIOID').AsString);
|
|||
|
|
Fieldbyname('Grade').Value := '<27><>Ʒ';
|
|||
|
|
Fieldbyname('CIIOFlag').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with CDS_MX do
|
|||
|
|
begin
|
|||
|
|
append;
|
|||
|
|
Fieldbyname('ssel').Value := false;
|
|||
|
|
Fieldbyname('CIID').Value := trim(fMJID);
|
|||
|
|
Fieldbyname('PieceNo').Value := MMJXH;
|
|||
|
|
Fieldbyname('BCIOID').Value := trim(CDS_Sub.fieldbyname('BCIOID').AsString);
|
|||
|
|
|
|||
|
|
Fieldbyname('PrtCount').Value := 0;
|
|||
|
|
if lenunit.Text = 'KG' then
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('InputWeight').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('NetWeight').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('GrossWeight').Value := strtofloatdef(QtyMX.Text, 0) + strtofloatdef(QtyFJ.Text, 0);
|
|||
|
|
Fieldbyname('Tare').Value := strtofloatdef(QtyFJ.Text, 0);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if lenunit.Text = 'M' then
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('InputLen').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('Meter').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('Yardage').Value := RoundFloat(strtofloatdef(QtyMX.Text, 0) / 0.9144, 2);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('InputLen').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('Yardage').Value := strtofloatdef(QtyMX.Text, 0);
|
|||
|
|
Fieldbyname('Meter').Value := RoundFloat(strtofloatdef(QtyMX.Text, 0) * 0.9144, 2);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Fieldbyname('Tare').Value := strtofloatdef(QtyFJ.Text, 0);
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update BS_Cloth_IO Set Piece=Piece+1');
|
|||
|
|
sql.Add(',Qty=Qty+(select InputLen from Trade_Cloth_Inspect X where X.CIID=''' + trim(fMJID) + ''' ) ');
|
|||
|
|
sql.Add(',KGQty=KGQty+(select NetWeight from Trade_Cloth_Inspect X where X.CIID=''' + trim(fMJID) + ''' ) ');
|
|||
|
|
sql.Add(' where BCIOID=''' + trim(CDS_Sub.fieldbyname('BCIOID').AsString) + '''');
|
|||
|
|
|
|||
|
|
sql.Add('update Trade_Cloth_Inspect set C_Code=(select C_Code from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID) ');
|
|||
|
|
sql.Add(' ,C_Name=(select C_Name from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,BatchNO=(select BatchNO from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Spec=(select C_Spec from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Color=(select C_Color from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_ColorNo=(select C_ColorNo from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_StyleNo=(select C_StyleNo from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Composition=(select C_Composition from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Width=(select C_Width from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_GramWeight=(select C_GramWeight from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Pattern=(select C_Pattern from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_CustPattern=(select C_CustPattern from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,C_ColorDepth=(select C_ColorDepth from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,FtyPCId=(select FtyPCId from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add(' ,LenUnit=(select QtyUnit from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Inspect.BCIOID)');
|
|||
|
|
sql.Add('where CIID=''' + trim(fMJID) + '''');
|
|||
|
|
|
|||
|
|
sql.Add('update Trade_Cloth_Stock set C_Code=(select C_Code from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID) ');
|
|||
|
|
sql.Add(' ,C_Name=(select C_Name from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,BatchNO=(select BatchNO from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Spec=(select C_Spec from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Color=(select C_Color from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_ColorNo=(select C_ColorNo from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_StyleNo=(select C_StyleNo from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Composition=(select C_Composition from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Width=(select C_Width from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_GramWeight=(select C_GramWeight from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_Pattern=(select C_Pattern from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,C_CustPattern=(select C_CustPattern from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add(' ,FtyPCId=(select FtyPCId from BS_Cloth_IO X where X.BCIOID=Trade_Cloth_Stock.BCIOID)');
|
|||
|
|
sql.Add('where STKID=''' + trim(fMJID) + '''');
|
|||
|
|
|
|||
|
|
sql.Add('exec P_Trade_Insp_In_Stk @CIID=''' + trim(fMJID) + '''');
|
|||
|
|
|
|||
|
|
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('<27>ز<EFBFBD><D8B2><EFBFBD>־')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ز<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>룺' + quotedstr(fMJID) + '<27>زֱ<D8B2><D6B1>ţ<EFBFBD>' + quotedstr(CDS_Sub.fieldbyname('BCIOID').AsString) + 'Ʒ<><C6B7><EFBFBD><EFBFBD>' + quotedstr(CDS_Sub.fieldbyname('C_Name').AsString) + '<27><><EFBFBD>ͣ<EFBFBD>' + quotedstr(CDS_Sub.fieldbyname('C_Pattern').AsString) + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + quotedstr(QtyMX.Text))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
edit;
|
|||
|
|
if CDS_MX.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('Piece').Value := 0;
|
|||
|
|
Fieldbyname('Qty').Value := 0;
|
|||
|
|
Fieldbyname('KgQty').Value := 0;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('Piece').Value := tv2.DataController.Summary.FooterSummaryValues[1];
|
|||
|
|
Fieldbyname('Qty').Value := tv2.DataController.Summary.FooterSummaryValues[2];
|
|||
|
|
Fieldbyname('KgQty').Value := tv2.DataController.Summary.FooterSummaryValues[3];
|
|||
|
|
end;
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if not chkMJJH.Checked then
|
|||
|
|
edtMJXH.SetFocus;
|
|||
|
|
except
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Trade_Cloth_Inspect where CIID=''' + trim(fMJID) + '''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
QtyMX.Text := '';
|
|||
|
|
CountMX.Text := '';
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.TBDelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Sub.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if Trim(CDS_Sub.fieldbyname('BCIOID').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('exec P_Fin_Flow_Judge ');
|
|||
|
|
Sql.Add(' @FFIDS=' + quotedstr(Trim(CDS_Sub.fieldbyname('BCIOID').AsString)));
|
|||
|
|
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(''ó<>ز<D7BB>¼<EFBFBD><C2BC>'' ');
|
|||
|
|
sql.Add(',' + quotedstr(Trim(CDS_Sub.fieldbyname('BCIOID').AsString)));
|
|||
|
|
sql.Add(',''ɾ<><C9BE>'' ');
|
|||
|
|
sql.Add(',' + quotedstr(DName));
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(Trim(CDS_Sub.fieldbyname('BCIOID').AsString)));
|
|||
|
|
sql.Add(') ');
|
|||
|
|
|
|||
|
|
Sql.Add('exec P_BS_Cloth_In_Del ');
|
|||
|
|
Sql.Add(' @BCIOIDS=' + quotedstr(Trim(CDS_Sub.fieldbyname('BCIOID').AsString)));
|
|||
|
|
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;
|
|||
|
|
CDS_Sub.Delete;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
CDS_Sub.Delete;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.TBSaveClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Sub.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if IOTime.Date = null then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD>䲻<EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if IOType.Text = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if FromCoName.Text = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_Sub.Locate('C_Name', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if CDS_Sub.Locate('C_Pattern', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// if CDS_Sub.Locate('C_Color', null, []) = True then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
if CDS_Sub.Locate('Piece', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_Sub.Locate('Qty', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_Sub.Locate('QtyUnit', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if SaveCKData() then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
//ModalResult:=1;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid(FSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>', Tv1, 'ó<><EFBFBD><D7BB>ֿܲ<DCB2>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.ToolButton2Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MBCIOID: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_MX.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_MX.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
MBCIOID := '';
|
|||
|
|
CDS_MX.DisableControls;
|
|||
|
|
with CDS_MX do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while CDS_MX.Locate('SSel', True, []) do
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from bs_cloth_io where bcioid=''' + Trim(CDS_MX.fieldbyname('BCIOID').AsString) + ''' ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>棬<EFBFBD>뱣<EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD>ӡ!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
MBCIOID := MBCIOID + ',' + QuotedStr(Trim(CDS_MX.fieldbyname('BCIOID').AsString));
|
|||
|
|
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('SSel').Value := False;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_MX.EnableControls;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
|
with frmLabelPrint do
|
|||
|
|
begin
|
|||
|
|
FLMType := 'TradeReturnClothInPrt1';
|
|||
|
|
FFiltration1 := MBCIOID;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// Self.InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelPrint.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.ToolButton6Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile, FLabVolume: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_MX.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_MX.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from bs_cloth_io where bcioid=''' + Trim(CDS_MX.fieldbyname('BCIOID').AsString) + ''' ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>棬<EFBFBD>뱣<EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD>ӡ!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
CDS_MX.DisableControls;
|
|||
|
|
with CDS_MX do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_MX.FieldByName('SSel').AsBoolean = True then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update Trade_Cloth_Inspect Set PrtCount=PrtCount+1,PrtDate=getdate(),Prter=''' + Trim(DName) + '''');
|
|||
|
|
sql.Add(' where CIID=''' + Trim(CDS_MX.fieldbyname('CIID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' EXEC P_Trade_Insp_Prt_Lab ');
|
|||
|
|
SQL.Add(' @CIID=''' + Trim(CDS_MX.fieldbyname('CIID').AsString) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryPrint.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
CDS_MX.EnableControls;
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if Trim(ADOQueryPrint.fieldbyname('Grade').AsString) = '<27><>Ʒ' then
|
|||
|
|
FLabVolume := Trim(ADOQueryPrint.fieldbyname('LabVolume').AsString)
|
|||
|
|
else
|
|||
|
|
FLabVolume := '<27><>Ʒ<EFBFBD><C6B7>ǩ';
|
|||
|
|
|
|||
|
|
ExportFtErpFile(FLabVolume + '.rmf', ADOQueryTemp);
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLabVolume + '.rmf';
|
|||
|
|
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
if Trim(ADOQueryPrint.fieldbyname('LabVolume').AsString) <> '<27><>Ʒ<EFBFBD><C6B7>ǩ' then
|
|||
|
|
Rm1.DefaultCopies := 1
|
|||
|
|
else
|
|||
|
|
Rm1.DefaultCopies := 1;
|
|||
|
|
RM1.PrintReport;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_MX.EnableControls;
|
|||
|
|
|
|||
|
|
initMJID();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
initMJID();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.initMJID();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
with ADOMX do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Trade_Cloth_Inspect A');
|
|||
|
|
sql.Add('where BCIOID=' + quotedstr(trim(cds_sub.fieldByName('BCIOID').AsString)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOMX, CDS_MX);
|
|||
|
|
SInitCDSData(ADOMX, CDS_MX);
|
|||
|
|
except
|
|||
|
|
end;
|
|||
|
|
if chkMJJH.Checked then
|
|||
|
|
begin
|
|||
|
|
if CDS_MX.IsEmpty then
|
|||
|
|
edtMJXH.Text := '1'
|
|||
|
|
else
|
|||
|
|
edtMJXH.Text := IntToStr(1 + CDS_MX.RecordCount);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
edtMJXH.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
SelOKNo(cds_mx, True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
SelOKNo(cds_mx, False);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
|
with frmCompanySel do
|
|||
|
|
begin
|
|||
|
|
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('StkCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
|
FieldByName('StkCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCompanySel.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.Tv1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmTradePlanSel := TfrmTradePlanSel.Create(Application);
|
|||
|
|
with frmTradePlanSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('FromCoNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('FtyNo').AsString);
|
|||
|
|
FieldByName('FromCoName').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('FtyName').AsString);
|
|||
|
|
FieldByName('FromOrdNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('OrderNo').AsString);
|
|||
|
|
FieldByName('FromMainId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('MainId').AsString);
|
|||
|
|
FieldByName('FromSubId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
|
FieldByName('C_Code').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Code').AsString);
|
|||
|
|
FieldByName('C_Name').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Name').AsString);
|
|||
|
|
FieldByName('C_Spec').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Spec').AsString);
|
|||
|
|
FieldByName('C_Composition').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Composition').AsString);
|
|||
|
|
FieldByName('C_Width').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Width').AsString);
|
|||
|
|
FieldByName('C_GramWeight').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_GramWeight').AsString);
|
|||
|
|
FieldByName('C_Color').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Color').AsString);
|
|||
|
|
FieldByName('C_ColorNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_ColorNo').AsString);
|
|||
|
|
FieldByName('C_Pattern').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Pattern').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmTradePlanSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
initMJID();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if CDS_MX.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Trade_Cloth_Inspect where CIID=''' + trim(CDS_MX.fieldbyName('CIID').AsString) + '''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if trim(ADOQueryTemp.fieldbyName('CIIOFlag').AsString) <> 'δ<><CEB4><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
Sql.Clear;
|
|||
|
|
// sql.Add('Update BS_Cloth_IO Set Piece=Piece-1');
|
|||
|
|
// sql.Add(',Qty=Qty-(select InputLen from Trade_Cloth_Inspect X where X.CIID=''' + trim(CDS_MX.fieldbyName('CIID').AsString) + ''' ) ');
|
|||
|
|
// sql.Add(',KGQty=KGQty-(select NetWeight from Trade_Cloth_Inspect X where X.CIID=''' + trim(CDS_MX.fieldbyName('CIID').AsString) + ''' ) ');
|
|||
|
|
// sql.Add(' where BCIOID=''' + trim(CDS_Sub.fieldbyname('BCIOID').AsString) + '''');
|
|||
|
|
// 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('<27>ز<EFBFBD><D8B2><EFBFBD>־')));
|
|||
|
|
// sql.Add(',' + quotedstr(trim('<27>ز<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ϸɾ<CFB8><C9BE>')));
|
|||
|
|
// sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>룺' + quotedstr(trim(CDS_MX.fieldbyName('CIID').AsString)))));
|
|||
|
|
// sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
// sql.Add(')');
|
|||
|
|
|
|||
|
|
Sql.Add('exec P_Trade_Insp_Del ');
|
|||
|
|
Sql.Add('@CIIDS=' + quotedstr(trim(CDS_MX.fieldbyName('CIID').AsString)));
|
|||
|
|
Sql.Add(',@DCode=' + Quotedstr(DCode));
|
|||
|
|
Sql.Add(',@DName=' + Quotedstr(DName));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
end;
|
|||
|
|
CDS_MX.Delete;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
edit;
|
|||
|
|
if CDS_MX.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('Piece').Value := 0;
|
|||
|
|
Fieldbyname('Qty').Value := 0;
|
|||
|
|
Fieldbyname('KgQty').Value := 0;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('Piece').Value := tv2.DataController.Summary.FooterSummaryValues[1];
|
|||
|
|
Fieldbyname('Qty').Value := tv2.DataController.Summary.FooterSummaryValues[2];
|
|||
|
|
Fieldbyname('KgQty').Value := tv2.DataController.Summary.FooterSummaryValues[3];
|
|||
|
|
end;
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.Tv2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if AViewInfo.GridRecord.Values[tv2.GetColumnByFieldName('PrtCount').Index] > 0 then
|
|||
|
|
ACanvas.Brush.Color := $00EEF08E;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.Tv2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Trade_Cloth_Inspect where CIID=''' + trim(CDS_MX.fieldbyName('CIID').AsString) + '''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if trim(ADOQueryTemp.fieldbyName('CIIOFlag').AsString) <> 'δ<><CEB4><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
v2Column4.Options.Editing := False;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
v2Column4.Options.Editing := True;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.ButtonEdit(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmClothInfoSel := TfrmClothInfoSel.Create(Application);
|
|||
|
|
with frmClothInfoSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
edit;
|
|||
|
|
FieldByName('C_Code').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Code').AsString);
|
|||
|
|
FieldByName('C_Name').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Name').AsString);
|
|||
|
|
FieldByName('C_Spec').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Spec').AsString);
|
|||
|
|
FieldByName('C_Composition').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Composition').AsString);
|
|||
|
|
FieldByName('C_Width').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Width').AsString);
|
|||
|
|
FieldByName('C_GramWeight').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_GramWeight').AsString);
|
|||
|
|
|
|||
|
|
Fieldbyname('C_ColorNo').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_ColorNo').AsString);
|
|||
|
|
Fieldbyname('C_Color').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Color').AsString);
|
|||
|
|
Fieldbyname('C_Pattern').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Pattern').AsString);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmClothInfoSel.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
|
with frmCompanySel do
|
|||
|
|
begin
|
|||
|
|
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('FromCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
|
FieldByName('FromCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
|
|
|||
|
|
FieldByName('SalesER').Value := Trim(CDS_1.fieldbyname('SalesER').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCompanySel.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.v2Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'JWLYCLName';
|
|||
|
|
flagname := 'Ʒ<><C6B7>';
|
|||
|
|
MainType := FSTKName;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('C_Name').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.v2Column4PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue, FFieldName: string;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_MX do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' update Trade_Cloth_Inspect set ' + FFieldName + ' = ' + mvalue);
|
|||
|
|
sql.Add(' where CIID= ' + quotedstr(Trim(CDS_MX.FieldByName('CIID').Asstring)));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'StkPosition';
|
|||
|
|
flagname := '<27><>λ';
|
|||
|
|
MainType := FSTKName;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('StkPosition').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeReturnClothInEdit.v1Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'C_Spec';
|
|||
|
|
flagname := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
MainType := FSTKName;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('C_Spec').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|