D7wmguihua/坯布码单待检(PBMDDJ.dll)/U_DJBCKInPut.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

848 lines
27 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_DJBCKInPut;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit,
ComCtrls, ToolWin, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient, cxButtonEdit,
cxTextEdit;
type
TfrmDJBCKInPut = class(TForm)
cxGrid2: TcxGrid;
Tv1: TcxGridDBTableView;
v1Column2: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
cxGrid2Level1: TcxGridLevel;
ToolBar1: TToolBar;
TBAdd: TToolButton;
TBDel: TToolButton;
TBSave: TToolButton;
TBClose: TToolButton;
v1Column4: TcxGridDBColumn;
DataSource3: TDataSource;
CDS_Sub: TClientDataSet;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
cxGridPopupMenu2: TcxGridPopupMenu;
v1Column12: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column16: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
v1Column17: TcxGridDBColumn;
v1Column19: TcxGridDBColumn;
ToolButton1: TToolButton;
v1Column5: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBAddClick(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBDelClick(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure v1Column3PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v1Column14PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v2Column1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v1Column5PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v1Column11PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v1Column16PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v1Column13PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v1Column18PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure ToolButton1Click(Sender: TObject);
procedure v2Column6PropertiesEditValueChanged(Sender: TObject);
private
{ Private declarations }
function SaveCKData():Boolean;
function YSData(Order_Main10:TClientDataSet):Boolean;
public
{ Public declarations }
FBCId:String;
fckName:String;
end;
var
frmDJBCKInPut: TfrmDJBCKInPut;
implementation
uses
U_DataLink,U_RTFun,U_ClothContractListHZCX,U_ZDYHelp, U_ZdyAttachGYS,U_ProductOrderListSel,
U_ZdyAttachCP;
{$R *.dfm}
function TfrmDJBCKInPut.YSData(Order_Main10:TClientDataSet):Boolean;
var
CRID,YFID,PriceUnit,OrderUnit,FComTaiTou,FromSubID,khName:String;
fprice,huilv:double;
begin
Result:=False;
fprice:=0;
huilv:=0;
PriceUnit:='RMB';
khName:='';
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('update JYOrder_Sub SET Huilv=isnull((select Huilv from JYOrderCon_Sub X where X.SubId=JYOrder_Sub.SOrddefstr10),1) where Huilv=0');
execsql;
end;
with Order_Main10 do
begin
begin
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('select A.*,fPrice=dbo.F_Get_Order_Price(A.MainID,A.subID),B.customerNoName');
sql.Add(' from JYOrder_Sub A ');
sql.Add(' inner join JYOrder_main B on B.mainID=A.mainID ');
sql.Add(' Where subID='''+Trim(Order_Main10.fieldbyname('ORDSubIdRK').AsString)+'''');
Open;
end;
IF not ADOQueryTemp.IsEmpty then
begin
PriceUnit:=Trim(ADOQueryTemp.fieldbyname('PriceUnit').AsString);
OrderUnit:=Trim(ADOQueryTemp.fieldbyname('OrderUnit').AsString);
fPrice:= ADOQueryTemp.fieldbyname('fPrice').AsFloat;
huilv:= ADOQueryTemp.fieldbyname('huilv').AsFloat;
khName:= ADOQueryTemp.fieldbyname('customerNoName').AsString;
end;
IF huilv=0 then huilv:=1;
CRID:='0';
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add(' select * from YF_Money_CR ');
sql.Add(' where mainID='''+Trim(CDS_Sub.fieldbyname('SPID').AsString)+'''');
sql.Add(' and YFName=''<27>ͻ<EFBFBD><CDBB>˻<EFBFBD>'' ');
Open;
end;
if ADOQueryTemp.IsEmpty then
begin
if GetLSNo(ADOQueryCmd,YFID,'CS','YF_Money_CR',3,1)=False then
begin
Application.MessageBox(<><C8A1>ƷӦ<C6B7><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR where 1<>1');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('YFID').Value:=Trim(YFID);
FieldByName('YFTypeId').Value:=Trim(Order_Main10.fieldbyname('SPID').AsString);
FieldByName('CRID').Value:=StrToInt(CRID);
FieldByName('Filler').Value:=Trim(DName);
FieldByName('CRType').Value:=<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
FieldByName('CRFlag').Value:=<><D3A6><EFBFBD><EFBFBD>';
FieldByName('QtyFlag').Value:=1;
FieldByName('FactoryName').Value:=Trim(KHName);
FieldByName('CRTime').Value:=Trim(FormatDateTime('yyyy-MM-dd',CDS_Sub.fieldbyname('CRTime').AsDateTime));
FieldByName('YFType').Value:='<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('ps').Value:=-1*Order_Main10.fieldbyname('PiQty').AsFloat;
FieldByName('Qty').Value:=-1*Order_Main10.fieldbyname('Qty').AsFloat;
FieldByName('Price').Value:=fprice;
FieldByName('HuiLv').Value:=huilv;
FieldByName('BZType').Value:=Trim(PriceUnit);
// FieldByName('Money').Value:=-1*format('%.2f',[Order_Main10.fieldbyname('Qty').AsFloat*fprice]);
// FieldByName('BBMoney').Value:=-1*format('%.2f',[Order_Main10.fieldbyname('Qty').AsFloat*fprice*huilv]);
FieldByName('QtyUnit').Value:=Trim(Order_Main10.fieldbyname('QtyUnit').AsString);
FieldByName('ComTaiTou').Value:=Trim(KHName);
FieldByName('YFName').Value:='<27>ͻ<EFBFBD><CDBB>˻<EFBFBD>';
FieldByName('MainId').Value:=Trim(Order_Main10.fieldbyname('SPID').AsString);
FieldByName('subID').Value:='';
FieldByName('OrderNO').Value:=Trim(Order_Main10.fieldbyname('OrderNO').AsString);
FieldByName('P_CodeName').Value:=Trim(Order_Main10.fieldbyname('SPName').AsString);
FieldByName('P_Spec').Value:=Trim(Order_Main10.fieldbyname('SPSpec').AsString);
FieldByName('P_color').Value:=Trim(Order_Main10.fieldbyname('SPColor').AsString);
FieldByName('status').Value:='0';
Post;
end;
end
else
begin
YFID:=Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update YF_Money_CR Set Money=Price*Qty,BBMoney=Price*Qty*HuiLv');
sql.Add(' where YFID='''+Trim(YFID)+'''');
ExecSQL;
end;
//Next;
end;
end;
Result:=True;
end;
procedure TfrmDJBCKInPut.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmDJBCKInPut.TBAddClick(Sender: TObject);
begin
if CDS_Sub.IsEmpty=False then
begin
CopyAddRowCDS(CDS_Sub);
with CDS_Sub do
begin
Edit;
FieldByName('SPID').Value:=null;
post;
end;
end else
begin
with CDS_Sub do
begin
Append;
FieldByName('CRTime').Value:=Trim(FormatDateTime('yyyy-MM-dd',Now));
FieldByName('SPType').Value:='<27><>Ʒ';
Post;
end;
end;
end;
function TfrmDJBCKInPut.SaveCKData():Boolean;
var
FCRID,Maxno,FFSPID:string;
begin
try
ADOQueryCmd.Connection.BeginTrans;
CDS_Sub.DisableControls;
with CDS_Sub do
begin
First;
while not eof do
begin
{with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_SXPB_KC where BatchNo='''+Trim(CDS_Sub.fieldbyname('BatchNo').AsString)+'''');
SQL.Add(' and isnull(CKName,'''')=''ɴ<><C9B4>'' ');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
FCRID:=Trim(ADOQueryTemp.fieldbyname('CRID').AsString);
end else
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_SXPB_CRID');
Open;
end;
if ADOQueryTemp.IsEmpty then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into CK_SXPB_CRID select 0');
sql.Add(' select * from CK_SXPB_CRID');
Open;
end;
FCRID:=Trim(ADOQueryCmd.fieldbyname('CRID').AsString);
end else
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_SXPB_CRID Set CRID=CRID+1');
sql.Add(' select * from CK_SXPB_CRID');
Open;
end;
FCRID:=Trim(ADOQueryCmd.fieldbyname('CRID').AsString);
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from CK_SXPB_KC where CRID='+FCRID);
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('CRID').Value:=FCRID;
FieldByName('CKName').Value:='ɴ<><C9B4>';
FieldByName('BatchNo').Value:=CDS_Sub.fieldbyname('BatchNo').Value;
FieldByName('SPType').Value:=CDS_Sub.fieldbyname('SPType').Value;
FieldByName('FactoryName').Value:=CDS_Sub.fieldbyname('FactoryName').Value;
FieldByName('FactoryNo').Value:=CDS_Sub.fieldbyname('FactoryNo').Value;
FieldByName('SPName').Value:=CDS_Sub.fieldbyname('SPName').Value;
FieldByName('SPCF').Value:=CDS_Sub.fieldbyname('SPCF').Value;
FieldByName('ShaZhi').Value:=CDS_Sub.fieldbyname('ShaZhi').Value;
FieldByName('SeBie').Value:=CDS_Sub.fieldbyname('SeBie').Value;
FieldByName('KCNote').Value:=CDS_Sub.fieldbyname('Note').Value;
Post;
end;
end; }
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_SXPB_CR where SPID='''+Trim(CDS_Sub.fieldbyname('SPID').AsString)+'''');
open;
end;
FFSPID:=Trim(ADOQueryTemp.fieldbyname('SPID').AsString);
if Trim(FFSPID)='' then
begin
if GetLSNo(ADOQueryCmd,Maxno,'DR','CK_SXPB_CR',3,1)=False then
begin
Result:=False;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
end else
begin
Maxno:=Trim(FFSPID);
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete from YF_Money_CR ');
sql.Add(' where mainID='''+Trim(Maxno)+'''');
sql.Add(' and YFName=''<27>ͻ<EFBFBD><CDBB>˻<EFBFBD>'' ');
execsql;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from CK_SXPB_CR where SPID='''+Trim(Maxno)+'''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(FFSPID)='' then
begin
Append;
end else
begin
Edit;
end;
FieldByName('SPID').Value:=Trim(Maxno);
FieldByName('FZSPID').Value:=Trim(Maxno);
FieldByName('CKName').Value:=trim(fckName);
FieldByName('FactoryNo').Value:=Trim(CDS_Sub.fieldbyname('FactoryNo').AsString);
FieldByName('FromFactoryNo').Value:=Trim(CDS_Sub.fieldbyname('FromFactoryNo').AsString);
FieldByName('ToFactoryNo').Value:=Trim(CDS_Sub.fieldbyname('ToFactoryNo').AsString);
FieldByName('ORDMainIdRK').Value:=Trim(CDS_Sub.fieldbyname('ORDMainIdRK').AsString);
FieldByName('ORDSubIdRK').Value:=Trim(CDS_Sub.fieldbyname('ORDSubIdRK').AsString);
FieldByName('CRFlag').Value:='<27><><EFBFBD><EFBFBD>';
FieldByName('CRQtyFlag').Value:=1;
//FieldByName('CRID').Value:=FCRID;
RTSetSaveDataCDS(ADOQueryCmd,Tv1,CDS_Sub,'CK_SXPB_CR',2);
if Trim(FFSPID)='' then
FieldByName('Filler').Value:=Trim(DName)
else
begin
FieldByName('Editer').Value:=Trim(DName);
FieldByName('EditTime').Value:=SGetServerDate(ADOQueryTemp);
end;
if Trim(CDS_Sub.fieldbyname('OrderNo').AsString)<>'' then
begin
FieldByName('QCOrderNo').Value:=Trim(CDS_Sub.fieldbyname('OrderNo').AsString);
end;
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_SXPB_CR Set MXKCQty=(select sum(isnull(Qty,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
sql.Add(',MXKCPiQty=(select sum(isnull(PiQty,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
sql.Add(' where SPID='''+Trim(Maxno)+'''');
ExecSQL;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_SXPB_CR where SPID='''+Trim(Maxno)+'''');
Open;
end;
if ADOQueryTemp.FieldByName('MXKCQty').Value<0 then
begin
CDS_Sub.DisableControls;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
{with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_SXPB_KC Set KCKGQty=(select sum(isnull(KGQty,0)*CRQtyFlag) from CK_SXPB_CR A where A.CRID=CK_SXPB_KC.CRID)');
sql.Add(',KCPiQty=(select sum(isnull(PiQty,0)*CRQtyFlag) from CK_SXPB_CR A where A.CRID=CK_SXPB_KC.CRID)');
sql.Add(' where CRID='+FCRID);
ExecSQL;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_SXPB_KC where CRID='+Trim(FCRID));
Open;
end;
if ADOQueryTemp.FieldByName('KCKGQty').Value<0 then
begin
CDS_Sub.DisableControls;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><E2B9AB><EFBFBD><EFBFBD>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><E2B9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
}
{ if ADOQueryTemp.FieldByName('KCKeQty').Value<0 then
begin
CDS_Sub.DisableControls;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!','<27><>ʾ',0);
Exit;
end; }
Edit;
FieldByName('SPID').Value:=Trim(Maxno);
//FieldByName('CRID').Value:=Trim(FCRID);
Post;
if Trim(CDS_Sub.fieldbyname('CRType').AsString)='<27>ͻ<EFBFBD><CDBB>˻<EFBFBD>' then
begin
if not YSData(CDS_Sub) then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
exit;
end;
end;
Next;
end;
end;
CDS_Sub.EnableControls;
ADOQueryCmd.Connection.CommitTrans;
Result:=True;
except
Result:=False;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
end;
end;
procedure TfrmDJBCKInPut.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('<27><><EFBFBD><EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>',Tv1,'<27><><EFBFBD><EFBFBD>ֿ<EFBFBD>');
Close;
end;
procedure TfrmDJBCKInPut.FormShow(Sender: TObject);
var
fsj:String;
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>',Tv1,'<27><><EFBFBD><EFBFBD>ֿ<EFBFBD>');
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add(' select A.* ');
sql.Add(',OrderNO=(select OrderNO from JYOrder_Main JM where JM.MainId=A.ORDMainIdRK)');
sql.Add(' ,SOrddefstr1=(select SOrddefstr1 from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
sql.Add(' ,PRTColor=(select PRTColor from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
sql.Add(' ,PRTHX=(select PRTHX from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
sql.Add(' from CK_SXPB_CR A');
sql.Add(' where SPID='''+Trim(FBCId)+'''');
Open;
end;
SCreateCDS20(ADOQueryTemp,CDS_Sub);
SInitCDSData20(ADOQueryTemp,CDS_Sub);
if CDS_Sub.IsEmpty then Exit;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_SXPB_CR where FZSPID='''+Trim(CDS_Sub.fieldbyname('SPID').AsString)+'''');
sql.Add(' and CRQtyFlag=-1');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
v1Column4.Options.Focusing:=False;
// v1Column15.Options.Focusing:=False;
v1Column14.Options.Focusing:=False;
v2Column1.Options.Focusing:=False;
v1Column8.Options.Focusing:=False;
v1Column7.Options.Focusing:=False;
v1Column1.Options.Focusing:=False;
v1Column10.Options.Focusing:=False;
Exit;
end else
begin
v1Column4.Options.Focusing:=True;
//v1Column15.Options.Focusing:=True;
v1Column14.Options.Focusing:=True;
v2Column1.Options.Focusing:=True;
v1Column8.Options.Focusing:=True;
v1Column7.Options.Focusing:=True;
v1Column1.Options.Focusing:=True;
v1Column10.Options.Focusing:=True;
end;
end;
procedure TfrmDJBCKInPut.TBDelClick(Sender: TObject);
begin
if CDS_Sub.IsEmpty then Exit;
if Trim(CDS_Sub.fieldbyname('SPID').AsString)<>'' then
begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_SXPB_CR where FZSPID='''+Trim(CDS_Sub.fieldbyname('SPID').AsString)+'''');
sql.Add(' and CRQtyFlag=-1');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
Application.MessageBox('<27><><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!','<27><>ʾ',0);
Exit;
end;
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' delete CK_SXPB_CR where SPID='''+Trim(CDS_Sub.fieldbyname('SPID').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
CDS_Sub.Delete;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C9BE><EFBFBD>쳣!','<27><>ʾ',0);
end;
end else
begin
CDS_Sub.Delete;
end;
end;
procedure TfrmDJBCKInPut.TBSaveClick(Sender: TObject);
begin
if CDS_Sub.IsEmpty then Exit;
if CDS_Sub.Locate('CRTime',null,[])=True then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if CDS_Sub.Locate('CRType',null,[])=True then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if CDS_Sub.Locate('SPName',null,[])=True then
begin
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if CDS_Sub.Locate('SPcolor',null,[])=True then
begin
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if CDS_Sub.Locate('PiQty',null,[])=True then
begin
Application.MessageBox(<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if CDS_Sub.Locate('Qty',null,[])=True then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if CDS_Sub.Locate('QtyUnit',null,[])=True then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if SaveCKData() then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
//ModalResult:=1;
Exit;
end;
end;
procedure TfrmDJBCKInPut.v1Column3PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='SXKuWei';
flagname:='<27><>λ';
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('KuWei').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
end;
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmDJBCKInPut.v1Column14PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZdyAttachGYS:=TfrmZdyAttachGYS.Create(Application);
with frmZdyAttachGYS do
begin
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
edit;
FieldByName('FactoryNo').Value:=Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyCode').AsString) ;
FieldByName('FactoryName').Value:=Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyName').AsString);
FieldByName('FromFactoryNo').Value:=Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyCode').AsString) ;
FieldByName('FromFactoryName').Value:=Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyName').AsString);
//Post;
end;
end;
end;
finally
frmZdyAttachGYS.Free;
end;
end;
procedure TfrmDJBCKInPut.v2Column1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZdyAttachCP:=TfrmZdyAttachCP.Create(Application);
with frmZdyAttachCP do
begin
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('SPName').Value:=Trim(frmZdyAttachCP.CDS_HZ.fieldbyname('ZdyName').AsString);
FieldByName('SPSpec').Value:=Trim(frmZdyAttachCP.CDS_HZ.fieldbyname('DEFstr1').AsString);
FieldByName('SPColor').Value:=Trim(frmZdyAttachCP.CDS_HZ.fieldbyname('DEFstr3').AsString);
FieldByName('SPCF').Value:=Trim(frmZdyAttachCP.CDS_HZ.fieldbyname('DEFstr2').AsString);
FieldByName('SPMF').Value:=Trim(frmZdyAttachCP.CDS_HZ.fieldbyname('DEFstr7').AsString);
FieldByName('SPKZ').Value:=Trim(frmZdyAttachCP.CDS_HZ.fieldbyname('DEFstr8').AsString);
FieldByName('SPKZ').Value:=Trim(frmZdyAttachCP.CDS_HZ.fieldbyname('DEFstr8').AsString);
FieldByName('SPCode').Value:=Trim(frmZdyAttachCP.CDS_HZ.fieldbyname('ZdyCode').AsString);
FieldByName('CPID').Value:=Trim(frmZdyAttachCP.CDS_HZ.fieldbyname('ATID').AsString);
end;
end;
end;
finally
frmZdyAttachCP.Free;
end;
end;
procedure TfrmDJBCKInPut.v1Column5PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='KuWei';
flagname:='<27><>λ';
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('KuWei').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
end;
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmDJBCKInPut.v1Column11PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZdyAttachGYS:=TfrmZdyAttachGYS.Create(Application);
with frmZdyAttachGYS do
begin
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
edit;
FieldByName('ToFactoryNo').Value:=Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyCode').AsString) ;
FieldByName('ToFactoryName').Value:=Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyName').AsString);
//Post;
end;
end;
end;
finally
frmZdyAttachGYS.Free;
end;
end;
procedure TfrmDJBCKInPut.v1Column16PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZdyAttachGYS:=TfrmZdyAttachGYS.Create(Application);
with frmZdyAttachGYS do
begin
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
edit;
FieldByName('FromFactoryNo').Value:=Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyCode').AsString) ;
FieldByName('FromFactoryName').Value:=Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyName').AsString);
//Post;
end;
end;
end;
finally
frmZdyAttachGYS.Free;
end;
end;
procedure TfrmDJBCKInPut.v1Column13PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmProductOrderListSel:=TfrmProductOrderListSel.Create(Application);
with frmProductOrderListSel do
begin
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('ORDMainIdRK').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('MainId').AsString);
FieldByName('ORDSubIdRK').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('SubId').AsString);
FieldByName('OrderNo').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('OrderNo').AsString);
FieldByName('SOrddefstr1').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('SOrddefstr1').AsString);
FieldByName('PRTColor').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('PRTColor').AsString);
FieldByName('PRTHX').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('PRTHX').AsString);
FieldByName('SPName').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('MPRTCodeName').AsString);
FieldByName('SPSpec').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('MPRTSpec').AsString);
FieldByName('SPColor').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('PRTColor').AsString);
FieldByName('SPCF').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('MPRTCF').AsString);
FieldByName('SPMF').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('MPRTMF').AsString);
FieldByName('SPKZ').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('MPRTKZ').AsString);
FieldByName('SPHX').Value:=Trim(frmProductOrderListSel.Order_Main.fieldbyname('PRTHX').AsString);
end;
end;
end;
finally
frmProductOrderListSel.Free;
end;
end;
procedure TfrmDJBCKInPut.v1Column18PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='KuWei';
flagname:='<27><>λ';
if ShowModal=1 then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('KuWei').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
end;
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmDJBCKInPut.ToolButton1Click(Sender: TObject);
begin
if CDS_Sub.IsEmpty then Exit;
OneKeyPost(Tv1,CDS_Sub);
end;
procedure TfrmDJBCKInPut.v2Column6PropertiesEditValueChanged(
Sender: TObject);
var
fieldname:string;
begin
fieldname:=Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
with CDS_Sub do
begin
Edit;
FieldByName(Trim(fieldname)).Value:=TcxTextEdit(Sender).EditingText;
FieldByName('Money').Value:=strtofloat(format('%.2f',[FieldByName('Qty').AsFloat * FieldByName('Price').AsFloat]));
Post;
end;
Tv1.Controller.EditingController.ShowEdit();
end;
end.