826 lines
26 KiB
ObjectPascal
826 lines
26 KiB
ObjectPascal
unit U_ClothSCList;
|
||
|
||
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, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class,
|
||
RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxPC, cxCheckBox,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu,
|
||
dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter;
|
||
|
||
type
|
||
TfrmClothSCList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Label3: TLabel;
|
||
ConNo: TEdit;
|
||
Label5: TLabel;
|
||
C_CodeName: TEdit;
|
||
TBExport: TToolButton;
|
||
Order_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMXLSExport1: TRMXLSExport;
|
||
CDS_PRT: TClientDataSet;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1OrderNo: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1PRTMF: TcxGridDBColumn;
|
||
v1PRTKZ: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
RMDBPRT: TRMDBDataSet;
|
||
v1Column12: TcxGridDBColumn;
|
||
TBView: TToolButton;
|
||
v1Column19: TcxGridDBColumn;
|
||
RMDBPZ: TRMDBDataSet;
|
||
CDS_PZ: TClientDataSet;
|
||
CDS_SJ: TClientDataSet;
|
||
RMDBSJ: TRMDBDataSet;
|
||
v1Column21: TcxGridDBColumn;
|
||
Label10: TLabel;
|
||
C_Code: TEdit;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column28: TcxGridDBColumn;
|
||
RMDBDataSet1: TRMDBDataSet;
|
||
ClientDataSet1: TClientDataSet;
|
||
CDS_WJG: TClientDataSet;
|
||
RMDBWJG: TRMDBDataSet;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column29: TcxGridDBColumn;
|
||
Label6: TLabel;
|
||
GongYiCode: TEdit;
|
||
v1Column31: TcxGridDBColumn;
|
||
v1Column30: TcxGridDBColumn;
|
||
v1Column32: TcxGridDBColumn;
|
||
v1Column33: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
tbCheck: TToolButton;
|
||
tbCheckCX: TToolButton;
|
||
v1Column1: TcxGridDBColumn;
|
||
tbaddgongyi: TToolButton;
|
||
v1Column8: TcxGridDBColumn;
|
||
SCJHD: TComboBox;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoChange(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure conPress(Sender: TObject; var Key: Char);
|
||
procedure TBViewClick(Sender: TObject);
|
||
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure tbCheckClick(Sender: TObject);
|
||
procedure tbCheckCXClick(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure tbaddgongyiClick(Sender: TObject);
|
||
procedure Tv1Column2PropertiesEditValueChanged(Sender: TObject);
|
||
private
|
||
FInt, PFInt: Integer;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
function DelData(): Boolean;
|
||
procedure InitButton();
|
||
{ Private declarations }
|
||
public
|
||
canshu1, FCheJian: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
//var
|
||
//frmClothSCList: TfrmClothSCList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ClothSCInPut, U_Fun, U_ZDYHelp, U_SCPerson, U_ClothSCInPutSC,
|
||
U_RTFun;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmClothSCList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.InitButton();
|
||
begin
|
||
|
||
TBEdit.Visible := True;
|
||
TBDel.Visible := False;
|
||
tbaddgongyi.Visible := False;
|
||
tbCheck.Visible := False;
|
||
tbCheckCX.Visible := False;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
TBEdit.Visible := True;
|
||
tbCheck.Visible := True;
|
||
end;
|
||
1:
|
||
begin
|
||
tbaddgongyi.Visible := True;
|
||
tbCheckCX.Visible := True;
|
||
end;
|
||
2:
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
if Trim(DName) = 'ADMIN' then
|
||
begin
|
||
WriteCxGridAll(trim(self.Caption), Tv1, ADOQueryCmd, ADOQueryTemp);
|
||
end;
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.* '); //,C.PBJGPrice,B.JGTiaoJia,JGHSPrice=isnull(C.PBJGPrice,0)+isnull(B.JGTiaoJia,0)
|
||
|
||
sql.Add(',FILLTIME1=(select TOP 1 FILLTIME from Cloth_Main X inner join CLoth_Sub Y on X.Mainid=Y.MainId ');
|
||
sql.Add(' where Y.IsGongYi=1 and Y.GongYiCode= B.TJGongYiCode) ');
|
||
|
||
sql.Add(' from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.MainId');
|
||
// sql.Add(' left join CP_Info C on B.C_CodeName=C.SPName');
|
||
sql.Add(' where A.FillTIme>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''');
|
||
sql.Add(' and A.FillTIme<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''');
|
||
if canshu1 = 'ҵ<><D2B5>Ա' then
|
||
begin
|
||
sql.Add(' and Filler=' + QuotedStr(Trim(DName)));
|
||
end;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
sql.Add('and isnull(A.status,''0'')=''1''');
|
||
end;
|
||
1:
|
||
begin
|
||
sql.Add('and isnull(A.status,''0'')=''2''');
|
||
end;
|
||
2:
|
||
begin
|
||
sql.Add('and isnull(A.status,''0'') in (''1'',''2'')');
|
||
end;
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.InitForm();
|
||
begin
|
||
InitButton();
|
||
ReadCxGridAll(trim(self.Caption), Tv1);
|
||
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 7;
|
||
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select A.* from Cloth_Sub A where IsGongYi=1');
|
||
sql.Add(' and mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add(' and exists(select * from Cloth_Main B where A.MainId=B.MainId and DATEDIFF(DD,B.Filltime,GETDATE()) >30) ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with Self.ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
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><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>')));
|
||
sql.Add(',' + quotedstr(Trim(Order_Main.fieldbyname('SubId').AsString)));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
try
|
||
frmClothSCInPut := TfrmClothSCInPut.Create(Application);
|
||
with frmClothSCInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
FSubId := Trim(Self.Order_Main.fieldbyname('SubId').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
Self.Order_Main.Locate('MainId', frmClothSCInPut.FMainId, []);
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothSCInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select A.*');
|
||
sql.Add('from JYCon_Sub_AnPai A');
|
||
sql.Add(' where A.SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and A.MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
if DelData() then
|
||
begin
|
||
//TBRafresh.Click;
|
||
//TBFind.Click;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
|
||
function TfrmClothSCList.DelData(): Boolean;
|
||
begin
|
||
try
|
||
Result := false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Cloth_Sub where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Cloth_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
if Trim(Order_Main.fieldbyname('SubId').AsString) = '' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Cloth_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Cloth_YCL_PB where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Result := False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
i, j, k: integer;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
ExportFtErpFile(Trim(SCJHD.Text) + '.rmf', ADOQueryTemp);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(SCJHD.Text) + '.rmf';
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select WeiZhi1=WeiZhi,SPZ1=PZ1,SPZ2=PZ2,SPZ3=PZ3,SPZ4=PZ4,SPZ5=PZ5,SPZ6=PZ6,SPZ7=PZ7,SPZ8=PZ8,SPZ9=PZ9,SPZ10=PZ10, ');
|
||
sql.Add(' SPZ11=PZ11,SPZ12=PZ12,SPZ13=PZ13,SPZ14=PZ14,SPZ15=PZ15,SPZ16=PZ16,SPZ17=PZ17,SPZ18=PZ18,SPZ19=PZ19,SPZ20=PZ20, ');
|
||
sql.Add(' SPZ21=PZ21,SPZ22=PZ22,SPZ23=PZ23,SPZ24=PZ24,SPZ25=PZ25,SPZ26=PZ26,SPZ27=PZ27,SPZ28=PZ28,SPZ29=PZ29,SPZ30=PZ30, ');
|
||
sql.Add(' SPZ31=PZ31,SPZ32=PZ32,SPZ33=PZ33,SPZ34=PZ34,SPZ35=PZ35,SPZ36=PZ36 ');
|
||
sql.Add(' from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_PZ);
|
||
SInitCDSData20(ADOQueryTemp, CDS_PZ);
|
||
if CDS_PZ.IsEmpty then
|
||
begin
|
||
CDS_PZ.Append;
|
||
CDS_PZ.Post;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_SJ);
|
||
SInitCDSData20(ADOQueryTemp, CDS_SJ);
|
||
|
||
if CDS_SJ.IsEmpty then
|
||
begin
|
||
CDS_SJ.Append;
|
||
CDS_SJ.Post;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Select A.* ');
|
||
sql.Add(',YLQty=Cast(C_Qty*PBQty*0.01*(1+isnull(ZPSH,0)*0.01) as decimal(18,1))');
|
||
sql.Add(' from Cloth_YCL_PB A');
|
||
sql.Add(' inner join Cloth_Sub B on A.SubId=B.SubId');
|
||
sql.Add(' where A.SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
||
if CDS_PRT.IsEmpty then
|
||
begin
|
||
CDS_PRT.Append;
|
||
CDS_PRT.Post;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, ClientDataSet1);
|
||
SInitCDSData20(ADOQueryTemp, ClientDataSet1);
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RMVariables['ZSCPS'] := ClientDataSet1.fieldbyname('ZSCPS').Value;
|
||
RMVariables['ZSCQty'] := ClientDataSet1.fieldbyname('ZSCQty').Value;
|
||
RMVariables['WFJHPSHZ'] := ClientDataSet1.fieldbyname('WFJHPSHZ').Value;
|
||
RMVariables['WFJHQtyHZ'] := ClientDataSet1.fieldbyname('WFJHQtyHZ').Value;
|
||
RMVariables['C_Code'] := Order_Main.fieldbyname('C_Code').Value;
|
||
RMVariables['ConNo'] := Order_Main.fieldbyname('ConNo').Value;
|
||
RMVariables['C_CodeName'] := Order_Main.fieldbyname('C_CodeName').Value;
|
||
RMVariables['DayQty'] := Order_Main.fieldbyname('DayQty').Value;
|
||
RMVariables['CarType'] := Order_Main.fieldbyname('CarType').Value;
|
||
RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
|
||
RMVariables['KZQty'] := Order_Main.fieldbyname('KZQty').Value;
|
||
RMVariables['MFQty'] := Order_Main.fieldbyname('MFQty').Value;
|
||
RMVariables['KZ'] := Order_Main.fieldbyname('KZ').Value;
|
||
RMVariables['MF'] := Order_Main.fieldbyname('MF').Value;
|
||
RMVariables['PiKgQty'] := Order_Main.fieldbyname('PiKgQty').Value;
|
||
RMVariables['ZhuanQty'] := Order_Main.fieldbyname('ZhuanQty').Value;
|
||
RMVariables['PiQty'] := Order_Main.fieldbyname('PiQty').Value;
|
||
RMVariables['C_Qty'] := Order_Main.fieldbyname('C_Qty').Value;
|
||
RMVariables['QDTime'] := Order_Main.fieldbyname('QDTime').Value;
|
||
RMVariables['JHChejian'] := Order_Main.fieldbyname('JHChejian').Value;
|
||
RMVariables['DeliveryDate'] := Order_Main.fieldbyname('DeliveryDate').Value;
|
||
RMVariables['ShaChang1'] := Order_Main.fieldbyname('ShaChang').Value;
|
||
RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
|
||
RMVariables['C_Spec'] := Order_Main.fieldbyname('C_Spec').Value;
|
||
RMVariables['C_Color'] := Order_Main.fieldbyname('C_Color').Value;
|
||
RMVariables['C_Note'] := Order_Main.fieldbyname('C_Note').Value;
|
||
RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
|
||
RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
|
||
RMVariables['PiKgQtyFD'] := Order_Main.fieldbyname('PiKgQtyFD').Value;
|
||
RMVariables['BatchNoHZ'] := Order_Main.fieldbyname('BatchNoHZ').Value;
|
||
RMVariables['Zdr'] := Order_Main.fieldbyname('Filler').Value;
|
||
RMVariables['WzPrice'] := Order_Main.fieldbyname('WzPrice').Value;
|
||
RMVariables['BZNote'] := Order_Main.fieldbyname('BZNote').Value;
|
||
RMVariables['ZZYQ'] := Order_Main.fieldbyname('ZZYQ').Value;
|
||
RMVariables['ZZSH'] := Order_Main.fieldbyname('ZZSH').Value;
|
||
RMVariables['MFZZS'] := Order_Main.fieldbyname('MFZZS').Value;
|
||
RMVariables['ALBL'] := Order_Main.fieldbyname('ALBL').Value;
|
||
RMVariables['gongyi'] := Order_Main.fieldbyname('gongyi').Value;
|
||
RMVariables['ZongJieNote'] := Order_Main.fieldbyname('ZongJieNote').Value;
|
||
RMVariables['ZhenCun'] := Order_Main.fieldbyname('ZhenCun').Value;
|
||
RMVariables['Filler'] := Order_Main.fieldbyname('Filler').Value;
|
||
RMVariables['JHChejian'] := Order_Main.fieldbyname('JHChejian').Value;
|
||
RMVariables['YWY'] := Order_Main.fieldbyname('YWY').Value;
|
||
RMVariables['KJTS'] := Order_Main.fieldbyname('KJTS').Value;
|
||
RMVariables['PBMF'] := Order_Main.fieldbyname('PBMF').Value;
|
||
RMVariables['PBKZ'] := Order_Main.fieldbyname('PBKZ').Value;
|
||
RMVariables['ZongZhenQty'] := Order_Main.fieldbyname('ZongZhenQty').Value;
|
||
RMVariables['PSNote'] := Order_Main.fieldbyname('PSNote').Value;
|
||
RMVariables['SJNote'] := Order_Main.fieldbyname('SJNote').Value;
|
||
RMVariables['ISYT'] := Order_Main.fieldbyname('ISYT').Value;
|
||
RMVariables['ISKF'] := Order_Main.fieldbyname('ISKF').Value;
|
||
RMVariables['ISCZ'] := Order_Main.fieldbyname('ISCZ').Value;
|
||
RMVariables['FactoryNoName'] := Order_Main.fieldbyname('FactoryNoName').Value;
|
||
RMVariables['PBFactoryNoName'] := Order_Main.fieldbyname('PBFactoryNoName').Value;
|
||
RMVariables['JiTaiType'] := Order_Main.fieldbyname('JiTaiType').Value;
|
||
RMVariables['YGPS'] := Order_Main.fieldbyname('YGPS').Value;
|
||
RMVariables['YGQty'] := Order_Main.fieldbyname('YGQty').Value;
|
||
RMVariables['GongYiCode'] := Order_Main.fieldbyname('GongYiCode').Value;
|
||
|
||
RMVariables['FILLTIME1'] := Order_Main.fieldbyname('FILLTIME1').Value;
|
||
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.ConNoChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.conPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if Length(Trim(ConNo.Text)) < 4 then
|
||
Exit;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.MainId');
|
||
sql.Add(' where A.ConNo like ''' + '%' + Trim(ConNo.Text) + '%' + '''');
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
sql.Add('and isnull(A.status,''0'')=''1''');
|
||
end;
|
||
1:
|
||
begin
|
||
sql.Add('and isnull(A.status,''0'')=''2''');
|
||
end;
|
||
2:
|
||
begin
|
||
sql.Add('and isnull(A.status,''0'') in (''1'',''2'')');
|
||
end;
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.TBViewClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmClothSCInPut := TfrmClothSCInPut.Create(Application);
|
||
with frmClothSCInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
FSubId := Trim(Self.Order_Main.fieldbyname('SubId').AsString);
|
||
FConNo := Trim(Self.Order_Main.fieldbyname('ConNo').AsString);
|
||
TBSave.Visible := False;
|
||
ToolBar3.Visible := False;
|
||
ScrollBox1.Enabled := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothSCInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
// if Order_Main.IsEmpty = False then
|
||
// fsj := 'select Name=WFGYSName,Code=WFGYSNo from Cloth_WJG where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + ''''
|
||
// else
|
||
// fsj := 'select Name=WFGYSName,Code=WFGYSNo from Cloth_WJG where 1=2';
|
||
// WFGYSName.Items.Clear;
|
||
// SInitComBoxBySql(ADOQueryTemp, WFGYSName, True, fsj);
|
||
end;
|
||
|
||
procedure TfrmClothSCList.tbCheckClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Cloth_Main SET status=''2'',chker1=''' + trim(DName) + ''',Chktime1=getdate() ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('ConNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.tbCheckCXClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select A.* from Cloth_Sub A where IsGongYi=1');
|
||
sql.Add(' and mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add(' and exists(select * from Cloth_Main B where A.MainId=B.MainId and DATEDIFF(DD,B.Filltime,GETDATE()) >30) ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Cloth_Main SET status=''1'' ,chker1=null,Chktime1=null ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitButton();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothSCList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
begin
|
||
if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('status').Index] = null then
|
||
Exit;
|
||
if (AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('status').Index]) <> 2 then
|
||
begin
|
||
ACanvas.Brush.Color := $507FFF;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.tbaddgongyiClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
|
||
if Trim(Order_Main.fieldbyname('GongYiCode').AsString) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ձ<EFBFBD><D5B1>Ų<EFBFBD><C5B2><EFBFBD>ɾ<EFBFBD><C9BE>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select A.* from Cloth_Sub A');
|
||
sql.Add(' where IsGongYi=1 and A.GongYiCode=''' + Trim(Order_Main.fieldbyname('GongYiCode').AsString) + '''');
|
||
sql.Add(' and exists(select * from Cloth_Main B where A.MainId=B.MainId and DATEDIFF(DD,B.Filltime,GETDATE()) >30) ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select A.* from Cloth_Sub A');
|
||
sql.Add(' where IsGongYi=1 and A.GongYiCode=''' + Trim(Order_Main.fieldbyname('GongYiCode').AsString) + '''');
|
||
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27><>ǰ<EFBFBD><C7B0><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڹ<EFBFBD><DAB9>տ<EFBFBD><D5BF>Ƿ<EFBFBD><C7B7>滻<EFBFBD><E6BBBB><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Cloth_Sub SET IsGongYi=0 ');
|
||
sql.Add('where GongYiCode=' + quotedstr(trim(Order_Main.fieldbyname('GongYiCode').AsString)));
|
||
sql.Add('update Cloth_Sub SET IsGongYi=1 ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD>ӹ<EFBFBD><D3B9>ճɹ<D5B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCList.Tv1Column2PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FJGPrice, FJGTJ, FHSPrice: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue) = '' then
|
||
begin
|
||
FJGTJ := '0';
|
||
end
|
||
else
|
||
begin
|
||
FJGTJ := mvalue;
|
||
end;
|
||
FJGPrice := Trim(Order_Main.fieldbyname('PBJGPrice').AsString);
|
||
if Trim(FJGPrice) = '' then
|
||
FJGPrice := '0';
|
||
with Order_Main do
|
||
begin
|
||
Edit;
|
||
if Trim(FJGTJ) = '0' then
|
||
begin
|
||
FieldByName('JGTiaoJia').Value := null;
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('JGTiaoJia').Value := FJGTJ;
|
||
end;
|
||
FieldByName('JGHSPrice').Value := StrToFloat(FJGTJ) + StrToFloat(FJGPrice);
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
if Trim(FJGTJ) = '0' then
|
||
sql.Add('Update Cloth_Sub Set JGTiaoJia=Null ')
|
||
else
|
||
sql.Add('Update Cloth_Sub Set JGTiaoJia=' + FJGTJ);
|
||
sql.Add('where Subid=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|