1064 lines
32 KiB
ObjectPascal
1064 lines
32 KiB
ObjectPascal
|
|
unit U_SQSMCK;
|
|||
|
|
|
|||
|
|
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, cxGridCustomTableView,
|
|||
|
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
|||
|
|
cxGrid, MovePanel, cxCheckBox, Menus, ComCtrls, BtnEdit, ShellAPI, cxTextEdit,
|
|||
|
|
RM_Common, RM_Class, RM_GridReport, RM_System, RM_Dataset, RM_e_Xls,
|
|||
|
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmSQSMCK = class(TForm)
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
DS_MainSel: TDataSource;
|
|||
|
|
CDS_MainSel: TClientDataSet;
|
|||
|
|
cxGridPopupMenu4: TcxGridPopupMenu;
|
|||
|
|
cxGrid3: TcxGrid;
|
|||
|
|
Tv3: TcxGridDBTableView;
|
|||
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
|
v3Column1: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
v3Column2: TcxGridDBColumn;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
CKPSQty: TEdit;
|
|||
|
|
CKOrdNo: TEdit;
|
|||
|
|
BaoID: TEdit;
|
|||
|
|
CRTime: TDateTimePicker;
|
|||
|
|
KHName: TEdit;
|
|||
|
|
Button2: TButton;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
PrtCode: TEdit;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
PrtCodeName: TEdit;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Edit1: TEdit;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
CDS_Main: TClientDataSet;
|
|||
|
|
CRType: TEdit;
|
|||
|
|
Button1: TButton;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
BatchNo: TEdit;
|
|||
|
|
v3Column4: TcxGridDBColumn;
|
|||
|
|
ComboBox1: TComboBox;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
Button3: TButton;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
RMDBMX: TRMDBDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
CDS_JuanPRT: TClientDataSet;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
edtIsSMTH: TEdit;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
BDQty: TEdit;
|
|||
|
|
Button4: TButton;
|
|||
|
|
Button5: TButton;
|
|||
|
|
Image2: TImage;
|
|||
|
|
ClientDataSet1: TClientDataSet;
|
|||
|
|
Label13: TLabel;
|
|||
|
|
NoCarNo: TEdit;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
OKCarNo: TEdit;
|
|||
|
|
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 Button1Click(Sender: TObject);
|
|||
|
|
function YSData(Order_Main10: TClientDataSet): Boolean;
|
|||
|
|
procedure Button3Click(Sender: TObject);
|
|||
|
|
procedure edtIsSMTHClick(Sender: TObject);
|
|||
|
|
procedure Button5Click(Sender: TObject);
|
|||
|
|
procedure Image2Click(Sender: TObject);
|
|||
|
|
procedure Button4Click(Sender: TObject);
|
|||
|
|
procedure Tv3CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure BDQtyKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
FCKOrdNo, FSMStr, JXFlag: string;
|
|||
|
|
FCK:Integer;
|
|||
|
|
procedure TMPanDuan();
|
|||
|
|
procedure On1201(var Message: Tmessage); message 1201;
|
|||
|
|
procedure OpenCom(DllName: string);
|
|||
|
|
procedure CloseCom(DllName: string);
|
|||
|
|
procedure ClearCom(DllName: string);
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmSQSMCK: TfrmSQSMCK;
|
|||
|
|
newh, newh1,newh2: hwnd;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_Fun, U_RTFun, MMSystem, U_FHSQListSel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TfrmSQSMCK.ClearCom(DllName: string);
|
|||
|
|
type
|
|||
|
|
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
|
|||
|
|
var
|
|||
|
|
Tf2: TMyFunc;
|
|||
|
|
Tp2: TFarProc;
|
|||
|
|
Th2: Thandle;
|
|||
|
|
//newh1:hwnd;
|
|||
|
|
begin
|
|||
|
|
Th2 := LoadLibrary(Pchar(trim(DllName)));
|
|||
|
|
if Th2 > 0 then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Tp2 := GetProcAddress(Th2, 'CommClear');
|
|||
|
|
if Tp2 <> nil then
|
|||
|
|
begin
|
|||
|
|
Tf2 := TMyFunc(Tp2);
|
|||
|
|
newh2 := Tf2('Comm1');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
// FreeLibrary(Th1);
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
procedure TfrmSQSMCK.CloseCom(DllName: string);
|
|||
|
|
type
|
|||
|
|
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
|
|||
|
|
var
|
|||
|
|
Tf1: TMyFunc;
|
|||
|
|
Tp1: TFarProc;
|
|||
|
|
Th1: Thandle;
|
|||
|
|
//newh1:hwnd;
|
|||
|
|
begin
|
|||
|
|
Th1 := LoadLibrary(Pchar(trim(DllName)));
|
|||
|
|
if Th1 > 0 then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Tp1 := GetProcAddress(Th1, 'CommClose');
|
|||
|
|
if Tp1 <> nil then
|
|||
|
|
begin
|
|||
|
|
Tf1 := TMyFunc(Tp1);
|
|||
|
|
newh1 := Tf1('Comm1');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
// FreeLibrary(Th1);
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
procedure TfrmSQSMCK.OpenCom(DllName: string);
|
|||
|
|
type
|
|||
|
|
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
|
|||
|
|
var
|
|||
|
|
Tf: TMyFunc;
|
|||
|
|
Tp: TFarProc;
|
|||
|
|
Th: Thandle;
|
|||
|
|
begin
|
|||
|
|
Th := LoadLibrary(Pchar(trim(DllName)));
|
|||
|
|
if Th > 0 then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Tp := GetProcAddress(Th, 'CommOpen');
|
|||
|
|
if Tp <> nil then
|
|||
|
|
begin
|
|||
|
|
Tf := TMyFunc(Tp);
|
|||
|
|
newh := Tf(self.Handle, 'Comm1', 500, 1);
|
|||
|
|
if newh < 1 then
|
|||
|
|
begin
|
|||
|
|
FCK := 1;
|
|||
|
|
showmessage('<27><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
|||
|
|
Exit;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FCK := 9;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + '<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
procedure TfrmSQSMCK.On1201(var Message: Tmessage);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmSQSMCK.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 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 ');
|
|||
|
|
// sql.Add(' where 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 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('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(TocustName.Text);
|
|||
|
|
// 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
|
|||
|
|
// IF (uppercase(OrderUnit)='Y') and (uppercase(Trim(Order_Main10.fieldbyname('QtyUnit').AsString))='M') then
|
|||
|
|
// begin
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('update YF_Money_CR Set Qty=(select cast(isnull(Sum(A.Qty),0)/0.9144 as decimal(18,1)) 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
|
|||
|
|
// else
|
|||
|
|
// IF (uppercase(OrderUnit)='M') and (uppercase(Trim(Order_Main10.fieldbyname('QtyUnit').AsString))='Y') then
|
|||
|
|
// begin
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('update YF_Money_CR Set Qty=(select cast(isnull(Sum(A.Qty),0)*0.9144 as decimal(18,1)) 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
|
|||
|
|
// 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 TfrmSQSMCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
if FCK = 9 then
|
|||
|
|
begin
|
|||
|
|
CloseCom('JPort6E1R.dll');
|
|||
|
|
end;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmSQSMCK := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
BaoID.SetFocus;
|
|||
|
|
ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
|
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
|
OpenCom('JPort6E1R.dll');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.TMPanDuan();
|
|||
|
|
begin
|
|||
|
|
//<2F>ж<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD> <20><><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߸<EFBFBD><DFB8><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
JXFlag := '';
|
|||
|
|
FSMStr := Trim(BaoID.Text);
|
|||
|
|
if Copy(FSMStr, 1, 2) = 'SM' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from FHSQ_Main A inner join FHSQ_Sub B on A.FSID=B.FSID where A.FSID=''' + Trim(FSMStr) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('<27><><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from FHSQ_Main');
|
|||
|
|
sql.Add('where FSID=' + quotedstr(trim(FSMStr)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if Trim(ADOQueryTemp.fieldbyname('YSID').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\<5C>Ѷ<EFBFBD><D1B6><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(CKOrdNo.Text) <> '' then
|
|||
|
|
begin
|
|||
|
|
FCKOrdNo := Trim(CKOrdNo.Text);
|
|||
|
|
end;
|
|||
|
|
CKOrdNo.Text := Trim(FSMStr);
|
|||
|
|
if FSMStr <> FCKOrdNo then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select CarNo=isnull(B.CarNo,A.KCCarNo),APBatchNo=isnull(B.APBatchNo,A.KCAPBatchNo) ');
|
|||
|
|
sql.Add(', APXH=isnull(B.APXH,A.MJXH),MJMaoZ=isnull(B.MJMaoZ,A.KgQty),MJID=isnull(B.MJID,A.MJID) ');
|
|||
|
|
SQL.Add(',B.*');
|
|||
|
|
sql.Add(' from CK_PBCP_CR A');
|
|||
|
|
sql.Add(' left join WFB_MJJY_PB B on A.MJID=B.MJID');
|
|||
|
|
sql.Add(' where A.CKOrdNO=''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
|||
|
|
SInitCDSData20(ADOQueryTemp, CDS_MainSel);
|
|||
|
|
if CDS_MainSel.IsEmpty = False then
|
|||
|
|
Edit1.Text := IntToStr(Tv3.DataController.Summary.FooterSummaryValues[2])
|
|||
|
|
else
|
|||
|
|
Edit1.Text := '0';
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select Top 1 * from CK_PBCP_CR where 1=2');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,ClientDataSet1);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,ClientDataSet1);
|
|||
|
|
end;
|
|||
|
|
BaoID.Text := '';
|
|||
|
|
JXFlag := '888';
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if Trim(CKOrdNo.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\δɨ<CEB4><C9A8><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from WFB_MJJY_PB A ');
|
|||
|
|
sql.Add('where exists (select Y.SubId from FHSQ_Sub Y where Y.SubId=A.SubId and Y.FSId=' + quotedstr(Trim(CKOrdNo.Text)) + ')');
|
|||
|
|
sql.Add('and A.MJID=' + quotedstr(Trim(FSMStr)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.APID from WFB_MJJY_PB A ');
|
|||
|
|
sql.Add('where A.APID=' + quotedstr(Trim(FSMStr)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if Trim(BatchNo.Text) <> '' then
|
|||
|
|
begin
|
|||
|
|
if FormatTitle(Trim(ADOQueryTemp.fieldbyname('APBatchNo').AsString)) <> FormatTitle(Trim(BatchNo.Text)) then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('<27><><EFBFBD>Ų<EFBFBD>ͬ<EFBFBD><CDAC>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if Trim(NoCarNo.Text) <> '' then
|
|||
|
|
begin
|
|||
|
|
if Pos(Trim(ADOQueryTemp.fieldbyname('CarNo').AsString),Trim(NoCarNo.Text))>0 then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\<5C><>̨<EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if Trim(OKCarNo.Text) <> '' then
|
|||
|
|
begin
|
|||
|
|
if Pos(Trim(ADOQueryTemp.fieldbyname('CarNo').AsString),Trim(OKCarNo.Text))>0 then
|
|||
|
|
begin
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\<5C><>̨<EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if ((ADOQueryTemp.fieldbyname('MJMaoZ').AsFloat < 5) or (ADOQueryTemp.fieldbyname('MJMaoZ').AsFloat > 35)) then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.CKOrdNo from CK_PBCP_CR A ');
|
|||
|
|
sql.Add('where exists (select Y.SubId from FHSQ_Sub Y where Y.SubId=A.SubId and Y.FSId=' + quotedstr(Trim(CKOrdNo.Text)) + ')');
|
|||
|
|
sql.Add(' and A.MJID=' + quotedstr(Trim(FSMStr)));
|
|||
|
|
sql.Add(' and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if not ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
if Trim(ADOQueryTemp.fieldbyname('CKOrdNo').AsString) = Trim(CKOrdNo.Text) then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\<5C><>ɨ<EFBFBD><C9A8>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\<5C>ѳ<EFBFBD><D1B3><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.CKOrdNo from CK_PBCP_CR A ');
|
|||
|
|
sql.Add('where exists (select Y.SubId from FHSQ_Sub Y where Y.SubId=A.SubId and Y.FSId=' + quotedstr(Trim(CKOrdNo.Text)) + ')');
|
|||
|
|
sql.Add(' and A.MJID=' + quotedstr(Trim(FSMStr)));
|
|||
|
|
sql.Add(' and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(Edit1.Text) <> '' then
|
|||
|
|
begin
|
|||
|
|
if StrToInt(Edit1.Text) >= StrToInt(CKPSQty.Text) then
|
|||
|
|
begin
|
|||
|
|
JXFlag := '999';
|
|||
|
|
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
//<2F>ж<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD> <20><><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߸<EFBFBD><DFB8><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD> FHDate
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.BaoIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
var
|
|||
|
|
maxno, SMFlag, KYCKFlag, FMainId: string;
|
|||
|
|
FFQty: Integer;
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
if edtIsSMTH.Text = '' then
|
|||
|
|
begin
|
|||
|
|
TMPanDuan();
|
|||
|
|
if Trim(JXFlag) = '999' then
|
|||
|
|
begin
|
|||
|
|
BaoID.Text := '';
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(JXFlag) = '888' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.* ,KHName=CustomerNoName,CKPSQty=A.SQPSHZ ');
|
|||
|
|
sql.Add(' from FHSQ_Main A');
|
|||
|
|
|
|||
|
|
sql.Add(' where FSId=''' + Trim(CKOrdNo.Text) + ''' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCSHDataNew(ADOQueryTemp, Panel2, 2);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.*,B.CRID ');
|
|||
|
|
sql.Add(' from WFB_MJJY_PB A');
|
|||
|
|
sql.Add(' inner join CK_PBCP_CR B on A.MJID=B.MJID and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.Add(' where A. MJID=''' + Trim(BaoID.Text) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp, CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryTemp, CDS_Main);
|
|||
|
|
try
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from CK_PBCp_KC where MJID=''' + Trim(BaoID.Text) + '''');
|
|||
|
|
sql.Add(' and KCKGQty>0');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
KYCKFlag := '<27><><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>';
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
KYCKFlag := '<27>ܳ<EFBFBD><DCB3><EFBFBD>';
|
|||
|
|
end;
|
|||
|
|
if Trim(KYCKFlag) = '<27>ܳ<EFBFBD><DCB3><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('exec P_Do_PBCK @CRFlag=''ֱ<>ӳ<EFBFBD><D3B3><EFBFBD>'', @CKOrdNo=' + quotedstr(trim(CKOrdNo.Text)) + ', @MJID=' + quotedstr(trim(CDS_Main.fieldbyname('MJID').asstring)) + ', @DName=' + quotedstr(trim(DName)));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
FMainId := Trim(CDS_Main.fieldbyname('MainID').AsString);
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('exec P_Do_FHSQ ''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
with CDS_MainSel do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Mainid').Value := Self.CDS_Main.fieldbyname('Mainid').Value;
|
|||
|
|
FieldByName('SubID').Value := Self.CDS_Main.fieldbyname('SubID').Value;
|
|||
|
|
FieldByName('MJMaoZ').Value := Self.CDS_Main.fieldbyname('MJMaoZ').Value;
|
|||
|
|
FieldByName('MJId').Value := Self.CDS_Main.fieldbyname('MJId').Value;
|
|||
|
|
FieldByName('APXH').Value := Self.CDS_Main.fieldbyname('APXH').Value;
|
|||
|
|
FieldByName('CarNo').Value := Self.CDS_Main.fieldbyname('CarNo').Value;
|
|||
|
|
FieldByName('APBatchNo').Value := Self.CDS_Main.fieldbyname('APBatchNo').Value;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
BaoID.Text := '';
|
|||
|
|
PlaySound('<27><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
end;
|
|||
|
|
except
|
|||
|
|
BaoID.Text := '';
|
|||
|
|
PlaySound('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if not CDS_MainSel.Locate('MJID', BaoID.Text, []) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD>룡', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('exec P_Do_PBCK @CRFlag=''δ<><CEB4><EFBFBD><EFBFBD>'', @CKOrdNo='''', @MJID=' + quotedstr(trim(BaoID.Text)));
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><E2B3B7>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CKOrdNo.Text) + ' <20><><EFBFBD>룺' + trim(BaoID.Text))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('exec P_Do_FHSQ ''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
CDS_MainSel.Locate('MJID', BaoID.Text, []);
|
|||
|
|
CDS_MainSel.Delete;
|
|||
|
|
BaoID.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
//<2F>жϷ<D0B6><CFB7><EFBFBD>ƥ<EFBFBD><C6A5>
|
|||
|
|
if CDS_MainSel.IsEmpty = False then
|
|||
|
|
Edit1.Text := IntToStr(Tv3.DataController.Summary.FooterSummaryValues[2])
|
|||
|
|
else
|
|||
|
|
Edit1.Text := '0';
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select COUNT(*) fhjs from CK_PBCP_CR where CKOrdNo= ''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if StrToInt(Edit1.Text) <> ADOQueryTemp.FieldByName('fhjs').AsInteger then
|
|||
|
|
begin
|
|||
|
|
PlaySound('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.Button2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.Button1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MKey: Char;
|
|||
|
|
begin
|
|||
|
|
MKey := #13;
|
|||
|
|
try
|
|||
|
|
frmFHSQListSel := TfrmFHSQListSel.Create(self);
|
|||
|
|
with frmFHSQListSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
BaoID.Text := Trim(Order_Main.fieldbyname('FSID').AsString);
|
|||
|
|
BaoIDKeyPress(BaoID, MKey);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmFHSQListSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.Button3Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
begin
|
|||
|
|
if Trim(CKOrdNo.Text) = '' then
|
|||
|
|
EXIT;
|
|||
|
|
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
|||
|
|
if ComboBox1.Text = '<27><>ͨ<EFBFBD>뵥' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('exec P_Print_CKMDZZ1 ' + quotedstr(Trim(CKOrdNo.Text)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
|
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if trim(ComboBox1.Text) = '<27><>ͨ<EFBFBD><CDA8>̨<EFBFBD>뵥' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('exec P_Print_CKMDZZ2 ' + quotedstr(Trim(CKOrdNo.Text)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
|
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
|
end;
|
|||
|
|
if ComboBox1.Text = '<27><>ҳ<EFBFBD><D2B3>̨<EFBFBD>뵥' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('exec P_Print_CKMDZZ3 ' + quotedstr(Trim(CKOrdNo.Text)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
|
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
// RMVariables['OrdNo'] := Trim(CDS_Main.fieldbyname('OrdNo').AsString)<29><>
|
|||
|
|
RM1.DefaultCopies := 2;
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RM1.ShowReport;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.edtIsSMTHClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Trim(edtIsSMTH.Text) = '' then
|
|||
|
|
edtIsSMTH.Text := '<27><>'
|
|||
|
|
else
|
|||
|
|
edtIsSMTH.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.Button5Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_MainSel.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select Top 1 * from CK_PBCP_CR where isnull(CKordNo,'''')='''+Trim(CKOrdNo.Text)+'''');
|
|||
|
|
sql.Add('and MJXH>0 order by FillTime Desc');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,ClientDataSet1);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,ClientDataSet1);
|
|||
|
|
Panel1.Visible:=True;
|
|||
|
|
BDQty.Text:='';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.Image2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Panel1.Visible:=False;
|
|||
|
|
BDQty.Text:='';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.Button4Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
Freal:Double;
|
|||
|
|
maxno:string;
|
|||
|
|
begin
|
|||
|
|
if Trim(BDQty.Text)='' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if TryStrToFloat(BDQty.Text,Freal)=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if ClientDataSet1.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Button5.Click;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
if GetLSNoHZ(ADOQueryCmd, maxno, 'BD', 'CK_PBCP_CR', 3, 1, 0) = False then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select * from CK_PBCP_CR where 1=2');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('BCID').Value := Trim(maxno);
|
|||
|
|
FieldByName('MJID').Value := Trim(maxno);
|
|||
|
|
FieldByName('APID').Value := Trim(maxno);
|
|||
|
|
FieldByName('MainID').Value :=ClientDataSet1.fieldbyname('MainID').Value;
|
|||
|
|
FieldByName('SubID').Value :=ClientDataSet1.fieldbyname('SubID').Value;
|
|||
|
|
FieldByName('CRTime').Value := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
FieldByName('CRFlag').Value :=ClientDataSet1.fieldbyname('CRFlag').Value;
|
|||
|
|
FieldByName('CRType').Value :=ClientDataSet1.fieldbyname('CRType').Value;
|
|||
|
|
FieldByName('QtyUnit').Value :=ClientDataSet1.fieldbyname('QtyUnit').Value;
|
|||
|
|
FieldByName('KgQty').Value :=BDQty.Text;
|
|||
|
|
FieldByName('Valid').Value :=ClientDataSet1.fieldbyname('Valid').Value;
|
|||
|
|
FieldByName('NowOutFlag').Value :=ClientDataSet1.fieldbyname('NowOutFlag').Value;
|
|||
|
|
FieldByName('CKOrdNo').Value :=ClientDataSet1.fieldbyname('CKOrdNo').Value;
|
|||
|
|
FieldByName('IsCJ').Value :=ClientDataSet1.fieldbyname('IsCJ').Value;
|
|||
|
|
FieldByName('IsYCK').Value :=ClientDataSet1.fieldbyname('IsYCK').Value;
|
|||
|
|
FieldByName('KCCarNo').Value :='<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('KCAPBatchNo').Value :=ClientDataSet1.fieldbyname('KCAPBatchNo').Value;
|
|||
|
|
FieldByName('MJXH').Value :=-999;
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('exec P_Do_FHSQ ''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
with CDS_MainSel do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Mainid').Value := Self.ClientDataSet1.fieldbyname('Mainid').Value;
|
|||
|
|
FieldByName('SubID').Value := Self.ClientDataSet1.fieldbyname('SubID').Value;
|
|||
|
|
FieldByName('MJMaoZ').Value := BDQty.Text;
|
|||
|
|
FieldByName('MJId').Value :=Trim(maxno);
|
|||
|
|
FieldByName('APXH').Value :=-999;
|
|||
|
|
FieldByName('CarNo').Value :='<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('APBatchNo').Value :=Self.ClientDataSet1.fieldbyname('KCAPBatchNo').Value;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
PlaySound('<27><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
BDQty.Text:='';
|
|||
|
|
//<2F>жϷ<D0B6><CFB7><EFBFBD>ƥ<EFBFBD><C6A5>
|
|||
|
|
if CDS_MainSel.IsEmpty = False then
|
|||
|
|
Edit1.Text := IntToStr(Tv3.DataController.Summary.FooterSummaryValues[2])
|
|||
|
|
else
|
|||
|
|
Edit1.Text := '0';
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select COUNT(*) fhjs from CK_PBCP_CR where CKOrdNo= ''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if StrToInt(Edit1.Text) <> ADOQueryTemp.FieldByName('fhjs').AsInteger then
|
|||
|
|
begin
|
|||
|
|
PlaySound('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.Tv3CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
if CDS_MainSel.IsEmpty then Exit;
|
|||
|
|
if CDS_MainSel.fieldbyname('APXH').AsInteger>0 then Exit;
|
|||
|
|
if Trim(CDS_MainSel.fieldbyname('CarNo').AsString)<>'<27><><EFBFBD><EFBFBD>' then Exit;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete CK_PBCP_CR where BCID='''+Trim(CDS_MainSel.fieldbyname('MJID').AsString)+'''');
|
|||
|
|
SQL.Add(' and isnull(BCID,'''')<>'''' ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('exec P_Do_FHSQ ''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
CDS_MainSel.Delete;
|
|||
|
|
if CDS_MainSel.IsEmpty = False then
|
|||
|
|
Edit1.Text := IntToStr(Tv3.DataController.Summary.FooterSummaryValues[2])
|
|||
|
|
else
|
|||
|
|
Edit1.Text := '0';
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select COUNT(*) fhjs from CK_PBCP_CR where CKOrdNo= ''' + Trim(CKOrdNo.Text) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if StrToInt(Edit1.Text) <> ADOQueryTemp.FieldByName('fhjs').AsInteger then
|
|||
|
|
begin
|
|||
|
|
PlaySound('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSQSMCK.BDQtyKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key=#13 then
|
|||
|
|
begin
|
|||
|
|
Button4.Click;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|