448 lines
15 KiB
ObjectPascal
448 lines
15 KiB
ObjectPascal
![]() |
unit U_CPSMCK;
|
|||
|
|
|||
|
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;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCPSMCK = class(TForm)
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
DS_MainSel: TDataSource;
|
|||
|
CDS_MainSel: TClientDataSet;
|
|||
|
cxGridPopupMenu4: TcxGridPopupMenu;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
v3Column3: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
Panel2: TPanel;
|
|||
|
Label5: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
CKOrdNo: TEdit;
|
|||
|
BaoID: TEdit;
|
|||
|
CRTime: TDateTimePicker;
|
|||
|
Button2: TButton;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
Label12: TLabel;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
CRType: TEdit;
|
|||
|
Button1: TButton;
|
|||
|
v3Column4: TcxGridDBColumn;
|
|||
|
v3Column5: 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 Button1Click(Sender: TObject);
|
|||
|
function YSData(Order_Main10: TClientDataSet): Boolean;
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
FCKOrdNo, FSMStr, JXFlag: string;
|
|||
|
procedure TMPanDuan();
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmCPSMCK: TfrmCPSMCK;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, MMSystem, U_PBKCList;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
function TfrmCPSMCK.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 TfrmCPSMCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSMCK.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCPSMCK := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSMCK.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
BaoID.SetFocus;
|
|||
|
ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.*,B.CRID,C.C_Code PrtCode,C.C_CodeName PrtCodeName 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(' inner join Cloth_Sub C on C.SubId=B.SubId ');
|
|||
|
sql.Add(' where 1=2');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_MainSel);
|
|||
|
// SInitCDSData20(ADOQueryTemp,CDS_MainSel);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSMCK.TMPanDuan();
|
|||
|
var
|
|||
|
FCKOrdNo: string;
|
|||
|
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);
|
|||
|
|
|||
|
begin
|
|||
|
if Trim(CKOrdNo.Text) = '' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, FCKOrdNo, 'CC', 'CK_PBCp_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
PlaySound('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
end;
|
|||
|
CKOrdNo.Text := FCKOrdNo;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select C.CKOrdNo from WFB_MJJY_PB B ');
|
|||
|
sql.Add(' inner join CK_PBCP_CR C on B.MJID=C.MJID and C.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' where B.MJID=''' + Trim(FSMStr) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('CKOrdNo').AsString) = Trim(CKOrdNo.Text) then
|
|||
|
begin
|
|||
|
JXFlag := '999';
|
|||
|
PlaySound('<27><>ɨ<EFBFBD><C9A8>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Exit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
JXFlag := '999';
|
|||
|
PlaySound('<27>ѳ<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 C.CKOrdNo,CPType from CK_PBCP_CR C ');
|
|||
|
sql.Add(' where C.CRFlag=''<27><><EFBFBD><EFBFBD>'' and C.MJID=''' + Trim(FSMStr) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
JXFlag := '999';
|
|||
|
PlaySound('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('CPType').AsString) <> '<27><><EFBFBD><EFBFBD>Ʒ' then
|
|||
|
begin
|
|||
|
JXFlag := '999';
|
|||
|
PlaySound('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Exit;
|
|||
|
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 TfrmCPSMCK.BaoIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
maxno, SMFlag, KYCKFlag, FMainId: string;
|
|||
|
FFQty: Integer;
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
TMPanDuan();
|
|||
|
if Trim(JXFlag) = '999' then
|
|||
|
begin
|
|||
|
BaoID.Text := '';
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.*,B.CRID,C.C_Code PrtCode,C.C_CodeName PrtCodeName 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(' inner join Cloth_Sub C on C.SubId=B.SubId ');
|
|||
|
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=''<27><><EFBFBD><EFBFBD>'', @CKOrdNo=' + quotedstr(trim(CKOrdNo.Text))
|
|||
|
+ ', @MJID=' + quotedstr(trim(CDS_Main.fieldbyname('MJID').asstring))
|
|||
|
+ ', @DName=' + quotedstr(trim(DName)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
with CDS_MainSel do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('PrtCode').Value := Self.CDS_Main.fieldbyname('PrtCode').Value;
|
|||
|
FieldByName('PrtCodeName').Value := Self.CDS_Main.fieldbyname('PrtCodeName').Value;
|
|||
|
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('MJStr3').Value := Self.CDS_Main.fieldbyname('MJStr3').Value;
|
|||
|
FieldByName('CarNo').Value := Self.CDS_Main.fieldbyname('CarNo').Value;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
BaoID.Text := '';
|
|||
|
PlaySound('<27><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
|
|||
|
Exit;
|
|||
|
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;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSMCK.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPSMCK.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
MKey: Char;
|
|||
|
begin
|
|||
|
MKey := #13;
|
|||
|
try
|
|||
|
frmPBKCList := TfrmPBKCList.Create(self);
|
|||
|
with frmPBKCList do
|
|||
|
begin
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
while frmPBKCList.CDS_Main.Locate('SSel', true, []) do
|
|||
|
begin
|
|||
|
BaoID.Text := Trim(frmPBKCList.CDS_Main.fieldbyname('MJID').AsString);
|
|||
|
BaoIDKeyPress(BaoID, MKey);
|
|||
|
frmPBKCList.CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmPBKCList.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|