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

358 lines
10 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_OrderJSHZView; //27
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxButtonEdit, cxCalendar,
cxDropDownEdit, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridBandedTableView, cxGridDBBandedTableView, cxClasses, cxControls,
cxGridCustomView, cxGrid, StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBClient,
ADODB, cxCheckBox, cxPC, BtnEdit, cxGridDBTableView,
cxGridCustomPopupMenu, cxGridPopupMenu;
type
TfrmOrderJSHZView = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
Label3: TLabel;
OrderNo: TEdit;
ClientDataSet6: TClientDataSet;
DataSource6: TDataSource;
ADOQuery1: TADOQuery;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label18: TLabel;
MPRTCode: TEdit;
Label19: TLabel;
MPRTCodeName: TEdit;
ADOQueryMain: TADOQuery;
cxGridPopupMenu1: TcxGridPopupMenu;
Label2: TLabel;
Filler: TEdit;
cxGrid4: TcxGrid;
Tv0: TcxGridDBTableView;
cxGridDBColumn29: TcxGridDBColumn;
cxGridDBColumn33: TcxGridDBColumn;
cxGridDBColumn35: TcxGridDBColumn;
cxGridLevel6: TcxGridLevel;
v0Column1: TcxGridDBColumn;
v0Column2: TcxGridDBColumn;
v0Column3: TcxGridDBColumn;
v0Column5: TcxGridDBColumn;
v0Column6: TcxGridDBColumn;
Panel2: TPanel;
CheckBox1: TCheckBox;
v0Column4: TcxGridDBColumn;
v0Column7: TcxGridDBColumn;
v0Column8: TcxGridDBColumn;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ComboBox1: TComboBox;
v0Column9: TcxGridDBColumn;
v0Column10: TcxGridDBColumn;
v0Column11: TcxGridDBColumn;
v0Column12: TcxGridDBColumn;
ToolButton3: TToolButton;
v0Column13: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBRafreshClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
procedure TBFindClick(Sender: TObject);
procedure OrderNoChange(Sender: TObject);
procedure MPRTCodeChange(Sender: TObject);
procedure Tv0CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
private
{ Private declarations }
canshu1:String;
procedure InitGrid();
procedure GetData();
public
{ Public declarations }
end;
var
frmOrderJSHZView: TfrmOrderJSHZView;
implementation
uses
U_DataLink,U_RTFun, U_GYSList,U_ZDYHelp,U_OrdCostList, U_ModuleNote;
{$R *.dfm}
procedure TfrmOrderJSHZView.FormDestroy(Sender: TObject);
begin
frmOrderJSHZView:=nil;
end;
procedure TfrmOrderJSHZView.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmOrderJSHZView.TBRafreshClick(Sender: TObject);
begin
Panel2.Visible:=True;
Panel2.Refresh;
InitGrid();
GetData();
Panel2.Visible:=False;
end;
procedure TfrmOrderJSHZView.InitGrid();
begin
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add(' exec P_View_OrderHZDate :begdate,:enddate,'''',:PState,:WSql ');
Parameters.ParamByName('begdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date));
Parameters.ParamByName('enddate').Value:=Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1));
Parameters.ParamByName('PState').Value:=ComboBox1.ItemIndex;
if CheckBox1.Checked then
Parameters.ParamByName('WSql').Value:=' and Filler in(select UserName from SY_User where DPID in'+
'(select DPID from SY_User where UserName='''+Trim(DName)+'''))'
else
Parameters.ParamByName('WSql').Value:='';
Open;
end;
SCreateCDS20(ADOQueryMain,ClientDataSet6);
SInitCDSData20(ADOQueryMain,ClientDataSet6);
end;
procedure TfrmOrderJSHZView.GetData();
begin
ClientDataSet6.DisableControls;
with ClientDataSet6 do
begin
First;
while not Eof do
begin
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('select Top 1* from JYOrder_Main_MD where ORDMainID='''+Trim(ClientDataSet6.fieldbyname('MainId').AsString)+'''');
Open;
end;
if ADOQuery1.IsEmpty=False then
begin
try
with ADOQueryTemp do
begin
Close;
SQL.Clear;
//sql.Add(' exec F_View_PSNameSH :MainId');
sql.Add(' exec P_View_PSNameSH :MainId');
Parameters.ParamByName('MainId').Value:=Trim(ClientDataSet6.fieldbyname('MainId').AsString);
Open;
end;
Edit;
FieldByName('HZSH').Value:=ADOQueryTemp.fieldbyname('HZSH').Value;
FieldByName('HZSHQty').Value:=ADOQueryTemp.fieldbyname('HZSHQty').Value;
Post;
except
Edit;
FieldByName('HZSH').Value:=NUll;
FieldByName('HZSHQty').Value:=Null;
FieldByName('HZNote').Value:=<>ٹ<EFBFBD><D9B9><EFBFBD><EFBFBD><EFBFBD><EBB5A5><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
Post;
end;
end;
Next;
end;
end;
ClientDataSet6.EnableControls;
end;
procedure TfrmOrderJSHZView.FormShow(Sender: TObject);
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD>ѯ',Tv0,<>Ʋ<EFBFBD>ѯ');
EndDate.Date:=SGetServerDate(ADOQuery1);
BegDate.Date:=EndDate.Date-30;
if Trim(canshu1)='<27><>Ȩ<EFBFBD><C8A8>' then
begin
ToolButton1.Visible:=True;
ToolButton2.Visible:=True;
end;
end;
procedure TfrmOrderJSHZView.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD>ѯ',Tv0,<>Ʋ<EFBFBD>ѯ');
close;
end;
procedure TfrmOrderJSHZView.OrderNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
if Trim(OrderNo.Text)='' then Exit;
Panel2.Visible:=True;
Panel2.Refresh;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add(' exec P_View_OrderHZDate '''','''',:OrderNo,1,'''' ');
Parameters.ParamByName('OrderNo').Value:=Trim(OrderNo.Text);
Open;
end;
SCreateCDS20(ADOQueryMain,ClientDataSet6);
SInitCDSData20(ADOQueryMain,ClientDataSet6);
GetData();
Panel2.Visible:=False;
end;
end;
procedure TfrmOrderJSHZView.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter10(ClientDataSet6,SGetFilters(Panel1,1,2));
//SCreateCDS20(ADOQueryMain,ClientDataSet6);
//SInitCDSData20(ADOQueryMain,ClientDataSet6);
end;
procedure TfrmOrderJSHZView.OrderNoChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmOrderJSHZView.MPRTCodeChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmOrderJSHZView.Tv0CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
try
frmOrdCostList:=TfrmOrdCostList.Create(Application);
with frmOrdCostList do
begin
//frmOrdCostList.Align:=alClient;
frmOrdCostList.orderNo.Text:=Trim(Self.ClientDataSet6.fieldbyname('OrderNo').AsString);
with frmOrdCostList.ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.MainId,MPRTCode=RTrim(A.MPRTCode)+RTrim(A.MPRTGY),A.MPRTCodeName,A.OrderNo,A.Filler,A.SGJSSH from JYOrder_Main A where ');
sql.Add(' A.orderno like '''+'%'+Trim(frmOrdCostList.orderNo.Text)+'%'+'''');
Open;
end;
SCreateCDS20(frmOrdCostList.ADOQueryMain,frmOrdCostList.ClientDataSet0);
SInitCDSData20(frmOrdCostList.ADOQueryMain,frmOrdCostList.ClientDataSet0);
if Trim(canshu1)='<27><>Ȩ<EFBFBD><C8A8>' then
begin
Button1.Visible:=True;
end;
if ShowModal=1 then
begin
end;
end;
finally
frmOrdCostList.Free;
end;
end;
procedure TfrmOrderJSHZView.ToolButton1Click(Sender: TObject);
begin
if ClientDataSet6.IsEmpty then Exit;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA><D6B4><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('UPdate JYOrder_Main Set JSFlag=1,JSTime=getdate(),JSPerson='''+Trim(DName)+'''');
if Trim(ClientDataSet6.FieldByName('HZSH').AsString)<>'' then
begin
sql.Add(',HZSH='+ClientDataSet6.FieldByName('HZSH').AsString);
end else
begin
SQL.Add(',HZSH=NUll');
end;
if Trim(ClientDataSet6.FieldByName('HZSHQty').AsString)<>'' then
begin
sql.Add(',HZSHQty='+ClientDataSet6.FieldByName('HZSHQty').AsString);
end else
begin
SQL.Add(',HZSHQty=NUll');
end;
sql.Add(' where MainId='''+Trim(ClientDataSet6.fieldbyname('MainId').AsString)+'''');
ExecSQL;
end;
with ClientDataSet6 do
begin
Edit;
FieldByName('JSFlag').Value:=True;
FieldByName('JSPerson').Value:=Trim(DName);
FieldByName('JSTime').Value:=Now;
Post;
end;
end;
procedure TfrmOrderJSHZView.ToolButton2Click(Sender: TObject);
begin
if ClientDataSet6.IsEmpty then Exit;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate JYOrder_Main Set JSFlag=0,JSTime=Null,JSPerson=Null,HZSH=Null,HZSHQty=Null ');
sql.Add(' where MainId='''+Trim(ClientDataSet6.fieldbyname('MainId').AsString)+'''');
ExecSQL;
end;
with ClientDataSet6 do
begin
Edit;
FieldByName('JSFlag').Value:=False;
FieldByName('JSPerson').Value:='';
FieldByName('JSTime').Value:=Null;
Post;
end;
end;
procedure TfrmOrderJSHZView.FormCreate(Sender: TObject);
begin
canshu1:=Trim(DParameters1);
end;
procedure TfrmOrderJSHZView.ToolButton3Click(Sender: TObject);
begin
try
frmModuleNote:=TfrmModuleNote.Create(Application);
with frmModuleNote do
begin
flag:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>';
if ShowModal=1 then
begin
end;
end;
finally
frmModuleNote.Free;
end;
end;
end.