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

184 lines
6.2 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

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

unit U_OrderSunSelList;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter,
RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport, RM_e_Xls,
Menus, cxPC;
type
TfrmOrderSunSelList = class(TForm)
ToolBar1: TToolBar;
TBClose: TToolButton;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryMain: TADOQuery;
DataSource1: TDataSource;
v1ConNo: TcxGridDBColumn;
v1MPRTSpec: TcxGridDBColumn;
Order_Main: TClientDataSet;
v1CustomerNoName: TcxGridDBColumn;
v1MPRTCodeName: TcxGridDBColumn;
PopupMenu1: TPopupMenu;
N2: TMenuItem;
v1Column1: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
Panel1: TPanel;
Label9: TLabel;
OrderNo: TEdit;
v1Column7: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
ToolButton2: TToolButton;
v1Column13: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
N1: TMenuItem;
v1Column5: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
v1Column16: TcxGridDBColumn;
v1Column17: TcxGridDBColumn;
v1Column18: TcxGridDBColumn;
v1Column19: TcxGridDBColumn;
v1Column20: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
procedure ToolButton2Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N1Click(Sender: TObject);
private
procedure InitForm();
{ Private declarations }
public
FFInt,FCloth:Integer;
{ Public declarations }
end;
var
frmOrderSunSelList: TfrmOrderSunSelList;
implementation
uses
U_DataLink,U_ConInPut,U_RTFun;
{$R *.dfm}
procedure TfrmOrderSunSelList.FormDestroy(Sender: TObject);
begin
frmOrderSunSelList:=nil;
end;
procedure TfrmOrderSunSelList.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmOrderSunSelList.FormCreate(Sender: TObject);
begin
cxgrid1.Align:=alClient;
end;
procedure TfrmOrderSunSelList.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>б<EFBFBD>ѡ<EFBFBD><D1A1>',Tv1,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmOrderSunSelList.InitForm();
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>б<EFBFBD>ѡ<EFBFBD><D1A1>',Tv1,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmOrderSunSelList.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmOrderSunSelList.OrderNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
if Length(OrderNo.Text)<3 then Exit;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
SQL.Clear;
sql.Add(' select AAA.*,KCPS=AAA.ZPPS-AAA.CKPS,KCQty=AAA.ZPQty-AAA.CKQty ');
sql.Add(' from (');
sql.Add(' select AA.* ');
sql.Add(' ,Case when isnull(OrderUnit,'''')=''M'' then ZPMQty');
sql.Add(' when isnull(OrderUnit,'''')=''Y'' then ZPYQty');
sql.Add(' else ZPKgQty end as ZPQty');
sql.Add(' ,Case when isnull(OrderUnit,'''')=''M'' then CPMQty');
sql.Add(' when isnull(OrderUnit,'''')=''Y'' then CPYQty');
sql.Add(' else CPKgQty end as CPQty');
sql.Add(' ,CKPS=(select isnull(Sum(FHPS),0) from JYOrder_FH FH where FH.SubId=AA.SubId)');
sql.Add(' ,CKQty=(select Cast(isnull(Sum(FHQty),0) as decimal(18,2)) from JYOrder_FH FH where FH.SubId=AA.SubId)');
sql.Add('from (');
sql.Add('select A.*,B.SubId,B.PRTHX,B.OrderUnit,B.PRTOrdQty ');
sql.Add(',PRTColor=isnull(B.PRTColorNo,'''')+'' ''+isnull(B.PRTColor,'''')+'' ''+isnull(B.PRTColorEng,'''')');
sql.Add(',ZPPS=(select Count(*) from WFB_MJJY WM where WM.SubId=B.SubId and MJType=''<27><>Ʒ'')');
sql.Add(',ZPKgQty=(select Cast(isnull(sum(MJQty4),0) as decimal(18,2)) from WFB_MJJY WM where WM.SubId=B.SubId and MJType=''<27><>Ʒ'' )');
sql.Add(',ZPMQty=(select Cast(isnull(sum(MJLen),0) as decimal(18,2)) from WFB_MJJY WM where WM.SubId=B.SubId and MJType=''<27><>Ʒ'')');
sql.Add(',ZPYQty=(select Cast(isnull(sum(MJLenMa),0) as decimal(18,2)) from WFB_MJJY WM where WM.SubId=B.SubId and MJType=''<27><>Ʒ'')');
sql.Add(',CPPS=(select Count(*) from WFB_MJJY WM where WM.SubId=B.SubId and MJType=''<27><>Ʒ'')');
sql.Add(',CPKgQty=(select Cast(isnull(sum(MJQty4),0) as decimal(18,2)) from WFB_MJJY WM where WM.SubId=B.SubId and MJType=''<27><>Ʒ'' )');
sql.Add(',CPMQty=(select Cast(isnull(sum(MJLen),0) as decimal(18,2)) from WFB_MJJY WM where WM.SubId=B.SubId and MJType=''<27><>Ʒ'')');
sql.Add(',CPYQty=(select Cast(isnull(sum(MJLenMa),0) as decimal(18,2)) from WFB_MJJY WM where WM.SubId=B.SubId and MJType=''<27><>Ʒ'')');
sql.Add(' from JYOrder_Main A ');
sql.Add(' inner join JYOrder_Sub B on A.MainId=B.MainId');
SQL.Add(' where A.OrderNo like '''+'%'+Trim(OrderNo.Text)+'%'+''')AA)AAA');
//ShowMessage(SQL.Text);
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
end;
procedure TfrmOrderSunSelList.ToolButton2Click(Sender: TObject);
begin
if Order_Main.IsEmpty then Exit;
if Order_Main.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
OrderNo.SetFocus;
ModalResult:=1;
end;
procedure TfrmOrderSunSelList.N2Click(Sender: TObject);
begin
SelOKNo(Order_Main,True);
end;
procedure TfrmOrderSunSelList.N1Click(Sender: TObject);
begin
SelOKNo(Order_Main,False);
end;
end.