D7wmguihua/桂华管理系统/U_OrderInPutZPLNew.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

3707 lines
106 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_OrderInPutZPLNew;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer,
cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB,
ExtCtrls, BtnEdit, cxCalendar, cxGridBandedTableView,
cxGridDBBandedTableView, Menus, RM_Common, RM_Class, RM_e_Xls,
RM_GridReport, RM_System, RM_Dataset, cxCheckBox, cxDropDownEdit,
cxGridCustomPopupMenu, cxGridPopupMenu;
type
TfrmOrderInPutZPLNew = class(TForm)
ToolBar1: TToolBar;
TBSave: TToolButton;
TBClose: TToolButton;
ADOTemp: TADOQuery;
ADOCmd: TADOQuery;
DataSourceZ: TDataSource;
Order_SubZ: TClientDataSet;
DataSource2: TDataSource;
ADOZDY: TADOQuery;
CDS_ZDY: TClientDataSet;
ADOQuery1: TADOQuery;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
DataSource3: TDataSource;
CDS_DB: TClientDataSet;
Order_SubF: TClientDataSet;
DataSourceF: TDataSource;
Order_SubQ: TClientDataSet;
DataSourceQ: TDataSource;
ScrollBox2: TScrollBox;
cxGrid3: TcxGrid;
Tv3: TcxGridDBBandedTableView;
v3Column1: TcxGridDBBandedColumn;
v3Column2: TcxGridDBBandedColumn;
v3Column3: TcxGridDBBandedColumn;
v3Column4: TcxGridDBBandedColumn;
v3Column5: TcxGridDBBandedColumn;
cxGridLevel2: TcxGridLevel;
cxGrid2: TcxGrid;
Tv2: TcxGridDBBandedTableView;
v2Column1: TcxGridDBBandedColumn;
v2Column2: TcxGridDBBandedColumn;
v2Column3: TcxGridDBBandedColumn;
v2Column4: TcxGridDBBandedColumn;
v2Column5: TcxGridDBBandedColumn;
cxGridLevel1: TcxGridLevel;
cxGrid1: TcxGrid;
Tv1: TcxGridDBBandedTableView;
v1Column1: TcxGridDBBandedColumn;
v1Column2: TcxGridDBBandedColumn;
v1Column3: TcxGridDBBandedColumn;
v1Column4: TcxGridDBBandedColumn;
v1Column5: TcxGridDBBandedColumn;
v1Column6: TcxGridDBBandedColumn;
cxGrid1Level1: TcxGridLevel;
ToolBar2: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
TBPrint: TToolButton;
v1Column7: TcxGridDBBandedColumn;
v2Column6: TcxGridDBBandedColumn;
v3Column6: TcxGridDBBandedColumn;
v1Column8: TcxGridDBBandedColumn;
v2Column7: TcxGridDBBandedColumn;
v3Column7: TcxGridDBBandedColumn;
v1Column9: TcxGridDBBandedColumn;
v2Column8: TcxGridDBBandedColumn;
v3Column8: TcxGridDBBandedColumn;
ADOQueryQG: TADOQuery;
RMDB_Main: TRMDBDataSet;
RM2: TRMGridReport;
RMXLSExport1: TRMXLSExport;
PopupMenu2: TPopupMenu;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
DataSource1: TDataSource;
CDS_Sub: TClientDataSet;
DSSel: TDataSource;
CDS_Sel: TClientDataSet;
ScrollBox1: TScrollBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label12: TLabel;
Label13: TLabel;
Label16: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label18: TLabel;
Label32: TLabel;
Label33: TLabel;
Label4: TLabel;
Label5: TLabel;
Label7: TLabel;
Label9: TLabel;
Label6: TLabel;
Label8: TLabel;
OrderNo: TEdit;
OrderDate: TDateTimePicker;
WFBCodeName: TcxButtonEdit;
CustomNoName: TcxButtonEdit;
ArrivalPortName: TcxButtonEdit;
OrdQty: TEdit;
OrdUnit: TComboBox;
ETADate: TDateTimePicker;
ETDDate: TDateTimePicker;
ZGDate: TDateTimePicker;
BegRKDate: TDateTimePicker;
BegSCDate: TDateTimePicker;
Day1: TEdit;
Day2: TEdit;
Day3: TEdit;
cxGrid5: TcxGrid;
TvSub: TcxGridDBTableView;
vSubColumn3: TcxGridDBColumn;
vSubColumn11: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
vSubColumn2: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
vSubColumn4: TcxGridDBColumn;
vSubColumn5: TcxGridDBColumn;
vSubColumn6: TcxGridDBColumn;
vSubColumn7: TcxGridDBColumn;
vSubColumn8: TcxGridDBColumn;
vSubColumn9: TcxGridDBColumn;
vSubColumn10: TcxGridDBColumn;
TvSubColumn1: TcxGridDBColumn;
cxGridLevel4: TcxGridLevel;
cxGrid4: TcxGrid;
TVDB: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
VDBColumn1: TcxGridDBColumn;
VDBColumn2: TcxGridDBColumn;
cxGridLevel3: TcxGridLevel;
Note: TRichEdit;
SCXName: TcxButtonEdit;
WJGName: TcxButtonEdit;
PanZDY: TPanel;
CXGridZDY: TcxGrid;
TVZDY: TcxGridDBTableView;
VHelpZDYName: TcxGridDBColumn;
CXGridZDYLevel1: TcxGridLevel;
Button1: TButton;
Label14: TLabel;
OrderCode: TEdit;
vSubColumn12: TcxGridDBColumn;
PopupMenu3: TPopupMenu;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
BZ: TcxButtonEdit;
Label35: TLabel;
vSubColumn13: TcxGridDBColumn;
vSubColumn14: TcxGridDBColumn;
vSubColumn15: TcxGridDBColumn;
Panel1: TPanel;
cxGrid6: TcxGrid;
Tvsel: TcxGridDBTableView;
vselColumn1: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridLevel5: TcxGridLevel;
Panel10: TPanel;
Image2: TImage;
Button2: TButton;
Button3: TButton;
cxGrid7: TcxGrid;
TVKCSel: TcxGridDBTableView;
TVKCSelColumn1: TcxGridDBColumn;
v1P_ChnName: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
v1ShortName: TcxGridDBColumn;
v1Quantity: TcxGridDBColumn;
VKCSelColumn2: TcxGridDBColumn;
VKCSelColumn1: TcxGridDBColumn;
v1UnitName: TcxGridDBColumn;
cxGridLevel6: TcxGridLevel;
DataSource4: TDataSource;
CDS_KCSel: TClientDataSet;
v1Column10: TcxGridDBBandedColumn;
vSubColumn16: TcxGridDBColumn;
v2Column9: TcxGridDBBandedColumn;
v3Column9: TcxGridDBBandedColumn;
cxGridPopupMenu5: TcxGridPopupMenu;
cxGridPopupMenu1: TcxGridPopupMenu;
cxGridPopupMenu2: TcxGridPopupMenu;
cxGridPopupMenu3: TcxGridPopupMenu;
cxGridPopupMenu4: TcxGridPopupMenu;
N3: TMenuItem;
N4: TMenuItem;
Label10: TLabel;
Label11: TLabel;
DD: TEdit;
Label15: TLabel;
ZD: TEdit;
Label17: TLabel;
Label34: TLabel;
PopupMenu4: TPopupMenu;
MenuItem7: TMenuItem;
MenuItem8: TMenuItem;
procedure TBCloseClick(Sender: TObject);
procedure TVZDYCellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure Button1Click(Sender: TObject);
procedure WFBCodeNameKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TVZDYKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure CustomNoNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure CustomNoNamePropertiesChange(Sender: TObject);
procedure ArrivalPortNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure SCXNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure WJGNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure WFBCodeNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure WFBCodeNamePropertiesChange(Sender: TObject);
procedure ArrivalPortNamePropertiesChange(Sender: TObject);
procedure SCXNamePropertiesChange(Sender: TObject);
procedure WJGNamePropertiesChange(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure Day1Change(Sender: TObject);
procedure OrdQtyKeyPress(Sender: TObject; var Key: Char);
procedure Day2Change(Sender: TObject);
procedure Day3Change(Sender: TObject);
procedure ETADateChange(Sender: TObject);
procedure BegRKDateChange(Sender: TObject);
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Tv2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Tv3MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure v1Column2PropertiesEditValueChanged(Sender: TObject);
procedure v1Column3PropertiesEditValueChanged(Sender: TObject);
procedure v2Column2PropertiesEditValueChanged(Sender: TObject);
procedure OrdQtyChange(Sender: TObject);
procedure v3Column4PropertiesEditValueChanged(Sender: TObject);
procedure TBPrintClick(Sender: TObject);
procedure v1Column1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v2Column1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v3Column1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure MenuItem1Click(Sender: TObject);
procedure MenuItem2Click(Sender: TObject);
procedure cxGridDBColumn3PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure vSubColumn2PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure cxGridDBColumn2PropertiesEditValueChanged(Sender: TObject);
procedure TvSubColumn1PropertiesEditValueChanged(Sender: TObject);
procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Image2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure vSubColumn6PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure vSubColumn8PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure vSubColumn10PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure BZPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure BZPropertiesChange(Sender: TObject);
procedure cxGridDBColumn4PropertiesEditValueChanged(Sender: TObject);
procedure vSubColumn4PropertiesEditValueChanged(Sender: TObject);
procedure vSubColumn5PropertiesEditValueChanged(Sender: TObject);
procedure vSubColumn7PropertiesEditValueChanged(Sender: TObject);
procedure vSubColumn9PropertiesEditValueChanged(Sender: TObject);
procedure vSubColumn12PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure MenuItem3Click(Sender: TObject);
procedure MenuItem4Click(Sender: TObject);
procedure cxButtonEdit1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure cxButtonEdit1PropertiesChange(Sender: TObject);
procedure vSubColumn13PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure TBChkOkClick(Sender: TObject);
procedure TBChkNoClick(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure DDChange(Sender: TObject);
procedure ZDChange(Sender: TObject);
procedure vSubColumn11PropertiesEditValueChanged(Sender: TObject);
procedure MenuItem7Click(Sender: TObject);
procedure MenuItem8Click(Sender: TObject);
private
MInt,ChkInt,CloInt:Integer;
procedure InitData();
procedure ZDYHelp(FButn:TcxButtonEdit;LType:string);
function SaveData():Boolean;
procedure DelOrderSub(FOrder_Sub:TClientDataSet);
procedure SELYCL(SCDS_Sub:TClientDataSet);
procedure EditYCL(SCDS_Sub:TClientDataSet);
function SaveData10():Boolean;
procedure SaveYCL(SCDS_Sub:TClientDataSet);
procedure YLUpdate();
procedure UpMainId();
procedure YCLDataUPdate();
procedure SELYCLKC(SCDS_Sub:TClientDataSet);
procedure OnlyUpYCLData();
procedure YCLPBIDUPdate(SOrder_SubZ:TClientDataSet);
procedure SelAll(SCDS_Sub:TClientDataSet;FSEL:Boolean);
{ Private declarations }
public
PState,BState,CopyInt:Integer;
FMainId,OrderType:String;
FXS:Integer;
{ Public declarations }
end;
var
frmOrderInPutZPLNew: TfrmOrderInPutZPLNew;
implementation
uses
U_DataLink,U_ZDYHelp,U_Fun,U_GetPGJBInList;
{$R *.dfm}
procedure TfrmOrderInPutZPLNew.TBCloseClick(Sender: TObject);
begin
WriteCxBandedGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',Tv1,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
WriteCxBandedGrid('<27><><EFBFBD>ϸ<EFBFBD>1',Tv2,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
WriteCxBandedGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',Tv3,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>1',TvSub,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',TVDB,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
{ if PState<>3 then
begin
if Application.MessageBox('<27>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',32+4)=IDYES then
begin
CloInt:=1;
TBSave.Click;
Exit;
end;
end; }
Close;
end;
procedure TfrmOrderInPutZPLNew.SelAll(SCDS_Sub:TClientDataSet;FSEL:Boolean);
begin
if SCDS_Sub.IsEmpty then exit;
with SCDS_Sub do
begin
First;
while not eof do
begin
Edit;
FieldByName('SSel').Value:=FSEL;
post;
Next;
end;
end;
end;
procedure TfrmOrderInPutZPLNew.InitData();
var
i:Integer;
begin
with ADOQuery1 do
begin
Close;
SQL.Clear;
sql.Add(' exec P_WFBOrder_List :begdate,:endate,:MainId');
if PState>0 then
begin
ADOQuery1.Parameters.ParamByName('MainId').Value:=Trim(FMainId);
ADOQuery1.Parameters.ParamByName('begdate').Value:='';
ADOQuery1.Parameters.ParamByName('endate').Value:='';
end;
if PState=0 then
begin
ADOQuery1.Parameters.ParamByName('MainId').Value:='999999';
ADOQuery1.Parameters.ParamByName('begdate').Value:='';
ADOQuery1.Parameters.ParamByName('endate').Value:='';
end;
Open;
end;
// SCreateCDS20(ADOQuery1,Order_Sub);
//SInitCDSData20(ADOQuery1,Order_Sub);
SCSHData(ADOQuery1,ScrollBox1,0);
if PState=0 then
begin
OrderDate.DateTime:=StrToDate(FormatDateTime('yyyy-MM-dd',SGetServerDateTime(ADOTemp)));
ETADate.DateTime:=OrderDate.DateTime;
ETDDate.DateTime:=OrderDate.DateTime;
ZGDate.DateTime:=OrderDate.DateTime;
BegRKDate.DateTime:=OrderDate.DateTime;
BegSCDate.DateTime:=OrderDate.DateTime;
ETADate.Checked:=False;
ETDDate.Checked:=False;
ZGDate.Checked:=False;
BegRKDate.Checked:=False;
BegSCDate.Checked:=False;
//OrdUnit.Text:='<27>K';
OrdUnit.ItemIndex:=OrdUnit.Items.IndexOf('<27>K');
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select Top 1* from WFBOrder_Main where ordertype=''<27><>Ʒ''');
Open;
end;
if ADOTemp.IsEmpty then Exit;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select Top 1* from WFBOrder_Main where ordertype=''<27><>Ʒ''');
sql.Add(' order by FillTime Desc');
Open;
end;
DD.Text:=ADOTemp.fieldbyname('DD').AsString;
ZD.Text:=ADOTemp.fieldbyname('ZD').AsString;
end;
{if Trim(DParameters1)<>'<27><><EFBFBD><EFBFBD>' then
begin
BegRKDate.Enabled:=False;
Day3.Enabled:=False;
BegSCDate.Enabled:=False;
//Note.Enabled:=False;
cxGrid4.Enabled:=False;
SCXName.Enabled:=False;
WJGName.Enabled:=False;
ScrollBox2.Enabled:=False;
end;}
if PState=4 then
begin
BegRKDate.Enabled:=True;
Day3.Enabled:=True;
BegSCDate.Enabled:=True;
//Note.Enabled:=False;
cxGrid4.Enabled:=True;
{ MJKZX.Enabled:=True;
MJKZD.Enabled:=True;
XJKZX.Enabled:=True;
XJKZD.Enabled:=True;}
SCXName.Enabled:=True;
WJGName.Enabled:=True;
ScrollBox2.Enabled:=True;
end;
with ADOQuery1 do
begin
Close;
sql.Clear;
SQL.Add('select * from WFB_DB where MainId='''+Trim(FMainId)+'''');
Open;
end;
SCreateCDS20(ADOQuery1,CDS_DB);
SInitCDSData20(ADOQuery1,CDS_DB);
with ADOQuery1 do
begin
Close;
sql.Clear;
SQL.Add('select * from WFBOrder_Sub where MainId='''+Trim(FMainId)+'''');
Open;
end;
SCreateCDS20(ADOQuery1,CDS_Sub);
SInitCDSData20(ADOQuery1,CDS_Sub);
with ADOQuery1 do
begin
Close;
sql.Clear;
SQL.Add('select A.*,Case when A.YLQty-A.YCLYJkc>=0 then A.YLQty-A.YCLYJkc else null end as BZ from WFBYCL_PB A where MainId='''+Trim(FMainId)+'''');
sql.Add(' and PBType=''<27><>Ҫ'' ');
Open;
end;
SCreateCDS20(ADOQuery1,Order_SubZ);
SInitCDSData20(ADOQuery1,Order_SubZ);
with ADOQuery1 do
begin
Close;
sql.Clear;
SQL.Add('select A.*,Case when A.YLQty-A.YCLYJkc>=0 then A.YLQty-A.YCLYJkc else null end as BZ from WFBYCL_PB A where MainId='''+Trim(FMainId)+'''');
sql.Add(' and PBType=''<27><><EFBFBD><EFBFBD>'' ');
Open;
end;
SCreateCDS20(ADOQuery1,Order_SubF);
SInitCDSData20(ADOQuery1,Order_SubF);
with ADOQuery1 do
begin
Close;
sql.Clear;
SQL.Add('select A.*,Case when A.YLQty-A.YCLYJkc>=0 then A.YLQty-A.YCLYJkc else null end as BZ from WFBYCL_PB A where MainId='''+Trim(FMainId)+'''');
sql.Add(' and PBType=''<27><><EFBFBD><EFBFBD>'' ');
Open;
end;
SCreateCDS20(ADOQuery1,Order_SubQ);
SInitCDSData20(ADOQuery1,Order_SubQ);
PanZDY.Visible:=False;
if PState=4 then
begin
PState:=0;
FMainId:='';
//OrderNo.Text:='';
WFBCodeName.Text:='';
WFBCodeName.Hint:='';
PanZDY.Visible:=False;
with CDS_DB do
begin
First;
while not Eof do
begin
Edit;
FieldByName('DBID').Value:='';
Post;
Next;
end;
end;
with Order_SubZ do
begin
First;
while not Eof do
begin
Edit;
FieldByName('PBID').Value:='';
FieldByName('YLKC').Value:=0;
FieldByName('YCLYJKC').Value:=0;
FieldByName('BZ').Value:=0;
FieldByName('SGQty').Value:=0;
Post;
Next;
end;
end;
v1Column1.Options.Focusing:=True;
with Order_SubF do
begin
First;
while not Eof do
begin
Edit;
FieldByName('PBID').Value:='';
FieldByName('YLKC').Value:=0;
FieldByName('YCLYJKC').Value:=0;
FieldByName('BZ').Value:=0;
FieldByName('SGQty').Value:=0;
Post;
Next;
end;
end;
v2Column1.Options.Focusing:=True;
with Order_SubQ do
begin
First;
while not Eof do
begin
Edit;
FieldByName('PBID').Value:='';
FieldByName('YLKC').Value:=0;
FieldByName('YCLYJKC').Value:=0;
FieldByName('BZ').Value:=0;
FieldByName('SGQty').Value:=0;
Post;
Next;
end;
end;
v3Column1.Options.Focusing:=True;
end;
end;
procedure TfrmOrderInPutZPLNew.ZDYHelp(FButn:TcxButtonEdit;LType:string);
var
FType,ZDYName,FText:String;
begin
PanZDY.Visible:=True;
PanZDY.Left:=FButn.Left;
PanZDY.Top:=FButn.Top+FButn.Height;
with ADOZDY do
begin
Filtered:=False;
Close;
SQL.Clear;
SQL.Add('select RTrim(ZDYNo) ZDYNo,RTrim(ZDYName) ZDYName from KH_ZDY where Type='''+Trim(LType)+'''');
Open;
end;
FText:=Trim(FButn.Text);
if FText<>'' then
SDofilter(ADOZDY,' ZDYName like '+QuotedStr('%'+Trim(FText)+'%'))
else
SDofilter(ADOZDY,'');
VHelpZDYName.Summary.GroupFormat:=Trim(FButn.Name);
end;
procedure TfrmOrderInPutZPLNew.TVZDYCellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
var
FName:string;
begin
if ADOZDY.IsEmpty then Exit;
FName:=Trim(VHelpZDYName.Summary.GroupFormat);
TcxButtonEdit(FindComponent(FName)).Text:=Trim(ADOZDY.fieldbyname('ZDYName').AsString);
TcxButtonEdit(FindComponent(FName)).Hint:=Trim(ADOZDY.fieldbyname('ZDYNO').AsString);
PanZDY.Visible:=False;
end;
procedure TfrmOrderInPutZPLNew.Button1Click(Sender: TObject);
begin
PanZDY.Visible:=False;
end;
procedure TfrmOrderInPutZPLNew.WFBCodeNameKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key=vk_return) or (Key=vk_Down) then
begin
if ADOZDY.Active then
CXGridZDY.SetFocus;
end;
end;
procedure TfrmOrderInPutZPLNew.TVZDYKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
if ADOZDY.IsEmpty then Exit;
TcxButtonEdit(FindComponent(VHelpZDYName.Summary.GroupFormat)).Text:=Trim(ADOZDY.fieldbyname('ZDYName').AsString);
TcxButtonEdit(FindComponent(VHelpZDYName.Summary.GroupFormat)).Hint:=Trim(ADOZDY.fieldbyname('ZDYNO').AsString);
PanZDY.Visible:=False;
ADOZDY.Active:=False;
end;
end;
procedure TfrmOrderInPutZPLNew.FormShow(Sender: TObject);
var
fsj:string;
begin
ReadCxBandedGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',Tv1,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
ReadCxBandedGrid('<27><><EFBFBD>ϸ<EFBFBD>1',Tv2,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
ReadCxBandedGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',Tv3,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>1',TvSub,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',TVDB,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
{if Trim(DParameters1)='<27><><EFBFBD><EFBFBD>' then
begin
TBSave.Visible:=False;
TBChkOk.Visible:=True;
TBChkNo.Visible:=True;
end else
begin
TBSave.Visible:=True;
TBChkOk.Visible:=False;
TBChkNo.Visible:=False;
end; }
fsj:=FormatDateTime('yyyy-MM-dd',SGetServerDate(ADOTemp));
if ( (Trim(FMainId)='') or (CopyInt=1)) then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select Count(*) As SL from WFBOrder_Main where OrderDate='''+Trim(fsj)+'''');
sql.Add(' and MainId not like ''%FZ'' ');
Open;
end;
if ADOTemp.IsEmpty then
begin
fsj:=fsj+'-1'
end else
fsj:=fsj+'-'+Trim(IntToStr(ADOTemp.fieldbyname('SL').AsInteger+1));
OrderCode.Text:=Trim(fsj);
end;
InitData();
ReadCxBandedGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv1,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
ReadCxBandedGrid('<27><><EFBFBD>ϸ<EFBFBD>',Tv2,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
ReadCxBandedGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv3,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
end;
function TfrmOrderInPutZPLNew.SaveData():Boolean;
var
maxno,FSubId:String;
begin
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from WFBOrder_Main where MainId='''+Trim(FMainId)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(FMainId)='' then
begin
Append;
if GetLSNo(ADOTemp,maxno,'','WFBOrder_Main',2,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
exit;
end;
end
else begin
maxno:=Trim(FMainId);
Edit;
end;
FieldByName('MainId').Value:=Trim(maxno);
FieldByName('OrderType').Value:='<27><>Ʒ';
SSetsaveSql(ADOCmd,'WFBOrder_Main',ScrollBox1,0);
if PState=2 then
begin
FieldByName('Chker').Value:=Trim(DName);
FieldByName('ChkTime').Value:=SGetServerDateTime(ADOTemp);
if ChkInt=1 then
FieldByName('ChkStatus').Value:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'
else if ChkInt=2 then
FieldByName('ChkStatus').Value:='<27><><EFBFBD>˲<EFBFBD>ͨ<EFBFBD><CDA8>';
end;
if Trim(FMainId)='' then
begin
FieldByName('Filler').Value:=Trim(DName);
end else
begin
if PState=1 then
begin
FieldByName('Editer').Value:=Trim(DName);
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
end;
end;
Post;
end;
FMainId:=Trim(maxno);
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ
with CDS_DB do
begin
First;
while not Eof do
begin
if Trim(CDS_DB.fieldbyname('DBId').AsString)='' then
begin
if GetLSNo(ADOTemp,maxno,'DB','WFB_DB',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(CDS_DB.fieldbyname('DBId').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from WFB_DB ');
sql.Add(' where DBId='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_DB.fieldbyname('DBId').AsString)='' then
Append
else
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('DBId').Value:=Trim(maxno);
SSetSaveDataCDSNew(ADOCmd,TVDB,CDS_DB,'WFB_DB',0);
Post;
end;
CDS_DB.Edit;
CDS_DB.FieldByName('DBId').Value:=Trim(maxno);
//Order_Sub.Post;
Next;
end;
end;
///<2F><><EFBFBD><EFBFBD><EFBFBD>
CDS_Sub.DisableControls;
with CDS_Sub do
begin
First;
while not Eof do
begin
if Trim(CDS_Sub.fieldbyname('SubId').AsString)='' then
begin
if GetLSNo(ADOTemp,maxno,'','WFBOrder_Sub',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(CDS_Sub.fieldbyname('SubId').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBOrder_Sub ');
sql.Add(' where SubId='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_Sub.fieldbyname('SubId').AsString)='' then
Append
else
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('SubId').Value:=Trim(maxno);
SSetSaveDataCDSNew(ADOCmd,TvSub,CDS_Sub,'WFBOrder_Sub',0);
Post;
end;
CDS_Sub.Edit;
CDS_Sub.FieldByName('SubId').Value:=Trim(maxno);
//CDS_Sub.Post;
Next;
end;
end;
CDS_Sub.EnableControls;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫԭ<D2AA><D4AD>
if not Order_SubZ.IsEmpty then
begin
with Order_SubZ do
begin
First;
while not Eof do
begin
if Trim(Order_SubZ.fieldbyname('PBId').AsString)='' then
begin
if GetLSNo(ADOTemp,maxno,'PB','WFBYCL_PB',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(Order_SubZ.fieldbyname('PBId').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PB ');
sql.Add(' where PBId='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(Order_SubZ.fieldbyname('PBId').AsString)='' then
Append
else
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('PBId').Value:=Trim(maxno);
FieldByName('CRId').Value:=Trim(Order_SubZ.fieldbyname('CRID').AsString);
FieldByName('PBType').Value:='<27><>Ҫ';
// SSetSaveDataCDSNew();
SSetSaveDataCDSBandNew(ADOCmd,TV1,Order_SubZ,'WFBYCL_PB',0);
Post;
end;
Order_SubZ.Edit;
Order_SubZ.FieldByName('PBId').Value:=Trim(maxno);
//Order_SubZ.Post;
Next;
end;
end;
end;
//<2F><><EFBFBD><EFBFBD><E6B8A8>ԭ<EFBFBD><D4AD>
if not Order_SubF.IsEmpty then
begin
with Order_SubF do
begin
First;
while not Eof do
begin
if Trim(Order_SubF.fieldbyname('PBId').AsString)='' then
begin
if GetLSNo(ADOTemp,maxno,'PB','WFBYCL_PB',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(Order_SubF.fieldbyname('PBId').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PB ');
sql.Add(' where PBId='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(Order_SubF.fieldbyname('PBId').AsString)='' then
Append
else
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('PBId').Value:=Trim(maxno);
FieldByName('PBType').Value:='<27><><EFBFBD><EFBFBD>';
FieldByName('CRId').Value:=Trim(Order_SubF.fieldbyname('CRID').AsString);
// SSetSaveDataCDSNew();
SSetSaveDataCDSBandNew(ADOCmd,TV2,Order_SubF,'WFBYCL_PB',0);
Post;
end;
Order_SubF.Edit;
Order_SubF.FieldByName('PBId').Value:=Trim(maxno);
//Order_SubF.Post;
Next;
end;
end;
end;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
if not Order_SubQ.IsEmpty then
begin
with Order_SubQ do
begin
First;
while not Eof do
begin
if Trim(Order_SubQ.fieldbyname('PBId').AsString)='' then
begin
if GetLSNo(ADOTemp,maxno,'PB','WFBYCL_PB',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(Order_SubQ.fieldbyname('PBId').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PB ');
sql.Add(' where PBId='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(Order_SubQ.fieldbyname('PBId').AsString)='' then
Append
else
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('PBId').Value:=Trim(maxno);
FieldByName('PBType').Value:='<27><><EFBFBD><EFBFBD>';
FieldByName('CRId').Value:=Trim(Order_SubQ.fieldbyname('CRID').AsString);
// SSetSaveDataCDSNew();
SSetSaveDataCDSBandNew(ADOCmd,TV3,Order_SubQ,'WFBYCL_PB',0);
Post;
end;
Order_SubQ.Edit;
Order_SubQ.FieldByName('PBId').Value:=Trim(maxno);
//Order_SubQ.Post;
Next;
end;
end;
end;
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
{with Order_Sub do
begin
First;
while not Eof do
begin
if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then
begin
if GetLSNo(ADOTemp,maxno,'OS','Order_Sub',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(Order_Sub.fieldbyname('SubId').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from Order_Sub where MainId='''+Trim(FMainId)+'''');
sql.Add(' and SubId='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then
Append
else
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('SubId').Value:=Trim(maxno);
SSetSaveDataCDSNew(ADOCmd,Tv1,Order_Sub,'Order_Sub',0);
Post;
end;
Order_Sub.Edit;
Order_Sub.FieldByName('SubId').Value:=Trim(maxno);
//Order_Sub.Post;
Next;
end;
end; }
ADOCmd.Connection.CommitTrans;
Result:=True;
except
Result:=False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
end;
end;
function TfrmOrderInPutZPLNew.SaveData10():Boolean;
var
maxno,FSubId:String;
begin
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from WFBOrder_Main where MainId='''+Trim(FMainId)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(FMainId)='' then
begin
Append;
if GetLSNo(ADOTemp,maxno,'','WFBOrder_Main',2,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
exit;
end;
end
else begin
maxno:=Trim(FMainId);
Edit;
end;
FieldByName('MainId').Value:=Trim(maxno);
FieldByName('OrderType').Value:='<27><>Ʒ';
SSetsaveSql(ADOCmd,'WFBOrder_Main',ScrollBox1,0);
if PState=2 then
begin
FieldByName('Chker').Value:=Trim(DName);
FieldByName('ChkTime').Value:=SGetServerDateTime(ADOTemp);
end;
if Trim(FMainId)='' then
begin
FieldByName('Filler').Value:=Trim(DName);
end else
begin
if PState=1 then
begin
FieldByName('Editer').Value:=Trim(DName);
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
end;
end;
Post;
end;
FMainId:=Trim(maxno);
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ
with CDS_DB do
begin
First;
while not Eof do
begin
if Trim(CDS_DB.fieldbyname('DBId').AsString)='' then
begin
if GetLSNo(ADOTemp,maxno,'DB','WFB_DB',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(CDS_DB.fieldbyname('DBId').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from WFB_DB ');
sql.Add(' where DBId='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_DB.fieldbyname('DBId').AsString)='' then
Append
else
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('DBId').Value:=Trim(maxno);
SSetSaveDataCDSNew(ADOCmd,TVDB,CDS_DB,'WFB_DB',0);
Post;
end;
CDS_DB.Edit;
CDS_DB.FieldByName('DBId').Value:=Trim(maxno);
//Order_Sub.Post;
Next;
end;
end;
///<2F><><EFBFBD><EFBFBD><EFBFBD>
with CDS_Sub do
begin
First;
while not Eof do
begin
if Trim(CDS_Sub.fieldbyname('SubId').AsString)='' then
begin
if GetLSNo(ADOTemp,maxno,'','WFBOrder_Sub',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(CDS_Sub.fieldbyname('SubId').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBOrder_Sub ');
sql.Add(' where SubId='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_Sub.fieldbyname('SubId').AsString)='' then
Append
else
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('SubId').Value:=Trim(maxno);
SSetSaveDataCDSNew(ADOCmd,TvSub,CDS_Sub,'WFBOrder_Sub',0);
Post;
end;
CDS_Sub.Edit;
CDS_Sub.FieldByName('SubId').Value:=Trim(maxno);
//CDS_Sub.Post;
Next;
end;
end;
ADOCmd.Connection.CommitTrans;
Result:=True;
except
Result:=False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
end;
end;
procedure TfrmOrderInPutZPLNew.TBSaveClick(Sender: TObject);
var
FFS:string;
wz:Integer;
begin
OrderDate.SetFocus;
if Trim(OrderNo.Text)='' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if CDS_Sub.Locate('SWFBCodeName',null,[]) then
begin
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
{if Trim(WFBCodeName.Text)='' then
begin
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Trim(WFBCodeName.Hint)='' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>壡','<27><>ʾ',0);
Exit;
end; }
{if Order_Sub.IsEmpty then
begin
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end; }
if CDS_DB.Locate('BSL',null,[]) then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if CDS_DB.Locate('JSL',null,[]) then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Order_SubZ.Locate('YLKC;YCLYJKC;BZ',VarArrayOf([0,0,0]),[]) then
begin
Application.MessageBox('<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Order_SubF.Locate('YLKC;YCLYJKC;BZ',VarArrayOf([0,0,0]),[]) then
begin
Application.MessageBox('<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Order_SubQ.Locate('YLKC;YCLYJKC;BZ',VarArrayOf([0,0,0]),[]) then
begin
Application.MessageBox('<27><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if SaveData() then
begin
wz:=Pos('F',FMainId);
FFS:=Copy(FMainId,wz,4);
if ((CopyInt=1) or (FFS='FZ')) then
begin
UpMainId();
end;
CopyInt:=0;
if ChkInt>0 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
end else
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
if CloInt=1 then ModalResult:=1;
Exit;
end;
end;
procedure TfrmOrderInPutZPLNew.SaveYCL(SCDS_Sub:TClientDataSet);
var
maxno,maxnosub:string;
begin
try
ADOCmd.Connection.BeginTrans;
with frmGetPGJBInList.ClientDataSet2 do
begin
First;
while not Eof do
begin
if GetLSNo(ADOCmd,maxno,'PB','WFBYCL_PB',4,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFBYCL_PB where 1<>1');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('PBId').Value:=Trim(maxno);
if MInt=1 then
begin
FieldByName('PBType').Value:='<27><>Ҫ';
end else
if MInt=2 then
begin
FieldByName('PBType').Value:='<27><><EFBFBD><EFBFBD>';
end else
if MInt=3 then
begin
FieldByName('PBType').Value:='<27><><EFBFBD><EFBFBD>';
end;
FieldByName('YCLCode').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('YCLCode').AsString);
FieldByName('YCLName').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('YCLCode').AsString);
FieldByName('YCLSpec').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('YCLCode').AsString);
FieldByName('YLKC').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('QuantityKC').AsString);
FieldByName('YLUnit').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('CRUnit').AsString);
FieldByName('CRID').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('CRID').AsString);
FieldByName('YCLYJKC').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('YJKC').AsString);
Post;
end;
with SCDS_Sub do
begin
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('PBId').Value:=Trim(maxno);
Post;
end;
with Self.CDS_Sel do
begin
First;
while not Eof do
begin
if GetLSNo(ADOCmd,maxnosub,'PS','WFBYCL_PBSub',4,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFBYCL_PBSub where 1<>1');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('SubId').Value:=Trim(CDS_Sel.fieldbyname('SubId').AsString);
FieldByName('PBId').Value:=Trim(maxno);
FieldByName('PSId').Value:=Trim(maxnosub);
Post;
end;
Next;
end;
end;
Next;
end;
end;
except
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
end;
end;
procedure TfrmOrderInPutZPLNew.SELYCL(SCDS_Sub:TClientDataSet);
var
maxno,maxnosub:string;
begin
try
frmGetPGJBInList:=TfrmGetPGJBInList.Create(Application);
with frmGetPGJBInList do
begin
if ShowModal=1 then
begin
try ADOCmd.Connection.BeginTrans;
with ClientDataSet2 do
begin
First;
while not Eof do
begin
with SCDS_Sub do
begin
Append;
SCDS_Sub.FieldByName('YCLCode').Value:=Trim(ClientDataSet2.fieldbyname('YCLCode').AsString);
SCDS_Sub.FieldByName('YCLName').Value:=Trim(ClientDataSet2.fieldbyname('YCLName').AsString);
SCDS_Sub.FieldByName('YCLSpec').Value:=Trim(ClientDataSet2.fieldbyname('YCLSpec').AsString);
SCDS_Sub.FieldByName('YLKC').Value:=Trim(ClientDataSet2.fieldbyname('QuantityKC').AsString);
SCDS_Sub.FieldByName('YLUnit').Value:=Trim(ClientDataSet2.fieldbyname('CRUnit').AsString);
SCDS_Sub.FieldByName('CRID').Value:=Trim(ClientDataSet2.fieldbyname('CRID').AsString);
SCDS_Sub.FieldByName('YCLYJKC').Value:=Trim(ClientDataSet2.fieldbyname('YJKC').AsString);
Post;
end;
if GetLSNo(ADOCmd,maxno,'PB','WFBYCL_PB',4,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFBYCL_PB where 1<>1');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('PBId').Value:=Trim(maxno);
if MInt=1 then
begin
FieldByName('PBType').Value:='<27><>Ҫ';
end else
if MInt=2 then
begin
FieldByName('PBType').Value:='<27><><EFBFBD><EFBFBD>';
end else
if MInt=3 then
begin
FieldByName('PBType').Value:='<27><><EFBFBD><EFBFBD>';
end;
FieldByName('YCLCode').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('YCLCode').AsString);
FieldByName('YCLName').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('YCLName').AsString);
FieldByName('YCLSpec').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('YCLSpec').AsString);
FieldByName('YLKC').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('QuantityKC').AsString);
FieldByName('YLUnit').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('CRUnit').AsString);
FieldByName('CRID').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('CRID').AsString);
FieldByName('YCLYJKC').Value:=Trim(frmGetPGJBInList.ClientDataSet2.fieldbyname('YJKC').AsString);
Post;
end;
with SCDS_Sub do
begin
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('PBId').Value:=Trim(maxno);
Post;
end;
with Self.CDS_Sel do
begin
First;
while not Eof do
begin
if Self.CDS_Sel.FieldByName('SSel').AsBoolean=True then
begin
if GetLSNo(ADOCmd,maxnosub,'PS','WFBYCL_PBSub',4,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFBYCL_PBSub where 1<>1');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('SubId').Value:=Trim(CDS_Sel.fieldbyname('SubId').AsString);
FieldByName('PBId').Value:=Trim(maxno);
FieldByName('PSId').Value:=Trim(maxnosub);
Post;
end;
end;
Next;
end;
end;
Next;
end;
end;
ADOQueryCmd.Connection.CommitTrans;
except
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
Exit;
end;
//Self.SaveYCL(SCDS_Sub);
end;
end;
finally
frmGetPGJBInList.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.EditYCL(SCDS_Sub:TClientDataSet);
begin
try
frmGetPGJBInList:=TfrmGetPGJBInList.Create(Application);
with frmGetPGJBInList do
begin
if ShowModal=1 then
begin
with ClientDataSet2 do
begin
//First;
// while not Eof do
//begin
with SCDS_Sub do
begin
Edit;
SCDS_Sub.FieldByName('YCLCode').Value:=Trim(ClientDataSet2.fieldbyname('YCLCode').AsString);
SCDS_Sub.FieldByName('YCLName').Value:=Trim(ClientDataSet2.fieldbyname('YCLName').AsString);
SCDS_Sub.FieldByName('YCLSpec').Value:=Trim(ClientDataSet2.fieldbyname('YCLSpec').AsString);
//SCDS_Sub.FieldByName('GYSName').Value:=Trim(ClientDataSet2.fieldbyname('GYSName').AsString);
//SCDS_Sub.FieldByName('GYS').Value:=Trim(ClientDataSet2.fieldbyname('GYS').AsString);
SCDS_Sub.FieldByName('YLKC').Value:=Trim(ClientDataSet2.fieldbyname('QuantityKC').AsString);
//CDS_Sub.FieldByName('Qty').Value:=Trim(ClientDataSet2.fieldbyname('QtyKC').AsString);
SCDS_Sub.FieldByName('YLUnit').Value:=Trim(ClientDataSet2.fieldbyname('CRUnit').AsString);
SCDS_Sub.FieldByName('CRID').Value:=Trim(ClientDataSet2.fieldbyname('CRID').AsString);
SCDS_Sub.FieldByName('YCLYJKC').Value:=Trim(ClientDataSet2.fieldbyname('YJKC').AsString);
if SCDS_Sub.FieldByName('YLQty').Value-ClientDataSet2.fieldbyname('YJKC').Value>=0 then
SCDS_Sub.FieldByName('BZ').Value:=SCDS_Sub.FieldByName('YLQty').Value-
ClientDataSet2.fieldbyname('YJKC').Value
else
SCDS_Sub.FieldByName('BZ').Value:=null;
//SCDS_Sub.FieldByName('YCLType').Value:=Trim(ClientDataSet2.fieldbyname('YCLType').AsString);
//SCDS_Sub.FieldByName('YCLPrice').Value:=Trim(ClientDataSet2.fieldbyname('YCLPrice').AsString);
//SCDS_Sub.FieldByName('KCPlace').Value:=Trim(ClientDataSet2.fieldbyname('KCPlace').AsString);
//CDS_Sub.FieldByName('DepotShow').Value:=Trim(ClientDataSet2.fieldbyname('DepotShow').AsString);
//Post;
end;
// Next;
//end;
end;
end;
end;
finally
frmGetPGJBInList.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.ToolButton1Click(Sender: TObject);
begin
if CDS_Sub.IsEmpty=True then
begin
Application.MessageBox('<27><EFBFBD><EAB5A5><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
OrderDate.SetFocus;
if Trim(OrderNo.Text)='' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
{if Trim(WFBCodeName.Text)='' then
begin
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Trim(WFBCodeName.Hint)='' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>壡','<27><>ʾ',0);
Exit;
end; }
SaveData10();
Panel1.Visible:=True;
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('select * from WFBOrder_Sub where MainId='''+Trim(FMainId)+'''');
Open;
{if MInt=1 then
begin
SELYCL(Order_SubZ);
end else
if MInt=2 then
begin
SELYCL(Order_SubF);
end else
if MInt=3 then
begin
SELYCL(Order_SubQ); }
end;
SCreateCDS20(ADOQuery1,CDS_Sel);
SInitCDSData20(ADOQuery1,CDS_Sel);
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add(' exec P_YCLKC_ListKCDD :KCType ');
if MInt=1 then
begin
Parameters.ParamByName('KCType').Value:='<27><>Ҫ';
end else
if MInt=2 then
begin
Parameters.ParamByName('KCType').Value:='<27><><EFBFBD><EFBFBD>';
end else
if MInt=3 then
begin
Parameters.ParamByName('KCType').Value:='<27><><EFBFBD><EFBFBD>';
end;
open;
end;
SCreateCDS20(ADOQuery1,CDS_KCSel);
SInitCDSData20(ADOQuery1,CDS_KCSel);
end;
procedure TfrmOrderInPutZPLNew.ToolButton2Click(Sender: TObject);
begin
if MInt=1 then
begin
DelOrderSub(Order_SubZ);
end else
if MInt=2 then
begin
DelOrderSub(Order_SubF);
end else
if MInt=3 then
begin
DelOrderSub(Order_SubQ);
end;
end;
procedure TfrmOrderInPutZPLNew.DelOrderSub(FOrder_Sub:TClientDataSet);
begin
if FOrder_Sub.IsEmpty then Exit;
if Trim(FOrder_Sub.fieldbyname('PBID').AsString)<>'' then
begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('delete WFBYCL_PB where PBID='''+Trim(FOrder_Sub.fieldbyname('PBID').AsString)+'''');
sql.Add('delete WFBYCL_PBSub where PBID='''+Trim(FOrder_Sub.fieldbyname('PBID').AsString)+'''');
ExecSQL;
end;
end;
FOrder_Sub.Delete;
end;
procedure TfrmOrderInPutZPLNew.CustomNoNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('CustomNoName');
flagname:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal=1 then
begin
Self.FXS:=99;
CustomNoName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
CustomNoName.Hint:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.CustomNoNamePropertiesChange(Sender: TObject);
begin
if FXS=99 then
begin
PanZDY.Visible:=False;
FXS:=0;
Exit;
end;
ZDYHelp(CustomNoName,'CustomNoName');
end;
procedure TfrmOrderInPutZPLNew.ArrivalPortNamePropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('ArrivalPort');
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal=1 then
begin
Self.FXS:=99;
ArrivalPortName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
ArrivalPortName.Hint:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.SCXNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('SCXName');
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal=1 then
begin
Self.FXS:=99;
SCXName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
SCXName.Hint:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.WJGNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('WJGName');
flagname:='<27><><EFBFBD>ṹ';
if ShowModal=1 then
begin
Self.FXS:=99;
WJGName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
WJGName.Hint:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.WFBCodeNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim(WFBCodeName.Name);
flagname:='<27><><EFBFBD><EFBFBD>';
if ShowModal=1 then
begin
Self.FXS:=99;
WFBCodeName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
WFBCodeName.Hint:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.WFBCodeNamePropertiesChange(Sender: TObject);
begin
if FXS=99 then
begin
PanZDY.Visible:=False;
FXS:=0;
Exit;
end;
ZDYHelp(WFBCodeName,Trim(WFBCodeName.Name));
end;
procedure TfrmOrderInPutZPLNew.ArrivalPortNamePropertiesChange(Sender: TObject);
begin
if FXS=99 then
begin
PanZDY.Visible:=False;
FXS:=0;
Exit;
end;
ZDYHelp(ArrivalPortName,'ArrivalPort');
end;
procedure TfrmOrderInPutZPLNew.SCXNamePropertiesChange(Sender: TObject);
begin
if FXS=99 then
begin
PanZDY.Visible:=False;
FXS:=0;
Exit;
end;
ZDYHelp(SCXName,Trim(SCXName.Name));
end;
procedure TfrmOrderInPutZPLNew.WJGNamePropertiesChange(Sender: TObject);
begin
if FXS=99 then
begin
PanZDY.Visible:=False;
FXS:=0;
Exit;
end;
ZDYHelp(WJGName,Trim(WJGName.Name));
end;
procedure TfrmOrderInPutZPLNew.N1Click(Sender: TObject);
begin
with CDS_DB do
begin
Append;
FieldByName('DBUnit').Value:='<27><>/<2F><>';
Post;
end;
end;
procedure TfrmOrderInPutZPLNew.N2Click(Sender: TObject);
begin
if CDS_DB.IsEmpty then Exit;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('delete WFB_DB where DBID='''+Trim(CDS_DB.fieldbyname('DBID').AsString)+'''');
ExecSQL;
end;
CDS_DB.Delete;
end;
procedure TfrmOrderInPutZPLNew.Day1Change(Sender: TObject);
var
DayL:string;
begin
if trim(Day1.Text)='' then DayL:='0'
else DayL:=Trim(Day1.Text);
ETDDate.DateTime:=ETADate.Date-strtoint(DayL);
end;
procedure TfrmOrderInPutZPLNew.OrdQtyKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in['0'..'9','.',#8,#13]) then
begin
key:=#0;
end;
end;
procedure TfrmOrderInPutZPLNew.Day2Change(Sender: TObject);
var
DayL:string;
begin
if trim(Day2.Text)='' then DayL:='0'
else DayL:=Trim(Day2.Text);
ZGDate.DateTime:=ETDDate.Date-strtoint(DayL);
end;
procedure TfrmOrderInPutZPLNew.Day3Change(Sender: TObject);
var
DayL:string;
begin
if trim(Day3.Text)='' then DayL:='0'
else DayL:=Trim(Day3.Text);
BegSCDate.DateTime:=BegRKDate.Date-strtoint(DayL);
end;
procedure TfrmOrderInPutZPLNew.ETADateChange(Sender: TObject);
begin
if Trim(Day1.Text)<>'' then
begin
ETDDate.DateTime:=ETADate.Date-strtoint(Day1.Text);
end;
if Trim(Day2.Text)<>'' then
begin
ZGDate.DateTime:=ETDDate.Date-strtoint(Day2.Text);
end;
end;
procedure TfrmOrderInPutZPLNew.BegRKDateChange(Sender: TObject);
begin
if Trim(Day3.Text)<>'' then
begin
BegSCDate.DateTime:=BegRKDate.Date-strtoint(Day3.Text);
end;
end;
procedure TfrmOrderInPutZPLNew.Tv1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
MInt:=1;
Tv1.Bands[0].Caption:='<27><>Ҫԭ<D2AA>ϡ<EFBFBD>';
Tv2.Bands[0].Caption:='<27><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>';
Tv3.Bands[0].Caption:='<27><><EFBFBD><EFBFBD>';
Tv1.Bands[0].Styles.Header.TextColor:=clBlue;
Tv2.Bands[0].Styles.Header.TextColor:=clBlack;
Tv3.Bands[0].Styles.Header.TextColor:=clBlack;
end;
procedure TfrmOrderInPutZPLNew.Tv2MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
MInt:=2;
Tv1.Bands[0].Caption:='<27><>Ҫԭ<D2AA><D4AD>';
Tv2.Bands[0].Caption:='<27><><EFBFBD><EFBFBD>ԭ<EFBFBD>ϡ<EFBFBD>';
Tv3.Bands[0].Caption:='<27><><EFBFBD><EFBFBD>';
Tv1.Bands[0].Styles.Header.TextColor:=clBlack;
Tv2.Bands[0].Styles.Header.TextColor:=clBlue;
Tv3.Bands[0].Styles.Header.TextColor:=clBlack;
end;
procedure TfrmOrderInPutZPLNew.Tv3MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
MInt:=3;
Tv1.Bands[0].Caption:='<27><>Ҫԭ<D2AA><D4AD>';
Tv2.Bands[0].Caption:='<27><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>';
Tv3.Bands[0].Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
Tv1.Bands[0].Styles.Header.TextColor:=clBlack;
Tv2.Bands[0].Styles.Header.TextColor:=clBlack;
Tv3.Bands[0].Styles.Header.TextColor:=clBlue;
end;
procedure TfrmOrderInPutZPLNew.v1Column2PropertiesEditValueChanged(
Sender: TObject);
var
mvalue,YLSH,DHSL,YLQty:Double;
FOrdQty,FKZ:String;
begin
YLQty:=0;
mvalue:=TcxTextEdit(Sender).EditingValue; //<2F>K<EFBFBD>O
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add(' select A.* from WFBYCL_PBSub A ');
//SQL.Add(' inner join WFBYCL_PB B on B.PBID=A.PBID ');
sql.Add(' where A.PBID='''+Trim(Order_SubZ.fieldbyname('PBID').AsString)+'''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOTemp.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
if Trim(Order_SubZ.fieldbyname('YLSH').AsString)='' then
begin
YLSH:=0;
end else
YLSH:=StrToFloat(Order_SubZ.fieldbyname('YLSH').AsString);
YLQty:=YLQty+StrToFloat(FOrdQty)*mvalue/100*(1+YLSH/100);
Next;
end;
with Order_SubZ do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
FieldByName('YLPB').Value:=mvalue;
Post;
end;
end;
end;
procedure TfrmOrderInPutZPLNew.OnlyUpYCLData();
var
mvalue,YLSH,DHSL,YLQty:Double;
FOrdQty,FKZ:String;
begin
YLQty:=0;
if Trim(Order_SubZ.fieldbyname('YLPB').AsString)<>'' then
mvalue:=Order_SubZ.fieldbyname('YLPB').Value
else
mvalue:=0; //<2F>K<EFBFBD>O
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add(' select A.* from WFBYCL_PBSub A ');
//SQL.Add(' inner join WFBYCL_PB B on B.PBID=A.PBID ');
sql.Add(' where A.PBID='''+Trim(Order_SubZ.fieldbyname('PBID').AsString)+'''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOTemp.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
if Trim(Order_SubZ.fieldbyname('YLSH').AsString)='' then
begin
YLSH:=0;
end else
YLSH:=StrToFloat(Order_SubZ.fieldbyname('YLSH').AsString);
YLQty:=YLQty+StrToFloat(FOrdQty)*mvalue/100*(1+YLSH/100);
Next;
end;
with Order_SubZ do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
//FieldByName('YLPB').Value:=mvalue;
Post;
end;
end;
end;
procedure TfrmOrderInPutZPLNew.v1Column3PropertiesEditValueChanged(
Sender: TObject);
var
mvalue,YLSH,DHSL,YLQty,YLPB:Double;
FOrdQty,FKZ:String;
begin
YLQty:=0;
mvalue:=TcxTextEdit(Sender).EditingValue; //<2F>K<EFBFBD>O
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PBSub where PBID='''+Trim(Order_SubZ.fieldbyname('PBID').AsString)+'''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOTemp.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
if Trim(Order_SubZ.fieldbyname('YLPB').AsString)='' then
begin
YLPB:=0;
end else
YLPB:=StrToFloat(Order_SubZ.fieldbyname('YLPB').AsString);
YLQty:=YLQty+StrToFloat(FOrdQty)*YLPB/100*(1+mvalue/100);
Next;
end;
with Order_SubZ do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
FieldByName('YLSH').Value:=mvalue;
Post;
end;
end;
end;
procedure TfrmOrderInPutZPLNew.v2Column2PropertiesEditValueChanged(
Sender: TObject);
var
mvalue,YLSHQ,DHSL,YLQty,YLPB:Double;
FOrdQty,FKZ:String;
begin
YLQty:=0;
mvalue:=TcxTextEdit(Sender).EditingValue; //<2F>K<EFBFBD>O
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PBSub where PBID='''+Trim(Order_SubF.fieldbyname('PBID').AsString)+'''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOTemp.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
YLQty:=YLQty+StrToFloat(FOrdQty)*(mvalue*1.00/1000);
Next;
end;
with Order_SubF do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
FieldByName('YLSHQ').Value:=mvalue;
Post;
end;
end;
end;
procedure TfrmOrderInPutZPLNew.OrdQtyChange(Sender: TObject);
begin
YLUpdate();
end;
procedure TfrmOrderInPutZPLNew.YLUpdate();
var
mvalue,YLSH,DHSL,YLQty,YLPB,YLSHQ:Double;
FOrdQty,FKZ:String;
begin
YLQty:=0;
with Order_SubZ do
begin
if Order_SubZ.IsEmpty=False then
begin
First;
while not Eof do
begin
YLQty:=0;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PBSub where PBID='''+Trim(Order_SubZ.fieldbyname('PBID').AsString)+'''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOTemp.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
if Trim(OrdUnit.Text)='<27>K' then
begin
if Trim(Order_SubZ.fieldbyname('YLPB').AsString)='' then
begin
YLPB:=0;
end else
YLPB:=StrToFloat(Order_SubZ.fieldbyname('YLPB').AsString);
if Trim(Order_SubZ.fieldbyname('YLSH').AsString)='' then
begin
YLSH:=0;
end else
YLSH:=StrToFloat(Order_SubZ.fieldbyname('YLSH').AsString);
YLQty:=YLQty+StrToFloat(FOrdQty)*YLPB/100*(1+YLSH/100);
end else
if Trim(OrdUnit.Text)='<27>O' then
begin
if Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString)='' then
begin
FKZ:='0';
end else
FKZ:=Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString);
DHSL:=StrToFloat(FOrdQty)*strtofloat(FKZ)/1000;
if Trim(Order_SubZ.fieldbyname('YLPB').AsString)='' then
begin
YLPB:=0;
end else
YLPB:=StrToFloat(Order_SubZ.fieldbyname('YLPB').AsString);
if Trim(Order_SubZ.fieldbyname('YLSH').AsString)='' then
begin
YLSH:=0;
end else
YLSH:=StrToFloat(Order_SubZ.fieldbyname('YLSH').AsString);
YLQty:=YLQty+DHSL*YLPB/100*(1+YLSH/100);
end;
Next;
end;
with Order_SubZ do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
Post;
end;
end;
Next;
end;
end;
end;
if Order_SubF.IsEmpty=False then
begin
with Order_SubF do
begin
First;
while not Eof do
begin
YLQty:=0;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PBSub where PBID='''+Trim(Order_SubF.fieldbyname('PBID').AsString)+'''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOTemp.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
if Trim(OrdUnit.Text)='<27>K' then
begin
if Trim(Order_SubF.fieldbyname('YLSHQ').AsString)='' then
begin
YLSHQ:=0;
end else
YLSHQ:=StrToFloat(Order_SubF.fieldbyname('YLSHQ').AsString);
YLQty:=YLQty+StrToFloat(FOrdQty)*(YLSHQ*1.00/1000);
end else
if Trim(OrdUnit.Text)='<27>O' then
begin
if Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString)='' then
begin
FKZ:='0';
end else
FKZ:=Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString);
DHSL:=StrToFloat(FOrdQty)*strtofloat(FKZ)/1000;
if Trim(Order_SubF.fieldbyname('YLSHQ').AsString)='' then
begin
YLSHQ:=0;
end else
YLSHQ:=StrToFloat(Order_SubF.fieldbyname('YLSHQ').AsString);
YLQty:=YLQty+DHSL*(YLSHQ*1.00/1000);
end;
Next;
end;
with Order_SubF do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
Post;
end;
end;
Next;
end;
end;
end;
end;
procedure TfrmOrderInPutZPLNew.v3Column4PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:Double;
begin
mvalue:=TcxTextEdit(Sender).EditingValue;
with Order_SubQ do
begin
Edit;
FieldByName('YLQty').Value:=mvalue;
if mvalue-fieldbyname('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=mvalue-fieldbyname('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
Post;
end;
end;
procedure TfrmOrderInPutZPLNew.TBPrintClick(Sender: TObject);
var
fPrintFile:String;
begin
with ADOQueryQG do
begin
Close;
sql.Clear;
sql.Add(' exec P_Print_SGD :OrderNo');
Parameters.ParamByName('OrderNo').Value:=Trim(OrderNo.Text);
Open;
end;
if ADOQueryQG.IsEmpty then Exit;
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\<5C><EFBFBD><EBB9BA>.rmf' ;
if FileExists(fPrintFile) then
begin
RM2.LoadFromFile(fPrintFile);
RMVariables['dyr']:=Trim(DName);
RM2.ShowReport;
end else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><EFBFBD><EBB9BA>.rmf'),'<27><>ʾ',0);
end;
end;
procedure TfrmOrderInPutZPLNew.v1Column1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
EditYCL(Order_SubZ);
end;
procedure TfrmOrderInPutZPLNew.v2Column1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
EditYCL(Order_SubF);
end;
procedure TfrmOrderInPutZPLNew.v3Column1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
EditYCL(Order_SubQ);
end;
procedure TfrmOrderInPutZPLNew.MenuItem1Click(Sender: TObject);
var
i:Integer;
begin
CopyAddRow(TvSub,CDS_Sub);
i:=CDS_Sub.RecordCount;
with CDS_Sub do
begin
Edit;
FieldByName('MainId').Value:='';
FieldByName('SubId').Value:='';
FieldByName('SWFBColor').Value:='';
FieldByName('SWFBCode').Value:='';
FieldByName('SWFBCodeName').Value:='';
FieldByName('SWFBBZQty1').Value:=0;
FieldByName('SOrdQty').Value:=0;
FieldByName('XHNO').Value:=IntToStr(i);
Post;
end;
OrdQty.Text:=floattostr(TvSub.DataController.Summary.FooterSummaryValues[0]);
end;
procedure TfrmOrderInPutZPLNew.MenuItem2Click(Sender: TObject);
var
mvalue,YLSH,DHSL,YLQty,YLPB,YLSHQ:Double;
FOrdQty,FKZ:String;
begin
if CDS_Sub.IsEmpty then Exit;
if Trim(CDS_Sub.fieldbyname('SubID').AsString)<>'' then
begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from WFBYCL_PBSub where SubId='''+Trim(CDS_Sub.fieldbyname('SubID').AsString)+'''');
Open;
end;
if ADOTemp.IsEmpty=False then
begin
with ADOCMD do
begin
Close;
sql.Clear;
sql.Add('delete WFBYCL_PBSub where SubId='''+Trim(CDS_Sub.fieldbyname('SubID').AsString)+'''');
sql.Add('delete WFBOrder_Sub where SubID='''+Trim(CDS_Sub.fieldbyname('SubID').AsString)+'''');
ExecSQL;
end;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PB where MainId='''+Trim(FMainId)+''' ');
sql.Add(' and not exists(select * from WFBYCL_PBSub A where A.PBId=WFBYCL_PB.PBID and A.MainId='''+Trim(FMainId)+''' )');
open;
end;
with ADOTemp do
begin
ADOTemp.First;
while not ADOTemp.Eof do
begin
if Trim(ADOTemp.fieldbyname('PBID').AsString)<>'' then
begin
if Order_SubZ.IsEmpty=False then
begin
if Order_SubZ.Locate('PBID',Trim(ADOTemp.fieldbyname('PBID').AsString),[]) then
Order_SubZ.Delete;
end;
if Order_SubF.IsEmpty=False then
begin
if Order_SubF.Locate('PBID',Trim(ADOTemp.fieldbyname('PBID').AsString),[]) then
Order_SubF.Delete;
end;
if Order_SubQ.IsEmpty=False then
begin
if Order_SubQ.Locate('PBID',Trim(ADOTemp.fieldbyname('PBID').AsString),[]) then
Order_SubQ.Delete;
end;
end;
ADOTemp.Next;
end;
end;
with ADOCMD do
begin
Close;
SQL.Clear;
sql.Add(' delete WFBYCL_PB where not exists(select * from WFBYCL_PBSub A where A.PBId=WFBYCL_PB.PBID )');
SQL.Add(' and MainId='''+Trim(FMainId)+'''');
ExecSQL;
end;
end else
begin
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('delete WFBOrder_Sub where SubID='''+Trim(CDS_Sub.fieldbyname('SubID').AsString)+'''');
ExecSQL;
end;
end;
end;
CDS_Sub.Delete;
//YLUpdate();
if CDS_Sub.isempty=False then
OrdQty.Text:=floattostr(TvSub.DataController.Summary.FooterSummaryValues[0]);
//if ((Order_SubZ.IsEmpty) and (Order_SubF.IsEmpty) and (Order_SubQ.IsEmpty)) then Exit;
YLUpdate();
end;
procedure TfrmOrderInPutZPLNew.cxGridDBColumn3PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='WFBColor';
flagname:='<27><>ɫ';
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('SWFBColor').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
//Post;
end;
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.vSubColumn2PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='WFBHX';
flagname:='<27><><EFBFBD><EFBFBD>';
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('SWFBHW').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
//Post;
end;
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.cxGridDBColumn2PropertiesEditValueChanged(
Sender: TObject);
var
FOrdQty,FKZ:String;
begin
FKZ:=TcxTextEdit(Sender).EditingText;
with CDS_Sub do
begin
Edit;
if Trim(FKZ)='' then
FieldByName('SWFBKZ').Value:='0'
else
FieldByName('SWFBKZ').Value:=FKZ;
Post;
end;
YCLDataUPdate();
end;
procedure TfrmOrderInPutZPLNew.YCLDataUPdate();
var
mvalue,YLSH,DHSL,YLQty,YLPB,YLSHQ,FQty1,FQty2,FQty3,FFK1,FFK2,DDZDHL:Double;
FOrdQty,FKZ,ZPType:String;
begin
if Trim(CDS_Sub.FieldByName('SWFBFK1').AsString)='' then
FFK1:=0
else
FFK1:=CDS_Sub.FieldByName('SWFBFK1').Value;
if Trim(CDS_Sub.FieldByName('SWFBFK2').AsString)='' then
FFK2:=0
else
FFK2:=CDS_Sub.FieldByName('SWFBFK2').Value;
if Trim(CDS_Sub.FieldByName('SWFBBZQty1').AsString)='' then
FQty1:=1
else
FQty1:=CDS_Sub.FieldByName('SWFBBZQty1').Value;
if Trim(CDS_Sub.FieldByName('SWFBBZQty2').AsString)='' then
FQty2:=1
else
FQty2:=CDS_Sub.FieldByName('SWFBBZQty2').Value;
if Trim(CDS_Sub.FieldByName('SWFBBZQty3').AsString)='' then
FQty3:=1
else
FQty3:=CDS_Sub.FieldByName('SWFBBZQty3').Value;
if Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString)='' then
FKZ:='0'
else
FKZ:=Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString);
ZPType:=Trim(CDS_Sub.fieldbyname('SubType').AsString);
if Trim(ZPType)='<27><><EFBFBD><EFBFBD>' then
begin
if Trim(Self.DD.Text)<>'' then
begin
DDZDHL:=StrToFloat(DD.Text);
end else
DDZDHL:=0;
end else
if Trim(ZPType)='<27>۵<EFBFBD>' then
begin
if Trim(Self.ZD.Text)<>'' then
begin
DDZDHL:=StrToFloat(ZD.Text);
end else
DDZDHL:=0;
end else
DDZDHL:=0;
DDZDHL:=(100+DDZDHL)*1.00/100;
with CDS_Sub do
begin
Edit;
FieldByName('SOrdQty').Value:=(FFK1*1.00/100)*(FFK2*1.00/100)*(FQty1*FQty2*FQty3)*Strtofloat(FKZ)/1000*DDZDHL;
Post;
end;
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
OrdQty.Text:=floattostr(TvSub.DataController.Summary.FooterSummaryValues[0]);
YLQty:=0;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add(' select distinct(A.PBID) PBID from WFBYCL_PBSub A ');
SQL.Add(' inner join WFBYCL_PB B on B.PBID=A.PBID ');
sql.Add(' where A.SubId='''+Trim(CDS_Sub.fieldbyname('SubId').AsString)+'''');
sql.Add(' and B.PBType=''<27><>Ҫ''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
with ADOQuery1 do
begin
Close;
sql.Clear;
SQL.Add('select * from WFBYCL_PBSub where PBID='''+Trim(ADOTemp.fieldbyname('PBID').AsString)+'''');
Open;
end;
Order_SubZ.Locate('PBID',Trim(ADOTemp.fieldbyname('PBID').AsString),[]);
if Trim(Order_SubZ.fieldbyname('YLSH').AsString)='' then
begin
YLSH:=0;
end else
YLSH:=StrToFloat(Order_SubZ.fieldbyname('YLSH').AsString);
if Trim(Order_SubZ.fieldbyname('YLPB').AsString)='' then
begin
YLPB:=0;
end else
YLPB:=StrToFloat(Order_SubZ.fieldbyname('YLPB').AsString);
with ADOQuery1 do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOQuery1.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
YLQty:=YLQty+StrToFloat(FOrdQty)*YLPB/100*(1+YLSH/100);
Next;
end;
end;
with Order_SubZ do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
Post;
end;
YLQty:=0;
Next;
end;
end;
YLQty:=0;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add(' select distinct(A.PBID) PBID from WFBYCL_PBSub A ');
SQL.Add(' inner join WFBYCL_PB B on B.PBID=A.PBID ');
sql.Add(' where A.SubId='''+Trim(CDS_Sub.fieldbyname('SubId').AsString)+'''');
sql.Add(' and B.PBType=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
with ADOQuery1 do
begin
Close;
sql.Clear;
SQL.Add('select * from WFBYCL_PBSub where PBID='''+Trim(ADOTemp.fieldbyname('PBID').AsString)+'''');
Open;
end;
Order_SubF.Locate('PBID',Trim(ADOTemp.fieldbyname('PBID').AsString),[]);
if Trim(Order_SubF.fieldbyname('YLSHQ').AsString)='' then
begin
YLSHQ:=0;
end else
YLSHQ:=StrToFloat(Order_SubF.fieldbyname('YLSHQ').AsString);
with ADOQuery1 do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOQuery1.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
YLQty:=YLQty+StrToFloat(FOrdQty)*(YLSHQ*1.00/1000);
Next;
end;
end;
with Order_SubF do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
Post;
end;
YLQty:=0;
Next;
end;
end;
end;
procedure TfrmOrderInPutZPLNew.TvSubColumn1PropertiesEditValueChanged(
Sender: TObject);
var
mvalue,YLSH,DHSL,YLQty,YLPB,YLSHQ:Double;
FOrdQty,FKZ:String;
begin
FOrdQty:=TcxTextEdit(Sender).EditingText;
with CDS_Sub do
begin
Edit;
if Trim(FOrdQty)='' then
FieldByName('SOrdQty').Value:='0'
else
FieldByName('SOrdQty').Value:=FOrdQty;
Post;
end;
YLQty:=0;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add(' select distinct(A.PBID) PBID from WFBYCL_PBSub A ');
SQL.Add(' inner join WFBYCL_PB B on B.PBID=A.PBID ');
sql.Add(' where A.SubId='''+Trim(CDS_Sub.fieldbyname('SubId').AsString)+'''');
sql.Add(' and B.PBType=''<27><>Ҫ''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
with ADOQuery1 do
begin
Close;
sql.Clear;
SQL.Add('select * from WFBYCL_PBSub where PBID='''+Trim(ADOTemp.fieldbyname('PBID').AsString)+'''');
Open;
end;
Order_SubZ.Locate('PBID',Trim(ADOTemp.fieldbyname('PBID').AsString),[]);
if Trim(Order_SubZ.fieldbyname('YLSH').AsString)='' then
begin
YLSH:=0;
end else
YLSH:=StrToFloat(Order_SubZ.fieldbyname('YLSH').AsString);
if Trim(Order_SubZ.fieldbyname('YLPB').AsString)='' then
begin
YLPB:=0;
end else
YLPB:=StrToFloat(Order_SubZ.fieldbyname('YLPB').AsString);
with ADOQuery1 do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOQuery1.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
if Trim(OrdUnit.Text)='<27>K' then
begin
YLQty:=YLQty+StrToFloat(FOrdQty)*YLPB/100*(1+YLSH/100);
end else
if Trim(OrdUnit.Text)='<27>O' then
begin
if Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString)='' then
begin
FKZ:='0';
end else
FKZ:=Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString);
DHSL:=StrToFloat(FOrdQty)*strtofloat(FKZ)/1000;
YLQty:=YLQty+DHSL*YLPB/100*(1+YLSH/100);
end;
Next;
end;
end;
with Order_SubZ do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
Post;
end;
YLQty:=0;
Next;
end;
end;
YLQty:=0;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add(' select distinct(A.PBID) PBID from WFBYCL_PBSub A ');
SQL.Add(' inner join WFBYCL_PB B on B.PBID=A.PBID ');
sql.Add(' where A.SubId='''+Trim(CDS_Sub.fieldbyname('SubId').AsString)+'''');
sql.Add(' and B.PBType=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
with ADOQuery1 do
begin
Close;
sql.Clear;
SQL.Add('select * from WFBYCL_PBSub where PBID='''+Trim(ADOTemp.fieldbyname('PBID').AsString)+'''');
Open;
end;
Order_SubF.Locate('PBID',Trim(ADOTemp.fieldbyname('PBID').AsString),[]);
if Trim(Order_SubF.fieldbyname('YLSHQ').AsString)='' then
begin
YLSHQ:=0;
end else
YLSHQ:=StrToFloat(Order_SubF.fieldbyname('YLSHQ').AsString);
with ADOQuery1 do
begin
First;
while not Eof do
begin
CDS_Sub.Locate('SubId',Trim(ADOQuery1.fieldbyname('SubId').AsString),[]);
if Trim(CDS_Sub.fieldbyname('SOrdQty').AsString)='' then
FOrdQty:='0'
else
FOrdQty:=Trim(CDS_Sub.fieldbyname('SOrdQty').AsString);
if Trim(OrdUnit.Text)='<27>K' then
begin
YLQty:=YLQty+StrToFloat(FOrdQty)*(YLSHQ*1.00/1000);
end else
if Trim(OrdUnit.Text)='<27>O' then
begin
if Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString)='' then
begin
FKZ:='0';
end else
FKZ:=Trim(CDS_Sub.fieldbyname('SWFBKZ').AsString);
DHSL:=StrToFloat(FOrdQty)*strtofloat(FKZ)/1000;
YLQty:=YLQty+DHSL*(YLSHQ*1.00/1000);
end;
Next;
end;
end;
with Order_SubF do
begin
Edit;
FieldByName('YLQty').Value:=YLQty;
if YLQty-FieldByName('YCLYJKC').Value>=0 then
FieldByName('BZ').Value:=YLQty-FieldByName('YCLYJKC').Value
else
FieldByName('BZ').Value:=null;
Post;
end;
YLQty:=0;
Next;
end;
end;
//OrdQty:=
OrdQty.Text:=floattostr(TvSub.DataController.Summary.FooterSummaryValues[0]);
end;
procedure TfrmOrderInPutZPLNew.Panel10MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TWinControl(Panel1).perform(WM_SYSCOMMAND, $F012, 0);
end;
procedure TfrmOrderInPutZPLNew.Image2Click(Sender: TObject);
begin
Panel1.Visible:=False;
end;
procedure TfrmOrderInPutZPLNew.Button3Click(Sender: TObject);
begin
Panel1.Visible:=False;
end;
procedure TfrmOrderInPutZPLNew.Button2Click(Sender: TObject);
begin
if CDS_Sel.Locate('ssel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if MInt=1 then
begin
SELYCLKC(Order_SubZ);
end else
if MInt=2 then
begin
SELYCLKC(Order_SubF);
end else
if MInt=3 then
begin
SELYCLKC(Order_SubQ);
end;
Panel1.Visible:=False;
end;
procedure TfrmOrderInPutZPLNew.SELYCLKC(SCDS_Sub:TClientDataSet);
var
maxno,maxnosub:string;
YLPB,YLSH:Double;
begin
try ADOCmd.Connection.BeginTrans;
with CDS_KCSel do
begin
First;
while not Eof do
begin
if CDS_KCSel.FieldByName('SSel').AsBoolean=True then
begin
if MInt=1 then
begin
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select Top 1* from WFBYCL_PB where YCLCode='''+Trim(CDS_KCSel.fieldbyname('YCLCode').AsString)+'''');
Open;
end;
if ADOTemp.IsEmpty=False then
begin
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select Top 1* from WFBYCL_PB where YCLCode='''+Trim(CDS_KCSel.fieldbyname('YCLCode').AsString)+'''');
SQL.Add(' and YLPB>0 order by FillTime desc');
Open;
end;
if Trim(ADOTemp.fieldbyname('YLPB').AsString)<>'' then
YLPB:=ADOTemp.fieldbyname('YLPB').Value
else
YLPB:=0;
if Trim(ADOTemp.fieldbyname('YLSH').AsString)<>'' then
YLSH:=ADOTemp.fieldbyname('YLSH').Value
else
YLSH:=0;
end else
begin
YLPB:=0;
YLSH:=0;
end;
end;
with SCDS_Sub do
begin
Append;
SCDS_Sub.FieldByName('YCLCode').Value:=Trim(CDS_KCSel.fieldbyname('YCLCode').AsString);
SCDS_Sub.FieldByName('YCLName').Value:=Trim(CDS_KCSel.fieldbyname('YCLName').AsString);
SCDS_Sub.FieldByName('YCLSpec').Value:=Trim(CDS_KCSel.fieldbyname('YCLSpec').AsString);
SCDS_Sub.FieldByName('YLKC').Value:=Trim(CDS_KCSel.fieldbyname('KCQty').AsString);
SCDS_Sub.FieldByName('YLUnit').Value:=Trim(CDS_KCSel.fieldbyname('KCUint').AsString);
SCDS_Sub.FieldByName('CRID').Value:=Trim(CDS_KCSel.fieldbyname('CRID').AsString);
SCDS_Sub.FieldByName('YCLYJKC').Value:=Trim(CDS_KCSel.fieldbyname('YJKC').AsString);
if MInt=1 then
begin
SCDS_Sub.FieldByName('YLPB').Value:=YLPB;
SCDS_Sub.FieldByName('YLSH').Value:=YLSH;
end;
Post;
end;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if GetLSNo(ADOCmd,maxno,'PB','WFBYCL_PB',4,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFBYCL_PB where 1<>1');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('PBId').Value:=Trim(maxno);
if MInt=1 then
begin
FieldByName('PBType').Value:='<27><>Ҫ';
end else
if MInt=2 then
begin
FieldByName('PBType').Value:='<27><><EFBFBD><EFBFBD>';
end else
if MInt=3 then
begin
FieldByName('PBType').Value:='<27><><EFBFBD><EFBFBD>';
end;
FieldByName('YCLCode').Value:=Trim(CDS_KCSel.fieldbyname('YCLCode').AsString);
FieldByName('YCLName').Value:=Trim(CDS_KCSel.fieldbyname('YCLName').AsString);
FieldByName('YCLSpec').Value:=Trim(CDS_KCSel.fieldbyname('YCLSpec').AsString);
FieldByName('YLKC').Value:=Trim(CDS_KCSel.fieldbyname('KCQty').AsString);
FieldByName('YLUnit').Value:=Trim(CDS_KCSel.fieldbyname('KCUint').AsString);
FieldByName('CRID').Value:=Trim(CDS_KCSel.fieldbyname('CRID').AsString);
FieldByName('YCLYJKC').Value:=Trim(CDS_KCSel.fieldbyname('YJKC').AsString);
Post;
end;
with SCDS_Sub do
begin
Edit;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('PBId').Value:=Trim(maxno);
Post;
end;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
with Self.CDS_Sel do
begin
First;
while not Eof do
begin
if Self.CDS_Sel.FieldByName('SSel').AsBoolean=True then
begin
if GetLSNo(ADOCmd,maxnosub,'PS','WFBYCL_PBSub',4,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFBYCL_PBSub where 1<>1');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('SubId').Value:=Trim(CDS_Sel.fieldbyname('SubId').AsString);
FieldByName('PBId').Value:=Trim(maxno);
FieldByName('PSId').Value:=Trim(maxnosub);
Post;
end;
end;
Next;
end;
end;
if MInt=1 then
OnlyUpYCLData();
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
end;
Next;
end;
end;
ADOCmd.Connection.CommitTrans;
except
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
Exit;
end;
end;
procedure TfrmOrderInPutZPLNew.FormClose(Sender: TObject;
var Action: TCloseAction);
var
maxno,FFS:string;
wz:Integer;
begin
WriteCxBandedGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',Tv1,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
WriteCxBandedGrid('<27><><EFBFBD>ϸ<EFBFBD>1',Tv2,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
WriteCxBandedGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',Tv3,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>1',TvSub,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',TVDB,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
{if CopyInt=1 then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('delete WFBOrder_Main where MainId='''+Trim(FMainId)+'''');
sql.Add('delete WFBOrder_Sub where MainId='''+Trim(FMainId)+'''');
sql.Add('delete WFB_DB where MainId='''+Trim(FMainId)+'''');
sql.Add('delete WFBYCL_PB where MainId='''+Trim(FMainId)+'''');
sql.Add('delete WFBYCL_PBSub where MainId='''+Trim(FMainId)+'''');
ExecSQL;
end;
end;
wz:=Pos('F',FMainId);
FFS:=Copy(FMainId,wz,4);
if ((CopyInt=1) or (FFS='FZ')) then
begin
UpMainId();
end; }
end;
procedure TfrmOrderInPutZPLNew.UpMainId();
var
maxno:string;
begin
try
ADOCmd.Connection.BeginTrans;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PBSub where MainId='''+Trim(FMainId)+'''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
if GetLSNo(ADOCmd,maxno,'PS','WFBYCL_PBSub',4,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBYCL_PBSub Set PSID='''+Trim(maxno)+'''');
SQL.Add(' where PSID='''+Trim(ADOTemp.fieldbyname('PSID').AsString)+'''');
ExecSQL;
end;
Next;
end;
end;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBYCL_PB where MainId='''+Trim(FMainId)+'''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
if GetLSNo(ADOCmd,maxno,'PB','WFBYCL_PB',4,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBYCL_PB Set PBID='''+Trim(maxno)+'''');
SQL.Add(' where PBID='''+Trim(ADOTemp.fieldbyname('PBID').AsString)+'''');
sql.Add('UPdate WFBYCL_PBSub Set PBID='''+Trim(maxno)+'''');
SQL.Add(' where PBID='''+Trim(ADOTemp.fieldbyname('PBID').AsString)+'''');
ExecSQL;
end;
Next;
end;
end;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from WFBOrder_Sub where MainId='''+Trim(FMainId)+'''');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
if GetLSNo(ADOCmd,maxno,'','WFBOrder_Sub',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBOrder_Sub Set SubID='''+Trim(maxno)+'''');
SQL.Add(' where SubID='''+Trim(ADOTemp.fieldbyname('SubID').AsString)+'''');
sql.Add('UPdate WFBYCL_PBSub Set SubID='''+Trim(maxno)+'''');
SQL.Add(' where SubID='''+Trim(ADOTemp.fieldbyname('SubID').AsString)+'''');
ExecSQL;
end;
Next;
end;
end;
if GetLSNo(ADOCmd,maxno,'','WFBOrder_Main',2,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBOrder_Main Set MainID='''+Trim(maxno)+'''');
SQL.Add(' where MainID='''+Trim(FMainId)+'''');
sql.Add('Update WFBOrder_Sub Set MainID='''+Trim(maxno)+'''');
SQL.Add(' where MainID='''+Trim(FMainId)+'''');
sql.Add('Update WFB_DB Set MainID='''+Trim(maxno)+'''');
SQL.Add(' where MainID='''+Trim(FMainId)+'''');
sql.Add('UPdate WFBYCL_PB Set MainID='''+Trim(maxno)+'''');
SQL.Add(' where MainID='''+Trim(FMainId)+'''');
sql.Add('UPdate WFBYCL_PBSub Set MainID='''+Trim(maxno)+'''');
SQL.Add(' where MainID='''+Trim(FMainId)+'''');
ExecSQL;
end;
ADOCmd.Connection.CommitTrans;
FMainId:=Trim(maxno);
except
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
end;
end;
procedure TfrmOrderInPutZPLNew.vSubColumn6PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('WFBBZUnitD');
flagname:='<27><><EFBFBD><EFBFBD>װ';
if ShowModal=1 then
begin
Self.CDS_Sub.Edit;
CDS_Sub.FieldByName('SWFBBZUnit1').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.vSubColumn8PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('WFBBZUnitZ');
flagname:='<27>а<EFBFBD>װ';
if ShowModal=1 then
begin
Self.CDS_Sub.Edit;
CDS_Sub.FieldByName('SWFBBZUnit2').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.vSubColumn10PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('WFBBZUnitD');
flagname:='С<><D0A1>װ';
if ShowModal=1 then
begin
Self.CDS_Sub.Edit;
CDS_Sub.FieldByName('SWFBBZUnit3').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.BZPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
{try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('BZ');
flagname:='<27><><EFBFBD>۵<EFBFBD>λ';
if ShowModal=1 then
begin
Self.FXS:=99;
BZ.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
BZ.Hint:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end; }
end;
procedure TfrmOrderInPutZPLNew.BZPropertiesChange(Sender: TObject);
begin
{ if FXS=99 then
begin
PanZDY.Visible:=False;
FXS:=0;
Exit;
end;
ZDYHelp(BZ,'BZ'); }
end;
procedure TfrmOrderInPutZPLNew.cxGridDBColumn4PropertiesEditValueChanged(
Sender: TObject);
var
FStr:String;
begin
FStr:=TcxTextEdit(Sender).EditingText;
with CDS_Sub do
begin
Edit;
if Trim(FStr)='' then
FieldByName('SWFBFK1').Value:='0'
else
FieldByName('SWFBFK1').Value:=FStr;
Post;
end;
YCLDataUPdate();
end;
procedure TfrmOrderInPutZPLNew.vSubColumn4PropertiesEditValueChanged(
Sender: TObject);
var
FStr:String;
begin
FStr:=TcxTextEdit(Sender).EditingText;
with CDS_Sub do
begin
Edit;
if Trim(FStr)='' then
FieldByName('SWFBFK2').Value:='0'
else
FieldByName('SWFBFK2').Value:=FStr;
Post;
end;
YCLDataUPdate();
end;
procedure TfrmOrderInPutZPLNew.vSubColumn5PropertiesEditValueChanged(
Sender: TObject);
var
FStr:String;
begin
FStr:=TcxTextEdit(Sender).EditingText;
with CDS_Sub do
begin
Edit;
if Trim(FStr)='' then
FieldByName('SWFBBZQty1').Value:='1'
else
FieldByName('SWFBBZQty1').Value:=FStr;
Post;
end;
YCLDataUPdate();
end;
procedure TfrmOrderInPutZPLNew.vSubColumn7PropertiesEditValueChanged(
Sender: TObject);
var
FStr:String;
begin
FStr:=TcxTextEdit(Sender).EditingText;
with CDS_Sub do
begin
Edit;
if Trim(FStr)='' then
FieldByName('SWFBBZQty2').Value:='1'
else
FieldByName('SWFBBZQty2').Value:=FStr;
Post;
end;
YCLDataUPdate();
end;
procedure TfrmOrderInPutZPLNew.vSubColumn9PropertiesEditValueChanged(
Sender: TObject);
var
FStr:String;
begin
FStr:=TcxTextEdit(Sender).EditingText;
with CDS_Sub do
begin
Edit;
if Trim(FStr)='' then
FieldByName('SWFBBZQty3').Value:='1'
else
FieldByName('SWFBBZQty3').Value:=FStr;
Post;
end;
YCLDataUPdate();
end;
procedure TfrmOrderInPutZPLNew.vSubColumn12PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim(WFBCodeName.Name);
flagname:='<27><><EFBFBD><EFBFBD>';
if ShowModal=1 then
begin
CDS_Sub.Edit;
CDS_Sub.FieldByName('SWFBCodeName').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
CDS_Sub.FieldByName('SWFBCode').Value:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select Top 1* from WFBOrder_Sub where SWFBCode='''+Trim(CDS_Sub.fieldbyname('SWFBCode').AsString)+'''');
Open;
end;
if ADOTemp.IsEmpty then Exit;
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add('select Top 1* from WFBOrder_Sub where SWFBCode='''+Trim(CDS_Sub.fieldbyname('SWFBCode').AsString)+'''');
sql.Add(' order by SFillTIme Desc');
Open;
end;
with CDS_Sub do
begin
Edit;
FieldByName('SWFBColor').Value:=ADOTemp.fieldbyname('SWFBColor').Value;
FieldByName('SWFBHW').Value:=ADOTemp.fieldbyname('SWFBHW').Value;
FieldByName('SWFBKZ').Value:=ADOTemp.fieldbyname('SWFBKZ').Value;
FieldByName('SWFBFK1').Value:=ADOTemp.fieldbyname('SWFBFK1').Value;
FieldByName('SWFBFK2').Value:=ADOTemp.fieldbyname('SWFBFK2').Value;
FieldByName('SOrdPrice').Value:=ADOTemp.fieldbyname('SOrdPrice').Value;
FieldByName('SWFBBZUnit1').Value:=ADOTemp.fieldbyname('SWFBBZUnit1').Value;
FieldByName('SWFBBZQty2').Value:=ADOTemp.fieldbyname('SWFBBZQty2').Value;
FieldByName('SWFBBZUnit2').Value:=ADOTemp.fieldbyname('SWFBBZUnit2').Value;
FieldByName('SWFBBZQty3').Value:=ADOTemp.fieldbyname('SWFBBZQty3').Value;
FieldByName('SWFBBZUnit3').Value:=ADOTemp.fieldbyname('SWFBBZUnit3').Value;
FieldByName('WKMS').Value:=ADOTemp.fieldbyname('WKMS').Value;
FieldByName('KZSmal').Value:=ADOTemp.fieldbyname('KZSmal').Value;
FieldByName('KZBig').Value:=ADOTemp.fieldbyname('KZBig').Value;
//Post;
end;
end;
procedure TfrmOrderInPutZPLNew.MenuItem3Click(Sender: TObject);
begin
CDS_Sel.DisableControls;
with CDS_Sel do
begin
First;
while not Eof do
begin
Edit;
FieldByName('SSel').Value:=True;
Post;
Next;
end;
end;
CDS_Sel.EnableControls;
end;
procedure TfrmOrderInPutZPLNew.MenuItem4Click(Sender: TObject);
begin
CDS_Sel.DisableControls;
with CDS_Sel do
begin
First;
while not Eof do
begin
Edit;
FieldByName('SSel').Value:=False;
Post;
Next;
end;
end;
CDS_Sel.EnableControls;
end;
procedure TfrmOrderInPutZPLNew.cxButtonEdit1PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('JJDW');
flagname:='<27>Ƽ۵<C6BC>λ';
if ShowModal=1 then
begin
Self.FXS:=99;
BZ.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
// BZ.Hint:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.cxButtonEdit1PropertiesChange(
Sender: TObject);
begin
if FXS=99 then
begin
PanZDY.Visible:=False;
FXS:=0;
Exit;
end;
ZDYHelp(BZ,'JJDW');
end;
procedure TfrmOrderInPutZPLNew.vSubColumn13PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:=Trim('WKMS');
flagname:='<27><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>';
if ShowModal=1 then
begin
Self.CDS_Sub.Edit;
CDS_Sub.FieldByName('WKMS').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmOrderInPutZPLNew.TBChkOkClick(Sender: TObject);
begin
ChkInt:=1;
TBSave.Click;
end;
procedure TfrmOrderInPutZPLNew.TBChkNoClick(Sender: TObject);
begin
ChkInt:=2;
TBSave.Click;
end;
procedure TfrmOrderInPutZPLNew.Button4Click(Sender: TObject);
begin
if CDS_Sub.IsEmpty then exit;
if( (Order_SubZ.IsEmpty) and (Order_SubF.IsEmpty) and (Order_SubQ.IsEmpty) )then Exit;
if Trim(OrderNo.Text)='' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
SaveData10();
if CDS_Sub.Locate('SSel',True,[])=False then
begin
Application.MessageBox('<27>굥δѡ<CEB4><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8>£<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Order_SubZ.Locate('SSel',True,[])=False then
begin
if Order_SubF.Locate('SSel',True,[])=False then
if Order_SubZ.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<>ϱ<EFBFBD>δѡ<CEB4><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8>£<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end;
try
ADOCMD.Connection.BeginTrans;
YCLPBIDUPdate(Order_SubZ);
YCLPBIDUPdate(Order_SubF);
YCLPBIDUPdate(Order_SubQ);
YLUpdate();
ADOCMD.Connection.CommitTrans;
Application.MessageBox('<27><><EFBFBD>³ɹ<C2B3><C9B9><EFBFBD>','<27><>ʾ',0);
Exit;
except
ADOCMD.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
end;
end;
procedure TfrmOrderInPutZPLNew.YCLPBIDUPdate(SOrder_SubZ:TClientDataSet);
var
maxno:String;
begin
with CDS_Sub do
begin
First;
while not Eof do
begin
if CDS_Sub.FieldByName('SSel').AsBoolean=True then
begin
with SOrder_SubZ do
begin
First;
while not Eof do
begin
if SOrder_SubZ.FieldByName('SSel').AsBoolean=True then
begin
with ADOCMD do
begin
Close;
sql.Clear;
sql.Add('delete WFBYCL_PBSub where SubId='''+Trim(CDS_Sub.fieldbyname('SubId').AsString)+'''');
sql.Add(' and PBID='''+Trim(SOrder_SubZ.fieldbyname('PBID').AsString)+'''');
ExecSQL;
end;
if GetLSNo(ADOCMD,maxno,'PS','WFBYCL_PBSub',4,1)=False then
begin
ADOCMD.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOCMD do
begin
Close;
sql.Clear;
sql.Add('select * from WFBYCL_PBSub where 1<>1');
Open;
end;
with ADOCMD do
begin
Append;
FieldByName('MainId').Value:=Trim(FMainId);
FieldByName('SubId').Value:=Trim(CDS_Sub.fieldbyname('SubId').AsString);
FieldByName('PBID').Value:=Trim(SOrder_SubZ.fieldbyname('PBID').AsString);
FieldByName('PSID').Value:=Trim(maxno);
Post;
end;
end;
Next;
end;
end;
end;
Next;
end;
end;
end;
procedure TfrmOrderInPutZPLNew.N3Click(Sender: TObject);
begin
SelAll(CDS_Sub,True);
end;
procedure TfrmOrderInPutZPLNew.N4Click(Sender: TObject);
begin
SelAll(CDS_Sub,False);
end;
procedure TfrmOrderInPutZPLNew.DDChange(Sender: TObject);
begin
if CDS_Sub.IsEmpty then Exit;
YCLDataUPdate();
end;
procedure TfrmOrderInPutZPLNew.ZDChange(Sender: TObject);
begin
if CDS_Sub.IsEmpty then Exit;
YCLDataUPdate();
end;
procedure TfrmOrderInPutZPLNew.vSubColumn11PropertiesEditValueChanged(
Sender: TObject);
var
FStr:String;
begin
FStr:=TcxTextEdit(Sender).EditingText;
with CDS_Sub do
begin
Edit;
if Trim(FStr)='' then
FieldByName('SubType').Value:=''
else
FieldByName('SubType').Value:=FStr;
Post;
end;
YCLDataUPdate();
end;
procedure TfrmOrderInPutZPLNew.MenuItem7Click(Sender: TObject);
begin
if MInt=1 then
begin
SelAll(Order_SubZ,True);
end else
if MInt=2 then
begin
SelAll(Order_SubF,True);
end else
if MInt=3 then
begin
SelAll(Order_SubQ,True);
end;
end;
procedure TfrmOrderInPutZPLNew.MenuItem8Click(Sender: TObject);
begin
if MInt=1 then
begin
SelAll(Order_SubZ,False);
end else
if MInt=2 then
begin
SelAll(Order_SubF,False);
end else
if MInt=3 then
begin
SelAll(Order_SubQ,False);
end;
end;
end.