D7YPDJlingyao/贸易管理(TradeManage.dll)/U_CpCkSaoMNewSel.pas
DESKTOP-E401PHE\Administrator 43fbfa8db2 ~
2025-07-19 16:53:04 +08:00

1847 lines
69 KiB
ObjectPascal
Raw Permalink 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_CpCkSaoMNewSel;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, StdCtrls, ExtCtrls, ADODB, DBClient,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, MMSystem,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxControls, cxGridCustomView, cxGrid, MovePanel, cxCheckBox, Menus, ComCtrls,
cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit, cxLookAndFeels,
cxLookAndFeelPainters, cxNavigator;
type
TfrmCpCkSaoMNewSel = class(TForm)
cxGridPopupMenu1: TcxGridPopupMenu;
CDS_Main: TClientDataSet;
DataSource1: TDataSource;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
Panel1: TPanel;
BaoID: TEdit;
Label1: TLabel;
Button2: TButton;
Button3: TButton;
CDS_Sub: TClientDataSet;
DataSource2: TDataSource;
ADOQuerySub: TADOQuery;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_MainSel: TDataSource;
CDS_MainSel: TClientDataSet;
Button1: TButton;
cxGridPopupMenu4: TcxGridPopupMenu;
cxGrid1: TcxGrid;
Tv2: TcxGridDBTableView;
v1OrderNo: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
v1PRTMF: TcxGridDBColumn;
v1PRTKZ: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
cxGrid2: TcxGrid;
Tv1: TcxGridDBTableView;
v1Column6: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v2Column5: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
cxGrid2Level1: TcxGridLevel;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
v3Column5: TcxGridDBColumn;
cxGridDBColumn1: TcxGridDBColumn;
v3Column3: TcxGridDBColumn;
v3Column4: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
v3Column1: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
v3Column2: TcxGridDBColumn;
v3Column6: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
PopupMenu2: TPopupMenu;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
Button5: TButton;
CRTime: TDateTimePicker;
Label4: TLabel;
Label5: TLabel;
CKOrdNo: TEdit;
ADOQueryPrice: TADOQuery;
Label6: TLabel;
RKOrdID: TEdit;
Label7: TLabel;
v1Column8: TcxGridDBColumn;
v3Column7: TcxGridDBColumn;
MovePanel1: TMovePanel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button4: TButton;
MovePanel2: TMovePanel;
v1Column9: TcxGridDBColumn;
v3Column8: TcxGridDBColumn;
Label8: TLabel;
CRNote: TEdit;
bao: TEdit;
Label9: TLabel;
v1Column11: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
Label10: TLabel;
THMJID: TEdit;
v3MJID: TcxGridDBColumn;
Label12: TLabel;
Label11: TLabel;
CRType: TComboBox;
ADOQuery_Other: TADOQuery;
ADOQuery1: TADOQuery;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Button6: TButton;
Label13: TLabel;
CYNO: TEdit;
v1Column13: TcxGridDBColumn;
v3Column9: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
Label14: TLabel;
ToFactoryName: TcxButtonEdit;
Label15: TLabel;
ToOrderNo: TcxButtonEdit;
Tv1Column1: TcxGridDBColumn;
Tv3Column1: TcxGridDBColumn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BaoIDKeyPress(Sender: TObject; var Key: Char);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure Button4Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure MenuItem2Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure RKOrdIDKeyPress(Sender: TObject; var Key: Char);
procedure baoKeyPress(Sender: TObject; var Key: Char);
procedure THMJIDKeyPress(Sender: TObject; var Key: Char);
procedure Button6Click(Sender: TObject);
procedure CRTypeChange(Sender: TObject);
procedure CYNOKeyPress(Sender: TObject; var Key: Char);
procedure ToFactoryNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure ToOrderNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
private
{ Private declarations }
FFPNo: string;
procedure InitGrid();
procedure InitSubGrid();
function YSData(Order_Main10: TClientDataSet): Boolean;
function YSData_other(Ado: TADOQuery; moneyFee: string; money: double): Boolean;
function ZD_YSData(): Boolean;
public
{ Public declarations }
end;
var
frmCpCkSaoMNewSel: TfrmCpCkSaoMNewSel;
implementation
uses
U_DataLink, U_Fun, U_OrderSel, U_ProductOrderNewList_CY_Help, U_ZdyAttachGYS,
U_ProductOrderListSel;
{$R *.dfm}
function TfrmCpCkSaoMNewSel.ZD_YSData(): Boolean;
var
CRID, YFID, PriceUnit, OrderUnit, FComTaiTou, FromSubID, FFPNo: string;
fprice, huilv: double;
begin
Result := False;
fprice := 0;
huilv := 0;
PriceUnit := 'RMB';
CRID := '0';
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 ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('select distinct A.MainId,A.SubId,A.CRTime,A.QtyUnit,A.FPNo,B.OrderNo,B.MPrtCodeName,B.Mprtspec,B.customerNoName as KHName,C.*,fPrice=dbo.F_Get_Order_Price(A.MainID,A.subID) ');
sql.Add('from CK_BanCP_CR A ');
sql.Add('inner join JYOrder_Main B on B.MainId=A.MainId ');
sql.Add('inner join JYOrder_Sub C on C.SubId=A.SubId ');
sql.Add('where CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'' ');
sql.Add('and not exists(select MainId from YF_Money_CR X where X.MainId=A.MainId and X.SubId=A.SubId and X.CRTime=A.CRTime and X.YFType=''<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>'' and X.CRType='<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>'') ');
open;
end;
if ADOQueryTemp.IsEmpty then
exit;
while not ADOQueryTemp.eof do
begin
PriceUnit := Trim(ADOQueryTemp.fieldbyname('PriceUnit').AsString);
OrderUnit := Trim(ADOQueryTemp.fieldbyname('OrderUnit').AsString);
FFPNo := Trim(ADOQueryTemp.fieldbyname('FPNo').AsString);
fprice := ADOQueryTemp.fieldbyname('fPrice').AsFloat;
huilv := ADOQueryTemp.fieldbyname('huilv').AsFloat;
if huilv = 0 then
huilv := 1;
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add(' select * from YF_Money_CR where FactoryName=''' + Trim(ADOQueryTemp.fieldbyname('KHName').AsString) + '''');
sql.Add(' and mainID=''' + Trim(ADOQueryTemp.fieldbyname('mainID').AsString) + '''');
sql.Add(' and subID=''' + Trim(ADOQueryTemp.fieldbyname('subID').AsString) + '''');
sql.Add(' and CRTime=''' + FormatDateTime('yyyy-MM-dd', ADOQueryTemp.fieldbyname('CRTime').AsDateTime) + '''');
sql.Add(' and YFName=''<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>'' ');
Open;
end;
if ADOQuery1.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(ADOQueryTemp.fieldbyname('mainID').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(ADOQueryTemp.fieldbyname('KHName').AsString);
FieldByName('CRTime').Value := FormatDateTime('yyyy-MM-dd', ADOQueryTemp.fieldbyname('CRTime').AsDateTime);
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('Price').Value := fprice;
FieldByName('HuiLv').Value := huilv;
FieldByName('BZType').Value := Trim(PriceUnit);
FieldByName('QtyUnit').Value := Trim(OrderUnit);
FieldByName('FPNo').Value := Trim(FFPNo);
FieldByName('ComTaiTou').Value := Trim(FComTaiTou);
FieldByName('YFName').Value := '<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>';
FieldByName('MainId').Value := Trim(ADOQueryTemp.fieldbyname('Mainid').AsString);
FieldByName('subID').Value := Trim(ADOQueryTemp.fieldbyname('subID').AsString);
FieldByName('OrderNO').Value := Trim(ADOQueryTemp.fieldbyname('OrderNO').AsString);
FieldByName('P_CodeName').Value := Trim(ADOQueryTemp.fieldbyname('MprtCodeName').AsString);
FieldByName('P_Spec').Value := Trim(ADOQueryTemp.fieldbyname('MprtSpec').AsString);
FieldByName('P_color').Value := Trim(ADOQueryTemp.fieldbyname('PRTColor').AsString);
FieldByName('status').Value := '0';
Post;
end;
end
else
begin
YFID := Trim(ADOQuery1.fieldbyname('YFID').AsString);
end;
if uppercase(OrderUnit) = 'KG' then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(B.MJQty4),0) from CK_BanCP_CR A,WFB_MJJY B where A.MJID=B.MJID and A.MainID=YF_Money_CR.MainID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
sql.Add(',PS=(select isnull(count(A.mainID),0) from CK_BanCP_CR A where A.maiNID=YF_Money_CR.maiNID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
sql.Add(' where YFID=''' + Trim(YFID) + '''');
ExecSQL;
end;
end
else
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(A.Qty),0) from CK_BanCP_CR A where A.MainID=YF_Money_CR.MainID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
sql.Add(',PS=(select isnull(count(A.mainID),0) from CK_BanCP_CR A where A.maiNID=YF_Money_CR.maiNID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
sql.Add(' where YFID=''' + Trim(YFID) + '''');
ExecSQL;
end;
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;
ADOQueryTemp.next;
end;
Result := true;
end;
function TfrmCpCkSaoMNewSel.YSData_other(Ado: TADOQuery; moneyFee: string; money: double): Boolean;
var
CRID, YFID: string;
begin
CRID := '0';
Result := False;
with Ado do
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add(' select * from YF_Money_CR where FactoryName=''' + Trim(Ado.fieldbyname('customerNoName').AsString) + '''');
sql.Add(' and mainID=''' + Trim(Ado.fieldbyname('mainID').AsString) + '''');
sql.Add(' and subID=''' + Trim(Ado.fieldbyname('subID').AsString) + '''');
sql.Add(' and YFName=''' + trim(moneyFee) + ''' ');
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(Ado.fieldbyname('mainID').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(Ado.fieldbyname('customerNoName').AsString);
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', CRTime.Date));
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('Qty').Value := 1;
FieldByName('Price').Value := money;
FieldByName('money').Value := money;
FieldByName('BBmoney').Value := money;
FieldByName('HuiLv').Value := Ado.fieldbyname('huilv').AsFloat;
FieldByName('BZType').Value := Trim(Ado.fieldbyname('priceUnit').AsString);
FieldByName('QtyUnit').Value := '<27><>';
FieldByName('ComTaiTou').Value := Trim(Ado.fieldbyname('customerNoName').AsString);
FieldByName('YFName').Value := trim(moneyFee);
FieldByName('MainId').Value := Trim(Ado.fieldbyname('Mainid').AsString);
FieldByName('subID').Value := Trim(Ado.fieldbyname('subID').AsString);
FieldByName('OrderNO').Value := Trim(Ado.fieldbyname('conNo').AsString);
FieldByName('P_CodeName').Value := Trim(Ado.fieldbyname('prtCodeName').AsString);
FieldByName('P_Spec').Value := Trim(Ado.fieldbyname('prtSpec').AsString);
FieldByName('P_color').Value := Trim(Ado.fieldbyname('PRTColor').AsString);
FieldByName('status').Value := '0';
Post;
end;
end
else
begin
YFID := Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
end;
end;
Result := True;
end;
procedure TfrmCpCkSaoMNewSel.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmCpCkSaoMNewSel.FormDestroy(Sender: TObject);
begin
frmCpCkSaoMNewSel := nil;
end;
procedure TfrmCpCkSaoMNewSel.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
sql.Clear;
SQL.Add('select A.*,OrderNo=(select OrderNo from JYOrder_Main where MainId=A.MainId) ');
sql.Add(',KHName=(select isnull(customerNoName,OrderNo) from JYOrder_Main where MainId=A.MainId)');
sql.Add(',MPrtCodeName=(select MPrtCodeName from JYOrder_Main where MainId=A.MainId)');
sql.Add(',Mprtspec=(select Mprtspec from JYOrder_Main where MainId=A.MainId)');
SQL.Add(',PRTHX=(select PRTHX from JYOrder_Sub where SubId=A.SubId)');
SQL.Add(',QRColNo=(select QRColNo from JYOrder_Sub where SubId=A.SubId)');
SQL.Add(',PRTColor=(select PRTColor from JYOrder_Sub where SubId=A.SubId)');
SQL.Add(',PRTkuanNO=(select PRTkuanNO from JYOrder_Sub where SubId=A.SubId)');
sql.Add(',AOrdDefstr1=(select MJstr4 from WFB_MJJY where MJID=A.MJID)');
sql.Add(',MJXH=(select MJXH from WFB_MJJY where MJID=A.MJID)');
sql.Add('from CK_BanCP_CR A');
sql.add('where 1<>1');
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_Main);
SInitCDSData20(ADOQueryMain, CDS_Main);
SCreateCDS20(ADOQueryMain, CDS_MainSel);
// SInitCDSData20(ADOQueryMain,CDS_MainSel);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmCpCkSaoMNewSel.FormShow(Sender: TObject);
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
ReadCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
ReadCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>Sels', Tv3, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
FFPNo := '';
InitSubGrid();
InitGrid();
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
end;
procedure TfrmCpCkSaoMNewSel.BaoIDKeyPress(Sender: TObject; var Key: Char);
var
maxno: string;
begin
if Key = #13 then
begin
if CDS_Main.IsEmpty then
exit;
Label12.Caption := '';
if Trim(CKOrdNo.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(CRType.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if (Trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>') or (Trim(CRType.Text) = '<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>') or (Trim(CRType.Text) = '<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>') then
begin
if Trim(ToFactoryName.Text) = '' then
begin
Application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
end;
if (Trim(CRType.Text) = '<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>') then
begin
if Trim(CYNO.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
end;
if CDS_MainSel.Locate('MJId', Trim(BaoID.Text), []) then
begin
MovePanel1.Visible := True;
Edit2.Text := Trim(BaoID.Text);
Label12.Caption := '<27><><EFBFBD>ѣ<EFBFBD><D1A3>˾<EFBFBD><CBBE>ظ<EFBFBD>ɨ<EFBFBD>裡';
BaoID.Text := '';
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C>ظ<EFBFBD>ɨ<EFBFBD><C9A8>.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C>ظ<EFBFBD>ɨ<EFBFBD><C9A8>.wav'), 0, SND_ASYNC);
// Application.MessageBox('<27>˾<EFBFBD><CBBE>ظ<EFBFBD>ɨ<EFBFBD>裡','<27><>ʾ',0);
Exit;
end;
if CDS_Main.Locate('MJId', Trim(BaoID.Text), []) = False then
begin
MovePanel1.Visible := True;
Edit2.Text := Trim(BaoID.Text);
Label12.Caption := '<27><><EFBFBD>ѣ<EFBFBD><D1A3>˾<EFBFBD><CBBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>';
BaoID.Text := '';
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
Exit;
end;
CDS_Main.Locate('MJId', Trim(BaoID.Text), []);
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_Main do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCP_CR SET CRFlag=''<27><><EFBFBD><EFBFBD>'',CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',FillTime=getdate(),RKStage=''<27><><EFBFBD><EFBFBD>'' ');
sql.add(',CRTime=''' + trim(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)) + '''');
sql.Add(',Filler=''' + trim(DName) + ''' ');
sql.Add('FROM CK_BanCP_CR A ');
sql.Add('where A.MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
sql.Add('and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCP_CR SET CRFlag=''<27><><EFBFBD><EFBFBD>'',FillTime=getdate() ');
sql.Add(',CRType=''' + trim(CRType.Text) + ''' ');
sql.add(',CRTime=''' + trim(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)) + '''');
sql.Add(',CKOrdNo=''' + trim(CKOrdNo.Text) + '''');
sql.Add(',CRNote=''' + trim(CRNote.Text) + '''');
sql.Add(',Filler=''' + trim(DName) + '''');
sql.Add(',ToFactoryName=''' + trim(ToFactoryName.Text) + '''');
sql.Add(',ToOrderNo=''' + trim(ToOrderNo.Text) + ''' ');
if Trim(CYNO.Text) <> '' then
begin
SQL.Add(',CYNO=''' + Trim(CYNO.Text) + ''' ');
SQL.Add(',FPNo=''' + Trim(CDS_Sub.fieldbyname('FPNo').AsString) + ''' ');
end;
sql.Add('FROM CK_BanCP_CR A ');
sql.Add('where A.MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
sql.Add('and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_BanCp_KC set KCKgQty=0,KCQty=0 where CRID=' + CDS_Main.fieldbyname('CRID').AsString);
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
ExecSQL;
end;
end;
{ IF trim(CRType.Text)='<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>' then
begin
if YSData(CDS_Main)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
// CDS_Main.EnableControls;
// CDS_MainSel.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD>տ<EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
end; }
ADOQueryCmd.Connection.CommitTrans;
with CDS_MainSel do
begin
Append;
FieldByName('MainId').Value := CDS_Main.fieldbyname('MainId').Value;
FieldByName('SubId').Value := Self.CDS_Main.fieldbyname('SubId').Value;
FieldByName('OrderNo').Value := Self.CDS_Main.fieldbyname('OrderNo').Value;
FieldByName('KGQty').Value := Self.CDS_Main.fieldbyname('KGQty').Value;
FieldByName('Qty').Value := Self.CDS_Main.fieldbyname('Qty').Value;
FieldByName('QtyUnit').Value := Self.CDS_Main.fieldbyname('QtyUnit').Value;
FieldByName('MJId').Value := Self.CDS_Main.fieldbyname('MJId').Value;
FieldByName('CRId').Value := Self.CDS_Main.fieldbyname('CRId').Value;
FieldByName('APID').Value := Self.CDS_Main.fieldbyname('APID').Value;
FieldByName('CPType').Value := CDS_Main.fieldbyname('CPType').Value;
FieldByName('BCID').Value := Trim(maxno);
FieldByName('PRTColor').Value := Self.CDS_Main.fieldbyname('PRTColor').Value;
FieldByName('MJXH').Value := Self.CDS_Main.fieldbyname('MJXH').Value;
FieldByName('AOrdDefstr1').Value := CDS_Main.fieldbyname('AOrdDefstr1').Value;
FieldByName('KHName').Value := CDS_Main.fieldbyname('KHName').Value;
FieldByName('RKOrdId').Value := CDS_Main.fieldbyname('RKOrdId').Value;
FieldByName('BaoNo').Value := CDS_Main.fieldbyname('BaoNo').Value;
//FieldByName('JZXNo').Value:=Trim(JZXNo.Text);
Post;
end;
CDS_Main.Delete;
MovePanel1.Visible := True;
if CDS_MainSel.IsEmpty = False then
Edit1.Text := IntToStr(Tv3.DataController.Summary.FooterSummaryValues[2])
else
Edit1.Text := '0';
Edit2.Text := Trim(BaoID.Text);
BaoID.Text := '';
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav'), 0, SND_ASYNC);
Exit;
except
BaoID.Text := '';
ADOQueryCmd.Connection.RollbackTrans;
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
end;
end;
end;
procedure TfrmCpCkSaoMNewSel.Button2Click(Sender: TObject);
begin
tv1.Controller.EditingController.ShowEdit();
tv3.Controller.EditingController.ShowEdit();
Close;
WriteCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
WriteCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
WriteCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>Sels', Tv3, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
end;
procedure TfrmCpCkSaoMNewSel.Button3Click(Sender: TObject);
var
maxno, fsj: string;
begin
{if CDS_Main.IsEmpty=False then
begin
Application.MessageBox('<27><>ɨ<EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8>ĵ<EFBFBD><C4B5>ţ<EFBFBD>','<27><>ʾ',0);
Exit;
end;}
try
frmOrderSel := TfrmOrderSel.Create(Application);
with frmOrderSel do
begin
if ShowModal = 1 then
begin
CDS_OrderSel.DisableControls;
with CDS_OrderSel do
begin
First;
while not Eof do
begin
if FieldByName('SSel').Value = True then
begin
if Self.CDS_Sub.Locate('SubId', Trim(CDS_OrderSel.fieldbyname('SubId').AsString), []) = False then
begin
with Self.CDS_Sub do
begin
Append;
FieldByName('MainId').Value := Trim(CDS_OrderSel.fieldbyname('MainId').AsString);
FieldByName('SubId').Value := Trim(CDS_OrderSel.fieldbyname('SubId').AsString);
FieldByName('CustomerNo').Value := Trim(CDS_OrderSel.fieldbyname('CustomerNo').AsString);
FieldByName('OrderNo').Value := Trim(CDS_OrderSel.fieldbyname('OrderNo').AsString);
FieldByName('CustomerNoName').Value := Trim(CDS_OrderSel.fieldbyname('CustomerNoName').AsString);
FieldByName('MPRTCodeName').Value := Trim(CDS_OrderSel.fieldbyname('MPRTCodeName').AsString);
FieldByName('PRTOrderQty').Value := Trim(CDS_OrderSel.fieldbyname('PRTOrderQty').AsString);
FieldByName('OrderUnit').Value := Trim(CDS_OrderSel.fieldbyname('OrderUnit').AsString);
FieldByName('PRTColor').Value := Trim(CDS_OrderSel.fieldbyname('PRTColor').AsString);
FieldByName('MPRTMF').Value := Trim(CDS_OrderSel.fieldbyname('MPRTMF').AsString);
FieldByName('MPRTKZ').Value := Trim(CDS_OrderSel.fieldbyname('MPRTKZ').AsString);
Post;
end;
end;
end;
Next;
end;
end;
CDS_OrderSel.EnableControls;
end;
end;
finally
frmOrderSel.Free;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
ExecSQL;
end;
CDS_Sub.DisableControls;
with CDS_Sub do
begin
First;
while not Eof do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into TBSubID select :SubId,:Dname');
Parameters.ParamByName('SubId').Value := Trim(CDS_Sub.fieldbyname('SubId').AsString);
Parameters.ParamByName('Dname').Value := Trim(DCode);
ExecSQL;
end;
Next;
end;
end;
CDS_Sub.EnableControls;
with Self.ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('select orderNo=(select OrderNo from JYOrder_Main where MainId=A.MainId), A.* ');
sql.Add(',KHName=(select isnull(customerNoName,OrderNo) from JYOrder_Main where MainId=A.MainId)');
sql.Add(',MPrtCodeName=(select MPrtCodeName from JYOrder_Main where MainId=A.MainId)');
sql.Add(',Mprtspec=(select Mprtspec from JYOrder_Main where MainId=A.MainId)');
SQL.Add(',PRTHX=(select PRTHX from JYOrder_Sub where SubId=A.SubId)');
SQL.Add(',PRTColor=(select PRTColor from JYOrder_Sub where SubId=A.SubId)');
SQL.Add(',PRTKuanNO=(select PRTKuanNO from JYOrder_Sub where SubId=A.SubId)');
sql.Add(',AOrdDefstr1=(select MJstr4 from WFB_MJJY where MJID=A.MJID)');
sql.Add(',MJXH=(select MJXH from WFB_MJJY where MJID=A.MJID)');
sql.Add(' from CK_BanCP_CR A inner join CK_BanCP_KC B on A.CRID=B.CRID');
sql.Add(' where exists( select * from TBSubID AA where AA.SubId=A.SubId and AA.DName=''' + Trim(DCode) + ''') ');
SQL.Add(' and (B.KCqty>0 or B.KCKgQty>0) and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_Main);
SInitCDSData20(ADOQueryTemp, CDS_Main);
SCreateCDS20(ADOQueryMain, CDS_MainSel);
if GetLSNo(ADOQueryCmd, maxno, 'CK', 'CK_BanCP_CR', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><E2B5A5>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
CKOrdNo.Text := Trim(maxno);
CYNO.Text := '';
end;
procedure TfrmCpCkSaoMNewSel.InitSubGrid();
begin
try
ADOQuerySub.DisableControls;
with ADOQuerySub do
begin
Close;
sql.Clear;
sql.Add('select A.*,B.*');
sql.Add(' from JYOrder_Main A inner join JYOrder_Sub B on A.MainId=B.Mainid');
sql.Add(' where 1<>1 ');
Open;
end;
SCreateCDS20(ADOQuerySub, CDS_Sub);
SInitCDSData20(ADOQuerySub, CDS_Sub);
finally
ADOQuerySub.EnableControls;
end;
end;
procedure TfrmCpCkSaoMNewSel.Button1Click(Sender: TObject);
var
FMainid: string;
begin
if CDS_MainSel.IsEmpty then
Exit;
if CDS_MainSel.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
MovePanel2.Visible := True;
MovePanel2.Refresh;
try
ADOQueryCmd.Connection.BeginTrans;
CDS_Main.DisableControls;
CDS_MainSel.DisableControls;
with CDS_MainSel do
begin
//First;
while CDS_MainSel.Locate('SSel', True, []) = True do
begin
//if CDS_MainSel.FieldByName('SSel').AsBoolean=True then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL');
sql.Add(',CRNote=''''');
sql.Add(',CKOrdNo=''''');
SQL.Add(',CYNO='''' ');
SQL.Add(',FPNo='''' ');
sql.Add(',ToFactoryName='''' ');
sql.Add(',ToOrderNo='''' ');
sql.Add(' where CRID=''' + Trim(CDS_MainSel.fieldbyname('CRID').AsString) + '''');
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' UPdate CK_BanCP_KC Set KCKgQty=(select KgQty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
sql.Add(',KCQty=(select Qty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
SQL.Add(' where CRID=' + CDS_MainSel.fieldbyname('CRID').AsString);
sql.Add(' Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + ''' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add(' Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,RKOrdId='''',RKStage='''' ');
sql.Add(' where CRID=''' + Trim(CDS_MainSel.fieldbyname('CRID').AsString) + '''');
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
SQL.Add(' and RKStage=''<27><><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add(' Update WFB_MJJY Set MJStr2='<><CEB4><EFBFBD><EFBFBD>'' where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + ''' ');
sql.Add(' and exists(select MJID from CK_BanCP_CR X where X.MJID=WFB_MJJY.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and MJStr2<>'<><CEB4><EFBFBD><EFBFBD>'')');
ExecSQL;
end;
with CDS_Main do
begin
Append;
FieldByName('MainId').Value := CDS_MainSel.fieldbyname('MainId').Value;
FieldByName('SubId').Value := Self.CDS_MainSel.fieldbyname('SubId').Value;
FieldByName('OrderNo').Value := Self.CDS_MainSel.fieldbyname('OrderNo').Value;
FieldByName('KgQty').Value := Self.CDS_MainSel.fieldbyname('KgQty').Value;
FieldByName('Qty').Value := Self.CDS_MainSel.fieldbyname('Qty').Value;
FieldByName('QtyUnit').Value := Self.CDS_MainSel.fieldbyname('QtyUnit').Value;
FieldByName('MJId').Value := Self.CDS_MainSel.fieldbyname('MJId').Value;
FieldByName('CRId').Value := Self.CDS_MainSel.fieldbyname('CRId').Value;
FieldByName('APID').Value := Self.CDS_MainSel.fieldbyname('APID').Value;
FieldByName('CPType').Value := Self.CDS_MainSel.fieldbyname('CPType').Value;
FieldByName('PRTColor').Value := Self.CDS_MainSel.fieldbyname('PRTColor').Value;
FieldByName('PRTkuanNo').Value := Self.CDS_MainSel.fieldbyname('PRTkuanNo').Value;
FieldByName('AOrddefstr1').Value := Self.CDS_MainSel.fieldbyname('AOrddefstr1').Value;
FieldByName('MJXH').Value := Self.CDS_MainSel.fieldbyname('MJXH').Value;
FieldByName('KHName').Value := CDS_MainSel.fieldbyname('KHName').Value;
FieldByName('RKOrdID').Value := CDS_MainSel.fieldbyname('RKOrdID').Value;
FieldByName('BaoNo').Value := CDS_MainSel.fieldbyname('BaoNo').Value;
FieldByName('BaoID').Value := CDS_MainSel.fieldbyname('BaoID').Value;
Post;
end;
{ if YSData(CDS_MainSel)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
CDS_Main.EnableControls;
CDS_MainSel.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD>տ<EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end; }
CDS_MainSel.Delete;
end;
end;
end;
ADOQueryCmd.Connection.CommitTrans;
CDS_Main.EnableControls;
CDS_MainSel.EnableControls;
MovePanel2.Visible := false;
Exit;
except
MovePanel2.Visible := False;
CDS_Main.EnableControls;
CDS_MainSel.EnableControls;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
end;
end;
procedure TfrmCpCkSaoMNewSel.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
if CDS_MainSel.IsEmpty = False then
Exit;
if CDS_Sub.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
CDS_Main.DisableControls;
with CDS_Main do
begin
First;
while not Eof do
begin
if Trim(CDS_Main.fieldbyname('SubId').AsString) = Trim(CDS_Sub.fieldbyname('SubId').AsString) then
begin
CDS_Main.Delete;
end
else
Next;
end;
end;
CDS_Main.EnableControls;
CDS_Sub.Delete;
end;
procedure TfrmCpCkSaoMNewSel.Button4Click(Sender: TObject);
begin
MovePanel1.Visible := False;
end;
procedure TfrmCpCkSaoMNewSel.N1Click(Sender: TObject);
begin
SelOKNo(CDS_Main, True);
end;
procedure TfrmCpCkSaoMNewSel.N2Click(Sender: TObject);
begin
SelOKNo(CDS_Main, False);
end;
procedure TfrmCpCkSaoMNewSel.MenuItem1Click(Sender: TObject);
begin
SelOKNo(CDS_MainSel, True);
end;
procedure TfrmCpCkSaoMNewSel.MenuItem2Click(Sender: TObject);
begin
SelOKNo(CDS_MainSel, False);
end;
procedure TfrmCpCkSaoMNewSel.Button5Click(Sender: TObject);
var
maxno: string;
sqlstr: string;
CRID: Integer;
MaxCkNo, MaxCkSubNo: string;
begin
CKOrdNo.SetFocus;
if CDS_Main.IsEmpty then
Exit;
if CDS_Main.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(CKOrdNo.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(CRType.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if (Trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>') or (Trim(CRType.Text) = '<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>') or (Trim(CRType.Text) = '<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>') then
begin
if Trim(ToFactoryName.Text) = '' then
begin
Application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(ToOrderNo.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
end;
if (Trim(CRType.Text) = '<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>') then
begin
if Trim(CYNO.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
exit;
MovePanel2.Visible := True;
MovePanel2.Refresh;
sqlstr := '';
try
ADOQueryCmd.Connection.BeginTrans;
CDS_Main.DisableControls;
CDS_MainSel.DisableControls;
with CDS_Main do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCp_CR where 1=2');
Open;
end;
//First;
while CDS_Main.Locate('SSel', True, []) = True do
begin
application.ProcessMessages;
sqlstr := sqlstr + 'UPDATE CK_BanCP_CR SET CRFlag=''<27><><EFBFBD><EFBFBD>'',CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',FillTime=getdate(),RKStage=''<27><><EFBFBD><EFBFBD>'' ';
sqlstr := sqlstr + ',CRTime=''' + trim(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)) + '''';
sqlstr := sqlstr + ',Filler=''' + trim(DName) + ''' ';
sqlstr := sqlstr + 'FROM CK_BanCP_CR A ';
sqlstr := sqlstr + 'where A.MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''';
sqlstr := sqlstr + 'and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
sqlstr := sqlstr + 'UPDATE CK_BanCP_CR SET CRFlag=''<27><><EFBFBD><EFBFBD>'',FillTime=getdate() ';
sqlstr := sqlstr + ',CRType=''' + trim(CRType.Text) + '''';
sqlstr := sqlstr + ',CRTime=''' + trim(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)) + '''';
sqlstr := sqlstr + ',CKOrdNo=''' + trim(CKOrdNo.Text) + '''';
sqlstr := sqlstr + ',CRNote=''' + trim(CRNote.Text) + '''';
sqlstr := sqlstr + ',ToFactoryName=''' + trim(ToFactoryName.Text) + '''';
sqlstr := sqlstr + ',ToOrderNo=''' + trim(ToOrderNo.Text) + '''';
sqlstr := sqlstr + ',Filler=''' + trim(DName) + '''';
if Trim(CYNO.Text) <> '' then
begin
sqlstr := sqlstr + ',CYNO=''' + Trim(CYNO.Text) + ''' ';
sqlstr := sqlstr + ',FPNo=''' + Trim(FFPNo) + ''' ';
end;
sqlstr := sqlstr + 'FROM CK_BanCP_CR A ';
sqlstr := sqlstr + 'where A.MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''';
sqlstr := sqlstr + 'and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ';
{ IF trim(CRType.Text)='<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>' then
begin
if YSData(CDS_Main)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
CDS_Main.EnableControls;
CDS_MainSel.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD>տ<EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
end; }
with CDS_MainSel do
begin
Append;
FieldByName('MainId').Value := CDS_Main.fieldbyname('MainId').Value;
FieldByName('SubId').Value := Self.CDS_Main.fieldbyname('SubId').Value;
FieldByName('OrderNo').Value := Self.CDS_Main.fieldbyname('OrderNo').Value;
FieldByName('JZQty').Value := Self.CDS_Main.fieldbyname('JZQty').Value;
FieldByName('Qty').Value := Self.CDS_Main.fieldbyname('Qty').Value;
FieldByName('QtyUnit').Value := Self.CDS_Main.fieldbyname('QtyUnit').Value;
FieldByName('MJId').Value := Self.CDS_Main.fieldbyname('MJId').Value;
FieldByName('CRId').Value := Self.CDS_Main.fieldbyname('CRId').Value;
FieldByName('APID').Value := Self.CDS_Main.fieldbyname('APID').Value;
FieldByName('CPType').Value := CDS_Main.fieldbyname('CPType').Value;
FieldByName('BCID').Value := Trim(maxno);
FieldByName('PRTColor').Value := Self.CDS_Main.fieldbyname('PRTColor').Value;
FieldByName('PRTkuanNo').Value := Self.CDS_Main.fieldbyname('PRTkuanNo').Value;
FieldByName('QRColNo').Value := Self.CDS_Main.fieldbyname('QRColNo').Value;
FieldByName('MJXH').Value := Self.CDS_Main.fieldbyname('MJXH').Value;
FieldByName('AOrdDefstr1').Value := CDS_Main.fieldbyname('AOrdDefstr1').Value;
FieldByName('KHName').Value := CDS_Main.fieldbyname('KHName').Value;
FieldByName('RKOrdId').Value := CDS_Main.fieldbyname('RKOrdId').Value;
FieldByName('BaoNo').Value := CDS_Main.fieldbyname('BaoNo').Value;
//FieldByName('JZXNo').Value:=Trim(JZXNo.Text);
Post;
end;
CDS_Main.Delete;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(sqlstr);
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.ADd('Update CK_BanCp_KC set KCKgQty=0,KCQty=0 ');
sql.ADd('from CK_BanCp_KC A ');
sql.ADd('inner join CK_BanCp_CR B on B.CRID=A.CRID');
sql.ADd('where B.CKOrdNo=''' + trim(CKOrdNo.Text) + ''' ');
sql.ADd('Update WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
sql.Add('where exists(select X.MJID from CK_BanCP_CR X where X.MJID=WFB_MJJY.MJID and X.CKOrdNo=''' + trim(CKOrdNo.Text) + ''') ');
ExecSQL;
end;
CDS_MainSel.EnableControls;
CDS_Main.EnableControls;
ADOQueryCmd.Connection.CommitTrans;
MovePanel2.Visible := False;
// ZD_YSdata();
Exit;
except
BaoID.Text := '';
CDS_Main.EnableControls;
MovePanel2.Visible := False;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
end;
end;
function TfrmCpCkSaoMNewSel.YSData(Order_Main10: TClientDataSet): Boolean;
var
CRID, YFID, PriceUnit, OrderUnit, FComTaiTou, FromSubID: string;
fprice, huilv: double;
begin
Result := False;
fprice := 0;
huilv := 0;
PriceUnit := 'RMB';
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 *,fPrice=dbo.F_Get_Order_Price(MainID,subID) from JYOrder_Sub Where subID=''' + Trim(Order_Main10.fieldbyname('subID').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;
end;
if huilv = 0 then
huilv := 1;
CRID := '0';
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add(' select * from YF_Money_CR where FactoryName=''' + Trim(Order_Main10.fieldbyname('KHName').AsString) + '''');
sql.Add(' and mainID=''' + Trim(Order_Main10.fieldbyname('mainID').AsString) + '''');
sql.Add(' and subID=''' + Trim(Order_Main10.fieldbyname('subID').AsString) + '''');
sql.Add(' and CRTime=''' + FormatDateTime('yyyy-MM-dd', CRTime.Date) + '''');
sql.Add(' and FPNo=''' + Trim(FFPNo) + '''');
sql.Add(' and YFName=''<27><><EFBFBD>۽<EFBFBD><DBBD><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('FPNo').Value := Trim(FFPNo);
FieldByName('YFTypeId').Value := Trim(Order_Main10.fieldbyname('mainID').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(Order_Main10.fieldbyname('KHName').AsString);
FieldByName('CRTime').Value := Trim(FormatDateTime('yyyy-MM-dd', CRTime.Date));
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('Price').Value := fprice;
FieldByName('HuiLv').Value := huilv;
FieldByName('BZType').Value := Trim(PriceUnit);
FieldByName('QtyUnit').Value := Trim(OrderUnit);
FieldByName('ComTaiTou').Value := Trim(FComTaiTou);
FieldByName('YFName').Value := '<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>';
FieldByName('MainId').Value := Trim(Order_Main10.fieldbyname('Mainid').AsString);
FieldByName('subID').Value := Trim(Order_Main10.fieldbyname('subID').AsString);
FieldByName('OrderNO').Value := Trim(Order_Main10.fieldbyname('OrderNO').AsString);
FieldByName('P_CodeName').Value := Trim(Order_Main10.fieldbyname('MprtCodeName').AsString);
FieldByName('P_Spec').Value := Trim(Order_Main10.fieldbyname('MprtSpec').AsString);
FieldByName('P_color').Value := Trim(Order_Main10.fieldbyname('PRTColor').AsString);
FieldByName('status').Value := '0';
Post;
end;
end
else
begin
YFID := Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
end;
if uppercase(OrderUnit) = 'KG' then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(B.MJQty4),0) from CK_BanCP_CR A,WFB_MJJY B where A.MJID=B.MJID and A.MainID=YF_Money_CR.MainID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
sql.Add(',PS=(select isnull(count(A.mainID),0) from CK_BanCP_CR A where A.maiNID=YF_Money_CR.maiNID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
sql.Add(' where YFID=''' + Trim(YFID) + '''');
ExecSQL;
end;
end
else
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(A.Qty),0) from CK_BanCP_CR A where A.MainID=YF_Money_CR.MainID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
sql.Add(',PS=(select isnull(count(A.mainID),0) from CK_BanCP_CR A where A.maiNID=YF_Money_CR.maiNID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
sql.Add(' where YFID=''' + Trim(YFID) + '''');
ExecSQL;
end;
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;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from YF_Money_CR where YFId=''' + Trim(YFID) + '''');
Open;
end;
if ADOQueryTemp.FieldByName('Qty').Value = 0 then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete from YF_Money_CR where YFID=''' + Trim(YFID) + '''');
ExecSQL;
end;
end;
//Next;
end;
end;
Result := True;
end;
procedure TfrmCpCkSaoMNewSel.RKOrdIDKeyPress(Sender: TObject; var Key: Char);
var
maxno: string;
begin
if Key = #13 then
begin
if CDS_Main.IsEmpty then
exit;
Label12.Caption := '';
if Trim(CKOrdNo.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(CRType.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if (Trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>') or (Trim(CRType.Text) = '<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>') or (Trim(CRType.Text) = '<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>') then
begin
if Trim(ToFactoryName.Text) = '' then
begin
Application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
end;
if (Trim(CRType.Text) = '<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>') then
begin
if Trim(CYNO.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
end;
if CDS_Main.Locate('RKOrdId', Trim(RKOrdId.Text), []) = False then
begin
MovePanel1.Visible := True;
Edit2.Text := Trim(RKOrdId.Text);
Label12.Caption := '<27><><EFBFBD>ѣ<EFBFBD><D1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>';
RKOrdId.Text := '';
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>','<27><>ʾ',0);
Exit;
end;
//CDS_Main.Locate('MJId',Trim(BaoID.Text),[]);
MovePanel2.Visible := True;
MovePanel2.Refresh;
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_Main do
begin
First;
while CDS_Main.Locate('RKOrdId', Trim(RKOrdId.Text), []) = True do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCP_CR SET CRFlag=''<27><><EFBFBD><EFBFBD>'',CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',FillTime=getdate(),RKStage=''<27><><EFBFBD><EFBFBD>'' ');
sql.add(',CRTime=''' + trim(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)) + '''');
sql.Add(',Filler=''' + trim(DName) + ''' ');
sql.Add('FROM CK_BanCP_CR A ');
sql.Add('where A.MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
sql.Add('and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCP_CR SET CRFlag=''<27><><EFBFBD><EFBFBD>'',FillTime=getdate() ');
sql.Add(',CRType=''' + trim(CRType.Text) + '''');
sql.add(',CRTime=''' + trim(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)) + '''');
sql.Add(',CKOrdNo=''' + trim(CKOrdNo.Text) + '''');
sql.Add(',CRNote=''' + trim(CRNote.Text) + '''');
sql.Add(',Filler=''' + trim(DName) + '''');
sql.Add(',ToFactoryName=''' + trim(ToFactoryName.Text) + '''');
sql.Add(',ToOrderNo=''' + trim(ToOrderNo.Text) + ''' ');
if Trim(CYNO.Text) <> '' then
begin
SQL.Add(',CYNO=''' + Trim(CYNO.Text) + ''' ');
SQL.Add(',FPNo=''' + Trim(CDS_Sub.fieldbyname('FPNo').AsString) + ''' ');
end;
sql.Add('FROM CK_BanCP_CR A ');
sql.Add('where A.MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
sql.Add('and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_BanCp_KC set KCKgQty=0,KCQty=0 where CRID=' + CDS_Main.fieldbyname('CRID').AsString);
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
ExecSQL;
end;
{ IF trim(CRType.Text)='<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>' then
begin
if YSData(CDS_Main)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
// CDS_Main.EnableControls;
// CDS_MainSel.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD>տ<EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
end;}
with CDS_MainSel do
begin
Append;
FieldByName('MainId').Value := CDS_Main.fieldbyname('MainId').Value;
FieldByName('SubId').Value := Self.CDS_Main.fieldbyname('SubId').Value;
FieldByName('OrderNo').Value := Self.CDS_Main.fieldbyname('OrderNo').Value;
FieldByName('KGQty').Value := Self.CDS_Main.fieldbyname('KGQty').Value;
FieldByName('Qty').Value := Self.CDS_Main.fieldbyname('Qty').Value;
FieldByName('QtyUnit').Value := Self.CDS_Main.fieldbyname('QtyUnit').Value;
FieldByName('MJId').Value := Self.CDS_Main.fieldbyname('MJId').Value;
FieldByName('CRId').Value := Self.CDS_Main.fieldbyname('CRId').Value;
FieldByName('APID').Value := Self.CDS_Main.fieldbyname('APID').Value;
FieldByName('CPType').Value := CDS_Main.fieldbyname('CPType').Value;
FieldByName('BCID').Value := Trim(maxno);
FieldByName('PRTColor').Value := Self.CDS_Main.fieldbyname('PRTColor').Value;
FieldByName('MJXH').Value := Self.CDS_Main.fieldbyname('MJXH').Value;
FieldByName('AOrdDefstr1').Value := CDS_Main.fieldbyname('AOrdDefstr1').Value;
FieldByName('KHName').Value := CDS_Main.fieldbyname('KHName').Value;
FieldByName('RKOrdId').Value := CDS_Main.fieldbyname('RKOrdId').Value;
FieldByName('BaoNo').Value := CDS_Main.fieldbyname('BaoNo').Value;
//FieldByName('JZXNo').Value:=Trim(JZXNo.Text);
Post;
end;
CDS_Main.Delete;
end;
end;
ADOQueryCmd.Connection.CommitTrans;
MovePanel1.Visible := True;
if CDS_MainSel.IsEmpty = False then
Edit1.Text := IntToStr(Tv3.DataController.Summary.FooterSummaryValues[2])
else
Edit1.Text := '0';
Edit2.Text := Trim(RKOrdID.Text);
RKOrdID.Text := '';
MovePanel2.Visible := False;
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav'), 0, SND_ASYNC);
Exit;
except
RKOrdID.Text := '';
MovePanel2.Visible := False;
ADOQueryCmd.Connection.RollbackTrans;
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
end;
end;
end;
procedure TfrmCpCkSaoMNewSel.baoKeyPress(Sender: TObject; var Key: Char);
var
maxno: string;
begin
if Key = #13 then
begin
if CDS_Main.IsEmpty then
exit;
Label12.Caption := '';
if Trim(bao.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(CKOrdNo.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(CRType.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if (Trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>') or (Trim(CRType.Text) = '<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>') or (Trim(CRType.Text) = '<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>') then
begin
if Trim(ToFactoryName.Text) = '' then
begin
Application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
end;
if (Trim(CRType.Text) = '<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>') then
begin
if Trim(CYNO.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
end;
if CDS_Main.Locate('baoID', Trim(bao.Text), []) = False then
begin
MovePanel1.Visible := True;
Edit2.Text := Trim(bao.Text);
Label12.Caption := '<27><><EFBFBD>ѣ<EFBFBD><D1A3>˰<EFBFBD><CBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>';
bao.Text := '';
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
// Application.MessageBox('<27>˰<EFBFBD><CBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>','<27><>ʾ',0);
Exit;
end;
// CDS_Main.Locate('baoID',Trim(bao.Text),[]);
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_Main do
begin
first;
while CDS_Main.Locate('baoID', Trim(bao.Text), []) do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCP_CR SET CRFlag=''<27><><EFBFBD><EFBFBD>'',CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',FillTime=getdate(),RKStage=''<27><><EFBFBD><EFBFBD>'' ');
sql.add(',CRTime=''' + trim(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)) + '''');
sql.Add(',Filler=''' + trim(DName) + ''' ');
sql.Add('FROM CK_BanCP_CR A ');
sql.Add('where A.MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
sql.Add('and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE CK_BanCP_CR SET CRFlag=''<27><><EFBFBD><EFBFBD>'',FillTime=getdate() ');
sql.Add(',CRType=''' + trim(CRType.Text) + '''');
sql.add(',CRTime=''' + trim(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)) + '''');
sql.Add(',CKOrdNo=''' + trim(CKOrdNo.Text) + '''');
sql.Add(',CRNote=''' + trim(CRNote.Text) + '''');
sql.Add(',ToFactoryName=''' + trim(ToFactoryName.Text) + '''');
sql.Add(',ToOrderNo=''' + trim(ToOrderNo.Text) + ''' ');
sql.Add(',Filler=''' + trim(DName) + '''');
if Trim(CYNO.Text) <> '' then
begin
SQL.Add(',CYNO=''' + Trim(CYNO.Text) + ''' ');
SQL.Add(',FPNo=''' + Trim(CDS_Sub.fieldbyname('FPNo').AsString) + ''' ');
end;
sql.Add('FROM CK_BanCP_CR A ');
sql.Add('where A.MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
sql.Add('and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_BanCp_KC set KCKgQty=0,KCQty=0 where CRID=' + CDS_Main.fieldbyname('CRID').AsString);
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
ExecSQL;
end;
{ IF trim(CRType.Text)='<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>' then
begin
if YSData(CDS_Main)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
// CDS_Main.EnableControls;
// CDS_MainSel.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD>տ<EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
end; }
with CDS_MainSel do
begin
Append;
FieldByName('MainId').Value := CDS_Main.fieldbyname('MainId').Value;
FieldByName('SubId').Value := Self.CDS_Main.fieldbyname('SubId').Value;
FieldByName('OrderNo').Value := Self.CDS_Main.fieldbyname('OrderNo').Value;
FieldByName('KGQty').Value := Self.CDS_Main.fieldbyname('KGQty').Value;
FieldByName('Qty').Value := Self.CDS_Main.fieldbyname('Qty').Value;
FieldByName('QtyUnit').Value := Self.CDS_Main.fieldbyname('QtyUnit').Value;
FieldByName('MJId').Value := Self.CDS_Main.fieldbyname('MJId').Value;
FieldByName('CRId').Value := Self.CDS_Main.fieldbyname('CRId').Value;
FieldByName('APID').Value := Self.CDS_Main.fieldbyname('APID').Value;
FieldByName('CPType').Value := CDS_Main.fieldbyname('CPType').Value;
FieldByName('BCID').Value := Trim(maxno);
FieldByName('PRTColor').Value := Self.CDS_Main.fieldbyname('PRTColor').Value;
FieldByName('MJXH').Value := Self.CDS_Main.fieldbyname('MJXH').Value;
FieldByName('AOrdDefstr1').Value := CDS_Main.fieldbyname('AOrdDefstr1').Value;
FieldByName('KHName').Value := CDS_Main.fieldbyname('KHName').Value;
FieldByName('RKOrdId').Value := CDS_Main.fieldbyname('RKOrdId').Value;
FieldByName('BaoNo').Value := CDS_Main.fieldbyname('BaoNo').Value;
//FieldByName('JZXNo').Value:=Trim(JZXNo.Text);
Post;
end;
CDS_Main.Delete;
end;
end;
ADOQueryCmd.Connection.CommitTrans;
MovePanel1.Visible := True;
if CDS_MainSel.IsEmpty = False then
Edit1.Text := IntToStr(Tv3.DataController.Summary.FooterSummaryValues[2])
else
Edit1.Text := '0';
Edit2.Text := Trim(bao.Text);
bao.Text := '';
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav'), 0, SND_ASYNC);
exit;
except
bao.Text := '';
ADOQueryCmd.Connection.RollbackTrans;
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
end;
end;
end;
procedure TfrmCpCkSaoMNewSel.THMJIDKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
if CDS_MainSel.IsEmpty then
begin
THMJID.Text := '';
Application.MessageBox(<><CEB4><EFBFBD><EFBFBD><E2B2BB>ɨ<EFBFBD><C9A8><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if Trim(THMJID.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if not CDS_MainSel.Locate('MJId', Trim(THMJID.Text), []) then
begin
THMJID.Text := '';
Application.MessageBox('<27>˾<EFBFBD><CBBE>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
CDS_MainSel.Locate('MJId', Trim(THMJID.Text), []);
try
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL');
sql.Add(',CRNote=''''');
sql.Add(',CKOrdNo=''''');
SQL.Add(',CYNO='''' ');
SQL.Add(',FPNo='''' ');
sql.Add(',ToFactoryName='''' ');
sql.Add(',ToOrderNo='''' ');
sql.Add(' where CRID=''' + Trim(CDS_MainSel.fieldbyname('CRID').AsString) + '''');
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate CK_BanCP_KC Set KCKgQty=(select KgQty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
sql.Add(',KCQty=(select Qty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
SQL.Add(' where CRID=' + CDS_MainSel.fieldbyname('CRID').AsString);
sql.Add('Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + '''');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,RKOrdId='''',RKStage='''' ');
sql.Add(' where CRID=''' + Trim(CDS_MainSel.fieldbyname('CRID').AsString) + '''');
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
SQL.Add(' and RKStage=''<27><><EFBFBD><EFBFBD>'' ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add(' Update WFB_MJJY Set MJStr2='<><CEB4><EFBFBD><EFBFBD>'' where MJID=''' + Trim(CDS_MainSel.fieldbyname('MJID').AsString) + ''' ');
sql.Add(' and exists(select MJID from CK_BanCP_CR X where X.MJID=WFB_MJJY.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and MJStr2<>'<><CEB4><EFBFBD><EFBFBD>'')');
ExecSQL;
end;
// CDS_Main.DisableControls;
with CDS_Main do
begin
Append;
FieldByName('MainId').Value := CDS_MainSel.fieldbyname('MainId').Value;
FieldByName('SubId').Value := Self.CDS_MainSel.fieldbyname('SubId').Value;
FieldByName('OrderNo').Value := Self.CDS_MainSel.fieldbyname('OrderNo').Value;
FieldByName('KgQty').Value := Self.CDS_MainSel.fieldbyname('KgQty').Value;
FieldByName('Qty').Value := Self.CDS_MainSel.fieldbyname('Qty').Value;
FieldByName('QtyUnit').Value := Self.CDS_MainSel.fieldbyname('QtyUnit').Value;
FieldByName('MJId').Value := Self.CDS_MainSel.fieldbyname('MJId').Value;
FieldByName('CRId').Value := Self.CDS_MainSel.fieldbyname('CRId').Value;
FieldByName('APID').Value := Self.CDS_MainSel.fieldbyname('APID').Value;
FieldByName('CPType').Value := Self.CDS_MainSel.fieldbyname('CPType').Value;
FieldByName('PRTColor').Value := Self.CDS_MainSel.fieldbyname('PRTColor').Value;
FieldByName('AOrddefstr1').Value := Self.CDS_MainSel.fieldbyname('AOrddefstr1').Value;
FieldByName('MJXH').Value := Self.CDS_MainSel.fieldbyname('MJXH').Value;
FieldByName('KHName').Value := CDS_MainSel.fieldbyname('KHName').Value;
FieldByName('RKOrdID').Value := CDS_MainSel.fieldbyname('RKOrdID').Value;
FieldByName('BaoNo').Value := CDS_MainSel.fieldbyname('BaoNo').Value;
FieldByName('BaoID').Value := CDS_MainSel.fieldbyname('BaoID').Value;
Post;
end;
{ if YSData(CDS_MainSel)=False then
begin
THMJID.Text:='';
THMJID.SetFocus;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD>տ<EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end; }
CDS_MainSel.Delete;
Edit2.Text := Trim(THMJID.Text);
THMJID.Text := '';
THMJID.SetFocus;
Exit;
except
THMJID.Text := '';
THMJID.SetFocus;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
end;
end;
end;
procedure TfrmCpCkSaoMNewSel.Button6Click(Sender: TObject);
var
maxno, fsj: string;
begin
try
frmProductOrderNewList_CY_Help := TfrmProductOrderNewList_CY_Help.Create(Application);
with frmProductOrderNewList_CY_Help do
begin
if ShowModal = 1 then
begin
Self.CYNO.text := Trim(frmProductOrderNewList_CY_Help.Order_Main.fieldbyname('CYNO').asstring);
FFPNo := Trim(frmProductOrderNewList_CY_Help.Order_Main.fieldbyname('FPNo').asstring);
end;
end;
finally
frmProductOrderNewList_CY_Help.Free;
end;
CDS_Sub.DisableControls;
with Self.ADOQueryTemp do
begin
Close;
SQL.Clear;
SQL.Add('select A.MainId as CYID,A.CYNO,A.FPNo,B.OrderNo,B.ConNo,A.CustomerNoName,B.PRTName as MPRTCodeName,B.OrdMainID as MainId,B.OrdSubID as SubID');
SQL.Add(',B.PRTEColor,B.PRTColor,B.Qty as PRTOrderQty,B.QtyUnit as OrderUnit');
SQL.Add('from JYOrderCY_Main A inner join JYOrderCY_Sub01 B on B.MainId=A.MainId');
SQL.Add('where A.CYNo=''' + Trim(CYNO.Text) + ''' ');
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_Sub);
SInitCDSData20(ADOQueryTemp, CDS_Sub);
CDS_Sub.EnableControls;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
ExecSQL;
end;
CDS_Sub.DisableControls;
with CDS_Sub do
begin
First;
while not Eof do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into TBSubID select :SubId,:Dname');
Parameters.ParamByName('SubId').Value := Trim(CDS_Sub.fieldbyname('SubId').AsString);
Parameters.ParamByName('Dname').Value := Trim(DCode);
ExecSQL;
end;
Next;
end;
end;
CDS_Sub.EnableControls;
with Self.ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('select orderNo=(select OrderNo from JYOrder_Main where MainId=A.MainId), A.* ');
sql.Add(',KHName=(select isnull(customerNoName,OrderNo) from JYOrder_Main where MainId=A.MainId)');
sql.Add(',MPrtCodeName=(select MPrtCodeName from JYOrder_Main where MainId=A.MainId)');
sql.Add(',Mprtspec=(select Mprtspec from JYOrder_Main where MainId=A.MainId)');
SQL.Add(',PRTHX=(select PRTHX from JYOrder_Sub where SubId=A.SubId)');
SQL.Add(',PRTKuanNO=(select PRTKuanNO from JYOrder_Sub where SubId=A.SubId)');
SQL.Add(',PRTColor=(select PRTColor from JYOrder_Sub where SubId=A.SubId)');
SQL.Add(',QRColNo=(select QRColNo from JYOrder_Sub where SubId=A.SubId)');
sql.Add(',AOrdDefstr1=(select MJstr4 from WFB_MJJY where MJID=A.MJID)');
sql.Add(',MJXH=(select MJXH from WFB_MJJY where MJID=A.MJID)');
sql.Add(' from CK_BanCP_CR A inner join CK_BanCP_KC B on A.CRID=B.CRID');
SQL.Add(' where exists( select * from TBSubID AA where AA.SubId=A.SubId and AA.DName=''' + Trim(DCode) + ''')');
// sql.Add(' where exists( select * from JYOrderCy_Main X1,JYOrderCy_sub01 X2 where X1.mainID=X2.mainID and X1.CYNO='''+trim(CYNO.Text)+''') ');
SQL.Add(' and (B.KCqty>0 or B.KCKgQty>0) and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_Main);
SInitCDSData20(ADOQueryTemp, CDS_Main);
SCreateCDS20(ADOQueryMain, CDS_MainSel);
if GetLSNo(ADOQueryCmd, maxno, 'CK', 'CK_BanCP_CR', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><E2B5A5>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
CKOrdNo.Text := Trim(maxno);
// CDS_Sub.EmptyDataSet;
end;
procedure TfrmCpCkSaoMNewSel.CRTypeChange(Sender: TObject);
begin
if Trim(CRType.Text) <> '<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>' then
Button3.Visible := True
else
Button3.Visible := False;
if (Trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>') or (Trim(CRType.Text) = '<27><><EFBFBD>޳<EFBFBD><DEB3><EFBFBD>') or (Trim(CRType.Text) = '<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>') then
begin
Label14.Visible := True;
ToFactoryName.Visible := True;
Label15.Visible := True;
ToOrderNo.Visible := True;
end
else
begin
Label14.Visible := False;
ToFactoryName.Visible := False;
Label15.Visible := False;
ToOrderNo.Visible := False;
end;
Exit;
end;
procedure TfrmCpCkSaoMNewSel.CYNOKeyPress(Sender: TObject; var Key: Char);
begin
if Key = '#13' then
begin
end;
end;
procedure TfrmCpCkSaoMNewSel.ToFactoryNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
with frmZdyAttachGYS do
begin
if ShowModal = 1 then
begin
ToFactoryName.Text := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZdyAttachGYS.Free;
end;
end;
procedure TfrmCpCkSaoMNewSel.ToOrderNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmProductOrderListSel := TfrmProductOrderListSel.Create(Application);
with frmProductOrderListSel do
begin
FFInt := 1;
if ShowModal = 1 then
begin
ToOrderNo.Text := Trim(Order_Main.FieldByName('OrderNo').AsString);
end;
end;
finally
frmProductOrderListSel.Free;
end;
end;
end.