D7szYidui/布匹检验(FabricInspection.dll)/U_ClothSCDCGAnPai.pas

1179 lines
40 KiB
ObjectPascal
Raw Normal View History

2025-07-19 09:32:10 +08:00
unit U_ClothSCDCGAnPai;
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, cxCheckBox,
BtnEdit, RM_BarCode, cxPC, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
dxCore, ActiveX;
type
TfrmClothSCDCGAnPai = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
Label3: TLabel;
OrderNo: TEdit;
CDS_PRT: TClientDataSet;
RM2: TRMGridReport;
RMDBPRT: TRMDBDataSet;
ADOQueryPrint: TADOQuery;
DSAnPai: TDataSource;
CDS_AnPai: TClientDataSet;
cxGridPopupMenu2: TcxGridPopupMenu;
ZhuanQty: TEdit;
Label9: TLabel;
Panel2: TPanel;
MachNo: TEdit;
Label1: TLabel;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridLevel2: TcxGridLevel;
v3Column1: TcxGridDBColumn;
Label2: TLabel;
P_Code: TEdit;
Label6: TLabel;
PS: TEdit;
Label7: TLabel;
JXPerson: TBtnEditA;
Button2: TButton;
Button1: TButton;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
v2Column2: TcxGridDBColumn;
cxGridDBColumn1: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
DataSource3: TDataSource;
ClientDataSet3: TClientDataSet;
v3Column3: TcxGridDBColumn;
Label5: TLabel;
Label8: TLabel;
APPS: TEdit;
PSSX: TEdit;
Label10: TLabel;
v2Column3: TcxGridDBColumn;
v3Column7: TcxGridDBColumn;
Button3: TButton;
v3Column8: TcxGridDBColumn;
v3Column10: TcxGridDBColumn;
Label12: TLabel;
CheJian: TComboBox;
v3Column14: TcxGridDBColumn;
Label14: TLabel;
APBatchNo: TEdit;
v2Column5: TcxGridDBColumn;
v3Column2: TcxGridDBColumn;
v3Column4: TcxGridDBColumn;
v3Column5: TcxGridDBColumn;
v3Column6: TcxGridDBColumn;
v3Column9: TcxGridDBColumn;
v3Column11: TcxGridDBColumn;
v3Column12: TcxGridDBColumn;
v3Column13: TcxGridDBColumn;
v3Column15: TcxGridDBColumn;
v3Column16: TcxGridDBColumn;
v3Column17: TcxGridDBColumn;
Button4: TButton;
v3Column18: TcxGridDBColumn;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
IsJYTime: TCheckBox;
Tv3Column1: TcxGridDBColumn;
Label4: TLabel;
conno: TEdit;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure OrderNoChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure JXPersonBtnClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure v3Column8PropertiesEditValueChanged(Sender: TObject);
procedure PSKeyPress(Sender: TObject; var Key: Char);
procedure Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Button4Click(Sender: TObject);
procedure v2Column2PropertiesChange(Sender: TObject);
private
FInt, PFInt, FFAPPS: Integer;
FFMainID: string;
procedure InitGrid();
procedure InitForm();
function SaveDataAP(): Boolean;
{ Private declarations }
public
canshu1: string;
{ Public declarations }
end;
var
frmClothSCDCGAnPai: TfrmClothSCDCGAnPai;
implementation
uses
U_DataLink, U_Fun, U_ZDYHelp;
{$R *.dfm}
procedure TfrmClothSCDCGAnPai.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmClothSCDCGAnPai.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid('DCG12', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('DCG13', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmClothSCDCGAnPai.InitGrid();
begin
OrderNo.SetFocus;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add('select A.*,C.*,D.* ');
SQL.Add(',ZAPPS=(SELECT COUNT(*) FROM PD_Plan_AnPai F WHERE F.MAINID=C.MAINID )');
SQL.Add(',ZJYPS=(SELECT COUNT(*) FROM JY_CLOTH g where g.pcid=a.pcid)');
SQL.Add('from PD_Plan_Card A ');
sql.Add('inner join PD_Plan_Card_MS B on A.PCID=B.PCID ');
sql.Add('left join PD_Plan_Main C on C.mainid=B.mainid ');
sql.Add('LEFT join PD_Plan_Sub D on D.Subid=B.SubId ');
sql.Add(' where A.Filltime>=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
sql.Add(' and A.Filltime<' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
SQL.Add(' order by A.Filltime desc');
// ShowMessage(SQL.Text);
Open;
end;
SCreateCDS20(ADOQueryMain, ClientDataSet3);
SInitCDSData20(ADOQueryMain, ClientDataSet3);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmClothSCDCGAnPai.InitForm();
var
fsj: string;
begin
ReadCxGrid('DCG12', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid('DCG13', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
// fsj := 'select distinct Code=Null,Name=MCCJ from Machine Group by MCCJ ';
// SInitComBoxBySql(ADOQueryTemp, CheJian, False, fsj);
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
BegDate.DateTime := EndDate.DateTime - 10;
InitGrid();
end;
procedure TfrmClothSCDCGAnPai.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmClothSCDCGAnPai.OrderNoChange(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, ClientDataSet3);
SInitCDSData20(ADOQueryMain, ClientDataSet3);
end;
procedure TfrmClothSCDCGAnPai.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmClothSCDCGAnPai.JXPersonBtnClick(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'JXPerson';
flagname := '<27><><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JXPerson.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmClothSCDCGAnPai.Button2Click(Sender: TObject);
var
FFDS: Integer;
FGYCarNo: string;
FStrs: TStringList;
i, j, MPCNo: Integer;
maxno, WSql: string;
Txt, fImagePath, fPrintFile: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
ZAPPS: Integer;
begin
if ClientDataSet3.IsEmpty then
Exit;
Button2.Enabled := False;
if ClientDataSet3.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Button2.Enabled := True;
Exit;
end;
if Trim(PS.Text) = '' then
begin
Application.MessageBox(<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Button2.Enabled := True;
Exit;
end;
if TryStrToInt(Trim(PS.Text), FFDS) = False then
begin
Application.MessageBox(<><C6A5><EFBFBD>Ƿ<EFBFBD>', '<27><>ʾ', 0);
Button2.Enabled := True;
Exit;
end;
FFDS := 0;
FGYCarNo := Trim(ClientDataSet3.fieldbyname('MachNo').AsString);
FStrs := TStringList.Create();
ClientDataSet3.DisableControls;
with ClientDataSet3 do
begin
if ClientDataSet3.Locate('SSel', True, []) = True then
begin
ZAPPS := StrToIntDef(ClientDataSet3.fieldbyname('ZAPPS').AsString, 0);
FFDS := FFDS + 1;
FStrs.Add(ClientDataSet3.fieldbyname('PCID').AsString);
end;
end;
ClientDataSet3.EnableControls;
if FFDS * strtoint(PS.Text) + ZAPPS > StrToInt(PSSX.Text) then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Button2.Enabled := True;
Exit;
end;
with ClientDataSet3 do
begin
if ClientDataSet3.Locate('SSel', True, []) = True then
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select apxh=isnull(Max(apxh),0) ');
sql.Add('from PD_Plan_AnPai A ');
sql.Add('where A.PCId=' + Quotedstr(Trim(ClientDataSet3.fieldbyname('pcid').AsString)));
Open;
end;
if ADOQueryTemp.IsEmpty then
MPCNo := 1
else
MPCNo := ADOQueryTemp.FieldByName('apxh').AsInteger + 1;
////////////////// <20><><EFBFBD>벼Ʊ //////////////////////
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' insert into PD_Plan_AnPai(MainId,SubId,pcid,APId,JXPerson,APBatchNo,MachNo,APXH,apdate,Filler,FillCode,FillTime,PRTCount,PRTFlag) values');
for j := 0 to StrToIntdef(ps.Text, 0) - 1 do
begin
if GetLSNo(ADOQueryTemp, maxno, '', 'PD_Plan_AnPai', 4, 1) = False then
begin
raise Exception.Create(<><C8A1>Ʊ<EFBFBD><C6B1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!');
end;
if j > 0 then
sql.Add(',');
sql.Add(' (' + Quotedstr(Trim(ClientDataSet3.fieldbyname('MAINID').AsString)));
sql.Add(',' + Quotedstr(Trim(ClientDataSet3.fieldbyname('SUBID').AsString)));
sql.Add(',' + Quotedstr(Trim(Trim(ClientDataSet3.fieldbyname('pcid').AsString))));
sql.Add(',' + Quotedstr(maxno));
sql.Add(',' + Quotedstr(JXPerson.Text));
sql.Add(',' + Quotedstr(APBatchNo.Text));
sql.Add(',' + Quotedstr(ClientDataSet3.fieldbyname('MachNo').AsString));
sql.Add(',' + Quotedstr(IntToStr(MPCNo)));
sql.Add(',getdate() ');
sql.Add(',' + Quotedstr(Trim(DName)));
sql.Add(',' + Quotedstr(Trim(DCode)));
sql.Add(',getdate(),1,0 ');
sql.Add(' )');
MPCNo := MPCNo + 1;
if WSql <> '' then
begin
WSql := WSql + ',' + QuotedStr(Trim(maxno));
end
else
begin
WSql := QuotedStr(Trim(maxno));
end;
end;
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' update PD_Plan_Card set APPS=(select Count(APID) from PD_Plan_AnPai AA where AA.PCID=PD_Plan_Card.PCId), Filltime=GETDATE() ');
sql.add(' where pcid =''' + Trim(ClientDataSet3.fieldbyname('PCId').AsString) + '''');
//ShowMessage(SQL.Text);
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><>ӡ<EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add(' select A.*');
sql.Add(' from PD_Plan_AnPai A');
sql.Add(' where A.PCId=''' + Trim(ClientDataSet3.fieldbyname('PCId').AsString) + '''');
sql.Add(' and isnull(A.machno,'''')=''' + Trim(ClientDataSet3.fieldbyname('machno').AsString) + '''');
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_AnPai);
SInitCDSData20(ADOQueryTemp, CDS_AnPai);
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.add(' select * from PD_Plan_AnPai A');
sql.add(' INNER JOIN PD_Plan_Main B on A.MainID =B.MainID ');
sql.add(' INNER JOIN PD_Plan_SUB C on B.MainID =C.MainID ');
sql.add(' where APID in (' + WSql + ')');
sql.add(' Order by APXH');
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_PRT);
SInitCDSData20(ADOQueryTemp, CDS_PRT);
with CDS_PRT do
begin
First;
while not Eof do
begin
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
if FileExists(fImagePath) then
DeleteFile(fImagePath);
try
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath) then
DeleteFile(fImagePath);
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(CDS_PRT.fieldbyname('APID').AsString);
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
except
cxGrid3.Enabled := True;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
Sleep(300);
ExportFtErpFile(trim('<27><>֯<EFBFBD><D6AF>Ʊ') + '.rmf', ADOQueryTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>֯<EFBFBD><D6AF>Ʊ.rmf';
if FileExists(fPrintFile) then
begin
RM2.LoadFromFile(fPrintFile);
RMVariables['QRBARCODE'] := fImagePath;
RMVariables['APXH'] := CDS_PRT.fieldbyname('APXH').AsString;
RM2.PrintReport;
end
else
begin
cxGrid3.Enabled := True;
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩAP.rmf'), '<27><>ʾ', 0);
Exit;
end;
Next;
end;
end;
ClientDataSet3.Delete;
end;
end;
InitGrid();
Button2.Enabled := True;
FFMainID := '';
cxGrid3.Enabled := True;
// try
// if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
// CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
// if FileExists(fImagePath) then
// DeleteFile(fImagePath);
// Sleep(300);
// Moudle := LoadLibrary('MakeQRBarcode.dll');
// @Makebar := GetProcAddress(Moudle, 'Make');
// @Mixtext := GetProcAddress(Moudle, 'MixText');
// Txt := Trim(maxno);
// Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
// except
// cxGrid3.Enabled := True;
// application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
// Button2.Enabled := True;
// exit;
// end;
// ExportFtErpFile(trim(GYLabName) + '.rmf', ADOQueryTemp);
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(GYLabName) + '.rmf';
end;
// if SaveDataAP() then
// begin
// InitGrid();
// Label10.Caption := Trim(ClientDataSet3.fieldbyname('ConNo').AsString);
// APPS.Text := Trim(ClientDataSet3.fieldbyname('APPS').AsString);
// PSSX.Text := Trim(ClientDataSet3.fieldbyname('PiQty').AsString);
// APBatchNo.Text := Trim(ClientDataSet3.fieldbyname('edZDFNo').AsString);
// end;
// CDS_AnPai.Last;
// Button2.Enabled := True;
function TfrmClothSCDCGAnPai.SaveDataAP(): Boolean;
var
maxno, fPrintFile: string;
i, FAPPS, FFDS: Integer;
FDate: string;
Txt, fImagePath, FGYCarNo: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
GYMainId, GYSubId, GYPCID, GYCarNo, GYC_Code, GYC_CodeName, GYConNo, GYXHInt, GYLabName, GYCheJian, GYBatchNOHZ, GYChouZhen, GYCarType, GYC_Spec, GYC_CPName, GYC_ZhenCun, GYC_Custom, GYC_gongyi: string;
begin
cxGrid3.Enabled := False;
FDate := FormatDateTime('yyyy-MM-dd', SGetServerDate(ADOQueryTemp));
with ClientDataSet3 do
begin
if ClientDataSet3.Locate('SSel', True, []) = True then
begin
GYMainId := Trim(ClientDataSet3.fieldbyname('Mainid').AsString);
GYSubId := Trim(ClientDataSet3.fieldbyname('SubId').AsString);
GYPCID := Trim(ClientDataSet3.fieldbyname('PCId').AsString);
GYCarNo := Trim(ClientDataSet3.fieldbyname('MachNo').AsString);
GYC_Code := Trim(ClientDataSet3.fieldbyname('P_Code').AsString);
GYC_CodeName := Trim(ClientDataSet3.fieldbyname('P_CodeName').AsString);
GYConNo := Trim(ClientDataSet3.fieldbyname('ConNo').AsString);
GYLabName := '<27><>֯<EFBFBD><D6AF>Ʊ';
GYBatchNOHZ := Trim(ClientDataSet3.fieldbyname('edZDFNo').AsString);
GYCarType := Trim(ClientDataSet3.fieldbyname('CarType').AsString);
GYC_Spec := Trim(ClientDataSet3.fieldbyname('P_Spec').AsString);
GYC_Custom := Trim(ClientDataSet3.fieldbyname('KHName').AsString);
for i := 1 to StrToInt(PS.Text) do
begin
try
ADOQueryCmd.Connection.BeginTrans;
if GetLSNo(ADOQueryCmd, maxno, '', 'PD_Plan_AnPai', 4, 1) = False then
begin
cxGrid3.Enabled := True;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
Button2.Enabled := True;
exit;
Break;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from PD_Plan_AnPai where 1=2');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('MainId').Value := Trim(GYMainId);
FieldByName('SubId').Value := Trim(GYSubId);
FieldByName('PCId').Value := Trim(GYPCID);
FieldByName('APId').Value := Trim(maxno);
FieldByName('JXPerson').Value := Trim(JXPerson.Text);
FieldByName('APBatchNo').Value := Trim(APBatchNo.Text);
FieldByName('MachNo').Value := Trim(GYCarNo);
FieldByName('PRTCount').Value := 1;
FieldByName('PRTFlag').Value := 0;
FieldByName('APDate').Value := FDate;
FieldByName('Filler').Value := Trim(DName);
FieldByName('FillTime').Value := FDate;
FieldByName('FillCode').Value := Trim(DCode);
Post;
end;
with ClientDataSet3 do
begin
if ClientDataSet3.Locate('SSel', True, []) = True then
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select Max(APXH) APXH from PD_Plan_AnPai A where A.PCId=''' + Trim(ClientDataSet3.fieldbyname('PCId').AsString) + '''');
Open;
end;
if ADOQueryTemp.FieldByName('APXH').Value = null then
begin
FFAPPS := 0;
end
else
begin
FFAPPS := StrToIntDef(Trim(ADOQueryTemp.fieldbyname('APXH').Value), 0);
end;
end;
FFAPPS := FFAPPS + 1;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' Update PD_Plan_AnPai set ');
SQL.Add('APXH=' + QuotedStr(IntToStr(FFAPPS)));
//SQL.Add(' APXH=isnull((select Max(APXH) from PD_Plan_AnPai A where A.MainId=PD_Plan_AnPai.MainId and A.MachNo=PD_Plan_AnPai.MachNo ),0)+1');
sql.Add(' where APId=''' + Trim(maxno) + '''');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' exec P_UP_CardByAnPai ' + quotedstr(Trim(GYPCID)));
//ShowMessage(SQL.Text);
ExecSQL;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select APXH from PD_Plan_AnPai A where A.APId=''' + Trim(maxno) + '''');
Open;
end;
GYXHInt := Trim(ADOQueryTemp.fieldbyname('APXH').AsString);
with CDS_AnPai do
begin
Append;
FieldByName('MainId').Value := Trim(GYMainId);
FieldByName('SubId').Value := Trim(GYSubId);
FieldByName('PCId').Value := Trim(GYPCID);
FieldByName('APId').Value := Trim(maxno);
FieldByName('JXPerson').Value := Trim(JXPerson.Text);
FieldByName('APBatchNo').Value := Trim(APBatchNo.Text);
FieldByName('MachNo').Value := Trim(GYCarNo);
FieldByName('APXH').Value := ADOQueryTemp.fieldbyname('APXH').Value;
FieldByName('APDate').Value := FDate;
FieldByName('PRTCount').Value := 1;
Post;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select * from PD_Plan_AnPai where APID=''' + Trim(maxno) + '''');
sql.Add(' and MachNo=''' + Trim(GYCarNo) + '''');
sql.Add(' and JXPerson=''' + Trim(JXPerson.Text) + '''');
sql.Add(' and MainId=''' + Trim(GYMainId) + '''');
sql.Add(' and SubId=''' + Trim(GYSubId) + '''');
SQL.Add('and PCID=''' + Trim(GYPCID) + ''' ');
Open;
end;
if ADOQueryTemp.IsEmpty then
begin
cxGrid3.Enabled := True;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><>ӡ<EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>Ѵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>ı<EFBFBD>ǩ<EFBFBD><C7A9>Ч!', '<27><>ʾ', 0);
Button2.Enabled := True;
Exit;
end;
ADOQueryCmd.Connection.CommitTrans;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><>ӡ<EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
Button2.Enabled := True;
Exit;
end;
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
// if FileExists(fImagePath) then
// DeleteFile(fImagePath);
// Sleep(300);
try
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath) then
DeleteFile(fImagePath);
Sleep(300);
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(maxno);
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
except
cxGrid3.Enabled := True;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
Button2.Enabled := True;
exit;
end;
ExportFtErpFile(trim(GYLabName) + '.rmf', ADOQueryTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(GYLabName) + '.rmf';
if FileExists(fPrintFile) then
begin
RM2.LoadFromFile(fPrintFile);
RMVariables['QRBARCODE'] := fImagePath;
RMVariables['PRTCS'] := '';
RMVariables['ConNo'] := Trim(GYConNo);
RMVariables['APID'] := Trim(maxno);
RMVariables['PCID'] := Trim(GYPCID);
RMVariables['P_Code'] := Trim(GYC_Code);
RMVariables['P_CodeName'] := Trim(GYC_CodeName);
RMVariables['JXPerson'] := Trim(JXPerson.Text);
RMVariables['APBatchNo'] := Trim(APBatchNo.Text);
RMVariables['MachNo'] := Trim(GYCarNo);
RMVariables['APXH'] := Trim(GYXHInt);
RMVariables['BatchNo'] := Trim(GYBatchNOHZ);
RMVariables['CarType'] := Trim(GYCarType);
RMVariables['P_Spec'] := Trim(GYC_Spec);
RMVariables['KHName'] := Trim(GYC_Custom);
RMVariables['CPName'] := Trim(GYC_CPName);
RM2.PrintReport;
end
else
begin
cxGrid3.Enabled := True;
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
Button2.Enabled := True;
Exit;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' exec P_UP_CardByAnPai ' + quotedstr(Trim(GYPCID)));
//ShowMessage(SQL.Text);
ExecSQL;
end;
//ClientDataSet3.Delete;
end;
end;
FFMainID := '';
cxGrid3.Enabled := True;
Result := True;
end;
procedure TfrmClothSCDCGAnPai.Button1Click(Sender: TObject);
var
GYPCID: string;
begin
if CDS_AnPai.IsEmpty then
Exit;
if CDS_AnPai.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if CDS_AnPai.Locate('SSel;JYFlag', VarArrayOf([True, True]), []) then
begin
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC><EFBFBD><E9B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select * from CK_Cloth_CR A where A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
sql.Add(' and A.APID=' + quotedstr(Trim(CDS_AnPai.fieldbyname('APID').AsString)));
// ShowMessage(sql.Text);
Open;
end;
if not ADOQueryTemp.IsEmpty then
begin
Application.MessageBox('<27>ѳ<EFBFBD><D1B3><EFBFBD><E2B2BB>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
try
ADOQueryCmd.Connection.BeginTrans;
CDS_AnPai.DisableControls;
with CDS_AnPai do
begin
while CDS_AnPai.FieldByName('SSel').AsBoolean = True do
begin
GYPCID := Trim(CDS_AnPai.fieldbyname('pcid').AsString);
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete PD_Plan_AnPai where APId=' + quotedstr(Trim(CDS_AnPai.fieldbyname('APID').AsString)));
sql.Add('delete CK_Cloth_CR where APId=' + quotedstr(Trim(CDS_AnPai.fieldbyname('APID').AsString)));
ExecSQL;
end;
CDS_AnPai.Delete;
end;
end;
CDS_AnPai.EnableControls;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' exec P_UP_CardByAnPai ' + quotedstr(Trim(GYPCID)));
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
TBRafresh.Click;
APPS.Text := Trim(ClientDataSet3.fieldbyname('APPS').AsString)
except
ADOQueryCmd.Connection.RollbackTrans;
CDS_AnPai.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
end;
procedure TfrmClothSCDCGAnPai.cxTabControl1Change(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmClothSCDCGAnPai.Button3Click(Sender: TObject);
var
fPrintFile: string;
i: Integer;
FDate: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
GYMainId, GYSubId, GYPCID, GYCarNo, GYC_Code, GYC_CodeName, GYConNo, GYXHInt, GYLabName, GYCheJian, GYBatchNOHZ, GYChouZhen, GYCarType, GYC_Spec, GYC_CPName, GYC_ZhenCun, GYC_Custom, GYC_gongyi: string;
begin
if ClientDataSet3.IsEmpty then
Exit;
if CDS_AnPai.IsEmpty then
Exit;
if CDS_AnPai.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if CDS_AnPai.Locate('SSel;JYFlag', VarArrayOf([True, True]), []) then
begin
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC><EFBFBD><E9B2BB><EFBFBD>ش<EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with CDS_AnPai do
begin
while CDS_AnPai.Locate('SSel', true, []) do
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from PD_Plan_Main where Mainid=''' + Trim(CDS_AnPai.fieldbyname('MainId').AsString) + '''');
Open;
end;
// GYLabName := Trim(ADOQueryTemp.fieldbyname('LabName').AsString);
GYLabName := '<27><>֯<EFBFBD><D6AF>Ʊ';
CDS_AnPai.Edit;
CDS_AnPai.FieldByName('PRTFlag').Value := 1;
CDS_AnPai.FieldByName('PRTCount').Value := 2;
CDS_AnPai.Post;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate PD_Plan_AnPai Set PRTFlag=1,PRTCount=2 ');
sql.Add(' where APId=''' + Trim(CDS_AnPai.fieldbyname('APID').AsString) + '''');
ExecSQL;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(CDS_AnPai.fieldbyname('APId').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;
ExportFtErpFile(trim(GYLabName) + '.rmf', ADOQueryTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>֯<EFBFBD><D6AF>Ʊ.rmf';
if FileExists(fPrintFile) then
begin
with ADOQueryPrint do
begin
Close;
sql.Clear;
sql.Add('select AA.*,A.*,C.*,D.* from PD_Plan_AnPai AA');
sql.add('inner join PD_Plan_Card A on AA.pcid=A.pcid');
sql.Add('inner join PD_Plan_Card_MS B on A.PCID=B.PCID ');
sql.Add('left join PD_Plan_Main C on C.mainid=B.mainid ');
sql.Add('LEFT join PD_Plan_Sub D on D.Subid=B.SubId');
sql.Add(' where AA.APId=''' + Trim(CDS_AnPai.fieldbyname('APID').AsString) + '''');
//ShowMessage(SQL.Text);
Open;
end;
SCreateCDS20(ADOQueryPrint, CDS_PRT);
SInitCDSData20(ADOQueryPrint, CDS_PRT);
GYMainId := Trim(CDS_PRT.fieldbyname('Mainid').AsString);
GYSubId := Trim(CDS_PRT.fieldbyname('SubId').AsString);
GYPCID := Trim(CDS_PRT.fieldbyname('PCId').AsString);
GYCarNo := Trim(CDS_PRT.fieldbyname('MachNo').AsString);
GYC_Code := Trim(CDS_PRT.fieldbyname('P_Code').AsString);
GYC_CodeName := Trim(CDS_PRT.fieldbyname('P_CodeName').AsString);
GYConNo := Trim(CDS_PRT.fieldbyname('ConNo').AsString);
GYXHInt := Trim(CDS_PRT.fieldbyname('APXH').AsString);
// GYLabName := Trim(ADOQueryPrint.fieldbyname('LabName').AsString);
GYLabName := '<27><>֯<EFBFBD><D6AF>Ʊ';
GYBatchNOHZ := Trim(CDS_PRT.fieldbyname('edZDFNo').AsString);
GYCarType := Trim(CDS_PRT.fieldbyname('CarType').AsString);
GYC_Spec := Trim(CDS_PRT.fieldbyname('P_Spec').AsString);
GYC_Custom := Trim(CDS_PRT.fieldbyname('KHName').AsString);
RM2.LoadFromFile(fPrintFile);
RMVariables['QRBARCODE'] := fImagePath;
RMVariables['PRTCS'] := '';
RMVariables['APID'] := Trim(CDS_AnPai.fieldbyname('APID').AsString);
RMVariables['PCID'] := Trim(GYPCID);
RMVariables['ConNo'] := Trim(GYConNo);
RMVariables['P_Code'] := Trim(GYC_Code);
RMVariables['P_CodeName'] := Trim(GYC_CodeName);
RMVariables['JXPerson'] := Trim(JXPerson.Text);
RMVariables['APBatchNo'] := Trim(APBatchNo.Text);
RMVariables['MachNo'] := Trim(GYCarNo);
RMVariables['APXH'] := Trim(GYXHInt);
RMVariables['BatchNo'] := Trim(GYBatchNOHZ);
RMVariables['CarType'] := Trim(GYCarType);
RMVariables['P_Spec'] := Trim(GYC_Spec);
RMVariables['KHName'] := Trim(GYC_Custom);
RMVariables['CPName'] := Trim(GYC_CPName);
RM2.PrintReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><>֯<EFBFBD><D6AF>Ʊ.rmf'), '<27><>ʾ', 0);
Exit;
end;
CDS_AnPai.Edit;
CDS_AnPai.FieldByName('SSel').Value := false;
end;
end;
end;
procedure TfrmClothSCDCGAnPai.v3Column8PropertiesEditValueChanged(Sender: TObject);
var
mvale: Boolean;
fsj: string;
FANPaiPS: Integer;
begin
mvale := TcxCheckBox(Sender).EditingValue;
if mvale = True then
begin
if Trim(FFMainID) = '' then
begin
FFMainID := Trim(ClientDataSet3.fieldbyname('Mainid').AsString)
end
else
begin
if Trim(FFMainID) <> Trim(ClientDataSet3.fieldbyname('Mainid').AsString) then
begin
with ClientDataSet3 do
begin
Edit;
FieldByName('SSel').Value := False;
end;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ͬ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
Label10.Caption := Trim(ClientDataSet3.fieldbyname('ConNo').AsString);
PSSX.Text := Trim(ClientDataSet3.fieldbyname('PiQty').AsString);
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add(' select A.*');
sql.Add(' from PD_Plan_AnPai A');
sql.Add(' where A.SubId=''' + Trim(ClientDataSet3.fieldbyname('SubId').AsString) + '''');
sql.Add(' and A.MainId=''' + Trim(ClientDataSet3.fieldbyname('MainId').AsString) + '''');
// sql.Add(' and A.PCID=''' + Trim(ClientDataSet3.fieldbyname('PCID').AsString) + '''');
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_AnPai);
SInitCDSData20(ADOQueryTemp, CDS_AnPai);
end;
APPS.Text := IntToStr(CDS_AnPai.RecordCount);
fsj := Trim(ClientDataSet3.fieldbyname('PCID').AsString);
with ClientDataSet3 do
begin
Edit;
FieldByName('SSel').Value := mvale;
end;
if mvale = True then
begin
end
else
begin
ClientDataSet3.Locate('SSel', True, []);
end;
if ClientDataSet3.Locate('SSel', True, []) = False then
begin
JXPerson.Text := '';
FFMainID := '';
end;
ClientDataSet3.Locate('PCID', fsj, []);
end;
procedure TfrmClothSCDCGAnPai.PSKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Button2.Click;
end;
end;
procedure TfrmClothSCDCGAnPai.Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
with ClientDataSet3 do
begin
if ClientDataSet3.Locate('SSel', True, []) = True then
begin
Edit;
ClientDataSet3.FieldByName('SSel').Value := False;
end;
FFMainID := '';
end;
Label10.Caption := Trim(ClientDataSet3.fieldbyname('ConNo').AsString);
APPS.Text := Trim(ClientDataSet3.fieldbyname('APPS').AsString);
PSSX.Text := Trim(ClientDataSet3.fieldbyname('PiQty').AsString);
APBatchNo.Text := Trim(ClientDataSet3.fieldbyname('edZDFNo').AsString);
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add(' select A.*,carno=((select top 1 carno from CK_YgCl y where y.mjid=a.pcid and (y.ClType =''<27><><EFBFBD><EFBFBD>'' or y.ClType =''<27><>ͷ'') and isnull(carno,'''')<>'''' order by filltime desc))');
sql.Add(' from PD_Plan_AnPai A');
sql.Add(' where A.PCId=''' + Trim(ClientDataSet3.fieldbyname('PCId').AsString) + '''');
// ShowMessage(sql.Text);
// sql.Add(' and isnull(A.machno,'''')=''' + Trim(ClientDataSet3.fieldbyname('machno').AsString) + '''');
Open;
end;
CDS_AnPai.enableControls;
SCreateCDS20(ADOQueryTemp, CDS_AnPai);
SInitCDSData20(ADOQueryTemp, CDS_AnPai);
v2Column3.SortOrder := soDescending;
CDS_AnPai.Last;
if CDS_AnPai.IsEmpty then
APBatchNo.Text := Trim(ClientDataSet3.fieldbyname('edZDFNo').AsString)
else
APBatchNo.Text := Trim(CDS_AnPai.fieldbyname('APBatchNo').AsString);
end;
procedure TfrmClothSCDCGAnPai.Button4Click(Sender: TObject);
var
fPrintFile: string;
i: Integer;
FDate: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
GYMainId, GYSubId, GYPCID, GYCarNo, GYC_Code, GYC_CodeName, GYConNo, GYXHInt, GYLabName, GYCheJian, GYBatchNOHZ, GYChouZhen, GYCarType, GYC_Spec, GYC_CPName, GYC_ZhenCun, GYC_Custom, GYC_gongyi: string;
begin
if ClientDataSet3.IsEmpty then
Exit;
if CDS_AnPai.IsEmpty then
Exit;
if CDS_AnPai.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if CDS_AnPai.Locate('SSel;JYFlag', VarArrayOf([True, True]), []) then
begin
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC><EFBFBD><E9B2BB><EFBFBD>ش<EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with CDS_AnPai do
begin
while CDS_AnPai.Locate('SSel', true, []) do
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from PD_Plan_Main where Mainid=''' + Trim(CDS_AnPai.fieldbyname('MainId').AsString) + '''');
Open;
end;
//GYLabName := '<27><>֯<EFBFBD><D6AF>Ʊ';
CDS_AnPai.Edit;
CDS_AnPai.FieldByName('PRTFlag').Value := 1;
CDS_AnPai.FieldByName('PRTCount').Value := 2;
CDS_AnPai.Post;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate PD_Plan_AnPai Set PRTFlag=1,PRTCount=2 ');
sql.Add(',APBatchNo =' + quotedstr(Trim(APBatchNo.Text)));
sql.Add(' where APId=''' + Trim(CDS_AnPai.fieldbyname('APID').AsString) + '''');
ExecSQL;
end;
// try
// Moudle := LoadLibrary('MakeQRBarcode.dll');
// @Makebar := GetProcAddress(Moudle, 'Make');
// @Mixtext := GetProcAddress(Moudle, 'MixText');
// Txt := Trim(CDS_AnPai.fieldbyname('APId').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><D6AF>Ʊ.rmf';
//
// if FileExists(fPrintFile) then
// begin
// with ADOQueryPrint do
// begin
// Close;
// sql.Clear;
// sql.Add('select AA.*,A.*,C.*,D.* from PD_Plan_AnPai AA');
// sql.add('inner join PD_Plan_Card A on AA.pcid=A.pcid');
// sql.Add('inner join PD_Plan_Card_MS B on A.PCID=B.PCID ');
// sql.Add('left join PD_Plan_Main C on C.mainid=B.mainid ');
// sql.Add('LEFT join PD_Plan_Sub D on D.Subid=B.SubId');
// sql.Add(' where AA.APId=''' + Trim(CDS_AnPai.fieldbyname('APID').AsString) + '''');
// //ShowMessage(SQL.Text);
// Open;
// end;
//
// GYMainId := Trim(ADOQueryPrint.fieldbyname('Mainid').AsString);
// GYSubId := Trim(ADOQueryPrint.fieldbyname('SubId').AsString);
// GYPCID := Trim(ADOQueryPrint.fieldbyname('PCId').AsString);
// GYCarNo := Trim(ADOQueryPrint.fieldbyname('MachNo').AsString);
// GYC_Code := Trim(ADOQueryPrint.fieldbyname('P_Code').AsString);
// GYC_CodeName := Trim(ADOQueryPrint.fieldbyname('P_CodeName').AsString);
// GYConNo := Trim(ADOQueryPrint.fieldbyname('ConNo').AsString);
// GYXHInt := Trim(ADOQueryPrint.fieldbyname('APXH').AsString);
//// GYLabName := Trim(ADOQueryPrint.fieldbyname('LabName').AsString);
// GYLabName := '<27><>֯<EFBFBD><D6AF>Ʊ';
// GYBatchNOHZ := Trim(ADOQueryPrint.fieldbyname('BatchNO').AsString);
// GYCarType := Trim(ADOQueryPrint.fieldbyname('CarType').AsString);
// GYC_Spec := Trim(ADOQueryPrint.fieldbyname('P_Spec').AsString);
// GYC_Custom := Trim(ADOQueryPrint.fieldbyname('KHName').AsString);
//
// RM2.LoadFromFile(fPrintFile);
// RMVariables['QRBARCODE'] := fImagePath;
// RMVariables['PRTCS'] := '';
// RMVariables['APID'] := Trim(CDS_AnPai.fieldbyname('APID').AsString);
// RMVariables['ConNo'] := Trim(GYConNo);
// RMVariables['P_Code'] := Trim(GYC_Code);
// RMVariables['P_CodeName'] := Trim(GYC_CodeName);
// RMVariables['JXPerson'] := Trim(JXPerson.Text);
// RMVariables['APBatchNo'] := Trim(APBatchNo.Text);
// RMVariables['MachNo'] := Trim(GYCarNo);
// RMVariables['APXH'] := Trim(GYXHInt);
// RMVariables['BatchNo'] := Trim(GYBatchNOHZ);
// RMVariables['CarType'] := Trim(GYCarType);
// RMVariables['P_Spec'] := Trim(GYC_Spec);
// RMVariables['KHName'] := Trim(GYC_Custom);
// RMVariables['CPName'] := Trim(GYC_CPName);
// RM2.PrintReport;
// end
// else
// begin
// Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><>֯<EFBFBD><D6AF>Ʊ.rmf'), '<27><>ʾ', 0);
// Exit;
// end;
CDS_AnPai.Edit;
CDS_AnPai.FieldByName('SSel').Value := false;
CDS_AnPai.FieldByName('APBatchNo').Value := Trim(APBatchNo.Text);
end;
end;
end;
procedure TfrmClothSCDCGAnPai.v2Column2PropertiesChange(Sender: TObject);
begin
if CDS_AnPai.Locate('SSel', True, []) = True then
begin
APBatchNo.Text := Trim(CDS_AnPai.fieldbyname('APBatchNo').AsString);
end
else
APBatchNo.Text := '';
end;
end.