839 lines
23 KiB
ObjectPascal
839 lines
23 KiB
ObjectPascal
unit U_BGZLInput;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, BtnEdit, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles,
|
||
cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB,
|
||
cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
||
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, DBClient, ADODB, cxButtonEdit,
|
||
cxDropDownEdit;
|
||
|
||
type
|
||
TfrmBGZLInput = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
Panel2: TPanel;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQuery1: TADOQuery;
|
||
ClientDataSet7: TClientDataSet;
|
||
cxGridPopupMenu7: TcxGridPopupMenu;
|
||
DataSource7: TDataSource;
|
||
ClientDataSet2: TClientDataSet;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DataSource2: TDataSource;
|
||
DS_OrderNo: TDataSource;
|
||
CDS_OrderNo: TClientDataSet;
|
||
Panel3: TPanel;
|
||
ToolBar2: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Panel4: TPanel;
|
||
DataSource1: TDataSource;
|
||
ClientDataSet1: TClientDataSet;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
cxGrid7: TcxGrid;
|
||
Tv7: TcxGridDBTableView;
|
||
cxGridDBColumn30: TcxGridDBColumn;
|
||
cxGridDBColumn34: TcxGridDBColumn;
|
||
v7Column2: TcxGridDBColumn;
|
||
cxGridDBColumn32: TcxGridDBColumn;
|
||
cxGridDBColumn31: TcxGridDBColumn;
|
||
v7Column1: TcxGridDBColumn;
|
||
cxGridDBColumn36: TcxGridDBColumn;
|
||
cxGridLevel5: TcxGridLevel;
|
||
Panel5: TPanel;
|
||
Label1: TLabel;
|
||
Label7: TLabel;
|
||
Label18: TLabel;
|
||
OrderNo: TEdit;
|
||
MLenStr: TEdit;
|
||
ComTaiTou: TBtnEditA;
|
||
ToolBar3: TToolBar;
|
||
ToolButton3: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
cxGrid6: TcxGrid;
|
||
TvOrdeNo: TcxGridDBTableView;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn10: TcxGridDBColumn;
|
||
cxGrid4Level1: TcxGridLevel;
|
||
Label2: TLabel;
|
||
BatchNo: TEdit;
|
||
Label3: TLabel;
|
||
ChengJiaoType: TBtnEditA;
|
||
Label4: TLabel;
|
||
HaiYunFee: TEdit;
|
||
Label5: TLabel;
|
||
BaoFee: TEdit;
|
||
Label6: TLabel;
|
||
Label8: TLabel;
|
||
Label9: TLabel;
|
||
HuoYuanPlace: TBtnEditA;
|
||
Label10: TLabel;
|
||
ChuKouKA: TBtnEditA;
|
||
Label11: TLabel;
|
||
YunDiG: TBtnEditA;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure OrderNoChange(Sender: TObject);
|
||
procedure TvOrdeNoDblClick(Sender: TObject);
|
||
procedure ComTaiTouBtnClick(Sender: TObject);
|
||
procedure Tv7CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure cxGridDBColumn2PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure Tv7DblClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ChengJiaoTypeBtnClick(Sender: TObject);
|
||
procedure HuoYuanPlaceBtnClick(Sender: TObject);
|
||
procedure ChuKouKABtnClick(Sender: TObject);
|
||
procedure YunDiGBtnClick(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
function SaveData():Boolean;
|
||
public
|
||
{ Public declarations }
|
||
FOrderNo,FBGID,FMainId:String;
|
||
FCopyInt:Integer;
|
||
end;
|
||
|
||
var
|
||
frmBGZLInput: TfrmBGZLInput;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_RTFun, U_ZDYHelp, U_ZDYHelpSel,U_ModuleNote, U_GYSList;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmBGZLInput.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmBGZLInput:=nil;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.FormShow(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYorder_BG where BGID='''+Trim(FBGID)+'''');
|
||
Open;
|
||
end;
|
||
SCSHDataNew(ADOQueryTemp,Panel5,2);
|
||
cxGrid6.Visible:=False;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_BG_Qty where BGID='''+Trim(FBGID)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet2);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet2);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_BG_Name where BGID='''+Trim(FBGID)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet1);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet1);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main where OrderNo='''+Trim(OrderNo.Text)+'''');
|
||
Open;
|
||
end;
|
||
FMainId:=Trim(ADOQueryTemp.fieldbyname('MainId').AsString);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_View_MDQtyFooter_BG :MainId');
|
||
Parameters.ParamByName('MainId').Value:=Trim(FMainId);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet7);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet7);
|
||
fsj:='select Code=PSName,Name=PSName from JYOrder_Process where MainId='''+Trim(FMainId)+''''+
|
||
' order by PSXH';
|
||
SInitCxGridComboBoxBySql(ADOQueryTemp,cxGridDBColumn1,fsj,1,True,'');
|
||
if FCopyInt=1 then
|
||
begin
|
||
OrderNo.ReadOnly:=True;
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('BNID').Value:='';
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
with ClientDataSet2 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('BQID').Value:='';
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
FBGID:='';
|
||
end;
|
||
{with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from (');
|
||
sql.Add('select PSName=Cast(A.PSXH As Varchar(20))+'' ''+Cast(A.PSName As Varchar(20)),B.FactoryNo,PSName10=A.PSName,B.FactoryName,sum(QtyFlag*PS) MDPS,Sum(QtyFlag*Qty) MDQty,B.QtyUnit');
|
||
sql.Add(' from JYOrder_Process A ');
|
||
sql.Add(' left join JYOrder_Main_MD B on A.PSID=B.PSID');
|
||
sql.Add(' inner join JYOrder_Main C on A.Mainid=C.MainId');
|
||
sql.Add(' where C.OrderNo='''+Trim(OrderNo.Text)+'''');
|
||
sql.Add(' group by A.PSXH,A.PSName,B.FactoryName,B.FactoryNo,B.QtyUnit)AA where MDQty>0 order by PSName');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet7);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet7); }
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key=#13 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.OrderNoChange(Sender: TObject);
|
||
var
|
||
mvalue:String;
|
||
begin
|
||
mvalue:=Trim(OrderNo.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 TfrmBGZLInput.TvOrdeNoDblClick(Sender: TObject);
|
||
var
|
||
fsj:string;
|
||
begin
|
||
OrderNo.Text:=Trim(CDS_OrderNo.fieldbyname('OrderNo').AsString);
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JYOrder_Main_MD Set QtyFlag=1');
|
||
sql.Add(' where ORDMainid='''+Trim(CDS_OrderNo.fieldbyname('MainId').AsString)+'''');
|
||
sql.Add(' and Isnull(CKName,'''')='''' ');
|
||
sql.Add('Update JYOrder_Main_MD Set QtyFlag=-1');
|
||
sql.Add(' where ORDMainid='''+Trim(CDS_OrderNo.fieldbyname('MainId').AsString)+'''');
|
||
sql.Add(' and Isnull(CKName,'''')<>'''' ');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_View_MDQtyFooter_BG :MainId');
|
||
Parameters.ParamByName('MainId').Value:=Trim(CDS_OrderNo.fieldbyname('MainId').AsString);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet7);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet7);
|
||
fsj:='select Code=PSName,Name=PSName from JYOrder_Process where MainId='''+Trim(CDS_OrderNo.fieldbyname('MainId').AsString)+''''+
|
||
' order by PSXH';
|
||
SInitCxGridComboBoxBySql(ADOQueryTemp,cxGridDBColumn1,fsj,1,True,'');
|
||
{with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from (');
|
||
sql.Add('select PSName=Cast(A.PSXH As Varchar(20))+'' ''+Cast(A.PSName As Varchar(20)),B.FactoryNo,PSName10=A.PSName,B.FactoryName,sum(QtyFlag*PS) MDPS,Sum(QtyFlag*Qty) MDQty,B.QtyUnit');
|
||
sql.Add(' from JYOrder_Process A ');
|
||
sql.Add(' left join JYOrder_Main_MD B on A.PSID=B.PSID');
|
||
sql.Add(' inner join JYOrder_Main C on A.Mainid=C.MainId');
|
||
sql.Add(' where C.OrderNo='''+Trim(OrderNo.Text)+'''');
|
||
sql.Add(' group by A.PSXH,A.PSName,B.FactoryName,B.FactoryNo,B.QtyUnit)AA where MDQty>0 order by PSName');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet7);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet7);}
|
||
cxGrid6.Visible:=false;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.ComTaiTouBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='GSTT';
|
||
flagname:='<27><><EFBFBD>ص<EFBFBD>λ';
|
||
V1ZdyStr1.Visible:=True;
|
||
V1ZdyStr2.Visible:=True;
|
||
V1ZdyStr3.Visible:=True;
|
||
V1ZdyStr4.Visible:=True;
|
||
V1ZdyStr1.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr2.Caption:='<27>绰';
|
||
V1ZdyStr3.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr4.Caption:='<27><>ַ';
|
||
frmZDYHelp.Align:=alClient;
|
||
if ShowModal=1 then
|
||
begin
|
||
ComTaiTou.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.Tv7CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
with ClientDataSet2 do
|
||
begin
|
||
Append;
|
||
FieldByName('PSName').Value:=Trim(ClientDataSet7.fieldbyname('PSName10').AsString);
|
||
FieldByName('FactoryNo').Value:=Trim(ClientDataSet7.fieldbyname('FactoryNo').AsString);
|
||
FieldByName('FactoryName').Value:=Trim(ClientDataSet7.fieldbyname('FactoryName').AsString);
|
||
FieldByName('BQUnit').Value:=Trim(ClientDataSet7.fieldbyname('QtyUnit').AsString);
|
||
FieldByName('BQPS').Value:=ClientDataSet7.fieldbyname('MDPS').Value;
|
||
FieldByName('BQQty').Value:=ClientDataSet7.fieldbyname('MDQty').Value;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.cxGridDBColumn2PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with ClientDataSet2 do
|
||
begin
|
||
edit;
|
||
FieldByName('FactoryNo').Value:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
||
FieldByName('FactoryName').Value:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if ClientDataSet2.IsEmpty then Exit;
|
||
if Trim(ClientDataSet2.fieldbyname('BQID').AsString)<>'' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_BG_Qty where BQID='''+Trim(ClientDataSet2.fieldbyname('BQID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
ClientDataSet2.Delete;
|
||
end;
|
||
function TfrmBGZLInput.SaveData():Boolean;
|
||
var
|
||
maxno,maxsubno,maxJDNo,JDMainId,maxjfno,maxjcno,maxBgNo:String;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if FCopyInt=1 then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate JYOrder_BG Set Valid=''N'' ');
|
||
sql.Add(' where OrderNo='''+Trim(OrderNo.Text)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FBGID)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxno,'BG','JYOrder_BG',3,1)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(FBGID);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JYOrder_BG where BGId='''+Trim(FBGID)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(FBGID)='' then
|
||
begin
|
||
Append;
|
||
end
|
||
else begin
|
||
Edit;
|
||
end;
|
||
FieldByName('BGId').Value:=Trim(maxno);
|
||
RTSetsavedata(ADOQueryCmd,'JYOrder_Main',Panel5,2);
|
||
if Trim(FBGID)='' then
|
||
begin
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
//FieldByName('Note').Value:=Trim(Note.Text);
|
||
Post;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_BG where orderno='''+Trim(OrderNo.Text)+'''');
|
||
if Trim(BatchNo.Text)<>'' then
|
||
begin
|
||
SQL.Add(' and isnull(BatchNo,'''')='''+Trim(BatchNo.Text)+'''');
|
||
end;
|
||
sql.Add(' and Valid=''Y'' ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.RecordCount>1 then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JYOrder_BG Set EditCount=');
|
||
sql.Add('(select Count(*) from JYOrder_BG where OrderNo='''+Trim(OrderNo.Text)+''')');
|
||
sql.Add(' where BGID='''+Trim(maxno)+'''');
|
||
SQL.Add(' Update JYOrder_BG Set Valid=''N'' ');
|
||
sql.Add(' where OrderNo='''+Trim(OrderNo.Text)+'''');
|
||
if Trim(BatchNo.Text)<>'' then
|
||
begin
|
||
SQL.Add(' and isnull(BatchNo,'''')='''+Trim(BatchNo.Text)+'''');
|
||
end;
|
||
sql.Add(' and BGID<>'''+Trim(maxno)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
||
with ClientDataSet2 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(ClientDataSet2.fieldbyname('BQId').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxsubno,'BQ','JYOrder_BG_Qty',4,1)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxsubno:=Trim(ClientDataSet2.fieldbyname('BQId').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_BG_Qty where BQId='''+Trim(maxsubno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(ClientDataSet2.fieldbyname('BQId').AsString)='' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('BGId').Value:=Trim(maxno);
|
||
FieldByName('BQId').Value:=Trim(maxsubno);
|
||
RTSetSaveDataCDS(ADOQueryCmd,Tv2,ClientDataSet2,'JYOrder_BG_Qty',0);
|
||
Post;
|
||
end;
|
||
ClientDataSet2.Edit;
|
||
ClientDataSet2.FieldByName('BQId').Value:=Trim(maxsubno);
|
||
//Order_Sub.Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
///<2F><><EFBFBD>汨<EFBFBD><E6B1A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(ClientDataSet1.fieldbyname('BNId').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxBgNo,'BN','JYOrder_BG_Name',4,1)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxBgNo:=Trim(ClientDataSet1.fieldbyname('BNId').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from JYOrder_BG_Name where BNId='''+Trim(maxBgNo)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(ClientDataSet1.fieldbyname('BNId').AsString)='' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('BGId').Value:=Trim(maxno);
|
||
FieldByName('BNId').Value:=Trim(maxBgNo);
|
||
RTSetSaveDataCDS(ADOQueryCmd,Tv1,ClientDataSet1,'JYOrder_BG_Name',0);
|
||
Post;
|
||
end;
|
||
ClientDataSet1.Edit;
|
||
ClientDataSet1.FieldByName('BNId').Value:=Trim(maxBgNo);
|
||
//Order_Sub.Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
FBGID:=Trim(maxno);
|
||
except
|
||
Result:=False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.TBSaveClick(Sender: TObject);
|
||
var
|
||
FReal:Double;
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
if Trim(OrderNo.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Main where orderno='''+Trim(OrderNo.Text)+'''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(ComTaiTou.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ص<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet1.IsEmpty then
|
||
begin
|
||
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet1.Locate('BGName',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(MLenStr.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(MLenStr.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27>׳<EFBFBD><D7B3><EFBFBD><EFBFBD>ַǷ<D6B7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(HaiYunFee.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(HaiYunFee.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD>ַǷ<D6B7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(BaoFee.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(BaoFee.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַǷ<D6B7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if ClientDataSet2.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet2.Locate('BQPS',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet2.Locate('BQQty',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet2.Locate('FactoryName',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet2.Locate('BQUnit',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet2.Locate('PSName',Null,[])=True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
|
||
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='BGName';
|
||
flagname:='<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.ClientDataSet1 do
|
||
begin
|
||
Append;
|
||
FieldByName('BGName').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
Post;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
if ClientDataSet1.IsEmpty then Exit;
|
||
if Trim(ClientDataSet1.fieldbyname('BNID').AsString)<>'' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYOrder_BG_Name where BNID='''+Trim(ClientDataSet1.fieldbyname('BNID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
ClientDataSet1.Delete;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.Tv7DblClick(Sender: TObject);
|
||
begin
|
||
with ClientDataSet2 do
|
||
begin
|
||
Append;
|
||
FieldByName('PSName').Value:=ClientDataSet7.fieldbyname('PSName').Value;
|
||
FieldByName('FactoryName').Value:=ClientDataSet7.fieldbyname('GYSName').Value;
|
||
FieldByName('FactoryNo').Value:=ClientDataSet7.fieldbyname('GYSCode').Value;
|
||
FieldByName('BQUnit').Value:=ClientDataSet7.fieldbyname('QtyUnit').Value;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
with ClientDataSet2 do
|
||
begin
|
||
Append;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.ChengJiaoTypeBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='ChengJiaoType';
|
||
flagname:='<27>ɽ<EFBFBD><C9BD><EFBFBD>ʽ';
|
||
if ShowModal=1 then
|
||
begin
|
||
ChengJiaoType.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.HuoYuanPlaceBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='HuoYuanPlace';
|
||
flagname:='<27><>Դ<EFBFBD><D4B4>';
|
||
if ShowModal=1 then
|
||
begin
|
||
HuoYuanPlace.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.ChuKouKABtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='ChuKouKA';
|
||
flagname:='<27><><EFBFBD>ڿڰ<DABF>';
|
||
if ShowModal=1 then
|
||
begin
|
||
ChuKouKA.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBGZLInput.YunDiGBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='YunDiG';
|
||
flagname:='<27>˵ֹ<CBB5>';
|
||
if ShowModal=1 then
|
||
begin
|
||
YunDiG.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|