1241 lines
34 KiB
ObjectPascal
1241 lines
34 KiB
ObjectPascal
![]() |
unit U_FinishedClothInspection;
|
|||
|
|
|||
|
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, MovePanel, cxTextEdit,
|
|||
|
cxContainer, cxCurrencyEdit, BtnEdit, RM_e_main, RM_e_htm, RM_e_Graphic,
|
|||
|
RM_e_Jpeg, RM_e_txt, RM_e_csv, RM_E_llPDF, Math, Clipbrd, cxPC, cxButtonEdit,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu,
|
|||
|
dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter, StrUtils;
|
|||
|
|
|||
|
type
|
|||
|
TfrmFinishedClothInspection = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DS_Main: TDataSource;
|
|||
|
TBExport: TToolButton;
|
|||
|
OrderNo: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
Label10: TLabel;
|
|||
|
JYID: TEdit;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
JYType: TComboBox;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
Label5: TLabel;
|
|||
|
conno: TEdit;
|
|||
|
v1Column17: TcxGridDBColumn;
|
|||
|
Label12: TLabel;
|
|||
|
edtKaNo: TEdit;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column21: TcxGridDBColumn;
|
|||
|
Filler: TComboBox;
|
|||
|
TBManage: TToolButton;
|
|||
|
v1Column22: TcxGridDBColumn;
|
|||
|
v1Column23: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
TBZF: TToolButton;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
RM2: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
P_Color: TEdit;
|
|||
|
tbPrintRCD: TToolButton;
|
|||
|
v1Column32: TcxGridDBColumn;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
IsJYTime: TCheckBox;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
N3: TMenuItem;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
X1: TMenuItem;
|
|||
|
B1: TToolButton;
|
|||
|
Panel3: TPanel;
|
|||
|
Panel4: TPanel;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Panel6: TPanel;
|
|||
|
Label31: TLabel;
|
|||
|
LBCPAP: TLabel;
|
|||
|
BTLP: TButton;
|
|||
|
BTNP: TButton;
|
|||
|
TCBNOR: TComboBox;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
x2: TMenuItem;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
P_CodeName: TEdit;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Label3: TLabel;
|
|||
|
JTH: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
person: TEdit;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
Tv1Column13: TcxGridDBColumn;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyleRepository2: TcxStyleRepository;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxStyleRepository3: TcxStyleRepository;
|
|||
|
cxStyle3: TcxStyle;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
procedure TBManageClick(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure TBZFClick(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure v1Column15PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure JYIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure BTLPClick(Sender: TObject);
|
|||
|
procedure BTNPClick(Sender: TObject);
|
|||
|
procedure TCBNORChange(Sender: TObject);
|
|||
|
procedure tbPrintRCDClick(Sender: TObject);
|
|||
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure MJStr2Change(Sender: TObject);
|
|||
|
procedure JYTypeChange(Sender: TObject);
|
|||
|
procedure KHConNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure RKOrdIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure X1Click(Sender: TObject);
|
|||
|
procedure B1Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure v1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure x2Click(Sender: TObject);
|
|||
|
procedure v1Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
private
|
|||
|
DQdate: TDateTime;
|
|||
|
FLeft, FTop: Integer;
|
|||
|
CurrentPage, RecordsNumber: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
function Savedata(): Boolean;
|
|||
|
procedure SetStatus();
|
|||
|
procedure PrintCKMDG(MRKOrdID: string);
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FFInt: Integer;
|
|||
|
canshu1: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_MJEdit, U_ZDYHelp, U_SysLogHelp, U_SCPerson,
|
|||
|
U_MovecardEdit;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmFinishedClothInspection.SetStatus();
|
|||
|
begin
|
|||
|
TBManage.Visible := False;
|
|||
|
TBZF.Visible := False;
|
|||
|
ToolButton1.Visible := False;
|
|||
|
|
|||
|
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
TBManage.Visible := True;
|
|||
|
|
|||
|
ToolButton1.Visible := true;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
TBZF.Visible := True;
|
|||
|
tbPrintRCD.Visible := true;
|
|||
|
ToolButton4.Visible := false;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
tbPrintRCD.Visible := false;
|
|||
|
ToolButton4.Visible := true;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
tbPrintRCD.Visible := false;
|
|||
|
ToolButton4.Visible := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(canshu1) = '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
TBZF.Visible := True;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
cxgrid1.Align := alClient;
|
|||
|
DQdate := SGetServerDate(ADOQueryTemp);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(self.Caption + '2', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.PrintCKMDG(MRKOrdID: string);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
ExportFtErpFile('<27><>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF>뵥.rmf', ADOQueryTemp);
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' exec P_CPCK_Print_RKMD ');
|
|||
|
SQL.Add(' @RKOrdID=''' + Trim(MRKOrdID) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOQueryPrint.fieldbyname('RKNO').AsString);
|
|||
|
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
|||
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
|||
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
|||
|
if FileExists(fImagePath) then
|
|||
|
DeleteFile(fImagePath);
|
|||
|
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF>뵥.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
Rm2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
|
|||
|
RM2.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.InitGrid();
|
|||
|
var
|
|||
|
fwhere, Pwhere: string;
|
|||
|
begin
|
|||
|
MovePanel2.Left := (self.Width - MovePanel2.Width) div 2;
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
|
|||
|
if (canshu1 = '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>') or (canshu1 = '<27><>Ʒ<EFBFBD><C6B7>ѯ') then
|
|||
|
begin
|
|||
|
JYType.ItemIndex := 0;
|
|||
|
end;
|
|||
|
|
|||
|
if IsJYTime.Checked then
|
|||
|
begin
|
|||
|
fwhere := ' where Filltime>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
|||
|
fwhere := fwhere + ' and Filltime<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
|||
|
end
|
|||
|
else
|
|||
|
fwhere := ' where 1=1 ';
|
|||
|
|
|||
|
Pwhere := SGetFilters(Panel1, 1, 2);
|
|||
|
if (Pwhere <> '') and (person.text <> '') then
|
|||
|
begin
|
|||
|
Pwhere := Pwhere + ' and ';
|
|||
|
end;
|
|||
|
if person.text <> '' then
|
|||
|
begin
|
|||
|
Pwhere := Pwhere + ' ( person1 like ''%' + trim(person.text) + '%''';
|
|||
|
Pwhere := Pwhere + ' or person2 like ''%' + trim(person.text) + '%''';
|
|||
|
Pwhere := Pwhere + ' or person3 like ''%' + trim(person.text) + '%''';
|
|||
|
Pwhere := Pwhere + ' or person4 like ''%' + trim(person.text) + '%''';
|
|||
|
Pwhere := Pwhere + ' or person5 like ''%' + trim(person.text) + '%'')';
|
|||
|
end;
|
|||
|
// ShowMessage(Pwhere);
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
fwhere := fwhere + ' and ' + Pwhere;
|
|||
|
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
fwhere := fwhere + ' and JYCRType=''δ<><CEB4><EFBFBD><EFBFBD>'' ';
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
fwhere := fwhere + ' and JYCRType<>''δ<><CEB4><EFBFBD><EFBFBD>'' ';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Page_Cloth_Inspect ');
|
|||
|
sql.Add('@pageIndex=' + inttostr(CurrentPage));
|
|||
|
sql.Add(',@pageSize=' + inttostr(RecordsNumber));
|
|||
|
sql.Add(',@criteria= ' + quotedstr(fwhere));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(Order_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
|
|||
|
MovePanel2.Visible := false;
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
MovePanel2.Visible := false;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.InitForm();
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
ReadCxGrid(self.Caption + '2', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
fsj := 'select distinct(Filler) name from JY_Cloth ';
|
|||
|
SInitComBoxBySql(ADOQueryCmd, Filler, False, fsj);
|
|||
|
// Filler.ItemIndex := Filler.Items.IndexOf(trim(DName));
|
|||
|
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
|||
|
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 30;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.TBFindClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj, fwhere: string;
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
SelExportData(Tv1, ADOQueryMain, '<27><><EFBFBD>鱨<EFBFBD><E9B1A8>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
// TV1.OptionsData.Editing := False;
|
|||
|
// TV1.OptionsSelection.CellSelect := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
RecordsNumber := 500;
|
|||
|
// TV1.OptionsData.Editing := False;
|
|||
|
// TV1.OptionsSelection.CellSelect := False;
|
|||
|
InitForm();
|
|||
|
SetStatus();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
FLeft := X;
|
|||
|
FTop := Y;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.TBManageClick(Sender: TObject);
|
|||
|
var
|
|||
|
key: Char;
|
|||
|
begin
|
|||
|
key := #13;
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_Cloth_CR where CRFlag in(''<27><><EFBFBD><EFBFBD>'',''<27><><EFBFBD><EFBFBD>'') and JYID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
if ADOQueryTemp.fieldbyname('CRFlag').Value = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
Order_Main.EnableControls;
|
|||
|
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܱ༭!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Order_Main.EnableControls;
|
|||
|
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܱ༭!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
try
|
|||
|
frmMJEdit := TfrmMJEdit.Create(Application);
|
|||
|
with frmMJEdit do
|
|||
|
begin
|
|||
|
JYID.Text := Trim(Self.Order_Main.fieldbyname('JYID').AsString);
|
|||
|
JYIDKeyPress(JYID, key);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmMJEdit.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(Order_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(Order_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.TBZFClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.Locate('ssel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
Order_Main.DisableControls;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Order_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_Cloth_CR where JYID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + ''' and CRFlag in(''<27><><EFBFBD><EFBFBD>'',''<27><><EFBFBD><EFBFBD>'')');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
if ADOQueryTemp.fieldbyname('CRFlag').Value = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
Order_Main.EnableControls;
|
|||
|
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Order_Main.EnableControls;
|
|||
|
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete JY_Cloth where JYID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + '''');
|
|||
|
sql.Add('delete CK_Cloth_CR where JYID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + '''');
|
|||
|
sql.Add('delete CK_Cloth_KC where JYID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + '''');
|
|||
|
sql.Add('delete JY_Cloth_CD where JYID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + '''');
|
|||
|
|
|||
|
// <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD>
|
|||
|
// sql.Add('exec P_UPdate_LCKJY @SPID=''' + trim(Order_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
sql.Add('update PD_Plan_AnPai set jyflag=(case when isnull((select count(*) from JY_Cloth where apid=''' + trim(Order_Main.fieldbyname('apid').AsString) + '''),0)>0 then 1 else 0 end)');
|
|||
|
sql.Add('where apid =''' + trim(Order_Main.fieldbyname('apid').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><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD>룺' + trim(Order_Main.fieldbyname('JYID').AsString) + ' <20><><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.fieldbyname('JYXH').AsString) + ' <20><><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.fieldbyname('apid').AsString)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
// showmessage(sql.text);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_JY_ChaiPi_Del ');
|
|||
|
sql.Add(' @OrgJYID=' + quotedstr(trim(Order_Main.FieldByName('OrgJYID').AsString)));
|
|||
|
sql.Add(',@JYID=' + quotedstr(trim(Order_Main.FieldByName('JYID').AsString)));
|
|||
|
// showmessage(sql.text);
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
begin
|
|||
|
Order_Main.EnableControls;
|
|||
|
application.MessageBox(PChar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Order_Main.EnableControls;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
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;
|
|||
|
|
|||
|
Order_Main.DisableControls;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Order_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('Update WFB_MJJY Set PrtAgnFlag=1,PrtAgnDate=getdate(),PrtAgnPerson=''' + Trim(DName) + '''');
|
|||
|
// sql.Add(' where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' EXEC P_JY_Print_Lab ');
|
|||
|
SQL.Add(' @JYID=''' + Trim(Order_Main.fieldbyname('JYID').AsString) + '''');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOQueryPrint.fieldbyname('JYID').AsString);
|
|||
|
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
|||
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
|||
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
|||
|
if FileExists(fImagePath) then
|
|||
|
DeleteFile(fImagePath);
|
|||
|
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(ADOQueryPrint.fieldbyname('LaBName').AsString) <> '' then
|
|||
|
begin
|
|||
|
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('LaBName').AsString), ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('LaBName').AsString) + '.rmf';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ExportFtErpFile('ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf';
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(Order_Main.fieldbyname('JYType').AsString) = '<27><>Ʒ' then
|
|||
|
begin
|
|||
|
ExportFtErpFile('<27><>Ʒ<EFBFBD><C6B7>ǩ.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>Ʒ<EFBFBD><C6B7>ǩ.rmf';
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
Rm2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
|
|||
|
RM2.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Order_Main.EnableControls;
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Order_Main.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmFinishedClothInspection.Savedata(): Boolean;
|
|||
|
var
|
|||
|
maxno, LLID: string;
|
|||
|
HXPS: Integer;
|
|||
|
HXQty, HXMQty: Double;
|
|||
|
begin
|
|||
|
HXPS := 0;
|
|||
|
HXQty := 0;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select Top 1 * from Contract_Cloth_LL where OrdSubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
|||
|
sql.Add(' and FirstName=''' + Trim(Order_Main.fieldbyname('AOrddefstr4').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
LLID := Trim(ADOQueryTemp.fieldbyname('LLID').AsString);
|
|||
|
if Trim(LLID) = '' then
|
|||
|
begin
|
|||
|
Result := False;
|
|||
|
Application.MessageBox('û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ļӹ<C4BC><D3B9><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
if GetLSNo(ADOQueryCmd, maxno, 'HX', 'Contract_Cloth_BefChkHX', 2, 1) = False then
|
|||
|
begin
|
|||
|
Result := False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Order_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
HXPS := HXPS + 1;
|
|||
|
HXQty := HXQty + Order_Main.FieldByName('MJLen').Value;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
except
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.v1Column15PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('PanDing').Value := Trim(mvalue);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate WFB_MJJY Set PanDing=''' + Trim(mvalue) + '''');
|
|||
|
SQL.Add(' where MJID=''' + Trim(Order_Main.fieldbyname('MJID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.JYIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if Length(JYID.Text) < 4 then
|
|||
|
Exit;
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.BTLPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage > 1 then
|
|||
|
CurrentPage := CurrentPage - 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.BTNPClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CurrentPage < Order_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
|||
|
CurrentPage := CurrentPage + 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.TCBNORChange(Sender: TObject);
|
|||
|
begin
|
|||
|
RecordsNumber := StrToInt(TCBNOR.Text);
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.tbPrintRCDClick(Sender: TObject);
|
|||
|
var
|
|||
|
SRKOrdID, strsql, WSql: string;
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex <> 0 then
|
|||
|
exit;
|
|||
|
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
begin
|
|||
|
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Order_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
tbPrintRCD.Enabled := True;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
begin
|
|||
|
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if GetLSNo(ADOQueryTemp, SRKOrdID, 'RK', 'CK_BanCP_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
tbPrintRCD.Enabled := True;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Order_Main.FieldByName('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with Self.ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_CK_Cloth_CRK @JYID=''' + trim(Order_Main.FIELDBYNAME('JYID').AsString) + '''');
|
|||
|
SQL.Add(',@RKORDID=''' + trim(SRKOrdID) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Order_Main.EnableControls;
|
|||
|
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Order_Main.EnableControls;
|
|||
|
tbPrintRCD.Enabled := true;
|
|||
|
application.MessageBox('<27><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
tbPrintRCD.Enabled := true;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
Clipboard.SetTextBuf(PChar(Trim(Order_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.OrderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.MJStr2Change(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.JYTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.KHConNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.RKOrdIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.N3Click(Sender: TObject);
|
|||
|
var
|
|||
|
SSubId, SGangNo: string;
|
|||
|
begin
|
|||
|
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
SSubId := trim(FieldByName('SubId').AsString);
|
|||
|
Order_Main.DisableControls;
|
|||
|
first;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if SSubId = trim(FieldByName('SubId').AsString) then
|
|||
|
begin
|
|||
|
edit;
|
|||
|
FieldByName('SSel').value := true;
|
|||
|
Post;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
edit;
|
|||
|
FieldByName('SSel').value := false;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
Order_Main.Locate('SubId', VarArrayOf([SSubId]), []);
|
|||
|
Order_Main.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(Order_Main.fieldbyname('RKNO').AsString) = '' then
|
|||
|
exit;
|
|||
|
PrintCKMDG(Trim(Order_Main.fieldbyname('RKNO').AsString));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.X1Click(Sender: TObject);
|
|||
|
var
|
|||
|
str, SSubId: string;
|
|||
|
ZChiShu, DQChiShu: integer;
|
|||
|
ISSel: boolean;
|
|||
|
begin
|
|||
|
ISSel := true;
|
|||
|
SSubId := trim(Order_Main.FieldByName('SubId').AsString);
|
|||
|
str := '';
|
|||
|
if InputQuery('ѡ<><D1A1>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', str) then
|
|||
|
begin
|
|||
|
ZChiShu := strtointdef(str, 0);
|
|||
|
if ZChiShu <= 0 then
|
|||
|
exit;
|
|||
|
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
|
|||
|
Order_Main.DisableControls;
|
|||
|
first;
|
|||
|
DQChiShu := 0;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
|
|||
|
if SSubId = trim(FieldByName('SubId').AsString) then
|
|||
|
begin
|
|||
|
edit;
|
|||
|
FieldByName('SSel').value := ISSel;
|
|||
|
DQChiShu := DQChiShu + 1;
|
|||
|
Post;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
edit;
|
|||
|
FieldByName('SSel').value := false;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
if DQChiShu = ZChiShu then
|
|||
|
ISSel := false;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
Order_Main.Locate('SubId', VarArrayOf([SSubId]), []);
|
|||
|
Order_Main.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.B1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
frmSysLogHelp := TfrmSysLogHelp.create(self);
|
|||
|
with frmSysLogHelp do
|
|||
|
begin
|
|||
|
fModel := self.caption;
|
|||
|
// facction:='<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>ɾ<EFBFBD><C9BE>';
|
|||
|
showmodal;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
CurrentPage := 1;
|
|||
|
InitGrid();
|
|||
|
SetStatus();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.ToolButton2Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
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;
|
|||
|
|
|||
|
Order_Main.DisableControls;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Order_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' EXEC P_Print_RKMDGangNo ');
|
|||
|
SQL.Add(' @RKOrdID=''' + Trim(Order_Main.fieldbyname('RKNO').AsString) + '''');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(Order_Main.fieldbyname('JYType').AsString) = '<27><>Ʒ' then
|
|||
|
begin
|
|||
|
ExportFtErpFile('<27><>Ʒ<EFBFBD><C6B7>ǩ.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>鱨<EFBFBD><E9B1A8><EFBFBD><EFBFBD>Ʒ.rmf';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ExportFtErpFile('<27><>Ʒ<EFBFBD><C6B7>ǩ.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>鱨<EFBFBD><E9B1A8><EFBFBD><EFBFBD>Ʒ.rmf';
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
Rm2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
|
|||
|
RM2.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Order_Main.EnableControls;
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Order_Main.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.v1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
var
|
|||
|
mvalue, FFieldName, FValue: string;
|
|||
|
begin
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
try
|
|||
|
frmSCPerson := TfrmSCPerson.Create(Self);
|
|||
|
with frmSCPerson do
|
|||
|
begin
|
|||
|
FlagStr := 'SCPerson';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
mvalue := frmSCPerson.FSDPerson;
|
|||
|
|
|||
|
end;
|
|||
|
end
|
|||
|
finally
|
|||
|
frmSCPerson.free;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := Trim(mvalue);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JY_Cloth ');
|
|||
|
sql.Add(' Set ' + FFieldName + '=''' + Trim(mvalue) + '''');
|
|||
|
sql.Add(' where JYID=' + quotedstr(Order_Main.fieldbyname('JYID').AsString));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
|||
|
except
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.x2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
TV1.OptionsData.Editing := True;
|
|||
|
TV1.OptionsSelection.CellSelect := True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.v1Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName, FValue: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
if mvalue = '' then
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := Trim(mvalue);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JY_Cloth ');
|
|||
|
sql.Add(' Set ' + FFieldName + '=''' + Trim(mvalue) + '''');
|
|||
|
sql.Add(' where JYID=' + quotedstr(Order_Main.fieldbyname('JYID').AsString));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
|||
|
except
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if (AViewInfo.GridRecord.Values[v1Column12.Index] = '<27><>Ʒ') then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color := $008080FF
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmFinishedClothInspection.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
MJYID, FPCID: string;
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if not Order_Main.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
MJYID := '';
|
|||
|
|
|||
|
Order_Main.DisableControls;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Order_Main.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
MJYID := MJYID + (Trim(Order_Main.fieldbyname('JYID').AsString)) + ',';
|
|||
|
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
MJYID := leftBstr(trim(MJYID), length(MJYID) - 1);
|
|||
|
|
|||
|
Order_Main.Locate('SSel', True, []);
|
|||
|
Order_Main.EnableControls;
|
|||
|
|
|||
|
try
|
|||
|
frmmovecardedit := Tfrmmovecardedit.Create(Application);
|
|||
|
with frmmovecardedit do
|
|||
|
begin
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
FPCID := Order_MJ.FIELDBYNAME('PCID').ASSTRING;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Sql.Clear;
|
|||
|
Sql.Add('exec P_CARD_ZD ');
|
|||
|
Sql.Add('@JYID=' + quotedstr(trim(MJYID)));
|
|||
|
Sql.Add(',@pcid=' + quotedstr(trim(FPCID)));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
begin
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
end;
|
|||
|
with 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('ת<><D7AA>')));
|
|||
|
sql.Add(',' + quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD>룺' + trim(MJYID) + ' <20><><EFBFBD>ţ<EFBFBD>' + trim(FPCID)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
// InitGrid();
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmmovecardedit.Free;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|