1747 lines
54 KiB
ObjectPascal
1747 lines
54 KiB
ObjectPascal
![]() |
unit U_CWMDList; //17
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, ComCtrls, StdCtrls, ExtCtrls, ToolWin, cxPC, cxControls,
|
|||
|
cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit, cxGridLevel,
|
|||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
cxGridCustomView, cxGrid, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB,
|
|||
|
DBClient, cxCheckBox, cxSplitter, cxGridBandedTableView,
|
|||
|
cxGridDBBandedTableView, cxTextEdit, Menus;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCWMDList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label10: TLabel;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
PRTColor: TEdit;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
orderNo: TEdit;
|
|||
|
AOrdDefStr1: TEdit;
|
|||
|
cxPageControl1: TcxPageControl;
|
|||
|
cxTabSheet1: TcxTabSheet;
|
|||
|
cxTabSheet2: TcxTabSheet;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
cxGridDBColumn11: TcxGridDBColumn;
|
|||
|
cxGridDBColumn14: TcxGridDBColumn;
|
|||
|
cxGridDBColumn12: TcxGridDBColumn;
|
|||
|
Tv3Column2: TcxGridDBColumn;
|
|||
|
Tv3Column3: TcxGridDBColumn;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
v3Column4: TcxGridDBColumn;
|
|||
|
v3Column5: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
v3Column3: TcxGridDBColumn;
|
|||
|
v3Column6: TcxGridDBColumn;
|
|||
|
v3Column7: TcxGridDBColumn;
|
|||
|
v3Column8: TcxGridDBColumn;
|
|||
|
v3Column9: TcxGridDBColumn;
|
|||
|
v3Column10: TcxGridDBColumn;
|
|||
|
v3Column11: TcxGridDBColumn;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
cxGridDBColumn8: TcxGridDBColumn;
|
|||
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
cxGridDBColumn15: TcxGridDBColumn;
|
|||
|
cxGridDBColumn16: TcxGridDBColumn;
|
|||
|
cxGridDBColumn17: TcxGridDBColumn;
|
|||
|
cxGridDBColumn18: TcxGridDBColumn;
|
|||
|
cxGridDBColumn19: TcxGridDBColumn;
|
|||
|
cxGridDBColumn20: TcxGridDBColumn;
|
|||
|
cxGridDBColumn21: TcxGridDBColumn;
|
|||
|
cxGridDBColumn22: TcxGridDBColumn;
|
|||
|
cxGridDBColumn23: TcxGridDBColumn;
|
|||
|
cxGridDBColumn24: TcxGridDBColumn;
|
|||
|
cxGridDBColumn25: TcxGridDBColumn;
|
|||
|
cxGridDBColumn26: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Label6: TLabel;
|
|||
|
MDNO: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
MPRTCode: TEdit;
|
|||
|
DataSource3: TDataSource;
|
|||
|
ClientDataSet3: TClientDataSet;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQuery1: TADOQuery;
|
|||
|
cxGridPopupMenu3: TcxGridPopupMenu;
|
|||
|
DataSource1: TDataSource;
|
|||
|
ClientDataSet1: TClientDataSet;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQuery3: TADOQuery;
|
|||
|
v3Column12: TcxGridDBColumn;
|
|||
|
MDType: TComboBox;
|
|||
|
Label8: TLabel;
|
|||
|
PSName: TComboBox;
|
|||
|
Label9: TLabel;
|
|||
|
v3Column13: TcxGridDBColumn;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
v3Column14: TcxGridDBColumn;
|
|||
|
v3Column15: TcxGridDBColumn;
|
|||
|
v3Column16: TcxGridDBColumn;
|
|||
|
v3Column17: TcxGridDBColumn;
|
|||
|
Label11: TLabel;
|
|||
|
MDFactoryName: TEdit;
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
cxSplitter1: TcxSplitter;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv2: TcxGridDBBandedTableView;
|
|||
|
v2Fty: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn7: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn8: TcxGridDBBandedColumn;
|
|||
|
v2Pon: TcxGridDBBandedColumn;
|
|||
|
v2Column2: TcxGridDBBandedColumn;
|
|||
|
v2Column3: TcxGridDBBandedColumn;
|
|||
|
cxGridLevel3: TcxGridLevel;
|
|||
|
cxGrid4: TcxGrid;
|
|||
|
Tv4: TcxGridDBBandedTableView;
|
|||
|
v3Fty: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn13: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn14: TcxGridDBBandedColumn;
|
|||
|
v3Pon: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn16: TcxGridDBBandedColumn;
|
|||
|
cxGridDBBandedColumn17: TcxGridDBBandedColumn;
|
|||
|
cxGridLevel4: TcxGridLevel;
|
|||
|
DataSource2: TDataSource;
|
|||
|
ClientDataSet2: TClientDataSet;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
DataSource4: TDataSource;
|
|||
|
ClientDataSet4: TClientDataSet;
|
|||
|
cxGridPopupMenu4: TcxGridPopupMenu;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
v3Column18: TcxGridDBColumn;
|
|||
|
v3Column19: TcxGridDBColumn;
|
|||
|
v3Column20: TcxGridDBColumn;
|
|||
|
v3Column21: TcxGridDBColumn;
|
|||
|
Panel2: TPanel;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
N3: TMenuItem;
|
|||
|
Panel3: TPanel;
|
|||
|
v3Column22: TcxGridDBColumn;
|
|||
|
v3Column23: TcxGridDBColumn;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure cxPageControl1Change(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure orderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure MDNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure Tv3CellClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
|||
|
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure v3Column19PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure Tv1DblClick(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
canshu1,canshu2:string;
|
|||
|
function UPdateData():Boolean;
|
|||
|
function JSMDData():Boolean;
|
|||
|
function JSTJMDData(FJSType:String):Boolean;
|
|||
|
function UPdateDataKK():Boolean;
|
|||
|
function YFData(YFTYpeId,CWFactoryNo,CWFactoryName,KFType:string):Boolean;
|
|||
|
function DelYFData(CRID:String):Boolean;
|
|||
|
function JSMDHZData():Boolean;
|
|||
|
function YFHZData(YFTYpeId,CWFactoryNo,CWFactoryName,KFType:string):Boolean;
|
|||
|
function DelYFHZData(CRID:String):Boolean;
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
FFPInt:Integer;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmCWMDList: TfrmCWMDList;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_RTFun, U_ModuleNote,U_TJCKRKOK;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCWMDList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCWMDList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.TBRafreshClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
Panel2.Visible:=True;
|
|||
|
Panel2.Refresh;
|
|||
|
try
|
|||
|
ADOQuery3.DisableControls;
|
|||
|
with ADOQuery3 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Filtered:=False;
|
|||
|
sql.Clear;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
sql.Add('exec P_View_MD_JS :begdate,:enddate,:orderno,:MDType,:WSql')
|
|||
|
else
|
|||
|
sql.Add('exec P_View_MDTJ_JS :begdate,:enddate,:orderno,:MDType,:WSql');
|
|||
|
if cxTabControl1.TabIndex<>0 then
|
|||
|
begin
|
|||
|
Parameters.ParamByName('begdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date));
|
|||
|
Parameters.ParamByName('enddate').Value:=Trim(FormatDateTime('yyyy-MM-dd',enddate.Date+1));
|
|||
|
end;
|
|||
|
Parameters.ParamByName('orderno').Value:=Trim(orderNo.Text);
|
|||
|
// Parameters.ParamByName('orderno').Value:='';
|
|||
|
Parameters.ParamByName('MDType').Value:='';
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(PF.CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' and isnull(JMM.CKName,'''')='''' and JMM.FactoryName<>''<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>'' ';
|
|||
|
end else
|
|||
|
begin
|
|||
|
fsj:=' and isnull(JMM.CKName,'''')<>'''' and exists(select * from JYOrder_Main_MD_KK JMK where JMK.MDID=JMM.MDID)';
|
|||
|
end;
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')='''' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
|||
|
end;
|
|||
|
if Trim(MDFactoryName.Text)<>'' then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.FactoryName,'''') like '''+'%'+Trim(MDFactoryName.Text)+'%'+'''';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:=fsj;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery3,ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQuery3,ClientDataSet3);
|
|||
|
finally
|
|||
|
ADOQuery3.EnableControls;
|
|||
|
end;
|
|||
|
TBFind.Click;
|
|||
|
Panel2.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
canshu1:=Trim(DParameters1);
|
|||
|
canshu2:=Trim(DParameters2);
|
|||
|
EndDate.Date:=SGetServerDate(ADOQueryTemp);
|
|||
|
BegDate.Date:=EndDate.Date-60;
|
|||
|
cxPageControl1.ActivePageIndex:=0;
|
|||
|
cxTabControl1.TabIndex:=0;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>ѯCW',Tv3,'<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>');
|
|||
|
WriteCxGrid('<27><><EFBFBD>ڲֿ<DAB2><D6BF>뵥<EFBFBD><EBB5A5>ѯCW',Tv1,'<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.cxPageControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQuery3.Active=False then Exit;
|
|||
|
//SDofilter10(ClientDataSet3,SGetFilters(Panel1,1,2));
|
|||
|
SDofilter(ADOQuery3,SGetFilters(Panel1,1,2));
|
|||
|
SCreateCDS20(ADOQuery3,ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQuery3,ClientDataSet3);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.orderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if Key=#13 then
|
|||
|
begin
|
|||
|
if Trim(orderNo.Text)='' then Exit;
|
|||
|
if Length(Trim(orderNo.Text))<4 then Exit;
|
|||
|
try
|
|||
|
ADOQuery3.DisableControls;
|
|||
|
with ADOQuery3 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Filtered:=False;
|
|||
|
sql.Clear;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
sql.Add('exec P_View_MD_JS :begdate,:enddate,:orderno,:MDType,:WSql')
|
|||
|
else
|
|||
|
sql.Add('exec P_View_MDTJ_JS :begdate,:enddate,:orderno,:MDType,:WSql');
|
|||
|
//sql.Add('exec P_View_MD_JS :begdate,:enddate,:orderno,:MDType,:WSql');
|
|||
|
Parameters.ParamByName('begdate').Value:='';
|
|||
|
Parameters.ParamByName('enddate').Value:='';
|
|||
|
Parameters.ParamByName('orderno').Value:=Trim(orderNo.Text);
|
|||
|
Parameters.ParamByName('MDType').Value:='';
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(PF.CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' and isnull(JMM.CKName,'''')='''' and JMM.FactoryName<>''<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>'' ';
|
|||
|
end else
|
|||
|
begin
|
|||
|
fsj:=' and isnull(JMM.CKName,'''')<>'''' and exists(select * from JYOrder_Main_MD_KK JMK where JMK.MDID=JMM.MDID)';
|
|||
|
end;
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')='''' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
|||
|
end;
|
|||
|
if Trim(MDFactoryName.Text)<>'' then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.FactoryName,'''') like '''+'%'+Trim(MDFactoryName.Text)+'%'+'''';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:=fsj;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery3,ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQuery3,ClientDataSet3);
|
|||
|
finally
|
|||
|
ADOQuery3.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.MDNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if Key=#13 then
|
|||
|
begin
|
|||
|
if Trim(MDNO.Text)='' then Exit;
|
|||
|
if Length(Trim(MDNO.Text))<4 then Exit;
|
|||
|
try
|
|||
|
ADOQuery3.DisableControls;
|
|||
|
with ADOQuery3 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Filtered:=False;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_View_MD_JS :begdate,:enddate,:orderno,:MDType,:WSql');
|
|||
|
Parameters.ParamByName('begdate').Value:='';
|
|||
|
Parameters.ParamByName('enddate').Value:='';
|
|||
|
Parameters.ParamByName('orderno').Value:='';
|
|||
|
Parameters.ParamByName('MDType').Value:=Trim(canshu1);
|
|||
|
fsj:=' and JMM.MDNO like '''+'%'+Trim(MDNO.Text)+'%'+'''';
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CKName,'''')='''' ';
|
|||
|
end else
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CKName,'''')<>'''' ';
|
|||
|
end;
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')='''' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
|||
|
end;
|
|||
|
if Trim(MDFactoryName.Text)<>'' then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.FactoryName,'''') like '''+'%'+Trim(MDFactoryName.Text)+'%'+'''';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:=fsj;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery3,ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQuery3,ClientDataSet3);
|
|||
|
finally
|
|||
|
ADOQuery3.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>뵥',cxGrid3)
|
|||
|
else
|
|||
|
TcxGridToExcel('<27><><EFBFBD>ڲֿ<DAB2><D6BF>뵥',cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.FormShow(Sender: TObject);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
READCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>ѯCW',Tv3,'<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>');
|
|||
|
READCxGrid('<27><><EFBFBD>ڲֿ<DAB2><D6BF>뵥<EFBFBD><EBB5A5>ѯCW',Tv1,'<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>');
|
|||
|
if FFPInt=9 then
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQuery3.DisableControls;
|
|||
|
with ADOQuery3 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Filtered:=False;
|
|||
|
sql.Clear;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
sql.Add('exec P_View_MD_JS :begdate,:enddate,:orderno,:MDType,:WSql')
|
|||
|
else
|
|||
|
sql.Add('exec P_View_MDTJ_JS :begdate,:enddate,:orderno,:MDType,:WSql');
|
|||
|
//sql.Add('exec P_View_MD_JS :begdate,:enddate,:orderno,:MDType,:WSql');
|
|||
|
Parameters.ParamByName('begdate').Value:='';
|
|||
|
Parameters.ParamByName('enddate').Value:='';
|
|||
|
Parameters.ParamByName('orderno').Value:=Trim(orderNo.Text);
|
|||
|
Parameters.ParamByName('MDType').Value:='';
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=' and isnull(PF.CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' and isnull(JMM.CKName,'''')='''' and JMM.FactoryName<>''<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>'' ';
|
|||
|
end else
|
|||
|
begin
|
|||
|
fsj:=' and isnull(JMM.CKName,'''')<>'''' and exists(select * from JYOrder_Main_MD_KK JMK where JMK.MDID=JMM.MDID)';
|
|||
|
end;
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')='''' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.CWStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
|
|||
|
end;
|
|||
|
if Trim(MDFactoryName.Text)<>'' then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and isnull(JMM.FactoryName,'''') like '''+'%'+Trim(MDFactoryName.Text)+'%'+'''';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:=fsj;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery3,ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQuery3,ClientDataSet3);
|
|||
|
finally
|
|||
|
ADOQuery3.EnableControls;
|
|||
|
end;
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.Tv3CellClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
fsj:='select distinct(PSName) Name, Cast('''' as varchar(20)) code from JYOrder_Process where Mainid='''+Trim(ClientDataSet3.fieldbyname('ORDMainId').AsString)+'''';
|
|||
|
SInitComBoxBySql(ADOQueryTemp,PSName,False,fsj);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
if Trim(ComboBox1.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('״̬δѡ<CEB4><D1A1>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
if Trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then Exit;
|
|||
|
end;
|
|||
|
if cxTabControl1.TabIndex=3 then exit;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
if ClientDataSet3.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
Panel3.Visible:=True;
|
|||
|
Panel3.Refresh;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
if JSMDHZData() then
|
|||
|
begin
|
|||
|
Panel3.Visible:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
if UPdateDataKK() then
|
|||
|
begin
|
|||
|
Panel3.Visible:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Panel3.Visible:=False;
|
|||
|
end;
|
|||
|
function TfrmCWMDList.UPdateData():Boolean;
|
|||
|
var
|
|||
|
maxno:string;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>״̬
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD Set CWStatusDate=getdate(), CWStatusFiller='''+Trim(DName)+'''');
|
|||
|
sql.Add(',CWStatusNote='''+Trim(ClientDataSet3.fieldbyname('JSNote').AsString)+'''');
|
|||
|
if ComboBox1.ItemIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add(',CWStatus='''' ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add(',CWStatus='''+Trim(ComboBox1.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add(' where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>״̬
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if ComboBox1.ItemIndex=1 then //1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD> <20><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
if YFData(Trim(ClientDataSet3.fieldbyname('MDID').AsString),
|
|||
|
Trim(ClientDataSet3.fieldbyname('FactoryNo').AsString),
|
|||
|
Trim(ClientDataSet3.fieldbyname('FactoryName').AsString),
|
|||
|
'')=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end else
|
|||
|
begin
|
|||
|
//ɾ<><C9BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
sql.Add(' and YFTYpe=''<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
if DelYFData(ADOQueryTemp.fieldbyname('CRID').AsString)=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ɾ<><C9BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>״̬
|
|||
|
if cxTabControl1.TabIndex<>ComboBox1.ItemIndex then
|
|||
|
begin
|
|||
|
ClientDataSet3.Delete;
|
|||
|
end else
|
|||
|
begin
|
|||
|
ClientDataSet3.Edit;
|
|||
|
ClientDataSet3.FieldByName('SSel').Value:=False;
|
|||
|
ClientDataSet3.Post;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>״̬
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
function TfrmCWMDList.JSMDData():Boolean;
|
|||
|
var
|
|||
|
maxno:string;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>״̬
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD Set CWStatusDate=getdate(), CWStatusFiller='''+Trim(DName)+'''');
|
|||
|
sql.Add(',CWStatusNote='''+Trim(ClientDataSet3.fieldbyname('JSNote').AsString)+'''');
|
|||
|
if ComboBox1.ItemIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add(',CWStatus='''' ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add(',CWStatus='''+Trim(ComboBox1.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add(' where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>״̬
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
|||
|
if ComboBox1.ItemIndex=1 then
|
|||
|
begin
|
|||
|
if Trim(ClientDataSet3.fieldbyname('JSID').AsString)='' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd,maxno,'JS','JYOrder_Main_MD_JS',4,1)=False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
maxno:=Trim(ClientDataSet3.fieldbyname('JSID').AsString);
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD_JS where JSID='''+Trim(ClientDataSet3.fieldbyname('JSID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
if Trim(ClientDataSet3.fieldbyname('JSID').AsString)='' then
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('Editer').Value:=Trim(DName);
|
|||
|
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
end;
|
|||
|
FieldByName('JSID').Value:=Trim(maxno);
|
|||
|
FieldByName('MDID').Value:=Trim(ClientDataSet3.fieldbyname('MDID').AsString);
|
|||
|
FieldByName('JSQtyUnit').Value:=Trim(ClientDataSet3.fieldbyname('QtyUnit').AsString);
|
|||
|
RTSetSaveDataCDS(ADOQueryCmd,Tv3,ClientDataSet3,'JYOrder_Main_MD_JS',9);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end else
|
|||
|
//if ComboBox1.ItemIndex=0 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete JYOrder_Main_MD_JS where JSID='''+Trim(ClientDataSet3.fieldbyname('JSID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
|||
|
//
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if ComboBox1.ItemIndex=1 then //1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD> <20><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
if YFData(Trim(ClientDataSet3.fieldbyname('MDID').AsString),
|
|||
|
Trim(ClientDataSet3.fieldbyname('MDFactoryNo').AsString),
|
|||
|
Trim(ClientDataSet3.fieldbyname('MDFactoryName').AsString),
|
|||
|
'')=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end else
|
|||
|
begin
|
|||
|
//ɾ<><C9BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
sql.Add(' and YFTYpe=''<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
if DelYFData(ADOQueryTemp.fieldbyname('CRID').AsString)=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ɾ<><C9BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>״̬
|
|||
|
if cxTabControl1.TabIndex<>ComboBox1.ItemIndex then
|
|||
|
begin
|
|||
|
ClientDataSet3.Delete;
|
|||
|
end else
|
|||
|
begin
|
|||
|
ClientDataSet3.Edit;
|
|||
|
ClientDataSet3.FieldByName('SSel').Value:=False;
|
|||
|
ClientDataSet3.Post;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>״̬
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
function TfrmCWMDList.JSMDHZData():Boolean;
|
|||
|
var
|
|||
|
maxno:string;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
ClientDataSet3.DisableControls;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>״̬
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD Set CWStatusDate=getdate(), CWStatusFiller='''+Trim(DName)+'''');
|
|||
|
sql.Add(',CWStatusNote='''+Trim(ClientDataSet3.fieldbyname('JSNote').AsString)+'''');
|
|||
|
if ComboBox1.ItemIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add(',CWStatus='''' ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add(',CWStatus='''+Trim(ComboBox1.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add(' where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>״̬
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
|||
|
if ComboBox1.ItemIndex=1 then
|
|||
|
begin
|
|||
|
if Trim(ClientDataSet3.fieldbyname('JSID').AsString)='' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd,maxno,'JS','JYOrder_Main_MD_JS',4,1)=False then
|
|||
|
begin
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
maxno:=Trim(ClientDataSet3.fieldbyname('JSID').AsString);
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD_JS where JSID='''+Trim(ClientDataSet3.fieldbyname('JSID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
if Trim(ClientDataSet3.fieldbyname('JSID').AsString)='' then
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('Editer').Value:=Trim(DName);
|
|||
|
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
end;
|
|||
|
FieldByName('JSID').Value:=Trim(maxno);
|
|||
|
FieldByName('MDID').Value:=Trim(ClientDataSet3.fieldbyname('MDID').AsString);
|
|||
|
FieldByName('JSQtyUnit').Value:=Trim(ClientDataSet3.fieldbyname('QtyUnit').AsString);
|
|||
|
FieldByName('JSDate').Value:=ClientDataSet3.fieldbyname('MDDate').Value;
|
|||
|
FieldByName('ORDMainId').Value:=ClientDataSet3.fieldbyname('ORDMainId').Value;
|
|||
|
RTSetSaveDataCDS(ADOQueryCmd,Tv3,ClientDataSet3,'JYOrder_Main_MD_JS',9);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end else
|
|||
|
//if ComboBox1.ItemIndex=0 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete JYOrder_Main_MD_JS where JSID='''+Trim(ClientDataSet3.fieldbyname('JSID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
|||
|
//
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if ComboBox1.ItemIndex=1 then //1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD> <20><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
if YFHZData(Trim(ClientDataSet3.fieldbyname('MDID').AsString),
|
|||
|
Trim(ClientDataSet3.fieldbyname('MDFactoryNo').AsString),
|
|||
|
Trim(ClientDataSet3.fieldbyname('MDFactoryName').AsString),
|
|||
|
'')=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end else
|
|||
|
begin
|
|||
|
//ɾ<><C9BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where YFID='''+Trim(ClientDataSet3.fieldbyname('YFID').AsString)+'''');
|
|||
|
sql.Add(' and YFTYpe=''<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
if DelYFHZData(ADOQueryTemp.fieldbyname('CRID').AsString)=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ɾ<><C9BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>״̬
|
|||
|
if cxTabControl1.TabIndex<>ComboBox1.ItemIndex then
|
|||
|
begin
|
|||
|
ClientDataSet3.Delete;
|
|||
|
end else
|
|||
|
begin
|
|||
|
ClientDataSet3.Edit;
|
|||
|
ClientDataSet3.FieldByName('SSel').Value:=False;
|
|||
|
ClientDataSet3.Post;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>״̬
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
function TfrmCWMDList.JSTJMDData(FJSType:String):Boolean;
|
|||
|
var
|
|||
|
maxno,FJSID:string;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD_JS where KKID='''+Trim(ClientDataSet4.fieldbyname('KKID').AsString)+'''');
|
|||
|
sql.Add(' and JSType='''+Trim(FJSType)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
FJSID:=Trim(ADOQueryTemp.fieldbyname('JSID').AsString);
|
|||
|
if ComboBox1.ItemIndex=1 then
|
|||
|
begin
|
|||
|
if Trim(FJSID)='' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd,maxno,'JS','JYOrder_Main_MD_JS',4,1)=False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
maxno:=Trim(FJSID);
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD_JS where JSID='''+Trim(FJSID)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
if Trim(FJSID)='' then
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('Editer').Value:=Trim(DName);
|
|||
|
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
end;
|
|||
|
FieldByName('JSID').Value:=Trim(maxno);
|
|||
|
FieldByName('MDID').Value:=Trim(ClientDataSet3.fieldbyname('MDID').AsString);
|
|||
|
FieldByName('KKID').Value:=Trim(ClientDataSet4.fieldbyname('KKID').AsString);
|
|||
|
FieldByName('JSType').Value:=Trim(FJSType);
|
|||
|
if FJSType='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
FieldByName('JSQty').Value:=-1;
|
|||
|
FieldByName('JSPrice').Value:=ClientDataSet4.fieldbyname('ZZPonMoney').Value;
|
|||
|
FieldByName('JSMoney').Value:=ClientDataSet4.fieldbyname('ZZPonMoney').AsFloat*-1;
|
|||
|
FieldByName('FactoryNo').Value:=ClientDataSet4.fieldbyname('ZZPerson').Value;
|
|||
|
FieldByName('FactoryName').Value:=ClientDataSet4.fieldbyname('ZZPerson').Value;
|
|||
|
end else
|
|||
|
if FJSType='<27><><EFBFBD>ι<EFBFBD><CEB9><EFBFBD>' then
|
|||
|
begin
|
|||
|
FieldByName('JSQty').Value:=-1;
|
|||
|
FieldByName('JSPrice').Value:=ClientDataSet4.fieldbyname('ZZFtyMoney').Value;
|
|||
|
FieldByName('JSMoney').Value:=ClientDataSet4.fieldbyname('ZZFtyMoney').AsFloat*-1;
|
|||
|
FieldByName('FactoryNo').Value:=ClientDataSet4.fieldbyname('ZZFactoryNo').Value;
|
|||
|
FieldByName('FactoryName').Value:=ClientDataSet4.fieldbyname('ZZFactoryName').Value;
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete JYOrder_Main_MD_JS where JSID='''+Trim(FJSID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
|
|||
|
end;
|
|||
|
function TfrmCWMDList.UPdateDataKK():Boolean;
|
|||
|
var
|
|||
|
maxno,maxjsno,maxkkno:string;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>״̬
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD Set CWStatusDate=getdate(), CWStatusFiller='''+Trim(DName)+'''');
|
|||
|
// sql.Add(',CWStatusNote='''+Trim(ClientDataSet3.fieldbyname('CWStatusNote').AsString)+'''');
|
|||
|
if ComboBox1.ItemIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add(',CWStatus='''' ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add(',CWStatus='''+Trim(ComboBox1.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add(' where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>״̬
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>
|
|||
|
with ClientDataSet4 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if ClientDataSet4.FieldByName('ZZFtyMoney').Value>0 then
|
|||
|
begin
|
|||
|
JSTJMDData('<27><><EFBFBD>ι<EFBFBD><CEB9><EFBFBD>');
|
|||
|
end;
|
|||
|
if ClientDataSet4.FieldByName('ZZPonMoney').Value>0 then
|
|||
|
begin
|
|||
|
JSTJMDData('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if ComboBox1.ItemIndex=1 then //1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD> <20><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
if ClientDataSet4.IsEmpty then Exit;
|
|||
|
with ClientDataSet4 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if ClientDataSet4.FieldByName('ZZFtyMoney').Value>0 then
|
|||
|
begin
|
|||
|
if YFData(Trim(ClientDataSet4.fieldbyname('KKID').AsString),
|
|||
|
Trim(ClientDataSet4.fieldbyname('ZZFactoryNo').AsString),
|
|||
|
Trim(ClientDataSet4.fieldbyname('ZZFactoryName').AsString),
|
|||
|
'<27><><EFBFBD>ι<EFBFBD><CEB9><EFBFBD>')=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if ClientDataSet4.FieldByName('ZZPonMoney').Value>0 then
|
|||
|
begin
|
|||
|
if YFData(Trim(ClientDataSet4.fieldbyname('KKID').AsString),
|
|||
|
Trim(ClientDataSet4.fieldbyname('ZZPerson').AsString),
|
|||
|
Trim(ClientDataSet4.fieldbyname('ZZPerson').AsString),
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('Update JYOrder_Main_MD_KK Set CWHX=1,CWHXDate=getdate(),CWHXPerson='''+Trim(DName)+'''');
|
|||
|
sql.Add(' where KKID='''+Trim(ClientDataSet4.fieldbyname('KKID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
//ɾ<><C9BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
|||
|
with ClientDataSet4 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where YFTypeID='''+Trim(ClientDataSet4.fieldbyname('KKID').AsString)+'''');
|
|||
|
sql.Add(' and YFTYpe=''<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' and KFType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
if DelYFData(ADOQueryTemp.fieldbyname('CRID').AsString)=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ɾ<><C9BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where YFTypeID='''+Trim(ClientDataSet4.fieldbyname('KKID').AsString)+'''');
|
|||
|
sql.Add(' and YFTYpe=''<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' and KFType=''<27><><EFBFBD>ι<EFBFBD><CEB9><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
if DelYFData(ADOQueryTemp.fieldbyname('CRID').AsString)=False then
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ɾ<><C9BE>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('Update JYOrder_Main_MD_KK Set CWHX=0,CWHXDate=Null,CWHXPerson=''''');
|
|||
|
sql.Add(' where KKID='''+Trim(ClientDataSet4.fieldbyname('KKID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>״̬
|
|||
|
if cxTabControl1.TabIndex<>ComboBox1.ItemIndex then
|
|||
|
begin
|
|||
|
ClientDataSet3.Delete;
|
|||
|
end else
|
|||
|
begin
|
|||
|
ClientDataSet3.Edit;
|
|||
|
ClientDataSet3.FieldByName('SSel').Value:=False;
|
|||
|
ClientDataSet3.Post;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD>״̬
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
function TfrmCWMDList.YFHZData(YFTYpeId,CWFactoryNo,CWFactoryName,KFType:string):Boolean;
|
|||
|
var
|
|||
|
CRID,OrdMainId,YFID,FComTaiTou,FCRID,FFactoryName:String;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where FactoryNo='''+Trim(CWFactoryNo)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
CRID:=ADOQueryTemp.fieldbyname('CRID').AsString;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
|||
|
sql.Add('select * from YF_Money_CRID ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CRID:=ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CRID').Value:=StrToInt(CRID);
|
|||
|
FieldByName('FactoryName').Value:=Trim(CWFactoryName);
|
|||
|
FieldByName('FactoryNo').Value:=Trim(CWFactoryNo);
|
|||
|
FieldByName('ZdyStr1').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where FactoryNo='''+Trim(CWFactoryNo)+'''');
|
|||
|
sql.Add(' and MainId='''+Trim(ClientDataSet3.fieldbyname('ORDMainId').AsString)+'''');
|
|||
|
sql.Add(' and CRTime='''+Trim(ClientDataSet3.fieldbyname('MDDate').AsString)+'''');
|
|||
|
SQL.Add(' and Price='+Trim(ClientDataSet3.fieldbyname('JSPrice').AsString));
|
|||
|
sql.Add(' and KFType=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd,YFID,'ZC','YF_Money_CR',3,1)=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD>뵥Ӧ<EBB5A5><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
YFID:=Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where YFID='''+Trim(YFID)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
Append
|
|||
|
else
|
|||
|
Edit;
|
|||
|
FieldByName('YFID').Value:=Trim(YFID);
|
|||
|
FieldByName('MainId').Value:=Trim(ClientDataSet3.fieldbyname('OrdMainId').AsString);
|
|||
|
FieldByName('CRID').Value:=StrToInt(CRID);
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
FieldByName('CRType').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
|||
|
FieldByName('CRFlag').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyFlag').Value:=1;
|
|||
|
FieldByName('FactoryNo').Value:=Trim(CWFactoryNo);
|
|||
|
FieldByName('FactoryName').Value:=Trim(CWFactoryName);
|
|||
|
FieldByName('HZFactoryNo').Value:=Trim(CWFactoryNo);
|
|||
|
FieldByName('HZFactoryName').Value:=Trim(CWFactoryName);
|
|||
|
FieldByName('CRTime').Value:=ClientDataSet3.fieldbyname('MDDate').Value;
|
|||
|
//FieldByName('Qty').Value:=ClientDataSet3.fieldbyname('Qty').Value;
|
|||
|
//FieldByName('PS').Value:=ClientDataSet3.fieldbyname('PS').Value;
|
|||
|
FieldByName('Price').Value:=ClientDataSet3.fieldbyname('Price').Value;
|
|||
|
FieldByName('QtyUnit').Value:=Trim(ClientDataSet3.fieldbyname('QtyUnit').AsString);
|
|||
|
FieldByName('YFType').Value:='<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('HuiLv').Value:=1;
|
|||
|
FieldByName('BZType').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('YFName').Value:=Trim(ClientDataSet3.fieldbyname('PSName').AsString)+'<27><><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('PSName').Value:=Trim(ClientDataSet3.fieldbyname('PSName').AsString);
|
|||
|
FieldByName('KFType').Value:='<27><><EFBFBD><EFBFBD>';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD_JS Set YFID='''+Trim(YFID)+'''');
|
|||
|
sql.Add(' where MDID='''+Trim(YFTYpeId)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CR Set ');
|
|||
|
sql.Add(' PS=(select isnull(Sum(JSPS),0) from JYOrder_Main_MD_JS A where A.YFID=YF_Money_CR.YFID)');
|
|||
|
sql.Add(' ,Qty=(select isnull(Sum(JSQty),0) from JYOrder_Main_MD_JS A where A.YFID=YF_Money_CR.YFID)');
|
|||
|
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CR Set Money=Price*Qty,BBMoney=Price*Qty');
|
|||
|
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(' where CRID='+CRID);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
Result:=True;
|
|||
|
end;
|
|||
|
function TfrmCWMDList.YFData(YFTYpeId,CWFactoryNo,CWFactoryName,KFType:string):Boolean;
|
|||
|
var
|
|||
|
CRID,OrdMainId,YFID,FComTaiTou,FCRID,FFactoryName:String;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where FactoryNo='''+Trim(CWFactoryNo)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
CRID:=ADOQueryTemp.fieldbyname('CRID').AsString;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
|||
|
sql.Add('select * from YF_Money_CRID ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CRID:=ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CRID').Value:=StrToInt(CRID);
|
|||
|
FieldByName('FactoryName').Value:=Trim(CWFactoryName);
|
|||
|
FieldByName('FactoryNo').Value:=Trim(CWFactoryNo);
|
|||
|
FieldByName('ZdyStr1').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where FactoryNo='''+Trim(CWFactoryNo)+'''');
|
|||
|
sql.Add(' and YFTypeId='''+Trim(YFTYpeId)+'''');
|
|||
|
if cxPageControl1.ActivePageIndex=1 then
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(KFType,'''')='''+Trim(KFType)+'''');
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd,YFID,'ZC','YF_Money_CR',3,1)=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD>뵥Ӧ<EBB5A5><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end else
|
|||
|
if cxPageControl1.ActivePageIndex=1 then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd,YFID,'KK','YF_Money_CR',3,1)=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD>ڲֿ<DAB2><D6BF>뵥Ӧ<EBB5A5><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
YFID:=Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where YFID='''+Trim(YFID)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
Append
|
|||
|
else
|
|||
|
Edit;
|
|||
|
FieldByName('YFID').Value:=Trim(YFID);
|
|||
|
FieldByName('YFTypeId').Value:=Trim(YFTYpeId);
|
|||
|
FieldByName('MainId').Value:=Trim(ClientDataSet3.fieldbyname('OrdMainId').AsString);
|
|||
|
FieldByName('MDID').Value:=Trim(ClientDataSet3.fieldbyname('MDID').AsString);
|
|||
|
FieldByName('CRID').Value:=StrToInt(CRID);
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
FieldByName('CRType').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
|||
|
FieldByName('CRFlag').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyFlag').Value:=1;
|
|||
|
FieldByName('FactoryNo').Value:=Trim(CWFactoryNo);
|
|||
|
FieldByName('FactoryName').Value:=Trim(CWFactoryName);
|
|||
|
FieldByName('HZFactoryNo').Value:=Trim(CWFactoryNo);
|
|||
|
FieldByName('HZFactoryName').Value:=Trim(CWFactoryName);
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
FieldByName('CRTime').Value:=ClientDataSet3.fieldbyname('MDDate').Value
|
|||
|
else
|
|||
|
FieldByName('CRTime').Value:=ClientDataSet4.fieldbyname('KKDate').Value;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
FieldByName('Qty').Value:=ClientDataSet3.fieldbyname('Qty').Value;
|
|||
|
FieldByName('PS').Value:=ClientDataSet3.fieldbyname('PS').Value;
|
|||
|
FieldByName('Price').Value:=ClientDataSet3.fieldbyname('Price').Value;
|
|||
|
FieldByName('QtyUnit').Value:=Trim(ClientDataSet3.fieldbyname('QtyUnit').AsString);
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('Qty').Value:=1;
|
|||
|
if Trim(KFType)='<27><><EFBFBD>ι<EFBFBD><CEB9><EFBFBD>' then
|
|||
|
FieldByName('Price').Value:=ClientDataSet4.fieldbyname('ZZFtyMoney').Value*-1
|
|||
|
else
|
|||
|
FieldByName('Price').Value:=ClientDataSet4.fieldbyname('ZZPonMoney').Value*-1;
|
|||
|
end;
|
|||
|
FieldByName('YFType').Value:='<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('HuiLv').Value:=1;
|
|||
|
FieldByName('BZType').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
FieldByName('YFName').Value:=Trim(ClientDataSet3.fieldbyname('PSName').AsString)+'<27><><EFBFBD><EFBFBD>';
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('YFName').Value:='<27>۷<EFBFBD>';
|
|||
|
FieldByName('KFType').Value:=Trim(KFType);
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CR Set Money=Price*Qty,BBMoney=Price*Qty');
|
|||
|
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(' where CRID='+CRID);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
if cxPageControl1.ActivePageIndex=1 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYorder_Main_MD_JS Set YFID='''+Trim(YFID)+'''');
|
|||
|
sql.Add(' where KKID='''+Trim(YFTYpeId)+'''');
|
|||
|
sql.Add(' and FactoryNo='''+Trim(CWFactoryNo)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Result:=True;
|
|||
|
end;
|
|||
|
function TfrmCWMDList.DelYFHZData(CRID:String):Boolean;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(' where CRID='+Trim(CRID));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete YF_Money_CR where not exists(select * from JYOrder_Main_MD_JS A where ');
|
|||
|
sql.Add(' A.YFID=YF_Money_CR.YFID and YF_Money_CR.YFType=''<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>'' )');
|
|||
|
sql.Add(' and YFType=''<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
end;
|
|||
|
function TfrmCWMDList.DelYFData(CRID:String):Boolean;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete YF_Money_CR where ');
|
|||
|
sql.Add(' MDId='''+Trim(ClientDataSet3.fieldbyname('MDId').AsString)+'''');
|
|||
|
sql.Add(' and YFType=''<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
|||
|
sql.Add(' where CRID='+Trim(CRID));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.Tv1FocusedRecordChanged(
|
|||
|
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
|||
|
AFocusedRecord: TcxCustomGridRecord;
|
|||
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD_KK where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
sql.Add(' and isnull(KKTYpe,'''')=''Э<><D0AD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery1,ClientDataSet2);
|
|||
|
SInitCDSData20(ADOQuery1,ClientDataSet2);
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD_KK where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
sql.Add(' and isnull(KKTYpe,'''')=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery1,ClientDataSet4);
|
|||
|
SInitCDSData20(ADOQuery1,ClientDataSet4);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmModuleNote:=TfrmModuleNote.Create(Application);
|
|||
|
with frmModuleNote do
|
|||
|
begin
|
|||
|
flag:='<27><><EFBFBD>˹<EFBFBD><CBB9><EFBFBD>';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmModuleNote.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.v3Column19PropertiesEditValueChanged(
|
|||
|
Sender: TObject);
|
|||
|
var
|
|||
|
mvalue,FName,FPrice,FQty:string;
|
|||
|
begin
|
|||
|
FName:=Trim(Tv3.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
if Trim(mvalue)='' then
|
|||
|
begin
|
|||
|
mvalue:='0';
|
|||
|
end;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FName).Value:=mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
FPrice:=Trim(ClientDataSet3.fieldbyname('JSPrice').AsString);
|
|||
|
FQty:=Trim(ClientDataSet3.fieldbyname('JSQty').AsString);
|
|||
|
if Trim(FPrice)='' then
|
|||
|
begin
|
|||
|
FPrice:='0';
|
|||
|
end;
|
|||
|
if Trim(FQty)='' then
|
|||
|
begin
|
|||
|
FQty:='0';
|
|||
|
end;
|
|||
|
if Trim(FName)<>'JSMoney' then
|
|||
|
begin
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('JSMoney').Value:=StrToFloat(FPrice)*StrToFloat(FQty);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('JSMoney').Value:=mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(ClientDataSet3,True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(ClientDataSet3,False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.N3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
ClientDataSet3.DisableControls;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
while ClientDataSet3.Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('JSPS').Value:=FieldByName('PS').Value;
|
|||
|
FieldByName('JSQty').Value:=FieldByName('Qty').Value;
|
|||
|
FieldByName('JSPrice').Value:=FieldByName('Price').Value;
|
|||
|
FieldByName('JSMoney').Value:=FieldByName('Money').Value;
|
|||
|
FieldByName('SSel').Value:=False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWMDList.Tv1DblClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmTJCKRKOK:=TfrmTJCKRKOK.Create(Application);
|
|||
|
with frmTJCKRKOK do
|
|||
|
begin
|
|||
|
|
|||
|
if Trim(Self.ClientDataSet3.fieldbyname('Status').AsString)='Э<><D0AD>' then
|
|||
|
frmTJCKRKOK.cxTabControl1.TabIndex:=2
|
|||
|
else
|
|||
|
if Trim(Self.ClientDataSet3.fieldbyname('Status').AsString)='<27><><EFBFBD><EFBFBD>' then
|
|||
|
frmTJCKRKOK.cxTabControl1.TabIndex:=3;
|
|||
|
//frmTJCKRKOK.OrderNo.Text:=Trim(self.ClientDataSet3.fieldbyname('OrderNo').AsString);
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select JM.OrderNo, A.*,B.PSName OrdPSName,C.ConNo,C.FactoryNoName,D.Price, ');
|
|||
|
sql.Add(' JS.PRTHX,JS.PRTColor,JS.PRTColorNo,D.C_Code,D.C_CodeName,ClotheType10=A.ClotheType,');
|
|||
|
sql.Add(' JSKCPS=A.RKPS-A.CKPS,');
|
|||
|
sql.Add(' JSKCQty=A.RKQty-A.CKQty,');
|
|||
|
sql.Add(' JM.MPRTCodeName,MPRTCode=RTrim(JM.MPRTCode)+RTrim(JM.MPRTGY)');
|
|||
|
sql.Add(' from JYOrder_Main_MD A');
|
|||
|
sql.Add(' inner join JYOrder_Main JM on A.OrdMainId=JM.MainId');
|
|||
|
sql.Add(' left join JYOrder_Sub JS on A.OrdSubId=JS.SubId');
|
|||
|
sql.Add(' inner join JYOrder_Process B on A.PSID=B.PSID');
|
|||
|
sql.Add(' inner join Contract_Main C on A.ConMainid=C.MainID');
|
|||
|
sql.Add(' inner join Contract_Sub D on A.ConSubid=D.SubID');
|
|||
|
sql.Add(' where A.MDID='''+Trim(Self.ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
SQL.Add(' and isnull(A.CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'' ');
|
|||
|
if cxTabControl1.TabIndex=2 then
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.Status,'''')=''Э<><D0AD>'' ');
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=3 then
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.Status,'''')=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery1,ClientDataSet6);
|
|||
|
SInitCDSData20(ADOQuery1,ClientDataSet6);
|
|||
|
fsj:='select Code=FactoryNo,Name=FactoryName from JYOrder_Main_MD where ORDMainId='''+Trim(ClientDataSet6.fieldbyname('ORDMainId').AsString)+''''+
|
|||
|
' group by FactoryNo,FactoryName';
|
|||
|
SInitCxBandGridComboBoxBySql(frmTJCKRKOK.ADOQueryTemp,frmTJCKRKOK.v2fty,fsj,1,True,'');
|
|||
|
with frmTJCKRKOK.ADOQuery1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD where MDID='''+Trim(ClientDataSet6.fieldbyname('MDID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCSHDataNew(frmTJCKRKOK.ADOQuery1,frmTJCKRKOK.ScrollBox1,2);
|
|||
|
frmTJCKRKOK.InitGridKK();
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD_Out where MDID='''+Trim(ClientDataSet6.fieldbyname('MDID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTJCKRKOK.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|