3941 lines
111 KiB
ObjectPascal
3941 lines
111 KiB
ObjectPascal
unit U_OrderInPut;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
||
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
|
||
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer,
|
||
cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB,
|
||
ExtCtrls, BtnEdit, cxCalendar,StrUtils, cxPC, cxGridCustomPopupMenu,
|
||
cxGridPopupMenu, cxDropDownEdit,jpeg,IdGlobal, RM_Common, RM_Class,
|
||
RM_e_Xls, RM_System, RM_GridReport, RM_Dataset;
|
||
|
||
type
|
||
TfrmOrderInPut = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Order_Sub: TClientDataSet;
|
||
ADOQuery1: TADOQuery;
|
||
cxPageControl1: TcxPageControl;
|
||
cxTabSheet1: TcxTabSheet;
|
||
ToolBar2: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1SOrddefstr1: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxTabSheet2: TcxTabSheet;
|
||
cxTabSheet3: TcxTabSheet;
|
||
v1Column1: TcxGridDBColumn;
|
||
Panel1: TPanel;
|
||
Label1: TLabel;
|
||
Label10: TLabel;
|
||
Label3: TLabel;
|
||
Label14: TLabel;
|
||
Label12: TLabel;
|
||
Label13: TLabel;
|
||
Label2: TLabel;
|
||
Label6: TLabel;
|
||
Label21: TLabel;
|
||
Label25: TLabel;
|
||
Label43: TLabel;
|
||
OrderNo: TEdit;
|
||
ConNo: TEdit;
|
||
OrdDate: TDateTimePicker;
|
||
ChuanY: TBtnEditC;
|
||
DLYDate: TDateTimePicker;
|
||
YWY: TBtnEditC;
|
||
Label4: TLabel;
|
||
Note: TMemo;
|
||
Label5: TLabel;
|
||
CDS_JGLC: TClientDataSet;
|
||
DataSource2: TDataSource;
|
||
CDS_JGC: TClientDataSet;
|
||
DataSource3: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
cxGridPopupMenu3: TcxGridPopupMenu;
|
||
MPRTCodeName: TEdit;
|
||
MPRTSpec: TEdit;
|
||
Label7: TLabel;
|
||
MPRTCF: TEdit;
|
||
MPRTMF: TEdit;
|
||
MPRTKZ: TEdit;
|
||
CustomerNoName: TBtnEditA;
|
||
MPRTCode: TBtnEditA;
|
||
Label8: TLabel;
|
||
MPRTGY: TEdit;
|
||
Label11: TLabel;
|
||
Label15: TLabel;
|
||
Label9: TLabel;
|
||
MPRTGYHZ: TEdit;
|
||
ClientDataSet5: TClientDataSet;
|
||
DataSource5: TDataSource;
|
||
cxGridPopupMenu5: TcxGridPopupMenu;
|
||
ClientDataSet6: TClientDataSet;
|
||
DataSource6: TDataSource;
|
||
cxGridPopupMenu6: TcxGridPopupMenu;
|
||
v1Column2: TcxGridDBColumn;
|
||
ComTaiTou: TBtnEditA;
|
||
Label18: TLabel;
|
||
LiDanPerson: TBtnEditA;
|
||
ToolBar4: TToolBar;
|
||
ToolButton6: TToolButton;
|
||
ToolButton7: TToolButton;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
v2Column3: TcxGridDBColumn;
|
||
v2Column4: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
ScrollBox2: TScrollBox;
|
||
cxGrid5: TcxGrid;
|
||
Tv5: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridDBColumn10: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
cxGridLevel3: TcxGridLevel;
|
||
cxGrid6: TcxGrid;
|
||
Tv6: TcxGridDBTableView;
|
||
v6Column1: TcxGridDBColumn;
|
||
v6Column3: TcxGridDBColumn;
|
||
v6Column2: TcxGridDBColumn;
|
||
cxGridDBColumn12: TcxGridDBColumn;
|
||
cxGridDBColumn15: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
cxGridDBColumn17: TcxGridDBColumn;
|
||
cxGridLevel4: TcxGridLevel;
|
||
ToolBar5: TToolBar;
|
||
ToolButton9: TToolButton;
|
||
ToolButton12: TToolButton;
|
||
Panel2: TPanel;
|
||
ScrollBox3: TScrollBox;
|
||
ToolBar3: TToolBar;
|
||
ToolButton8: TToolButton;
|
||
ToolButton10: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
ToolButton11: TToolButton;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
v3Column1: TcxGridDBColumn;
|
||
Tv3Column1: TcxGridDBColumn;
|
||
v3Column2: TcxGridDBColumn;
|
||
v3Column3: TcxGridDBColumn;
|
||
v3Column5: TcxGridDBColumn;
|
||
v3Column4: TcxGridDBColumn;
|
||
v3Column6: TcxGridDBColumn;
|
||
v3Column7: TcxGridDBColumn;
|
||
v3Column8: TcxGridDBColumn;
|
||
v3Column9: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
ScrollBox1: TScrollBox;
|
||
GroupBox1: TGroupBox;
|
||
Label16: TLabel;
|
||
Label17: TLabel;
|
||
MPRTMFNote: TEdit;
|
||
MPRTKZNote: TEdit;
|
||
CJNote: TcxMemo;
|
||
GroupBox2: TGroupBox;
|
||
DHNote: TcxMemo;
|
||
GroupBox3: TGroupBox;
|
||
GroupBox4: TGroupBox;
|
||
CHNote: TcxMemo;
|
||
Label19: TLabel;
|
||
ZGLen: TEdit;
|
||
Label20: TLabel;
|
||
ZGHd: TEdit;
|
||
Label22: TLabel;
|
||
ZGKg: TEdit;
|
||
Label23: TLabel;
|
||
Label24: TLabel;
|
||
NRDHD: TEdit;
|
||
Label26: TLabel;
|
||
Label27: TLabel;
|
||
ZGNote: TEdit;
|
||
Label28: TLabel;
|
||
PiZhong: TEdit;
|
||
ToolButton13: TToolButton;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column18: TcxGridDBColumn;
|
||
cxTabSheet4: TcxTabSheet;
|
||
cxGrid7: TcxGrid;
|
||
Tv7: TcxGridDBTableView;
|
||
cxGridDBColumn34: TcxGridDBColumn;
|
||
cxGridDBColumn30: TcxGridDBColumn;
|
||
cxGridDBColumn31: TcxGridDBColumn;
|
||
cxGridDBColumn32: TcxGridDBColumn;
|
||
cxGridDBColumn33: TcxGridDBColumn;
|
||
cxGridDBColumn36: TcxGridDBColumn;
|
||
cxGridLevel5: TcxGridLevel;
|
||
ToolBar6: TToolBar;
|
||
ToolButton14: TToolButton;
|
||
ToolButton15: TToolButton;
|
||
ClientDataSet7: TClientDataSet;
|
||
DataSource7: TDataSource;
|
||
cxGridPopupMenu7: TcxGridPopupMenu;
|
||
Panel3: TPanel;
|
||
Label30: TLabel;
|
||
Label29: TLabel;
|
||
Label31: TLabel;
|
||
ClothOneQty: TEdit;
|
||
OneQtyUnit: TComboBox;
|
||
MPRTOneQty: TEdit;
|
||
cxPageControl2: TcxPageControl;
|
||
cxTabSheet5: TcxTabSheet;
|
||
cxTabSheet6: TcxTabSheet;
|
||
BZNote: TcxMemo;
|
||
ToolBar7: TToolBar;
|
||
ToolButton16: TToolButton;
|
||
ToolButton17: TToolButton;
|
||
Image2: TImage;
|
||
OpenDialog2: TOpenDialog;
|
||
Panel4: TPanel;
|
||
CheckBox1: TCheckBox;
|
||
ToolButton18: TToolButton;
|
||
ToolButton19: TToolButton;
|
||
v2Column5: TcxGridDBColumn;
|
||
v5Column1: TcxGridDBColumn;
|
||
v5Column2: TcxGridDBColumn;
|
||
cxTabSheet7: TcxTabSheet;
|
||
ToolBar8: TToolBar;
|
||
ToolButton20: TToolButton;
|
||
ToolButton21: TToolButton;
|
||
cxGrid8: TcxGrid;
|
||
Tv8: TcxGridDBTableView;
|
||
cxGridDBColumn21: TcxGridDBColumn;
|
||
cxGridLevel6: TcxGridLevel;
|
||
DataSource8: TDataSource;
|
||
cxGridPopupMenu8: TcxGridPopupMenu;
|
||
ClientDataSet8: TClientDataSet;
|
||
v5Column3: TcxGridDBColumn;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
ClientDataSet9: TClientDataSet;
|
||
v6Column4: TcxGridDBColumn;
|
||
v6Column5: TcxGridDBColumn;
|
||
KgZMiXs: TEdit;
|
||
Label34: TLabel;
|
||
Label35: TLabel;
|
||
Label32: TLabel;
|
||
KgZMaXs: TEdit;
|
||
ToolButton22: TToolButton;
|
||
ADOQueryPrint: TADOQuery;
|
||
RM1: TRMGridReport;
|
||
CDS_Print: TClientDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
RMDBMain: TRMDBDataSet;
|
||
Label33: TLabel;
|
||
LabNote1: TEdit;
|
||
Label36: TLabel;
|
||
LabNote2: TEdit;
|
||
Label37: TLabel;
|
||
RollBeg: TEdit;
|
||
Label38: TLabel;
|
||
RollEnd: TEdit;
|
||
Label39: TLabel;
|
||
Button1: TButton;
|
||
RM2: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
v5Column4: TcxGridDBColumn;
|
||
v5Column5: TcxGridDBColumn;
|
||
v7Column1: TcxGridDBColumn;
|
||
v7Column2: TcxGridDBColumn;
|
||
ToolButton23: TToolButton;
|
||
Panel5: TPanel;
|
||
Label40: TLabel;
|
||
Edit1: TEdit;
|
||
Label41: TLabel;
|
||
ComboBox1: TComboBox;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure v1PRTColorPropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure RanFactoryBtnUpClick(Sender: TObject);
|
||
procedure CustomerNoNameBtnDnClick(Sender: TObject);
|
||
procedure NoteDblClick(Sender: TObject);
|
||
procedure v1OrderUnitPropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure v1PriceUnitPropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure OrdDefStr2BtnUpClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure YCLFactoryBtnUpClick(Sender: TObject);
|
||
procedure MPRTSCTeBieNoteBtnUpClick(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton8Click(Sender: TObject);
|
||
procedure cxGridDBColumn6PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure CustomerNoNameBtnClick(Sender: TObject);
|
||
procedure MPRTCodeBtnClick(Sender: TObject);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
procedure Tv2CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure ToolButton10Click(Sender: TObject);
|
||
procedure ToolButton11Click(Sender: TObject);
|
||
procedure cxGridDBColumn3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure v2Column2PropertiesEditValueChanged(Sender: TObject);
|
||
procedure BZNoteDblClick(Sender: TObject);
|
||
procedure CHNoteDblClick(Sender: TObject);
|
||
procedure DHNoteDblClick(Sender: TObject);
|
||
procedure CJNoteDblClick(Sender: TObject);
|
||
procedure ToolButton12Click(Sender: TObject);
|
||
procedure Tv5CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure cxGridDBColumn1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure cxGridDBColumn15PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton9Click(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure Tv6CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Tv5CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure v1Column2PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ComTaiTouBtnClick(Sender: TObject);
|
||
procedure LiDanPersonBtnClick(Sender: TObject);
|
||
procedure v3Column1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton13Click(Sender: TObject);
|
||
procedure v3Column2PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton14Click(Sender: TObject);
|
||
procedure cxGridDBColumn30PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton15Click(Sender: TObject);
|
||
procedure cxGridDBColumn31PropertiesEditValueChanged(Sender: TObject);
|
||
procedure cxGridDBColumn32PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton16Click(Sender: TObject);
|
||
procedure ToolButton17Click(Sender: TObject);
|
||
procedure ToolButton18Click(Sender: TObject);
|
||
procedure ToolButton19Click(Sender: TObject);
|
||
procedure v5Column1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton20Click(Sender: TObject);
|
||
procedure ToolButton21Click(Sender: TObject);
|
||
procedure v5Column3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton22Click(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure v7Column1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure Tv7MouseUp(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
procedure ToolButton23Click(Sender: TObject);
|
||
private
|
||
CanShu1,CanShu2:String;
|
||
FJSFlag:Boolean;
|
||
procedure InitData();
|
||
procedure ZDYHelp(FButn:TcxButtonEdit;LType:string);
|
||
function SaveData():Boolean;
|
||
function SaveDataSubOne():Boolean;
|
||
function SaveDataMain():Boolean;
|
||
function SaveDataSubMore():Boolean;
|
||
procedure SaveImageOther();
|
||
procedure CreThumb(AJPeg:TJPEGImage;Image1:TImage;Width, Height: Integer);
|
||
procedure InitImage();
|
||
function SaveMDData(FOrdMainId,FOrdSubId,FPSID,FPFID:string):Boolean;
|
||
function UpdateTJCKQty(FFPFID:string):Boolean;
|
||
function UpdateTJCKQtyOne(FFPFID:string):Boolean;
|
||
{ Private declarations }
|
||
public
|
||
PState,CopyInt,PriceFlag,DRInt,JYInt:Integer;
|
||
FMainId,FFMainId,FOrderNo,ConSubId,DataType:String;
|
||
FXS:Integer;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmOrderInPut: TfrmOrderInPut;
|
||
newh:hwnd;
|
||
implementation
|
||
uses
|
||
U_DataLink,U_ZDYHelp,U_RTFun,U_ZDYHelpSel,U_CPManageTPCX,U_ZHKHListNewCX
|
||
,U_GYSList,U_OrderSubSel,U_TJCKKC,U_LabelList, U_ModuleNote,U_OrderSubSelMX;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmOrderInPut.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('ָʾ<D6B8><CABE>¼<EFBFBD><C2BC>',Tv1,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>1',Tv2,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
WriteCxGrid('<27>ӹ<EFBFBD><D3B9><EFBFBD>¼<EFBFBD><C2BC>',Tv3,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv7,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.InitData();
|
||
var
|
||
fsj:string;
|
||
begin
|
||
fsj:='select ZdyName Name,ZdyNo Code from KH_Zdy where Type=''PFGenDanPerson'' ';
|
||
SInitCxGridComboBoxBySql(ADOTemp,cxGridDBColumn2,fsj,0,False,'');
|
||
if Trim(CanShu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main_MD where ORDMainId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty=false then
|
||
begin
|
||
OrderNo.ReadOnly:=True;
|
||
end else
|
||
begin
|
||
OrderNo.ReadOnly:=False;
|
||
end;
|
||
end;
|
||
|
||
ReadCxGrid('ָʾ<D6B8><CABE>¼<EFBFBD><C2BC>',Tv1,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>1',Tv2,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
ReadCxGrid('<27>ӹ<EFBFBD><D3B9><EFBFBD>¼<EFBFBD><C2BC>',Tv3,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv7,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
cxPageControl1.ActivePageIndex:=0;
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from JYOrder_Sub where 1=1 ');
|
||
//sql.Add('exec P_View_OrderSub :begdate,:enddate,:WSQl');
|
||
//Parameters.ParamByName('begdate').Value:='2010-10-10';
|
||
// Parameters.ParamByName('enddate').Value:='2050-12-24';
|
||
if PState=1 then
|
||
begin
|
||
sql.Add(' and MainId='''+Trim(FMainId)+'''');
|
||
end;
|
||
if PState=0 then
|
||
begin
|
||
sql.Add(' and 1<>1');
|
||
end;
|
||
//ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,Order_Sub);
|
||
SInitCDSData20(ADOQuery1,Order_Sub);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from JYOrder_Main_Fee where 1=1 ');
|
||
if PState=1 then
|
||
begin
|
||
sql.Add(' and MainId='''+Trim(FMainId)+'''');
|
||
end;
|
||
if PState=0 then
|
||
begin
|
||
sql.Add(' and 1<>1');
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet7);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet7);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from JYOrder_CD where 1=1 ');
|
||
if PState=1 then
|
||
begin
|
||
sql.Add(' and MainId='''+Trim(FMainId)+'''');
|
||
end;
|
||
if PState=0 then
|
||
begin
|
||
sql.Add(' and 1<>1');
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet8);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet8);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main where MainId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
FJSFlag:=ADOQuery1.FieldByName('JSFlag').AsBoolean;
|
||
SCSHDataNew(ADOQuery1,Panel1,2);
|
||
SCSHDataNew(ADOQuery1,Panel3,2);
|
||
SCSHDataNew(ADOQuery1,ScrollBox1,2);
|
||
SCSHDataNew(ADOQuery1,GroupBox3,2);
|
||
BZNote.Text:=Trim(ADOQuery1.fieldbyname('BZNote').AsString);
|
||
DHNote.Text:=Trim(ADOQuery1.fieldbyname('DHNote').AsString);
|
||
CJNote.Text:=Trim(ADOQuery1.fieldbyname('CJNote').AsString);
|
||
CHNote.Text:=Trim(ADOQuery1.fieldbyname('CHNote').AsString);
|
||
MPRTMFNote.Text:=Trim(ADOQuery1.fieldbyname('MPRTMFNote').AsString);
|
||
MPRTKZNote.Text:=Trim(ADOQuery1.fieldbyname('MPRTKZNote').AsString);
|
||
//ConSubId:=Trim(ADOQuery1.fieldbyname('ConSubId').AsString);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
if CopyInt<>99 then
|
||
sql.Add('select * from JYOrder_Process where MainId='''+Trim(FMainId)+'''')
|
||
else
|
||
sql.Add('select * from JYOrder_Process where 1<>1');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,CDS_JGLC);
|
||
SInitCDSData20(ADOQuery1,CDS_JGLC);
|
||
|
||
if PState=0 then
|
||
begin
|
||
OrdDate.DateTime:=SGetServerDateTime(ADOTemp);
|
||
DlyDate.DateTime:=OrdDate.DateTime;
|
||
LiDanPerson.Text:=Trim(DName);
|
||
YWY.Text:=Trim(DName);
|
||
end else
|
||
begin
|
||
end;
|
||
if CopyInt=99 then
|
||
begin
|
||
PState:=0;
|
||
FMainId:='';
|
||
//OrdPerson1.Text:=Trim(DName);
|
||
OrderNo.Text:='';
|
||
OrderNo.ReadOnly:=False;
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('MainId').Value:='';
|
||
FieldByName('SubId').Value:='';
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
InitImage();
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ZDYHelp(FButn:TcxButtonEdit;LType:string);
|
||
var
|
||
FType,ZDYName,FText:String;
|
||
begin
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.FormShow(Sender: TObject);
|
||
begin
|
||
InitData();
|
||
end;
|
||
|
||
function TfrmOrderInPut.SaveData():Boolean;
|
||
var
|
||
maxno,maxsubno,maxJDNo,JDMainId,maxjfno,maxjcno:String;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'JM','JYOrder_Main',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(FMainId);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JYOrder_Main where MainId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Append;
|
||
end
|
||
else begin
|
||
Edit;
|
||
end;
|
||
FieldByName('MainId').Value:=Trim(maxno);
|
||
RTSetsavedata(ADOCmd,'JYOrder_Main',Panel1,2);
|
||
RTSetsavedata(ADOCmd,'JYOrder_Main',GroupBox3,2);
|
||
RTSetsavedata(ADOCmd,'JYOrder_Main',Panel3,2);
|
||
FieldByName('CJNote').Value:=Trim(CJNote.Text);
|
||
FieldByName('DHNote').Value:=Trim(DHNote.Text);
|
||
FieldByName('BZNote').Value:=Trim(BZNote.Text);
|
||
FieldByName('CHNote').Value:=Trim(CHNote.Text);
|
||
FieldByName('MPRTMFNote').Value:=Trim(MPRTMFNote.Text);
|
||
FieldByName('MPRTKZNote').Value:=Trim(MPRTKZNote.Text);
|
||
FieldByName('CustomerNo').Value:=Trim(CustomerNoName.TxtCode);
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
FieldByName('Note').Value:=Trim(Note.Text);
|
||
FieldByName('BZNote').Value:=Trim(BZNote.Text);
|
||
//FieldByName('ConSubId').Value:=Trim(ConSubId);
|
||
Post;
|
||
end;
|
||
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main where orderno='''+Trim(OrderNo.Text)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.RecordCount>1 then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxsubno,'JS','JYOrder_Sub',4,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxsubno:=Trim(Order_Sub.fieldbyname('SubId').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Sub where SubId='''+Trim(maxsubno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('MainId').Value:=Trim(maxno);
|
||
FieldByName('SubId').Value:=Trim(maxsubno);
|
||
RTSetSaveDataCDS(ADOCmd,Tv1,Order_Sub,'JYOrder_Sub',0);
|
||
Post;
|
||
end;
|
||
Order_Sub.Edit;
|
||
Order_Sub.FieldByName('SubId').Value:=Trim(maxsubno);
|
||
//Order_Sub.Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
///<2F><><EFBFBD>ñ<EFBFBD>
|
||
with ClientDataSet7 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(ClientDataSet7.fieldbyname('JFId').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxjfno,'JF','JYOrder_Main_Fee',4,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxjfno:=Trim(ClientDataSet7.fieldbyname('JFId').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Main_Fee where JFId='''+Trim(maxjfno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(ClientDataSet7.fieldbyname('JFId').AsString)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
FieldByName('MainId').Value:=Trim(maxno);
|
||
FieldByName('JFID').Value:=Trim(maxjfno);
|
||
//FieldByName('SubId').Value:=Trim(maxsubno);
|
||
RTSetSaveDataCDS(ADOCmd,Tv7,ClientDataSet7,'JYOrder_Main_Fee',0);
|
||
FieldByName('FactoryNo').Value:=ClientDataSet7.fieldbyname('FactoryNo').Value;
|
||
Post;
|
||
end;
|
||
ClientDataSet7.Edit;
|
||
ClientDataSet7.FieldByName('JFId').Value:=Trim(maxjfno);
|
||
//Order_Sub.Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
///<2F>õ<EFBFBD><C3B5><EFBFBD>
|
||
with ClientDataSet8 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(ClientDataSet8.fieldbyname('JCId').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxjcno,'JC','JYOrder_CD',4,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<>õ<EFBFBD><C3B5><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxjcno:=Trim(ClientDataSet8.fieldbyname('JCId').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_CD where JCId='''+Trim(maxjcno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(ClientDataSet8.fieldbyname('JCId').AsString)='' then
|
||
begin
|
||
Append;
|
||
//FieldByName('Filler').Value:=Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
//FieldByName('Editer').Value:=Trim(DName);
|
||
//FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
FieldByName('MainId').Value:=Trim(maxno);
|
||
FieldByName('JCId').Value:=Trim(maxjcno);
|
||
//FieldByName('SubId').Value:=Trim(maxsubno);
|
||
RTSetSaveDataCDS(ADOCmd,Tv8,ClientDataSet8,'JYOrder_CD',0);
|
||
Post;
|
||
end;
|
||
ClientDataSet8.Edit;
|
||
ClientDataSet8.FieldByName('JCId').Value:=Trim(maxjcno);
|
||
//Order_Sub.Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̱<EFBFBD>
|
||
with CDS_JGLC do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_JGLC.fieldbyname('PSId').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxsubno,'PS','JYOrder_Process',4,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxsubno:=Trim(CDS_JGLC.fieldbyname('PSId').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Process where PSId='''+Trim(maxsubno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(CDS_JGLC.fieldbyname('PSId').AsString)='' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('MainId').Value:=Trim(maxno);
|
||
FieldByName('PSId').Value:=Trim(maxsubno);
|
||
RTSetSaveDataCDS(ADOCmd,Tv2,CDS_JGLC,'JYOrder_Process',0);
|
||
Post;
|
||
end;
|
||
CDS_JGLC.Edit;
|
||
CDS_JGLC.FieldByName('PSId').Value:=Trim(maxsubno);
|
||
//Order_Sub.Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrderJD_Main where OrderNo='''+Trim(OrderNo.Text)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
JDMainId:='';
|
||
end else
|
||
begin
|
||
JDMainId:=Trim(ADOTemp.fieldbyname('MainId').AsString);
|
||
end;
|
||
if Trim(JDMainId)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxJDNo,'JD','JYOrderJD_Main',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxJDNo:=Trim(JDMainId);
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main where OrderNo='''+Trim(OrderNo.Text)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrderJD_Main where MainId='''+Trim(JDMainId)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(JDMainId)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value:=ADOTemp.fieldbyname('Filler').Value;
|
||
FieldByName('Status').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
end else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQuery1);
|
||
end;
|
||
FieldByName('MainId').Value:=Trim(maxJDNo);
|
||
FieldByName('orderno').Value:=ADOTemp.fieldbyname('orderno').Value;
|
||
FieldByName('LiDanPerson').Value:=ADOTemp.fieldbyname('LiDanPerson').Value;
|
||
FieldByName('CustomerNoName').Value:=ADOTemp.fieldbyname('CustomerNoName').Value;
|
||
FieldByName('CustomerNo').Value:=ADOTemp.fieldbyname('CustomerNo').Value;
|
||
FieldByName('MPRTCode').Value:=ADOTemp.fieldbyname('MPRTCode').Value;
|
||
FieldByName('MPRTCodeName').Value:=ADOTemp.fieldbyname('MPRTCodeName').Value;
|
||
FieldByName('MPRTSpec').Value:=ADOTemp.fieldbyname('MPRTSpec').Value;
|
||
FieldByName('MPRTCF').Value:=ADOTemp.fieldbyname('MPRTCF').Value;
|
||
FieldByName('MPRTMF').Value:=ADOTemp.fieldbyname('MPRTMF').Value;
|
||
FieldByName('MPRTKZ').Value:=ADOTemp.fieldbyname('MPRTKZ').Value;
|
||
FieldByName('ORDQty').Value:=Tv1.DataController.Summary.FooterSummaryTexts[0];
|
||
FieldByName('QtyUnit').Value:=Order_Sub.fieldbyname('OrderUnit').Value;
|
||
Post;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
FMainId:=Trim(maxno);
|
||
except
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
function TfrmOrderInPut.SaveDataMain():Boolean;
|
||
var
|
||
maxno:String;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JYOrder_Main where MainId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Append;
|
||
maxno:=Trim(FFMainId);
|
||
end
|
||
else begin
|
||
maxno:=Trim(FMainId);
|
||
Edit;
|
||
end;
|
||
FieldByName('MainId').Value:=Trim(maxno);
|
||
//SSetsaveSqlNew(ADOCmd,'JYOrder_Main',ScrollBox1,2);
|
||
if PState=1 then
|
||
begin
|
||
FieldByName('OrdUpDate').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
Post;
|
||
end;
|
||
FMainId:=Trim(maxno);
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
function TfrmOrderInPut.SaveDataSubOne():Boolean;
|
||
var
|
||
maxno:String;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
||
with Order_Sub do
|
||
begin
|
||
//First;
|
||
//while not Eof do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOTemp,maxno,'JS','JYOrder_Sub',4,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(Order_Sub.fieldbyname('SubId').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Sub where MainId='''+Trim(FMainId)+'''');
|
||
sql.Add(' and SubId='''+Trim(maxno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('MainId').Value:=Trim(FMainId);
|
||
FieldByName('SubId').Value:=Trim(maxno);
|
||
RTSetSaveDataCDS(ADOCmd,Tv1,Order_Sub,'JYOrder_Sub',0);
|
||
Post;
|
||
end;
|
||
Order_Sub.Edit;
|
||
Order_Sub.FieldByName('SubId').Value:=Trim(maxno);
|
||
//Order_Sub.Post;
|
||
//Next;
|
||
end;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
function TfrmOrderInPut.SaveDataSubMore():Boolean;
|
||
var
|
||
maxno:String;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOTemp,maxno,'JS','JYOrder_Sub',4,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(Order_Sub.fieldbyname('SubId').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_Sub where MainId='''+Trim(FMainId)+'''');
|
||
sql.Add(' and SubId='''+Trim(maxno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('MainId').Value:=Trim(FMainId);
|
||
FieldByName('SubId').Value:=Trim(maxno);
|
||
RTSetSaveDataCDS(ADOCmd,Tv1,Order_Sub,'JYOrder_Sub',0);
|
||
Post;
|
||
end;
|
||
Order_Sub.Edit;
|
||
Order_Sub.FieldByName('SubId').Value:=Trim(maxno);
|
||
//Order_Sub.Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.TBSaveClick(Sender: TObject);
|
||
var
|
||
FReal:Double;
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
if Trim(OrderNo.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(MPRTMF.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(MPRTMF.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27>ŷ<EFBFBD><C5B7>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
Application.MessageBox('<27>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(MPRTKZ.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(MPRTKZ.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>طǷ<D8B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if CDS_JGLC.IsEmpty=False then
|
||
begin
|
||
if CDS_JGLC.Locate('MFQty',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
if CDS_JGLC.Locate('KZQty',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĿ<D0B5><C4BF>ز<EFBFBD><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
end;
|
||
if Trim(KgZMiXs.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(KgZMiXs.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(ClothOneQty.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(ClothOneQty.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('ÿƥ<C3BF><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(MPRTOneQty.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(MPRTOneQty.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('ÿƥ<C3BF><C6A5>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if ClientDataSet7.Locate('JFDate',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet7.Locate('JFName',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('PRTOrdQty',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
{if Trim(OrdDefStr1.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><>˾<EFBFBD><CBBE><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
{if Order_Sub.Locate('PRTColor',null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('SOrddefstr4',null,[])=True then
|
||
begin
|
||
Application.MessageBox('Ӣ<><D3A2><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('SOrddefstr1',null,[])=True then
|
||
begin
|
||
Application.MessageBox('ɫ<>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;}
|
||
if Order_Sub.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if CDS_JGLC.IsEmpty=False then
|
||
begin
|
||
if CDS_JGLC.Locate('KgZM',null,[])=True then
|
||
begin
|
||
Application.MessageBox('ÿ<><C3BF><EFBFBD><EFBFBD>/<2F>ײ<EFBFBD><D7B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if CDS_JGLC.IsEmpty=False then
|
||
begin
|
||
if CDS_JGLC.Locate('PSName','<27><><EFBFBD><EFBFBD>',[])=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
{if PState=1 then
|
||
begin
|
||
if Trim(OrderNo.Text)<>Trim(FOrderNo) then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR where MainId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty=False then
|
||
begin
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
end; }
|
||
{ if Trim(ConSubId)='' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ͬ!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
if cxPageControl1.ActivePageIndex=2 then
|
||
begin
|
||
if CDS_JGC.Locate('PFID',null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣδȷ<CEB4><C8B7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
// if cxPageControl1.ActivePageIndex=2 then
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.PRTHX,B.PRTColorNo,B.PRTOrdQty,B.OrderUnit from JYOrder_PCS_Sub A ');
|
||
sql.Add(' left join JYOrder_Sub B on A.SubId=B.SubId');
|
||
sql.Add('where A.PSID='''+Trim(CDS_JGLC.fieldbyname('PSID').AsString)+'''');
|
||
SQL.Add(' and isnull(A.CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,CDS_JGC);
|
||
SInitCDSData20(ADOQuery1,CDS_JGC);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.PRTHX,B.PRTColorNo,B.PRTOrdQty,B.OrderUnit from JYOrder_PCS_Sub A ');
|
||
sql.Add(' left join JYOrder_Sub B on A.SubId=B.SubId');
|
||
sql.Add('where A.PSID='''+Trim(CDS_JGLC.fieldbyname('PSID').AsString)+'''');
|
||
SQL.Add(' and isnull(A.CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet5);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet5);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,C.OrderNo,D.C_Code,D.C_CodeName,B.ToFactoryName,B.RKQtyUnit from JYOrder_Main_MD_Out A ');
|
||
sql.Add(' inner join JYOrder_Main_MD B on A.MDId=B.MDId');
|
||
sql.Add(' inner join JYOrder_Main C on B.OrdMainId=C.MainId');
|
||
sql.Add(' inner join Contract_Sub D on B.ConSubId=D.SubId');
|
||
sql.Add('where A.PFID='''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet6);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet6);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v1PRTColorPropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='OrdColor';
|
||
flagname:='<27><>ɫ';
|
||
V1Name.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
V1Note.Caption:='Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
MainType:=Trim(DName);
|
||
fnote:=True;
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.Order_Sub.Edit;
|
||
Self.Order_Sub.FieldByName('PRTColor').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
Self.Order_Sub.FieldByName('PRTColorEng').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton1Click(Sender: TObject);
|
||
var
|
||
FReal:Double;
|
||
i,j,z:Integer;
|
||
jstr:string;
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
if Trim(OrderNo.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if CheckBox1.Checked then
|
||
begin
|
||
if Order_Sub.IsEmpty then
|
||
begin
|
||
j:=1;
|
||
end else
|
||
begin
|
||
z:=Pos('#',Trim(Order_Sub.fieldbyname('PRTColorNo').AsString));
|
||
jstr:=Copy(Trim(Order_Sub.fieldbyname('PRTColorNo').AsString),2,z-2);
|
||
if Trim(jstr)<>'' then
|
||
begin
|
||
if TryStrToFloat(jstr,FReal)=True then
|
||
begin
|
||
j:=StrToInt(jstr)+1;
|
||
end;
|
||
end else
|
||
begin
|
||
j:=1;
|
||
end;
|
||
end;
|
||
end;
|
||
CopyAddRow(Tv1,Order_Sub);
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
//FieldByName('PRTColor').Value:='';
|
||
//FieldByName('PRTOrdQty').Value:=null;
|
||
//FieldByName('PRTColorNo').Value:=null;
|
||
//FieldByName('PRTColorEng').Value:=null;
|
||
//FieldByName('PRTHX').Value:=null;
|
||
FieldByName('SubId').Value:='';
|
||
if CheckBox1.Checked then
|
||
begin
|
||
FieldByName('PRTColorNo').Value:='C'+Trim(IntToStr(j))+'#';
|
||
end;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if Order_Sub.IsEmpty then Exit;
|
||
{ with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LLMX where OrdSubId='''+Trim(Order_Sub.fieldbyname('SubId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai where SubId='''+Trim(Order_Sub.fieldbyname('SubId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty=False then
|
||
begin
|
||
Application.MessageBox('<27>ѻزֲ<D8B2><D6B2><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString)<>'' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main_MD where ORDSubId='''+Trim(Order_Sub.fieldbyname('SubId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty=false then
|
||
begin
|
||
Application.MessageBox('<27>Ѿ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_Sub where SubId='''+Trim(Order_Sub.fieldbyname('SubId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Order_Sub.Delete;
|
||
{ if Order_Sub.IsEmpty then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_Main where MainId='''+Trim(FMainId)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.RanFactoryBtnUpClick(Sender: TObject);
|
||
begin
|
||
{try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='RKPlace';
|
||
flagname:='Ⱦ<><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
JGFactoryName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
JGFactoryName.TxtCode:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.CustomerNoNameBtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).Text:='';
|
||
TBtnEditC(Sender).TxtCode:='';
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.NoteDblClick(Sender: TObject);
|
||
begin
|
||
{try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:='OrdNote';
|
||
flagname:='<27><>ע<EFBFBD><D7A2>Ҫ<EFBFBD><D2AA>';
|
||
if ShowModal=1 then
|
||
begin
|
||
Note.Text:=Note.Text+frmZDYHelpSel.ReturnStr;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;}
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v1OrderUnitPropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='OrderUnit';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.Order_Sub.Edit;
|
||
Self.Order_Sub.FieldByName('OrderUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v1PriceUnitPropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='PriceUnit';
|
||
flagname:='<27>۸<EFBFBD><DBB8><EFBFBD>λ';
|
||
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
TBAdd.Visible:=False;
|
||
TBEdit.Visible:=False;
|
||
TBDel.Visible:=False;
|
||
end;
|
||
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.Order_Sub.Edit;
|
||
Self.Order_Sub.FieldByName('PriceUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.OrdDefStr2BtnUpClick(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
FWZ:Integer;
|
||
begin
|
||
fsj:=Trim(TEdit(Sender).Hint);
|
||
FWZ:=Pos('/',fsj);
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:=Copy(fsj,1,FWZ-1);
|
||
flagname:=Copy(fsj,FWZ+1,Length(fsj)-fwz);
|
||
if Trim(flag)='OrdDefStr2' then
|
||
begin
|
||
//flag:='OrdDefStr2';
|
||
V1Name.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
V1Note.Caption:='Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fnote:=True;
|
||
end;
|
||
if ShowModal=1 then
|
||
begin
|
||
TEdit(Sender).Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
if Trim(flag)='MPRTCode' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select Top 1 * from JYOrder_Main where MPRTCode='''+Trim(ClientDataSet1.fieldbyname('ZDYName').AsString)+'''');
|
||
sql.Add(' order by FillTime desc');
|
||
Open;
|
||
end;
|
||
MPRTCodeName.Text:=ADOTemp.fieldbyname('MPRTCodeName').Value;
|
||
MPRTMF.Text:=ADOTemp.fieldbyname('MPRTMF').Value;
|
||
MPRTKZ.Text:=ADOTemp.fieldbyname('MPRTKZ').Value;
|
||
MPRTSpec.Text:=ADOTemp.fieldbyname('MPRTSpec').Value;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
if Order_Sub.IsEmpty then Exit;
|
||
ToolBar1.SetFocus;
|
||
OneKeyPost(Tv1,Order_Sub);
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.YCLFactoryBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
FWZ:Integer;
|
||
begin
|
||
fsj:=Trim(TEdit(Sender).Hint);
|
||
FWZ:=Pos('/',fsj);
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:=Copy(fsj,1,FWZ-1);
|
||
flagname:=Copy(fsj,FWZ+1,Length(fsj)-fwz);
|
||
MainType:=TEdit(Sender).Name;
|
||
if ShowModal=1 then
|
||
begin
|
||
TEdit(Sender).Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.MPRTSCTeBieNoteBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
FWZ:Integer;
|
||
begin
|
||
fsj:=Trim(TEdit(Sender).Hint);
|
||
FWZ:=Pos('/',fsj);
|
||
try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:=Copy(fsj,1,FWZ-1);
|
||
flagname:=Copy(fsj,FWZ+1,Length(fsj)-fwz);
|
||
if ShowModal=1 then
|
||
begin
|
||
TEdit(Sender).Text:=ReturnStr;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TfrmOrderInPut.ToolButton6Click(Sender: TObject);
|
||
var
|
||
Fint:Integer;
|
||
FReal,FMF,FKZ:Double;
|
||
begin
|
||
{if Trim(FMainId)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣδ<CFA2><CEB4><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
Fint:=CDS_JGLC.RecordCount;
|
||
try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:='JGGX';
|
||
flagname:='<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if ClientDataSet1.FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
with CDS_JGLC do
|
||
begin
|
||
Append;
|
||
FieldByName('PSXH').Value:=Fint+1;
|
||
FieldByName('PSName').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
if Trim(MPRTMF.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(MPRTMF.Text,FReal)=True then
|
||
begin
|
||
FieldByName('MFQty').Value:=MPRTMF.Text;
|
||
FMF:=StrToFloat(MPRTMF.Text);
|
||
end else
|
||
begin
|
||
FMF:=0;
|
||
end;
|
||
end else
|
||
begin
|
||
FMF:=0;
|
||
end;
|
||
if Trim(MPRTKZ.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(MPRTKZ.Text,FReal)=True then
|
||
begin
|
||
FieldByName('KZQty').Value:=MPRTKZ.Text;
|
||
FKZ:=StrToFloat(MPRTKZ.Text);
|
||
end else
|
||
begin
|
||
FKZ:=0;
|
||
end;
|
||
end else
|
||
begin
|
||
FKZ:=0;
|
||
end;
|
||
if FMF*FKZ<>0 then
|
||
begin
|
||
FieldByName('KgZM').Value:=100000*1.0000/(FMF*FKZ);
|
||
end else
|
||
begin
|
||
FieldByName('KgZM').Value:=0;
|
||
end;
|
||
Fint:=Fint+1;
|
||
Post;
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
if CDS_JGLC.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(CDS_JGLC.fieldbyname('PSID').AsString)='' then
|
||
begin
|
||
Application.MessageBox('<27><>Ϣδ<CFA2><CEB4><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with CDS_JGC do
|
||
begin
|
||
Append;
|
||
FieldByName('FactoryNo').Value:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
||
FieldByName('FactoryName').Value:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
FieldByName('PFTPUnit').Value:=Trim(OneQtyUnit.Text);
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton8Click(Sender: TObject);
|
||
var
|
||
maxno:string;
|
||
begin
|
||
{if Trim(CDS_JGLC.fieldbyname('PSID').AsString)='' then
|
||
begin
|
||
Application.MessageBox('<27><>Ϣδ<CFA2><CEB4><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;}
|
||
if CDS_JGC.IsEmpty then Exit;
|
||
ToolBar1.SetFocus;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
CDS_JGC.DisableControls;
|
||
with CDS_JGC do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_JGC.fieldbyname('PFID').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'PF','JYOrder_PCS_Sub',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
CDS_JGC.EnableControls;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD>̼ӹ<CCBC><D3B9><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(CDS_JGC.fieldbyname('PFID').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_PCS_Sub where PFID='''+Trim(CDS_JGC.fieldbyname('PFID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(CDS_JGC.fieldbyname('PFID').AsString)='' then
|
||
begin
|
||
Append;
|
||
end else
|
||
begin
|
||
Edit;
|
||
end;
|
||
FieldByName('MainID').Value:=Trim(FMainId);
|
||
FieldByName('PSID').Value:=Trim(CDS_JGLC.fieldbyname('PSID').AsString);
|
||
FieldByName('SubID').Value:=Trim(CDS_JGC.fieldbyname('SubID').AsString);
|
||
FieldByName('PFID').Value:=Trim(maxno);
|
||
FieldByName('FactoryNo').Value:=Trim(CDS_JGC.fieldbyname('FactoryNo').AsString);
|
||
FieldByName('FactoryName').Value:=Trim(CDS_JGC.fieldbyname('FactoryName').AsString);
|
||
FieldByName('PFDlyDate').Value:=CDS_JGC.fieldbyname('PFDlyDate').Value;
|
||
RTSetSaveDataCDS(ADOCmd,Tv3,CDS_JGC,'JYOrder_PCS_Sub',0);
|
||
Post;
|
||
end;
|
||
if Trim(CDS_JGC.fieldbyname('PFTPUnit').AsString)<>'M' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JYOrder_PCS_Sub Set PFTPMQty=PFTPQty*');
|
||
sql.Add('(select KgZM from JYOrder_Process A where A.PSID=JYOrder_PCS_Sub.PSID)');
|
||
sql.Add(' where PFID='''+Trim(maxno)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JYOrder_PCS_Sub Set PFTPMQty=PFTPQty');
|
||
sql.Add(' where PFID='''+Trim(maxno)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
ADOCmd.Connection.CommitTrans;
|
||
CDS_JGC.EnableControls;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
except
|
||
ADOCmd.Connection.RollbackTrans;
|
||
CDS_JGC.EnableControls;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.cxGridDBColumn6PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
var
|
||
fsj:string;
|
||
begin
|
||
{try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='PSNote';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>';
|
||
|
||
if ShowModal=1 then
|
||
begin
|
||
with CDS_JGLC do
|
||
begin
|
||
Edit;
|
||
FieldByName('PSNote').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end; }
|
||
fsj:=Trim(CDS_JGLC.fieldbyname('PSNote').AsString);
|
||
try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:='PSNote';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>';
|
||
MainType:=Trim(CDS_JGLC.fieldbyname('PSName').AsString);
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if ClientDataSet1.FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
fsj:=fsj+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
with CDS_JGLC do
|
||
begin
|
||
Edit;
|
||
FieldByName('PSNote').Value:=Trim(fsj);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.CustomerNoNameBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZHKHListNewCX:=TfrmZHKHListNewCX.Create(Application);
|
||
with frmZHKHListNewCX do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
CustomerNoName.Text:=Trim(frmZHKHListNewCX.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
CustomerNoName.TxtCode:=Trim(frmZHKHListNewCX.Order_Main.fieldbyname('ZKID').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZHKHListNewCX.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.MPRTCodeBtnClick(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
begin
|
||
try
|
||
frmCPManageTPCX:=TfrmCPManageTPCX.Create(Application);
|
||
with frmCPManageTPCX do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
MPRTCode.Text:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYNO').AsString);
|
||
MPRTCodeName.Text:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYName').AsString);
|
||
MPRTSpec.Text:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYSpec').AsString);
|
||
MPRTCF.Text:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYCF').AsString);
|
||
MPRTMF.Text:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYMF').AsString);
|
||
MPRTKZ.Text:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYKZ').AsString);
|
||
MPRTGY.Text:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('GYStr').AsString);
|
||
if Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYHX').AsString)<>'' then
|
||
begin
|
||
fsj:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYHX').AsString);
|
||
end else
|
||
begin
|
||
fsj:='';
|
||
end;
|
||
if Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYHX2').AsString)<>'' then
|
||
begin
|
||
if Trim(Fsj)<>'' then
|
||
begin
|
||
fsj:=fsj+'+'+Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYHX2').AsString);
|
||
end else
|
||
begin
|
||
fsj:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYHX2').AsString);
|
||
end;
|
||
end;
|
||
if Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYHX3').AsString)<>'' then
|
||
begin
|
||
if Trim(Fsj)<>'' then
|
||
begin
|
||
fsj:=fsj+'+'+Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYHX3').AsString);
|
||
end else
|
||
begin
|
||
fsj:=Trim(frmCPManageTPCX.CDS_Main.fieldbyname('CYHX3').AsString);
|
||
end;
|
||
end;
|
||
MPRTGYHZ.Text:=Trim(fsj);
|
||
end;
|
||
end;
|
||
finally
|
||
frmCPManageTPCX.Free;
|
||
end;
|
||
if Trim(MPRTMF.Text)<>'' then
|
||
begin
|
||
MPRTMF.Text:=Copy(Trim(MPRTMF.Text),1,Pos('c',Trim(MPRTMF.Text))-1);
|
||
end;
|
||
if Trim(MPRTKZ.Text)<>'' then
|
||
begin
|
||
MPRTKZ.Text:=Copy(Trim(MPRTKZ.Text),1,Pos('g',Trim(MPRTKZ.Text))-1);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton7Click(Sender: TObject);
|
||
begin
|
||
if CDS_JGC.IsEmpty=False then
|
||
begin
|
||
Application.MessageBox('<27>Ѱ<EFBFBD><D1B0>Ų<EFBFBD><C5B2><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main_MD where PSID='''+Trim(CDS_JGLC.fieldbyname('PSID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty=False then
|
||
begin
|
||
Application.MessageBox('<27><>¼<EFBFBD><C2BC><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(CDS_JGLC.fieldbyname('PSId').AsString)<>'' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_Process where PSId='''+Trim(CDS_JGLC.fieldbyname('PSId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_JGLC.Delete;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.Tv2CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.PRTHX,PRTColor=isnull(B.PRTColorNo,'''')+'' ''+isnull(B.PRTColorEng,'''')+'' ''+isnull(B.PRTColor,''''), ');
|
||
sql.Add(' B.PRTOrdQty,B.OrderUnit from JYOrder_PCS_Sub A');
|
||
sql.Add(' left join JYOrder_Sub B on A.SubId=B.SubId');
|
||
sql.Add('where A.PSID='''+Trim(CDS_JGLC.fieldbyname('PSID').AsString)+'''');
|
||
SQL.Add(' and isnull(A.CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,CDS_JGC);
|
||
SInitCDSData20(ADOQuery1,CDS_JGC);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.PRTHX,B.PRTColorNo,B.PRTOrdQty,B.OrderUnit from JYOrder_PCS_Sub A ');
|
||
sql.Add(' left join JYOrder_Sub B on A.SubId=B.SubId');
|
||
sql.Add('where A.PSID='''+Trim(CDS_JGLC.fieldbyname('PSID').AsString)+'''');
|
||
SQL.Add(' and isnull(A.CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet5);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet5);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,C.OrderNo,D.C_Code,D.C_CodeName,B.FactoryName,B.RKQtyUnit from JYOrder_Main_MD_Out A ');
|
||
sql.Add(' inner join JYOrder_Main_MD B on A.MDId=B.MDId');
|
||
sql.Add(' inner join JYOrder_Main C on B.OrdMainId=C.MainId');
|
||
sql.Add(' inner join Contract_Sub D on B.ConSubId=D.SubId');
|
||
sql.Add('where A.PFID='''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet6);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet6);
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton10Click(Sender: TObject);
|
||
var
|
||
i:Integer;
|
||
FName:String;
|
||
begin
|
||
|
||
if CDS_JGLC.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(CDS_JGLC.fieldbyname('PSID').AsString)='' then
|
||
begin
|
||
Application.MessageBox('<27><>Ϣδ<CFA2><CEB4><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if CDS_JGC.IsEmpty then
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.PRTHX,PRTColor=isnull(B.PRTColorNo,'''')+'' ''+isnull(B.PRTColorEng,'''')+'' ''+isnull(B.PRTColor,''''), ');
|
||
sql.Add(' B.PRTOrdQty,B.OrderUnit from JYOrder_PCS_Sub A');
|
||
sql.Add(' left join JYOrder_Sub B on A.SubId=B.SubId');
|
||
sql.Add('where A.PSID='''+Trim(CDS_JGLC.fieldbyname('PSID').AsString)+'''');
|
||
SQL.Add(' and isnull(A.CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,CDS_JGC);
|
||
SInitCDSData20(ADOQuery1,CDS_JGC);
|
||
end;
|
||
try
|
||
frmOrderSubSel:=TfrmOrderSubSel.Create(Application);
|
||
with frmOrderSubSel do
|
||
begin
|
||
FFFMainId:=Trim(Self.FMainId);
|
||
if ShowModal=1 then
|
||
begin
|
||
ClientDataSet1.DisableControls;
|
||
with frmOrderSubSel.ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Self.CDS_JGC.Append;
|
||
Self.CDS_JGC.FieldByName('SubId').Value:=frmOrderSubSel.ClientDataSet1.FieldByName('SubId').Value;
|
||
for i:=0 to frmOrderSubSel.Tv3.ColumnCount-1 do
|
||
begin
|
||
FName:=frmOrderSubSel.Tv3.Columns[i].DataBinding.FilterFieldName;
|
||
Self.CDS_JGC.FieldByName(FName).Value:=frmOrderSubSel.ClientDataSet1.FieldByName(FName).Value;
|
||
|
||
end;
|
||
Self.CDS_JGC.FieldByName('FactoryNo').Value:=frmOrderSubSel.ClientDataSet1.FieldByName('FactoryNo').Value;
|
||
Self.CDS_JGC.Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
ClientDataSet1.EnableControls;
|
||
end;
|
||
end;
|
||
finally
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton11Click(Sender: TObject);
|
||
begin
|
||
if CDS_JGC.IsEmpty then Exit;
|
||
ToolBar1.SetFocus;
|
||
OneKeyPost(Tv3,CDS_JGC);
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.cxGridDBColumn3PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with CDS_JGC do
|
||
begin
|
||
edit;
|
||
FieldByName('FactoryNo').Value:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
||
FieldByName('FactoryName').Value:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
if CDS_JGC.IsEmpty then Exit;
|
||
if Trim(CDS_JGC.fieldbyname('PFId').AsString)<>'' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main_MD where PFId='''+Trim(CDS_JGC.fieldbyname('PFId').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty=false then
|
||
begin
|
||
Application.MessageBox('<27>Ѿ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_PCS_Sub where PFId='''+Trim(CDS_JGC.fieldbyname('PFId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_JGC.Delete;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v2Column2PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,FName,FMF,FKZ:string;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then
|
||
begin
|
||
mvalue:='0';
|
||
end;
|
||
FName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_JGLC do
|
||
begin
|
||
Edit;
|
||
FieldByName(FName).Value:=Trim(mvalue);
|
||
Post;
|
||
end;
|
||
FMF:=Trim(CDS_JGLC.fieldbyname('MFQty').AsString);
|
||
FKZ:=Trim(CDS_JGLC.fieldbyname('KZQty').AsString);
|
||
if Trim(FMF)='' then Exit;
|
||
if Trim(FKZ)='' then Exit;
|
||
if StrToFloat(FMF)=0 then Exit;
|
||
if StrToFloat(FKZ)=0 then Exit;
|
||
with CDS_JGLC do
|
||
begin
|
||
Edit;
|
||
FieldByName('KgZM').Value:=100000*1.0000/(StrToFloat(FMF)*StrToFloat(FKZ));
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.BZNoteDblClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:='BZNote';
|
||
flagname:='<27><>װҪ<D7B0><D2AA>';
|
||
frmZDYHelpSel.Align:=alClient;
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
if Trim(BZNote.Text)='' then
|
||
BZNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)
|
||
else
|
||
BZNote.Text:=BZNote.Text+#13+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
//JiaoHuoNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.CHNoteDblClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:='CHNote';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ';
|
||
frmZDYHelpSel.Align:=alClient;
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
if Trim(CHNote.Text)='' then
|
||
CHNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)
|
||
else
|
||
CHNote.Text:=CHNote.Text+#13+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
//JiaoHuoNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.DHNoteDblClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:='DHNote';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
frmZDYHelpSel.Align:=alClient;
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
if Trim(DHNote.Text)='' then
|
||
DHNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)
|
||
else
|
||
DHNote.Text:=DHNote.Text+#13+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.CJNoteDblClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:='CJNote';
|
||
flagname:='<27><><EFBFBD><EFBFBD>';
|
||
frmZDYHelpSel.Align:=alClient;
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
if Trim(CJNote.Text)='' then
|
||
CJNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)
|
||
else
|
||
CJNote.Text:=CJNote.Text+#13+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton12Click(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
begin
|
||
if CDS_JGLC.IsEmpty then Exit;
|
||
if FJSFlag=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
try
|
||
frmTJCKKC:=TfrmTJCKKC.Create(Application);
|
||
with frmTJCKKC do
|
||
begin
|
||
FFMainId:=Trim(Self.FMainId);
|
||
if ShowModal=1 then
|
||
begin
|
||
fsj:='99';
|
||
DataType:=Trim(frmTJCKKC.ComboBox1.Text);
|
||
with Self.ClientDataSet6 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Self.ClientDataSet6.Delete;
|
||
end;
|
||
end;
|
||
with frmTJCKKC.Order_Sub do
|
||
begin
|
||
Locate('SSel',True,[]);
|
||
with Self.ClientDataSet5 do
|
||
begin
|
||
Append;
|
||
FieldByName('FactoryName').Value:=frmTJCKKC.Order_Sub.fieldbyname('FactoryName').Value;
|
||
FieldByName('FactoryNo').Value:=frmTJCKKC.Order_Sub.fieldbyname('FactoryNo').Value;
|
||
FieldByName('PFTPUnit').Value:=frmTJCKKC.Order_Sub.fieldbyname('RKQtyUnit').Value;
|
||
Post;
|
||
end;
|
||
with Self.ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,C.OrderNo,D.C_Code,D.C_CodeName,B.FactoryName,B.RKQtyUnit from JYOrder_Main_MD_Out A ');
|
||
sql.Add(' inner join JYOrder_Main_MD B on A.MDId=B.MDId');
|
||
sql.Add(' inner join JYOrder_Main C on B.OrdMainId=C.MainId');
|
||
sql.Add(' inner join Contract_Sub D on B.ConSubId=D.SubId');
|
||
{if Trim(Self.ClientDataSet5.fieldbyname('PFID').AsString)<>'' then
|
||
sql.Add('where A.PFID='''+Trim(Self.ClientDataSet5.fieldbyname('PFID').AsString)+'''')
|
||
else }
|
||
sql.Add(' where 1<>1');
|
||
//ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(Self.ADOQueryTemp,Self.ClientDataSet6);
|
||
SInitCDSData20(Self.ADOQueryTemp,Self.ClientDataSet6);
|
||
while Locate('SSel',True,[])=True do
|
||
begin
|
||
with Self.ClientDataSet6 do
|
||
begin
|
||
Append;
|
||
FieldByName('OrderNo').Value:=frmTJCKKC.Order_Sub.fieldbyname('OrderNo').Value;
|
||
FieldByName('C_Code').Value:=frmTJCKKC.Order_Sub.fieldbyname('C_Code').Value;
|
||
FieldByName('C_CodeName').Value:=frmTJCKKC.Order_Sub.fieldbyname('C_CodeName').Value;
|
||
FieldByName('FactoryName').Value:=frmTJCKKC.Order_Sub.fieldbyname('FactoryName').Value;
|
||
//FieldByName('ToFactoryNo').Value:=frmTJCKKC.Order_Sub.fieldbyname('ToFactoryNo').Value;
|
||
FieldByName('CKQtyUnit').Value:=frmTJCKKC.Order_Sub.fieldbyname('RKQtyUnit').Value;
|
||
FieldByName('CKPS').Value:=StrToFloat(frmTJCKKC.DRPS.Text);
|
||
FieldByName('CKQty').Value:=StrToFloat(frmTJCKKC.DRQty.Text);
|
||
FieldByName('MDID').Value:=frmTJCKKC.Order_Sub.fieldbyname('MDID').Value;
|
||
Post;
|
||
end;
|
||
Edit;
|
||
FieldByName('SSel').Value:=False;
|
||
Post;
|
||
end;
|
||
|
||
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmTJCKKC.Free;
|
||
end;
|
||
if Trim(fsj)<>'99' then Exit;
|
||
if ClientDataSet6.IsEmpty=False then
|
||
begin
|
||
with Self.ClientDataSet5 do
|
||
begin
|
||
Edit;
|
||
FieldByName('PFTPPS').Value:=Tv6.DataController.Summary.FooterSummaryTexts[0];
|
||
FieldByName('PFTPQty').Value:=Tv6.DataController.Summary.FooterSummaryTexts[1];
|
||
Post;
|
||
end;
|
||
end;
|
||
DRInt:=99;
|
||
ToolButton9.Click;
|
||
DRInt:=0;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.Tv5CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
var
|
||
PFID,FPFID,Fsj:String;
|
||
begin
|
||
{if Trim(CanShu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Trim(ClientDataSet5.fieldbyname('PFID').AsString)<>'' then
|
||
begin
|
||
Tv5.OptionsSelection.CellSelect:=False;
|
||
end else
|
||
begin
|
||
Tv5.OptionsSelection.CellSelect:=True;
|
||
end;
|
||
end; }
|
||
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,C.OrderNo,D.C_Code,D.C_CodeName,B.FactoryName,B.RKQtyUnit from JYOrder_Main_MD_Out A ');
|
||
sql.Add(' inner join JYOrder_Main_MD B on A.MDId=B.MDId');
|
||
sql.Add(' inner join JYOrder_Main C on B.OrdMainId=C.MainId');
|
||
sql.Add(' left join Contract_Sub D on B.ConSubId=D.SubId');
|
||
sql.Add('where A.PFID='''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet6);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet6);
|
||
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.cxGridDBColumn1PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet5 do
|
||
begin
|
||
edit;
|
||
FieldByName('FactoryNo').Value:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
||
FieldByName('FactoryName').Value:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.cxGridDBColumn15PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,FName:string;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then
|
||
begin
|
||
mvalue:='0';
|
||
end;
|
||
FName:=Trim(Tv6.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with ClientDataSet6 do
|
||
begin
|
||
Edit;
|
||
FieldByName(FName).Value:=mvalue;
|
||
Post;
|
||
end;
|
||
if ClientDataSet6.IsEmpty=False then
|
||
begin
|
||
with Self.ClientDataSet5 do
|
||
begin
|
||
Edit;
|
||
FieldByName('PFTPPS').Value:=Tv6.DataController.Summary.FooterSummaryTexts[0];
|
||
FieldByName('PFTPQty').Value:=Tv6.DataController.Summary.FooterSummaryTexts[1];
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton9Click(Sender: TObject);
|
||
var
|
||
maxno,maxsubno:string;
|
||
begin
|
||
if ClientDataSet5.IsEmpty then Exit;
|
||
if ClientDataSet6.IsEmpty then Exit;
|
||
ToolBar1.SetFocus;
|
||
if FJSFlag=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
|
||
{if ClientDataSet5.Locate('PFDlyDate',null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
if DRInt<>99 then
|
||
begin
|
||
if Trim(CanShu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>!','',32+4)<>IDYES then Exit;
|
||
end else
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
end;
|
||
end;
|
||
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
if Trim(ClientDataSet5.fieldbyname('PFID').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'PF','JYOrder_PCS_Sub',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD>̼ӹ<CCBC><D3B9><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(ClientDataSet5.fieldbyname('PFID').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_PCS_Sub where PFID='''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(ClientDataSet5.fieldbyname('PFID').AsString)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
FieldByName('MainID').Value:=Trim(FMainId);
|
||
FieldByName('PSID').Value:=Trim(CDS_JGLC.fieldbyname('PSID').AsString);
|
||
FieldByName('PFID').Value:=Trim(maxno);
|
||
FieldByName('FactoryNo').Value:=Trim(ClientDataSet5.fieldbyname('FactoryNo').AsString);
|
||
FieldByName('FactoryName').Value:=Trim(ClientDataSet5.fieldbyname('FactoryName').AsString);
|
||
FieldByName('XDFactoryNo').Value:=Trim(ClientDataSet5.fieldbyname('XDFactoryNo').AsString);
|
||
FieldByName('XDFactoryName').Value:=Trim(ClientDataSet5.fieldbyname('XDFactoryName').AsString);
|
||
FieldByName('PFDlyDate').Value:=ClientDataSet5.fieldbyname('PFDlyDate').Value;
|
||
FieldByName('SubId').Value:=ClientDataSet5.fieldbyname('SubId').Value;
|
||
RTSetSaveDataCDS(ADOCmd,Tv5,ClientDataSet5,'JYOrder_PCS_Sub',0);
|
||
FieldByName('CKName').Value:='<27><><EFBFBD>ڲֿ<DAB2>';
|
||
Post;
|
||
end;
|
||
if Trim(ClientDataSet5.fieldbyname('PFTPUnit').AsString)<>'M' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JYOrder_PCS_Sub Set PFTPMQty=PFTPQty*');
|
||
sql.Add('(select KgZM from JYOrder_Process A where A.PSID=JYOrder_PCS_Sub.PSID)');
|
||
sql.Add(' where PFID='''+Trim(maxno)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JYOrder_PCS_Sub Set PFTPMQty=PFTPQty');
|
||
sql.Add(' where PFID='''+Trim(maxno)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
with ClientDataSet5 do
|
||
begin
|
||
Edit;
|
||
FieldByName('PFID').Value:=Trim(maxno);
|
||
Post;
|
||
end;
|
||
with ClientDataSet6 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(ClientDataSet6.fieldbyname('CKID').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxsubno,'CK','JYOrder_Main_MD_Out',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxsubno:=Trim(ClientDataSet6.fieldbyname('CKID').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main_MD_Out where CKID='''+Trim(ClientDataSet6.fieldbyname('CKID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(ClientDataSet6.fieldbyname('CKID').AsString)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQuery1);
|
||
end;
|
||
FieldByName('CKID').Value:=Trim(maxsubno);
|
||
FieldByName('PFID').Value:=Trim(maxno);
|
||
FieldByName('MDID').Value:=Trim(ClientDataSet6.fieldbyname('MDID').AsString);
|
||
RTSetSaveDataCDS(ADOCmd,Tv6,ClientDataSet6,'JYOrder_Main_MD_Out',2);
|
||
Post;
|
||
end;
|
||
Edit;
|
||
FieldByName('PFID').Value:=Trim(maxno);
|
||
FieldByName('CKID').Value:=Trim(maxsubno);
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
if Trim(DataType)='<27><>Χ' then
|
||
begin
|
||
SaveMDData(FMainId,Trim(ClientDataSet5.fieldbyname('SubId').AsString),
|
||
Trim(CDS_JGLC.fieldbyname('PSID').AsString),Trim(maxno));
|
||
end;
|
||
|
||
if UpdateTJCKQtyOne(Trim(maxno)) then
|
||
begin
|
||
|
||
end else
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
//Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
|
||
ADOCmd.Connection.CommitTrans;
|
||
if Trim(CDS_JGLC.FieldByName('PSName').AsString)<>'<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
if Trim(ClientDataSet5.fieldbyname('SubId').AsString)='' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>ɫ!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if DRInt<>99 then
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
except
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
function TfrmOrderInPut.SaveMDData(FOrdMainId,FOrdSubId,FPSID,FPFID:string):Boolean;
|
||
var
|
||
maxno,MDID:string;
|
||
BDInt,CPInt,JYInt:Integer;
|
||
begin
|
||
Result:=False;
|
||
//<2F>жϹ<D0B6><CFB9><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥
|
||
{BDInt:=CDS_JGLC.fieldbyname('PSXH').AsInteger;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(PSXH,-1) PSXH from JYOrder_Process where PSName=''<27><>Ʒ'' ');
|
||
sql.Add(' and MainId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty=False then
|
||
CPInt:=ADOTemp.fieldbyname('PSXH').AsInteger
|
||
else
|
||
CPInt:=-1;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(PSXH,-1) PSXH from JYOrder_Process where PSName=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ'' ');
|
||
sql.Add(' and MainId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
//JYInt:=ADOTemp.fieldbyname('PSXH').AsInteger;
|
||
if ADOTemp.IsEmpty=False then
|
||
begin
|
||
JYInt:=ADOTemp.fieldbyname('PSXH').AsInteger;
|
||
end else
|
||
begin
|
||
JYInt:=-1;
|
||
end;
|
||
if BDInt<JYInt then
|
||
begin
|
||
if CPInt>-1 then
|
||
begin
|
||
if BDInt+1<CPInt then
|
||
begin
|
||
//SaveMDData(FMainId,FOrdSubId,FPSID,FPFID);
|
||
end else
|
||
begin
|
||
Exit;
|
||
end;
|
||
end;
|
||
end else
|
||
if JYInt<>-1 then
|
||
begin
|
||
Exit;
|
||
end;}
|
||
//<2F>жϹ<D0B6><CFB9><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main_MD where PFID='''+Trim(FPFID)+'''');
|
||
sql.Add(' and Qty>0');
|
||
open;
|
||
end;
|
||
if ADOTemp.IsEmpty=False then
|
||
begin
|
||
MDID:=Trim(ADOTemp.fieldbyname('MDID').AsString);
|
||
end else
|
||
begin
|
||
MDID:='';
|
||
end;
|
||
if Trim(MDID)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'','JYOrder_Main_MD',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Result:=False;
|
||
Application.MessageBox('ȡ<>뵥<EFBFBD><EBB5A5>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(MDID);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main_MD where MDID='''+Trim(MDID)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(MDID)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTIme').Value:=SGetServerDateTime(ADOQuery1);
|
||
end;
|
||
FieldByName('MDID').Value:=Trim(maxno);
|
||
FieldByName('OrdMainID').Value:=Trim(FOrdMainId);
|
||
//FieldByName('ConMainID').Value:=Trim(FConMainId);
|
||
//FieldByName('ConSubID').Value:=Trim(FConSubId);
|
||
FieldByName('OrdSubId').Value:=Trim(FOrdSubId);
|
||
FieldByName('PSID').Value:=Trim(FPSID);
|
||
FieldByName('PFID').Value:=Trim(FPFID);
|
||
FieldByName('MDType').Value:=Trim(DataType);
|
||
FieldByName('MDNO').Value:='NM'+Trim(maxno);
|
||
FieldByName('FactoryName').Value:=Trim(ClientDataSet5.fieldbyname('FactoryName').AsString);
|
||
FieldByName('FactoryNo').Value:=Trim(ClientDataSet5.fieldbyname('FactoryNo').AsString);
|
||
FieldByName('FromFactoryName').Value:=Trim(ClientDataSet5.fieldbyname('XDFactoryName').AsString);
|
||
FieldByName('FromFactoryNo').Value:=Trim(ClientDataSet5.fieldbyname('XDFactoryNo').AsString);
|
||
FieldByName('PS').Value:=ClientDataSet5.fieldbyname('PFTPPS').Value;
|
||
FieldByName('Qty').Value:=ClientDataSet5.fieldbyname('PFTPQty').Value;
|
||
FieldByName('QtyUnit').Value:=ClientDataSet5.fieldbyname('PFTPUnit').Value;
|
||
FieldByName('PSName').Value:=CDS_JGLC.fieldbyname('PSName').Value;
|
||
//FieldByName('FromFactoryName').Value:=Trim(ToFactoryName.Text);
|
||
//FieldByName('FromFactoryNo').Value:=Trim(ToFactoryName.TxtCode);
|
||
if Trim(ClientDataSet5.fieldbyname('PFDlyDate').AsString)<>'' then
|
||
FieldByName('MDDate').Value:=ClientDataSet5.fieldbyname('PFDlyDate').Value
|
||
else
|
||
FieldByName('MDDate').Value:=SGetServerDateTime(ADOQuery1);
|
||
Post;
|
||
end;
|
||
Result:=True;
|
||
|
||
end;
|
||
function TfrmOrderInPut.UpdateTJCKQty(FFPFID:string):Boolean;
|
||
var
|
||
FAPQty,FMDQty,FPS,FQty:Double;
|
||
begin
|
||
Result:=False;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select * from JYOrder_Main_MD_Out where PFID='''+Trim(FFPFID)+'''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
Result:=True;
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select distinct(MDID) MDID from JYOrder_Main_MD_Out where PFID='''+Trim(FFPFID)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet9);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet9);
|
||
with ClientDataSet9 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(sum(SJCKQty),0) Qty from JYOrder_Main_MD_Out where MDID='''+Trim(ClientDataSet9.fieldbyname('MDID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
FAPQty:=ADOTemp.fieldbyname('Qty').Value;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select RKQty from JYOrder_Main_MD where MDID='''+Trim(ClientDataSet9.fieldbyname('MDID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
FMDQty:=ADOTemp.fieldbyname('RKQty').Value;
|
||
if FMDQty<FAPQty then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
with ClientDataSet9 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select RKPS PS, RKQty Qty from JYOrder_Main_MD where MDID='''+Trim(ClientDataSet9.fieldbyname('MDID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
FPS:=ADOQueryTemp.fieldbyname('PS').Value;
|
||
FQty:=ADOQueryTemp.fieldbyname('Qty').Value;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main_MD_Out where MDID='''+Trim(ClientDataSet9.fieldbyname('MDID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet8);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet8);
|
||
with ClientDataSet8 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if ClientDataSet8.FieldByName('CKQty').Value<=FQty then
|
||
begin
|
||
if ClientDataSet8.FieldByName('CKQty').Value=ClientDataSet8.FieldByName('SJCKQty').Value then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' Update JYOrder_Main_MD_Out Set SJCKPS=CKPS,SJCKQty=CKQty ');
|
||
sql.Add(' where CKID='''+Trim(ClientDataSet8.fieldbyname('CKID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
FPS:=FPS-ClientDataSet8.FieldByName('CKPS').Value;
|
||
FQty:=FQty-ClientDataSet8.FieldByName('CKQty').Value;
|
||
end else
|
||
begin
|
||
FPS:=FPS-ClientDataSet8.FieldByName('SJCKPS').Value;
|
||
FQty:=FQty-ClientDataSet8.FieldByName('SJCKQty').Value;
|
||
end;
|
||
|
||
ClientDataSet8.Delete;
|
||
end else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' Update JYOrder_Main_MD_Out Set SJCKPS='+floattostr(FPS) );
|
||
sql.Add(' ,SJCKQty='+floattostr(FQty) );
|
||
sql.Add(' where CKID='''+Trim(ClientDataSet8.fieldbyname('CKID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
ClientDataSet8.Last;
|
||
end;
|
||
end;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JYOrder_Main_MD Set CKPS=');
|
||
sql.Add('(select isnull(sum(SJCKPS),0) from JYOrder_Main_MD_Out A where A.MDID=JYOrder_Main_MD.MDID) ');
|
||
sql.Add(',CKQty=(select isnull(sum(SJCKQty),0) from JYOrder_Main_MD_Out A where A.MDID=JYOrder_Main_MD.MDID) ');
|
||
sql.Add(' where MDID='''+Trim(ClientDataSet9.fieldbyname('MDID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
Result:=True;
|
||
end;
|
||
function TfrmOrderInPut.UpdateTJCKQtyOne(FFPFID:string):Boolean;
|
||
var
|
||
FAPQty,FMDQty,FPS,FQty:Double;
|
||
FMDID:String;
|
||
begin
|
||
Result:=False;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select * from JYOrder_Main_MD_Out where PFID='''+Trim(FFPFID)+'''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
Result:=True;
|
||
Exit;
|
||
end;
|
||
FMDID:=Trim(ADOQueryTemp.fieldbyname('MDID').AsString);
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(sum(SJCKQty),0) Qty from JYOrder_Main_MD_Out where MDID='''+Trim(FMDID)+'''');
|
||
Open;
|
||
end;
|
||
FAPQty:=ADOTemp.fieldbyname('Qty').Value;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select RKQty from JYOrder_Main_MD where MDID='''+Trim(FMDID)+'''');
|
||
Open;
|
||
end;
|
||
FMDQty:=ADOTemp.fieldbyname('RKQty').Value;
|
||
if FMDQty<FAPQty then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD>ʵ<EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JYOrder_Main_MD_Out Set ');
|
||
sql.Add('SJCKPS=(select isnull(sum(PS),0) from JYOrder_Main_MD A where A.PFID=JYOrder_Main_MD_Out.PFID and isnull(A.CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' ),');
|
||
sql.Add('SJCKQty=(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_Main_MD_Out.PFID and isnull(A.CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' )');
|
||
sql.Add(' where PFID='''+Trim(FFPFID)+'''');
|
||
ExecSQL;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD>ʵ<EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
//<2F><><EFBFBD><EFBFBD>ԭʼTJ<54>뵥<EFBFBD>ij<EFBFBD><C4B3><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JYOrder_Main_MD Set CKPS=');
|
||
sql.Add('(select isnull(sum(SJCKPS),0) from JYOrder_Main_MD_Out A where A.MDID=JYOrder_Main_MD.MDID) ');
|
||
sql.Add(',CKQty=(select isnull(sum(SJCKQty),0) from JYOrder_Main_MD_Out A where A.MDID=JYOrder_Main_MD.MDID) ');
|
||
sql.Add(' where MDID='''+Trim(FMDID)+'''');
|
||
ExecSQL;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD>ԭʼTJ<54>뵥<EFBFBD>ij<EFBFBD><C4B3><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
Result:=True;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.FormCreate(Sender: TObject);
|
||
begin
|
||
CanShu1:=Trim(DParameters1);
|
||
CanShu2:=Trim(DParameters2);
|
||
if Trim(CanShu2)='<27>ֿ<EFBFBD>' then
|
||
begin
|
||
TBSave.Visible:=false;
|
||
ToolBar2.Visible:=False;
|
||
ToolBar3.Visible:=False;
|
||
ToolBar4.Visible:=False;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.Tv6CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
{if Trim(CanShu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if Trim(ClientDataSet6.fieldbyname('CKID').AsString)<>'' then
|
||
begin
|
||
Tv6.OptionsSelection.CellSelect:=False;
|
||
end;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.Tv5CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if ClientDataSet5.IsEmpty then Exit;
|
||
if Trim(ClientDataSet5.fieldbyname('PFID').AsString)='' then
|
||
begin
|
||
ClientDataSet5.Delete;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v1Column2PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmLabelList:=TfrmLabelList.Create(Application);
|
||
with frmLabelList do
|
||
begin
|
||
SLBName:=Trim(Order_Sub.fieldbyname('SLBName').AsString);
|
||
if Self.JYInt=99 then
|
||
begin
|
||
frmLabelList.Tadd.Visible:=False;
|
||
frmLabelList.Tupd.Visible:=False;
|
||
frmLabelList.TOK.Visible:=False;
|
||
frmLabelList.Tdel.Visible:=False;
|
||
end;
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
with Self.Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('SLBName').Value:=Trim(LBName);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmLabelList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ComTaiTouBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='GSTT';
|
||
flagname:='<27><>˾̧ͷ';
|
||
V1ZdyStr1.Visible:=True;
|
||
V1ZdyStr2.Visible:=True;
|
||
V1ZdyStr3.Visible:=True;
|
||
V1ZdyStr4.Visible:=True;
|
||
V1ZdyStr1.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr2.Caption:='<27>绰';
|
||
V1ZdyStr3.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr4.Caption:='<27><>ַ';
|
||
frmZDYHelp.Align:=alClient;
|
||
if ShowModal=1 then
|
||
begin
|
||
ComTaiTou.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.LiDanPersonBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='LiDanPerson';
|
||
flagname:='<27><><EFBFBD><EFBFBD>Ա';
|
||
fnote:=True;
|
||
V1Note.Caption:='<27>绰';
|
||
if ShowModal=1 then
|
||
begin
|
||
LiDanPerson.Text:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v3Column1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='PFGenDanPerson';
|
||
flagname:='<27><><EFBFBD><EFBFBD>Ա';
|
||
fnote:=True;
|
||
V1Note.Caption:='<27>绰';
|
||
if ShowModal=1 then
|
||
begin
|
||
with CDS_JGC do
|
||
begin
|
||
Edit;
|
||
FieldByName('PFGenDanPerson').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton13Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmModuleNote:=TfrmModuleNote.Create(Application);
|
||
with frmModuleNote do
|
||
begin
|
||
flag:='<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmModuleNote.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v3Column2PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
FReal:Double;
|
||
mvalue:string;
|
||
begin
|
||
if Trim(ClothOneQty.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(Trim(ClothOneQty.Text),FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ÿƥ<C3BF><C6A5><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then
|
||
begin
|
||
mvalue:='0';
|
||
end;
|
||
with CDS_JGC do
|
||
begin
|
||
Edit;
|
||
FieldByName('PFTPPS').Value:=mvalue;
|
||
FieldByName('PFTPQty').Value:=StrToFloat(mvalue)*StrToFloat(ClothOneQty.Text);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton14Click(Sender: TObject);
|
||
var
|
||
FPS,FJZ,XSJZ:Double;
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(Count(*),0) PS from WFB_MJJY where Mainid='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
FPS:=ADOQueryTemp.fieldbyname('PS').Value;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(Sum(MJQty4),0) JZ from WFB_MJJY where Mainid='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
FJZ:=ADOQueryTemp.fieldbyname('JZ').Value;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select isnull(Sum(Qty),0) XSJZ from JYOrder_Main_MD where ORDMainId='''+Trim(FMainId)+'''');
|
||
SQL.Add(' and FactoryNo='''+Trim('GS131221001')+'''');
|
||
Open;
|
||
end;
|
||
XSJZ:=ADOQueryTemp.fieldbyname('XSJZ').Value;
|
||
try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:='JFName';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with frmZDYHelpSel.ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if frmZDYHelpSel.ClientDataSet1.FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
with ClientDataSet7 do
|
||
begin
|
||
Append;
|
||
FieldByName('JFDate').Value:=Now;
|
||
FieldByName('JFName').Value:=Trim(frmZDYHelpSel.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
if Trim(frmZDYHelpSel.ClientDataSet1.fieldbyname('ZdyName').AsString)='<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ' then
|
||
begin
|
||
FieldByName('JFQty').Value:=FJZ;
|
||
FieldByName('JFPrice').Value:=0.3;
|
||
FieldByName('JFMoney').Value:=0.3*FJZ;
|
||
end else
|
||
if Trim(frmZDYHelpSel.ClientDataSet1.fieldbyname('ZdyName').AsString)='ֽ<><D6BD>' then
|
||
begin
|
||
FieldByName('JFQty').Value:=FPS;
|
||
//FieldByName('JFPrice').Value:=0.3;
|
||
//FieldByName('JFMoney').Value:=0.3*FJZ;
|
||
end else
|
||
if Trim(frmZDYHelpSel.ClientDataSet1.fieldbyname('ZdyName').AsString)='ɴ<><C9B4>' then
|
||
begin
|
||
FieldByName('JFQty').Value:=XSJZ;
|
||
//FieldByName('JFPrice').Value:=0.3;
|
||
//FieldByName('JFMoney').Value:=0.3*FJZ;
|
||
end;
|
||
Post;
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.cxGridDBColumn30PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='JFName';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet7 do
|
||
begin
|
||
Edit;
|
||
FieldByName('JFName').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton15Click(Sender: TObject);
|
||
begin
|
||
if ClientDataSet7.IsEmpty then Exit;
|
||
if Trim(ClientDataSet7.fieldbyname('JFID').AsString)<>'' then
|
||
begin
|
||
if Trim(ClientDataSet7.fieldbyname('Filler').AsString)<>Trim(DName) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete JYOrder_Main_Fee where JFID='''+Trim(ClientDataSet7.fieldbyname('JFID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
ClientDataSet7.Delete;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.cxGridDBColumn31PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,JFPrice,JFQty:string;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then
|
||
begin
|
||
mvalue:='0';
|
||
end;
|
||
with ClientDataSet7 do
|
||
begin
|
||
Edit;
|
||
FieldByName('JFPrice').Value:=mvalue;
|
||
Post;
|
||
end;
|
||
JFQty:=Trim(ClientDataSet7.fieldbyname('JFQty').AsString);
|
||
if Trim(JFQty)='' then JFQty:='0';
|
||
JFPrice:=Trim(ClientDataSet7.fieldbyname('JFPrice').AsString);
|
||
if Trim(JFPrice)='' then JFPrice:='0';
|
||
with ClientDataSet7 do
|
||
begin
|
||
Edit;
|
||
FieldByName('JFMoney').Value:=StrToFloat(JFQty)*StrToFloat(JFPrice);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.cxGridDBColumn32PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,JFPrice,JFQty:string;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then
|
||
begin
|
||
mvalue:='0';
|
||
end;
|
||
with ClientDataSet7 do
|
||
begin
|
||
Edit;
|
||
FieldByName('JFQty').Value:=mvalue;
|
||
Post;
|
||
end;
|
||
JFQty:=Trim(ClientDataSet7.fieldbyname('JFQty').AsString);
|
||
if Trim(JFQty)='' then JFQty:='0';
|
||
JFPrice:=Trim(ClientDataSet7.fieldbyname('JFPrice').AsString);
|
||
if Trim(JFPrice)='' then JFPrice:='0';
|
||
with ClientDataSet7 do
|
||
begin
|
||
Edit;
|
||
FieldByName('JFMoney').Value:=StrToFloat(JFQty)*StrToFloat(JFPrice);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton16Click(Sender: TObject);
|
||
var
|
||
AJpeg: TJPEGImage;
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Application.MessageBox('<27><>Ϣδ<CFA2><CEB4><EFBFBD>棡','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select WBID from TP_File where WBID='''+Trim(FMainId)+'''');
|
||
sql.Add(' and TFType=''<27><>װ'' ');
|
||
Open;
|
||
end;
|
||
if ADOQuery1.RecordCount>0 then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
end;
|
||
AJpeg:=TJpegImage.Create();
|
||
try
|
||
if self.OpenDialog2.Execute() then
|
||
begin
|
||
|
||
Image2.Picture.LoadFromFile(OpenDialog2.FileName);
|
||
AJpeg.Assign(Image2.Picture.Graphic);
|
||
if FileSizeByName(OpenDialog2.FileName)>300*1024 then
|
||
begin
|
||
CreThumb(AJpeg,Image2,418, 233);
|
||
end;
|
||
SaveImageOther();
|
||
end;
|
||
finally
|
||
AJpeg.Free;
|
||
end;
|
||
end;
|
||
procedure TfrmOrderInPut.InitImage();
|
||
var
|
||
jpg:TJpegImage;
|
||
myStream:TADOBlobStream;
|
||
begin
|
||
if Trim(FMainId)='' then Exit;
|
||
//if cxPageControl1.ActivePageIndex=6 then
|
||
begin
|
||
Image2.Picture.Assign(nil);
|
||
Image2.Picture:=nil;
|
||
try
|
||
with ADOQuery1 do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select * from TP_File A where A.WBID='''+Trim(FMainId)+'''');
|
||
sql.Add(' and TFType=''<27><>װ'' ');
|
||
open;
|
||
if RecordCount>0 then
|
||
begin
|
||
if trim(ADOQuery1.fieldbyname('FilesOther').AsString)<>'' then
|
||
begin
|
||
myStream:=tadoblobstream.Create(tblobfield(ADOQuery1.fieldbyname('FilesOther')),bmread);
|
||
if myStream=nil then exit;
|
||
jpg:=TJPEGImage.Create;
|
||
jpg.LoadFromStream(myStream);
|
||
Image2.Picture.Assign(jpg);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
jpg.Free;
|
||
myStream.Free;
|
||
end;
|
||
end;
|
||
end;
|
||
procedure TfrmOrderInPut.CreThumb(AJPeg:TJPEGImage;Image1:TImage;Width, Height: Integer);
|
||
var
|
||
Bitmap: TBitmap;
|
||
Ratio: Double;
|
||
ARect: TRect;
|
||
AHeight, AHeightOffset: Integer;
|
||
AWidth, AWidthOffset: Integer;
|
||
begin
|
||
Bitmap := TBitmap.Create;
|
||
try
|
||
Ratio := AJPeg.Width /AJPeg.Height;
|
||
if Ratio > 1.333 then
|
||
begin
|
||
AHeight := Round(Width / Ratio);
|
||
AHeightOffset := (Height - AHeight) div 2;
|
||
AWidth := Width;
|
||
AWidthOffset := 0;
|
||
end
|
||
else
|
||
begin
|
||
AWidth := Round(Height * Ratio);
|
||
AWidthOffset := (Width - AWidth) div 2;
|
||
AHeight := Height;
|
||
AHeightOffset := 0;
|
||
end;
|
||
Bitmap.Width := Width;
|
||
Bitmap.Height := Height;
|
||
Bitmap.Canvas.Brush.Color := clBtnFace;
|
||
Bitmap.Canvas.FillRect(Rect(0, 0, Width, Height));
|
||
ARect := Rect(AWidthOffset, AHeightOffset, AWidth + AWidthOffset, AHeight + AHeightOffset);
|
||
Bitmap.Canvas.StretchDraw(ARect, AJPeg);
|
||
Image1.Picture.Assign(BitMap);
|
||
finally
|
||
Bitmap.Free;
|
||
end;
|
||
end;
|
||
procedure TfrmOrderInPut.SaveImageOther();
|
||
var
|
||
AJpeg: TJPEGImage;
|
||
myStream: TADOBlobStream;
|
||
ImgMaxNo:String;
|
||
i,j: Integer;
|
||
PatFile: String;
|
||
FTPPath,FConNo,MaxNo,FTFID:string;
|
||
begin
|
||
if Image2.Picture=nil then Exit;
|
||
AJpeg:=TJpegImage.Create();
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from TP_File where WBID='''+Trim(FMainId)+'''');
|
||
sql.Add(' and TFType=''<27><>װ'' ');
|
||
Open;
|
||
end;
|
||
FTFID:=Trim(ADOTemp.fieldbyname('TFID').AsString);
|
||
if Trim(FTFID)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,ImgMaxNo,'TF','TP_File',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
ImgMaxNo:=Trim(FTFID);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add( ' select * from TP_File where TFID='''+Trim(FTFID)+'''');
|
||
open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FTFID)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
FieldByName('TFID').Value:=Trim(ImgMaxNo);
|
||
FieldByName('WBID').Value:=Trim(FMainId);
|
||
FieldByName('TFType').Value:='<27><>װ';
|
||
AJpeg.Assign(Image2.Picture.Graphic);
|
||
//CreThumb(AJpeg,Image1,160, 120);
|
||
myStream := TADOBlobStream.Create(TBlobField(ADOCmd.FieldByName('FilesOther')), bmWrite);
|
||
AJpeg.Assign(Image2.Picture.Graphic);
|
||
AJpeg.SaveToStream(myStream);
|
||
myStream.Free;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton17Click(Sender: TObject);
|
||
begin
|
||
if Image2.Picture=nil then Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' delete TP_File where WBID='''+Trim(FMainId)+'''');
|
||
SQL.Add(' and TFType=''<27><>װ'' ');
|
||
ExecSQL;
|
||
end;
|
||
Image2.Picture.Assign(nil);
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton18Click(Sender: TObject);
|
||
begin
|
||
// if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
// if not Assigned(DataLink_PBMDDJ) then
|
||
// DataLink_DDMD:=TDataLink_DDMD.Create(Application);
|
||
// Try
|
||
// with DataLink_DDMD.ADOLink do
|
||
// begin
|
||
// //if not Connected then
|
||
// begin
|
||
// Connected:=false;
|
||
// ConnectionString:=DConString;
|
||
// LoginPrompt:=false;
|
||
// Connected:=true;
|
||
// end;
|
||
// end;
|
||
// Except
|
||
// application.MessageBox('<27><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><><EFBFBD><EFBFBD>',mb_Ok+ MB_ICONERROR);
|
||
// end;
|
||
// with ADOCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('UPdate SY_MaxBH Set BHNo=BHNo+1 where BHType=''JYOrder_Sub'' ');
|
||
// sql.Add('UPdate SY_MaxBH Set BHNo=BHNo+1 where BHType=''JYOrder_Main'' ');
|
||
// ExecSQL;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton19Click(Sender: TObject);
|
||
begin
|
||
if ClientDataSet5.IsEmpty then Exit;
|
||
if FJSFlag=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(ClientDataSet5.fieldbyname('PFID').AsString)<>'' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main_MD where PFID='''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+'''');
|
||
sql.Add(' and (isnull(ConSubId,'''')<>'''' ');
|
||
sql.Add(' or MDNO like ''MD%'') ');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' Update JYOrder_Main_MD Set ');
|
||
sql.Add(' CKPS=(select isnull(Sum(SJCKPS),0) from JYOrder_Main_MD_Out A where A.MDID=JYOrder_Main_MD.MDID');
|
||
sql.Add(' and isnull(A.PFID,'''')<>'''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+''')');
|
||
sql.Add(' ,CKQty=(select isnull(Sum(SJCKQty),0) from JYOrder_Main_MD_Out A where A.MDID=JYOrder_Main_MD.MDID');
|
||
sql.Add(' and isnull(A.PFID,'''')<>'''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+''')');
|
||
sql.Add(' where MDID in(select MDID from JYOrder_Main_MD_Out B where');
|
||
sql.Add(' isnull(B.PFID,'''')<>'''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+''')');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_Main_MD where PFID='''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_PCS_Sub where PFID='''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+'''');
|
||
sql.Add('delete JYOrder_Main_MD_Out where PFID='''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
UpdateTJCKQty(Trim(ClientDataSet5.fieldbyname('PFID').AsString));
|
||
end;
|
||
ClientDataSet5.Delete;
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,C.OrderNo,D.C_Code,D.C_CodeName,B.FactoryName,B.RKQtyUnit from JYOrder_Main_MD_Out A ');
|
||
sql.Add(' inner join JYOrder_Main_MD B on A.MDId=B.MDId');
|
||
sql.Add(' inner join JYOrder_Main C on B.OrdMainId=C.MainId');
|
||
sql.Add(' inner join Contract_Sub D on B.ConSubId=D.SubId');
|
||
sql.Add('where A.PFID='''+Trim(ClientDataSet5.fieldbyname('PFID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet6);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet6);
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Update_TJCKQty');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v5Column1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmOrderSubSelMX:=TfrmOrderSubSelMX.Create(Application);
|
||
with frmOrderSubSelMX do
|
||
begin
|
||
FFFMainId:=Trim(Self.FMainId);
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.ClientDataSet5 do
|
||
begin
|
||
Edit;
|
||
FieldByName('SubId').Value:=frmOrderSubSelMX.Order_Sub.fieldbyname('SubId').Value;
|
||
FieldByName('PRTColorNo').Value:=frmOrderSubSelMX.Order_Sub.fieldbyname('PRTColorNo').Value;
|
||
FieldByName('PRTHX').Value:=frmOrderSubSelMX.Order_Sub.fieldbyname('PRTHX').Value;
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmOrderSubSelMX.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton20Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag:='WFBCD';
|
||
flagname:='<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>';
|
||
fnote:=True;
|
||
V1Note.Caption:='Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with frmZDYHelpSel.ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if frmZDYHelpSel.ClientDataSet1.FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
with ClientDataSet8 do
|
||
begin
|
||
Append;
|
||
FieldByName('ZDYCODE').Value:=Trim(frmZDYHelpSel.ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||
FieldByName('ZdyName').Value:=Trim(frmZDYHelpSel.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
FieldByName('ZdyNameEng').Value:=Trim(frmZDYHelpSel.ClientDataSet1.fieldbyname('Note').AsString);
|
||
Post;
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton21Click(Sender: TObject);
|
||
begin
|
||
if ClientDataSet8.IsEmpty then Exit;
|
||
if Trim(ClientDataSet8.fieldbyname('JCID').AsString)<>'' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete JYOrder_CD where JCID='''+Trim(ClientDataSet8.fieldbyname('JCID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
ClientDataSet8.Delete;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v5Column3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet5 do
|
||
begin
|
||
edit;
|
||
FieldByName('XDFactoryNo').Value:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
||
FieldByName('XDFactoryName').Value:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton22Click(Sender: TObject);
|
||
var
|
||
fPrintFile:string;
|
||
begin
|
||
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD>.rmf';
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main where Mainid='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint,CDS_Print);
|
||
SInitCDSData20(ADOQueryPrint,CDS_Print);
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['PFGenDanPerson']:=CDS_JGC.fieldbyname('PFGenDanPerson').Value;
|
||
RMVariables['PSName']:=CDS_JGLC.fieldbyname('PSName').Value;
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD>.rmf'),'<27><>ʾ',0);
|
||
end;
|
||
// Panel4.Visible:=True;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.Button1Click(Sender: TObject);
|
||
var
|
||
fPrintFile:String;
|
||
FReal:Integer;
|
||
i:Integer;
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('SLBName').AsString)<>'' then
|
||
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\'+Trim(Order_Sub.fieldbyname('SLBName').AsString);
|
||
if Trim(RollBeg.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if TryStrToInt(Trim(RollBeg.Text),FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>ŷǷ<C5B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(RollEnd.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if TryStrToInt(Trim(RollEnd.Text),FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>ŷǷ<C5B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
for i:=StrToInt(RollBeg.Text) to StrToInt(RollEnd.Text) do
|
||
begin
|
||
RMVariables['LabNote1']:=Trim(LabNote1.Text);
|
||
RMVariables['LabNote2']:=Trim(LabNote2.Text);
|
||
RMVariables['RollNo']:=i;
|
||
RMVariables['DESNO']:=Trim(Order_Sub.fieldbyname('PRTHX').AsString);
|
||
RM2.LoadFromFile(fPrintFile);
|
||
//RM2.ShowReport;
|
||
RM2.PrintReport;
|
||
end;
|
||
|
||
end else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\'+Trim(Order_Sub.fieldbyname('SLBName').AsString)),'<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.v7Column1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet7 do
|
||
begin
|
||
edit;
|
||
FieldByName('FactoryNo').Value:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
||
FieldByName('FactoryName').Value:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.Tv7MouseUp(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
if Trim(ClientDataSet7.fieldbyname('Chker').asstring)<>'' then
|
||
begin
|
||
Tv7.OptionsSelection.CellSelect:=False;
|
||
ToolButton15.Enabled:=False;
|
||
end else
|
||
begin
|
||
Tv7.OptionsSelection.CellSelect:=True;
|
||
ToolButton15.Enabled:=True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmOrderInPut.ToolButton23Click(Sender: TObject);
|
||
var
|
||
fPrintFile:String;
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>治<EFBFBD><E6B2BB>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>ǩ!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('exec P_Print_Lable_View :SubId,:ZSUnit,:DuoPinNote');
|
||
Parameters.ParamByName('SubId').Value:=Trim(Order_Sub.fieldbyname('SubId').AsString);
|
||
Parameters.ParamByName('ZSUnit').Value:=Trim(ComboBox1.Text);
|
||
Parameters.ParamByName('DuoPinNote').Value:=Trim(Edit1.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint,CDS_Print);
|
||
SInitCDSData20(ADOQueryPrint,CDS_Print);
|
||
if Trim(Order_Sub.fieldbyname('SLBName').AsString)<>'' then
|
||
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\'+Trim(Order_Sub.fieldbyname('SLBName').AsString)
|
||
else
|
||
Exit;
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
//RM1.PrintReport;
|
||
end else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\'+Trim(ADOQueryPrint.fieldbyname('SLBName').AsString)),'<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
|
||
end.
|