1573 lines
49 KiB
ObjectPascal
1573 lines
49 KiB
ObjectPascal
![]() |
unit U_MDManageChk; //29
|
|||
|
|
|||
|
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, cxButtonEdit;
|
|||
|
|
|||
|
type
|
|||
|
TfrmMDManageChk = 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;
|
|||
|
ConName: TEdit;
|
|||
|
PRTColorHZ: TEdit;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
orderNo: TEdit;
|
|||
|
gangNo: 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;
|
|||
|
Tv3Column1: 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;
|
|||
|
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;
|
|||
|
ConCode: 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;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
v3Column14: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
Panel3: TPanel;
|
|||
|
Label13: TLabel;
|
|||
|
cxGrid71: TcxGrid;
|
|||
|
Tv71: TcxGridDBTableView;
|
|||
|
v2Column2: TcxGridDBColumn;
|
|||
|
V2XH: TcxGridDBColumn;
|
|||
|
cxGridDBColumn15: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn27: TcxGridDBColumn;
|
|||
|
cxGridLevel3: TcxGridLevel;
|
|||
|
Panel7: TPanel;
|
|||
|
Label23: TLabel;
|
|||
|
cxGrid72: TcxGrid;
|
|||
|
Tv72: TcxGridDBTableView;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1SOrddefstr1: TcxGridDBColumn;
|
|||
|
v1PRTColor: TcxGridDBColumn;
|
|||
|
cxGridDBColumn28: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1PRTOrderQty: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1OrderUnit: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
Panel2: TPanel;
|
|||
|
Label21: TLabel;
|
|||
|
cxGrid77: TcxGrid;
|
|||
|
Tv77: TcxGridDBTableView;
|
|||
|
v5Column8: TcxGridDBColumn;
|
|||
|
cxGridDBColumn29: TcxGridDBColumn;
|
|||
|
v5Column6: TcxGridDBColumn;
|
|||
|
v5Column2: TcxGridDBColumn;
|
|||
|
v5Column7: TcxGridDBColumn;
|
|||
|
cxGridDBColumn30: TcxGridDBColumn;
|
|||
|
v5Column3: TcxGridDBColumn;
|
|||
|
v5Column4: TcxGridDBColumn;
|
|||
|
v5Column5: TcxGridDBColumn;
|
|||
|
v5Column10: TcxGridDBColumn;
|
|||
|
v5Column1: TcxGridDBColumn;
|
|||
|
v5Column9: TcxGridDBColumn;
|
|||
|
cxGridLevel4: TcxGridLevel;
|
|||
|
Panel4: TPanel;
|
|||
|
Button1: TButton;
|
|||
|
Button2: TButton;
|
|||
|
DataSource71: TDataSource;
|
|||
|
ClientDataSet71: TClientDataSet;
|
|||
|
cxGridPopupMenu71: TcxGridPopupMenu;
|
|||
|
DataSource72: TDataSource;
|
|||
|
ClientDataSet72: TClientDataSet;
|
|||
|
cxGridPopupMenu72: TcxGridPopupMenu;
|
|||
|
DataSource77: TDataSource;
|
|||
|
ClientDataSet77: TClientDataSet;
|
|||
|
cxGridPopupMenu77: TcxGridPopupMenu;
|
|||
|
Label11: TLabel;
|
|||
|
Edit1: TEdit;
|
|||
|
cxGrid6: TcxGrid;
|
|||
|
TvOrdeNo: TcxGridDBTableView;
|
|||
|
VOrderNo: TcxGridDBColumn;
|
|||
|
cxGrid4Level1: TcxGridLevel;
|
|||
|
CDS_OrderNo: TClientDataSet;
|
|||
|
DS_OrderNo: TDataSource;
|
|||
|
v77Column1: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
v3Column15: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v3Column16: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v3Column17: TcxGridDBColumn;
|
|||
|
v3Column18: TcxGridDBColumn;
|
|||
|
ClientDataSet8: TClientDataSet;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
ClientDataSet9: TClientDataSet;
|
|||
|
ADOTemp: TADOQuery;
|
|||
|
v3Column19: TcxGridDBColumn;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
v3Column20: 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 ToolButton4Click(Sender: TObject);
|
|||
|
procedure Tv3MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
procedure Tv3Column1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure Tv1Column3PropertiesButtonClick(Sender: TObject;
|
|||
|
AButtonIndex: Integer);
|
|||
|
procedure Tv1Column4PropertiesButtonClick(Sender: TObject;
|
|||
|
AButtonIndex: Integer);
|
|||
|
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
procedure Tv1Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure v2Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure v1Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure v5Column8PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure Edit1Change(Sender: TObject);
|
|||
|
procedure TvOrdeNoDblClick(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure v1Column13PropertiesButtonClick(Sender: TObject;
|
|||
|
AButtonIndex: Integer);
|
|||
|
procedure v3Column14PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure v1Column1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
canshu1,canshu2,FMainId,FOrderNo:string;
|
|||
|
procedure UPMDWCdata(FQtyUnit,FPFID:String);
|
|||
|
function UpdateTJCKQty10(FFPFID:string):Boolean;
|
|||
|
function UpdateTJCKQty(FFPFID:string):Boolean;
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmMDManageChk: TfrmMDManageChk;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_RTFun, U_GYSList,U_ZDYHelp, U_ModuleNote;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmMDManageChk.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmMDManageChk:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.TBRafreshClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQuery3.DisableControls;
|
|||
|
with ADOQuery3 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Filtered:=False;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_View_MD :begdate,:enddate,:orderno,:MDType,:WSql');
|
|||
|
Parameters.ParamByName('begdate').Value:='';
|
|||
|
Parameters.ParamByName('enddate').Value:='';
|
|||
|
Parameters.ParamByName('orderno').Value:='';
|
|||
|
Parameters.ParamByName('MDType').Value:='';
|
|||
|
fsj:=' and JMM.FillTime>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+''''
|
|||
|
+' and JMM.FillTime<'''+Trim(FormatDateTime('yyyy-MM-dd',enddate.Date+1))+'''';
|
|||
|
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 HCFlag=0';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and HCFlag=1';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:=fsj;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery3,ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQuery3,ClientDataSet3);
|
|||
|
finally
|
|||
|
ADOQuery3.EnableControls;
|
|||
|
end;
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
canshu1:=Trim(DParameters1);
|
|||
|
canshu2:=Trim(DParameters2);
|
|||
|
EndDate.Date:=SGetServerDate(ADOQueryTemp);
|
|||
|
BegDate.Date:=EndDate.Date-7;
|
|||
|
cxPageControl1.ActivePageIndex:=0;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>',Tv3,'<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>');
|
|||
|
WriteCxGrid('<27><><EFBFBD>ڲֿ<DAB2><D6BF>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>',Tv1,'<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.cxPageControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQuery3.Active=False then Exit;
|
|||
|
SDofilter(ADOQuery3,SGetFilters(Panel1,1,2));
|
|||
|
SCreateCDS20(ADOQuery3,ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQuery3,ClientDataSet3);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.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;
|
|||
|
sql.Add('exec P_View_MD :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(JMM.CKName,'''')='''' ';
|
|||
|
end else
|
|||
|
begin
|
|||
|
fsj:=' and isnull(JMM.CKName,'''')<>'''' ';
|
|||
|
end;
|
|||
|
if cxTabControl1.TabIndex=0 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and HCFlag=0';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and HCFlag=1';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:=fsj;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery3,ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQuery3,ClientDataSet3);
|
|||
|
finally
|
|||
|
ADOQuery3.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.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 :begdate,:enddate,:orderno,:MDType,:WSql');
|
|||
|
Parameters.ParamByName('begdate').Value:='';
|
|||
|
Parameters.ParamByName('enddate').Value:='';
|
|||
|
Parameters.ParamByName('orderno').Value:='';
|
|||
|
Parameters.ParamByName('MDType').Value:='';
|
|||
|
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 HCFalg=0';
|
|||
|
end else
|
|||
|
if cxTabControl1.TabIndex=1 then
|
|||
|
begin
|
|||
|
fsj:=fsj+' and HCFalg=1';
|
|||
|
end;
|
|||
|
Parameters.ParamByName('WSql').Value:=fsj;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery3,ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQuery3,ClientDataSet3);
|
|||
|
finally
|
|||
|
ADOQuery3.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.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 TfrmMDManageChk.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
READCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>',Tv3,'<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>');
|
|||
|
READCxGrid('<27><><EFBFBD>ڲֿ<DAB2><D6BF>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>',Tv1,'<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
if ClientDataSet3.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
ToolBar1.SetFocus;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
ClientDataSet3.DisableControls;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
while ClientDataSet3.Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Editer').Value:=Trim(DName);
|
|||
|
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
RTSetSaveDataCDS(ADOQueryCmd,Tv3,ClientDataSet3,'JYOrder_Main_MD',99)
|
|||
|
else
|
|||
|
RTSetSaveDataCDS(ADOQueryCmd,Tv1,ClientDataSet3,'JYOrder_Main_MD',99);
|
|||
|
FieldByName('FromFactoryNo').Value:=Trim(ClientDataSet3.fieldbyname('FromFactoryNo').AsString);
|
|||
|
if ClientDataSet3.FieldByName('OtherOrdFlag').AsBoolean=True then
|
|||
|
begin
|
|||
|
FieldByName('OtherOrdFlag').Value:=1;
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('OtherOrdFlag').Value:=0;
|
|||
|
end;
|
|||
|
if ClientDataSet3.FieldByName('HXFlag').AsBoolean=True then
|
|||
|
begin
|
|||
|
FieldByName('HXFlag').Value:=1;
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('HXFlag').Value:=0;
|
|||
|
end;
|
|||
|
if ClientDataSet3.FieldByName('CiPinFlag').AsBoolean=True then
|
|||
|
begin
|
|||
|
FieldByName('CiPinFlag').Value:=1;
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('CiPinFlag').Value:=0;
|
|||
|
end;
|
|||
|
FieldByName('RKDate').Value:=ClientDataSet3.fieldbyname('MDDate').Value;
|
|||
|
FieldByName('RKPS').Value:=ClientDataSet3.fieldbyname('PS').Value;
|
|||
|
FieldByName('RKQty').Value:=ClientDataSet3.fieldbyname('Qty').Value;
|
|||
|
FieldByName('RKQtyUnit').Value:=ClientDataSet3.fieldbyname('QtyUnit').Value;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
if Trim(ClientDataSet3.fieldbyname('QtyUnit').AsString)<>'M' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set WCMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')='''')*');
|
|||
|
end
|
|||
|
else
|
|||
|
if cxPageControl1.ActivePageIndex=1 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set TJMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'')*');
|
|||
|
end;
|
|||
|
sql.Add('(select KgZM from JYOrder_Process A where A.PSID=JYOrder_PCS_Sub.PSID)');
|
|||
|
sql.Add(' where PFID='''+Trim(ClientDataSet3.fieldbyname('PFID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set WCMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')='''')');
|
|||
|
end else
|
|||
|
if cxPageControl1.ActivePageIndex=1 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set TJMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'')');
|
|||
|
end;
|
|||
|
sql.Add(' where PFID='''+Trim(ClientDataSet3.fieldbyname('PFID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
UpdateTJCKQty(Trim(ClientDataSet3.fieldbyname('PFID').AsString));
|
|||
|
end;
|
|||
|
{if UpdateTJCKQty(Trim(ClientDataSet3.fieldbyname('PFID').AsString)) then
|
|||
|
begin
|
|||
|
|
|||
|
end else
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
//Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
exit;
|
|||
|
end;}
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
function TfrmMDManageChk.UpdateTJCKQty(FFPFID:string):Boolean;
|
|||
|
var
|
|||
|
FAPQty,FMDQty,FPS,FQty:Double;
|
|||
|
begin
|
|||
|
|
|||
|
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
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
{with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_PCS_Sub where PFID='''+Trim(FFPFID)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
FAPQty:=ADOQueryTemp.fieldbyname('PFTPQty').Value;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select isnull(sum(Qty),0) MDQty from JYOrder_Main_MD where PFID='''+Trim(FFPFID)+'''');
|
|||
|
sql.Add(' and isnull(CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
FMDQty:=ADOQueryTemp.fieldbyname('MDQty').Value;
|
|||
|
if FMDQty>FAPQty then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>뵥!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end; }
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select isnull(sum(PS),0) PS,isnull(Sum(Qty),0) Qty from JYOrder_Main_MD where PFID='''+Trim(FFPFID)+'''');
|
|||
|
sql.Add(' and isnull(CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
FPS:=ADOQueryTemp.fieldbyname('PS').Value;
|
|||
|
FQty:=ADOQueryTemp.fieldbyname('Qty').Value;
|
|||
|
if FQty=0 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD_Out Set SJCKPS=0,SJCKQty=0');
|
|||
|
sql.Add(' where PFID='''+Trim(FFPFID)+'''');
|
|||
|
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 in');
|
|||
|
sql.Add('(select MDID from JYOrder_Main_MD_Out JMO where JMO.PFID='''+Trim(FFPFID)+''')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD_Out Set SJCKPS=0,SJCKQty=0');
|
|||
|
sql.Add(' where PFID='''+Trim(FFPFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD_Out where PFID='''+Trim(FFPFID)+'''');
|
|||
|
sql.Add(' order by CKQty');
|
|||
|
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.RecordCount>1 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd 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;
|
|||
|
ClientDataSet8.Delete;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' Update JYOrder_Main_MD_Out Set SJCKPS='+floattostr(FPS)+',SJCKQty='+floattostr(FQty));
|
|||
|
sql.Add(' where CKID='''+Trim(ClientDataSet8.fieldbyname('CKID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
FPS:=0;
|
|||
|
FQty:=0;
|
|||
|
ClientDataSet8.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd 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 ADOQueryCmd 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 in');
|
|||
|
sql.Add('(select MDID from JYOrder_Main_MD_Out JMO where JMO.PFID='''+Trim(FFPFID)+''')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
function TfrmMDManageChk.UpdateTJCKQty10(FFPFID:string):Boolean;
|
|||
|
var
|
|||
|
FAPQty,FMDQty,FPS,FQty:Double;
|
|||
|
begin
|
|||
|
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
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_PCS_Sub where PFID='''+Trim(FFPFID)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
FAPQty:=ADOQueryTemp.fieldbyname('PFTPQty').Value;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select isnull(sum(Qty),0) MDQty from JYOrder_Main_MD where PFID='''+Trim(FFPFID)+'''');
|
|||
|
sql.Add(' and isnull(CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
FMDQty:=ADOQueryTemp.fieldbyname('MDQty').Value;
|
|||
|
if FMDQty>FAPQty then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>뵥!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select isnull(sum(PS),0) PS,isnull(Sum(Qty),0) Qty from JYOrder_Main_MD where PFID='''+Trim(FFPFID)+'''');
|
|||
|
sql.Add(' and isnull(CKName,'''')<>''<27><><EFBFBD>ڲֿ<DAB2>''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
FPS:=ADOQueryTemp.fieldbyname('PS').Value;
|
|||
|
FQty:=ADOQueryTemp.fieldbyname('Qty').Value;
|
|||
|
if FQty=0 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD_Out Set SJCKPS=0,SJCKQty=0');
|
|||
|
sql.Add(' where PFID='''+Trim(FFPFID)+'''');
|
|||
|
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 in');
|
|||
|
sql.Add('(select MDID from JYOrder_Main_MD_Out JMO where JMO.PFID='''+Trim(FFPFID)+''')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD_Out Set SJCKPS=0,SJCKQty=0');
|
|||
|
sql.Add(' where PFID='''+Trim(FFPFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Main_MD_Out where PFID='''+Trim(FFPFID)+'''');
|
|||
|
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
|
|||
|
with ADOQueryCmd 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;
|
|||
|
ClientDataSet8.Delete;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd 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 ADOQueryCmd 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 in');
|
|||
|
sql.Add('(select MDID from JYOrder_Main_MD_Out JMO where JMO.PFID='''+Trim(FFPFID)+''')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TfrmMDManageChk.Tv3MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
fsj:='select Code=FactoryNo,Name=FactoryName from JYOrder_PCS_Sub where MainId='''+Trim(ClientDataSet3.fieldbyname('ORDMainId').AsString)+''''+
|
|||
|
' and isnull(FactoryNo,'''')<>'''' group by FactoryNo,FactoryName';
|
|||
|
SInitCxGridComboBoxBySql(ADOQuery1,Tv3Column1,fsj,1,True,'');
|
|||
|
fsj:='select PSName Name, Cast('''' as varchar(20)) code from JYOrder_Process '+
|
|||
|
' where Mainid='''+Trim(ClientDataSet3.fieldbyname('ORDMainId').AsString)+''' order by PSXH';
|
|||
|
SInitComBoxBySql(ADOQueryTemp,PSName,False,fsj);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.Tv3Column1PropertiesEditValueChanged(
|
|||
|
Sender: TObject);
|
|||
|
var
|
|||
|
mvalue,fsj:string;
|
|||
|
begin
|
|||
|
mvalue:=TcxComboBox(Sender).EditingText;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('FromFactoryName').Value:=Trim(mvalue);
|
|||
|
fsj:=TA((Tv3Column1.Properties as TcxComboBoxProperties).Items.Objects[(Tv3Column1.Properties as TcxComboBoxProperties).Items.IndexOf(Trim(mvalue))]).S;
|
|||
|
FieldByName('FromFactoryNo').Value:=Trim(fsj);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
if ClientDataSet3.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><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;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
ClientDataSet3.DisableControls;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
while Locate('SSel',True,[])=true do
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY where APID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC>鲻<EFBFBD><E9B2BB>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if ClientDataSet3.FieldByName('RKQty').AsFloat>0 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ⲻ<EFBFBD><E2B2BB>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete JYOrder_Main_MD where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
if Trim(ClientDataSet3.fieldbyname('QtyUnit').AsString)<>'M' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set WCMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')='''')*');
|
|||
|
end
|
|||
|
else
|
|||
|
if cxPageControl1.ActivePageIndex=1 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set TJMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'')*');
|
|||
|
end;
|
|||
|
sql.Add('(select KgZM from JYOrder_Process A where A.PSID=JYOrder_PCS_Sub.PSID)');
|
|||
|
sql.Add(' where PFID='''+Trim(ClientDataSet3.fieldbyname('PFID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set WCMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')='''')');
|
|||
|
end else
|
|||
|
if cxPageControl1.ActivePageIndex=1 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set TJMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'')');
|
|||
|
end;
|
|||
|
sql.Add(' where PFID='''+Trim(ClientDataSet3.fieldbyname('PFID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
UpdateTJCKQty(Trim(ClientDataSet3.fieldbyname('PFID').AsString));
|
|||
|
end;
|
|||
|
ClientDataSet3.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
Application.MessageBox('ɾ<><C9BE><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.Tv1Column3PropertiesButtonClick(Sender: TObject;
|
|||
|
AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag:='DutyReason';
|
|||
|
flagname:='<27><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
with Self.ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('DutyReason').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
//Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.Tv1Column4PropertiesButtonClick(Sender: TObject;
|
|||
|
AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmGYSList:=TfrmGYSList.Create(Application);
|
|||
|
with frmGYSList do
|
|||
|
begin
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
with Self.ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('ToFactoryNo').Value:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
|||
|
FieldByName('ToFactoryName').Value:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
|||
|
//Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmGYSList.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.Tv1MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
fsj:='select Code=FactoryNo,Name=FactoryName from JYOrder_PCS_Sub where MainId='''+Trim(ClientDataSet3.fieldbyname('ORDMainId').AsString)+''''+
|
|||
|
' and isnull(FactoryNo,'''')<>'''' group by FactoryNo,FactoryName';
|
|||
|
SInitCxGridComboBoxBySql(ADOQuery1,Tv1Column2,fsj,1,True,'');
|
|||
|
fsj:='select Code=PFGenDanPerson,Name=PFGenDanPerson from JYOrder_PCS_Sub where MainId='''+Trim(ClientDataSet3.fieldbyname('ORDMainId').AsString)+''''+
|
|||
|
' and isnull(PFGenDanPerson,'''')<>'''' group by PFGenDanPerson';
|
|||
|
SInitCxGridComboBoxBySql(ADOQuery1,Tv1Column1,fsj,1,True,'');
|
|||
|
fsj:='select PSName Name, Cast('''' as varchar(20)) code from JYOrder_Process '+
|
|||
|
'where Mainid='''+Trim(ClientDataSet3.fieldbyname('ORDMainId').AsString)+''' order by PSXH';
|
|||
|
SInitComBoxBySql(ADOQueryTemp,PSName,False,fsj);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.Tv1Column2PropertiesEditValueChanged(
|
|||
|
Sender: TObject);
|
|||
|
var
|
|||
|
mvalue,fsj:string;
|
|||
|
begin
|
|||
|
mvalue:=TcxComboBox(Sender).EditingText;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('DutyFactoryName').Value:=Trim(mvalue);
|
|||
|
fsj:=TA((Tv1Column2.Properties as TcxComboBoxProperties).Items.Objects[(Tv1Column2.Properties as TcxComboBoxProperties).Items.IndexOf(Trim(mvalue))]).S;
|
|||
|
FieldByName('DutyFactoryNo').Value:=Trim(fsj);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
ScrollBox1.Visible:=True;
|
|||
|
ScrollBox1.Refresh;
|
|||
|
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
ScrollBox1.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.v2Column2PropertiesEditValueChanged(
|
|||
|
Sender: TObject);
|
|||
|
var
|
|||
|
PSID,ConType:String;
|
|||
|
Mvalue:Boolean;
|
|||
|
begin
|
|||
|
Mvalue:=TcxCheckBox(Sender).EditingValue;
|
|||
|
PSID:=Trim(ClientDataSet71.fieldbyname('PSID').AsString);
|
|||
|
with ClientDataSet71 do
|
|||
|
begin
|
|||
|
while ClientDataSet71.Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
ClientDataSet71.Locate('PSID',PSID,[]);
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=Mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.PRTHX,B.PRTColorNo,B.PRTColor,B.PRTOrdQty,B.OrderUnit,B.ColorNote,JP.PSName ');
|
|||
|
sql.Add(',Case when A.PFTPMQty<>0 then Cast((A.WCMQty-A.TJMQty)*100*1.00/A.PFTPMQty as decimal(18,2)) else 0 end as WCL');
|
|||
|
sql.Add(' from JYOrder_PCS_Sub A');
|
|||
|
sql.Add(' inner join JYOrder_Process JP on A.PSID=JP.PSID');
|
|||
|
sql.Add(' left join JYOrder_Sub B on A.SubId=B.SubId');
|
|||
|
if Mvalue=True then
|
|||
|
sql.Add('where A.PSID='''+Trim(ClientDataSet71.fieldbyname('PSID').AsString)+'''')
|
|||
|
else
|
|||
|
sql.Add(' where A.MainId='''+Trim(FMainId)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery1,ClientDataSet72);
|
|||
|
SInitCDSData20(ADOQuery1,ClientDataSet72);
|
|||
|
if Mvalue=True then
|
|||
|
begin
|
|||
|
ClientDataSet71.Locate('SSel',True,[]);
|
|||
|
ConType:=Trim(ClientDataSet71.fieldbyname('PSName').AsString);
|
|||
|
end else
|
|||
|
begin
|
|||
|
ConType:='';
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Contract_Main A inner join Contract_Sub B on A.MainId=B.MainId ');
|
|||
|
sql.Add(' where A.ConNo like '''+'%'+Trim(FOrderNo)+'%'+'''');
|
|||
|
if Trim(ConType)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and A.ConType='''+Trim(ConType)+'''');
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,ClientDataSet77);
|
|||
|
SInitCDSData20(ADOQueryTemp,ClientDataSet77);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.v1Column2PropertiesEditValueChanged(
|
|||
|
Sender: TObject);
|
|||
|
var
|
|||
|
PFID:String;
|
|||
|
Mvalue:Boolean;
|
|||
|
begin
|
|||
|
Mvalue:=TcxCheckBox(Sender).EditingValue;
|
|||
|
PFID:=Trim(ClientDataSet72.fieldbyname('PFID').AsString);
|
|||
|
with ClientDataSet72 do
|
|||
|
begin
|
|||
|
while ClientDataSet72.Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
ClientDataSet72.Locate('PFID',PFID,[]);
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=Mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
if Mvalue=True then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Contract_Main A inner join Contract_Sub B on A.MainId=B.MainId ');
|
|||
|
sql.Add(' where A.ConNo like '''+'%'+Trim(FOrderNo)+'%'+'''');
|
|||
|
sql.Add(' and A.ConType='''+Trim(ClientDataSet72.fieldbyname('PSName').AsString)+'''');
|
|||
|
sql.Add(' and A.FactoryNoName='''+Trim(ClientDataSet72.fieldbyname('FactoryName').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,ClientDataSet77);
|
|||
|
SInitCDSData20(ADOQueryTemp,ClientDataSet77);
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Contract_Main A inner join Contract_Sub B on A.MainId=B.MainId ');
|
|||
|
sql.Add(' where A.ConNo like '''+'%'+Trim(FOrderNo)+'%'+'''');
|
|||
|
sql.Add(' and A.ConType='''+Trim(ClientDataSet72.fieldbyname('PSName').AsString)+'''');
|
|||
|
//sql.Add(' and A.FactoryNoName='''+Trim(ClientDataSet1.fieldbyname('FactoryName').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,ClientDataSet77);
|
|||
|
SInitCDSData20(ADOQueryTemp,ClientDataSet77);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.v5Column8PropertiesEditValueChanged(
|
|||
|
Sender: TObject);
|
|||
|
var
|
|||
|
PSID:String;
|
|||
|
Mvalue:Boolean;
|
|||
|
begin
|
|||
|
Mvalue:=TcxCheckBox(Sender).EditingValue;
|
|||
|
PSID:=Trim(ClientDataSet77.fieldbyname('SubID').AsString);
|
|||
|
with ClientDataSet77 do
|
|||
|
begin
|
|||
|
while ClientDataSet77.Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
ClientDataSet77.Locate('SubID',PSID,[]);
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=Mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
FQtyUnit,FPFID:String;
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
if ClientDataSet3.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if ClientDataSet71.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if ClientDataSet72.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if ClientDataSet77.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD>ͬ!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
ClientDataSet71.Locate('SSel',True,[]);
|
|||
|
ClientDataSet72.Locate('SSel',True,[]);
|
|||
|
ClientDataSet77.Locate('SSel',True,[]);
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
ClientDataSet3.DisableControls;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
while Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
FQtyUnit:=Trim(ClientDataSet3.fieldbyname('QtyUnit').AsString);
|
|||
|
FPFID:=Trim(ClientDataSet3.fieldbyname('PFID').AsString);
|
|||
|
{if ClientDataSet3.FieldByName('RKQty').AsFloat>0 then
|
|||
|
begin
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ⲻ<EFBFBD><E2B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>!','',0);
|
|||
|
Exit;
|
|||
|
end;}
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('UPdate JYOrder_Main_MD Set Editer='''+Trim(DName)+''',EditTime=getdate(),');
|
|||
|
sql.Add(' ORDMainId='''+Trim(ClientDataSet72.fieldbyname('MainId').AsString)+'''');
|
|||
|
sql.Add(' ,ORDSubId='''+Trim(ClientDataSet72.fieldbyname('SubId').AsString)+'''');
|
|||
|
sql.Add(' ,PSId='''+Trim(ClientDataSet72.fieldbyname('PSId').AsString)+'''');
|
|||
|
sql.Add(' ,PFId='''+Trim(ClientDataSet72.fieldbyname('PFId').AsString)+'''');
|
|||
|
sql.Add(' ,ConMainId='''+Trim(ClientDataSet77.fieldbyname('MainId').AsString)+'''');
|
|||
|
sql.Add(' ,ConSubId='''+Trim(ClientDataSet77.fieldbyname('SubId').AsString)+'''');
|
|||
|
SQL.Add(' ,PSName='''+Trim(ClientDataSet71.fieldbyname('PSName').AsString)+'''');
|
|||
|
SQL.Add(' ,FactoryNo='''+Trim(ClientDataSet77.fieldbyname('FactoryNo').AsString)+'''');
|
|||
|
SQL.Add(' ,FactoryName='''+Trim(ClientDataSet77.fieldbyname('FactoryNoName').AsString)+'''');
|
|||
|
sql.Add(' where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
UPMDWCdata(FQtyUnit,FPFID);
|
|||
|
UPMDWCdata(FQtyUnit,Trim(ClientDataSet72.fieldbyname('PFId').AsString));
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
UpdateTJCKQty(FPFID);
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=false;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TfrmMDManageChk.UPMDWCdata(FQtyUnit,FPFID:String);
|
|||
|
begin
|
|||
|
if Trim(FQtyUnit)<>'M' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set WCMQty=');
|
|||
|
sql.Add('isnull((select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')='''')*');
|
|||
|
end
|
|||
|
else
|
|||
|
if cxPageControl1.ActivePageIndex=1 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set TJMQty=');
|
|||
|
sql.Add('isnull((select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'')*');
|
|||
|
end;
|
|||
|
sql.Add('(select KgZM from JYOrder_Process A where A.PSID=JYOrder_PCS_Sub.PSID),0)');
|
|||
|
sql.Add(' where PFID='''+Trim(FPFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
if cxPageControl1.ActivePageIndex=0 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set WCMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')='''')');
|
|||
|
end else
|
|||
|
if cxPageControl1.ActivePageIndex=1 then
|
|||
|
begin
|
|||
|
sql.Add('Update JYOrder_PCS_Sub Set TJMQty=');
|
|||
|
sql.Add('(select isnull(sum(Qty),0) from JYOrder_Main_MD A where A.PFID=JYOrder_PCS_Sub.PFID and isnull(CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'')');
|
|||
|
end;
|
|||
|
sql.Add(' where PFID='''+Trim(FPFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.Edit1Change(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue:String;
|
|||
|
begin
|
|||
|
mvalue:=Trim(Edit1.Text);
|
|||
|
if Length(Trim(mvalue))<2 then
|
|||
|
begin
|
|||
|
cxGrid6.Visible:=False;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
mvalue:='%'+Trim(mvalue)+'%';
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select OrderNo,MPRTCodeName,A.MainId from JYOrder_Main A');
|
|||
|
sql.Add(' where A.orderno like :orderno ');
|
|||
|
//sql.Add(' and A.MainId in(select MainId from JYOrder_Sub B where B.Mainid=A.MainId and B.subId in(select OrdSubId from Contract_Cloth_LL))');
|
|||
|
Parameters.ParamByName('orderno').Value:=mvalue;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery1,CDS_OrderNo);
|
|||
|
SInitCDSData20(ADOQuery1,CDS_OrderNo);
|
|||
|
if CDS_OrderNo.IsEmpty then cxGrid6.Visible:=False else cxGrid6.Visible:=True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.TvOrdeNoDblClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
Edit1.Text:=CDS_OrderNo.fieldbyname('OrderNo').AsString;
|
|||
|
cxGrid6.Visible:=False;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.* ');
|
|||
|
//sql.Add(',PFGenDanPerson=dbo.F_Get_Order_SubStr(A.MainId,''PFGenDanPerson'')');
|
|||
|
sql.Add(' from JYOrder_Main A');
|
|||
|
sql.Add(' where Orderno='''+Trim(Edit1.Text)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
FMainId:=Trim(ADOQueryTemp.fieldbyname('MainId').AsString);
|
|||
|
FOrderNo:=Trim(Edit1.Text);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.PRTHX,B.PRTColorNo,B.PRTColor,B.PRTOrdQty,B.OrderUnit,B.ColorNote,JP.PSName ');
|
|||
|
sql.Add(',Case when A.PFTPMQty<>0 then Cast((A.WCMQty-A.TJMQty)*100*1.00/A.PFTPMQty as decimal(18,2)) else 0 end as WCL');
|
|||
|
sql.Add(' from JYOrder_PCS_Sub A');
|
|||
|
sql.Add(' inner join JYOrder_Process JP on A.PSID=JP.PSID');
|
|||
|
sql.Add(' left join JYOrder_Sub B on A.SubId=B.SubId');
|
|||
|
sql.Add(' where A.MainId='''+Trim(FMainId)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,ClientDataSet72);
|
|||
|
SInitCDSData20(ADOQueryTemp,ClientDataSet72);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Contract_Main A inner join Contract_Sub B on A.MainId=B.MainId ');
|
|||
|
sql.Add(' where A.ConNo like '''+'%'+Trim(Edit1.Text)+'%'+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,ClientDataSet77);
|
|||
|
SInitCDSData20(ADOQueryTemp,ClientDataSet77);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_Process where MainId='''+Trim(FMainId)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,ClientDataSet71);
|
|||
|
SInitCDSData20(ADOQueryTemp,ClientDataSet71);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmModuleNote:=TfrmModuleNote.Create(Application);
|
|||
|
with frmModuleNote do
|
|||
|
begin
|
|||
|
flag:='<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmModuleNote.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.v1Column13PropertiesButtonClick(Sender: TObject;
|
|||
|
AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag:='RKYongTu';
|
|||
|
flagname:='<27><>;';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
with Self.ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('RKYongTu').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.v3Column14PropertiesEditValueChanged(
|
|||
|
Sender: TObject);
|
|||
|
var
|
|||
|
mvalue:Boolean;
|
|||
|
begin
|
|||
|
mvalue:=TcxCheckBox(Sender).EditingValue;
|
|||
|
if ClientDataSet3.FieldByName('JSFlag').AsBoolean=True then
|
|||
|
begin
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.v1Column1PropertiesEditValueChanged(
|
|||
|
Sender: TObject);
|
|||
|
var
|
|||
|
mvalue:Boolean;
|
|||
|
begin
|
|||
|
mvalue:=TcxCheckBox(Sender).EditingValue;
|
|||
|
if ClientDataSet3.FieldByName('JSFlag').AsBoolean=True then
|
|||
|
begin
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
|
|||
|
if ClientDataSet3.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
while Locate('SSel',True,[]) do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD Set HCFlag=1,HCDate=getdate(),HCPerson='''+Trim(DName)+'''');
|
|||
|
sql.Add(' where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ClientDataSet3.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMDManageChk.ToolButton6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ClientDataSet3.IsEmpty then Exit;
|
|||
|
|
|||
|
if ClientDataSet3.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if cxTabControl1.TabIndex<>1 then Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
while Locate('SSel',True,[]) do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Main_MD Set HCFlag=0,HCDate=Null,HCPerson=Null ');
|
|||
|
sql.Add(' where MDID='''+Trim(ClientDataSet3.fieldbyname('MDID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ClientDataSet3.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|