This commit is contained in:
DESKTOP-E401PHE\Administrator 2025-10-15 15:53:12 +08:00
parent 2a930bc9b2
commit 5d7c1572ec
2 changed files with 154 additions and 29 deletions

View File

@ -1009,7 +1009,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Label3: TLabel object Label3: TLabel
Left = 144 Left = 144
Top = 383 Top = 422
Width = 26 Width = 26
Height = 22 Height = 22
Caption = 'cm' Caption = 'cm'
@ -1048,7 +1048,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Label6: TLabel object Label6: TLabel
Left = 8 Left = 8
Top = 383 Top = 422
Width = 42 Width = 42
Height = 20 Height = 20
Caption = #24133#23485 Caption = #24133#23485
@ -1074,7 +1074,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Label10: TLabel object Label10: TLabel
Left = 8 Left = 8
Top = 296 Top = 294
Width = 42 Width = 42
Height = 20 Height = 20
Caption = #27491#21697 Caption = #27491#21697
@ -1087,7 +1087,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Label12: TLabel object Label12: TLabel
Left = 92 Left = 92
Top = 296 Top = 294
Width = 40 Width = 40
Height = 19 Height = 19
Caption = #27425#21697 Caption = #27425#21697
@ -1140,7 +1140,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Label22: TLabel object Label22: TLabel
Left = 144 Left = 144
Top = 424 Top = 457
Width = 36 Width = 36
Height = 22 Height = 22
Caption = 'g/'#13217 Caption = 'g/'#13217
@ -1153,7 +1153,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Label23: TLabel object Label23: TLabel
Left = 8 Left = 8
Top = 423 Top = 456
Width = 42 Width = 42
Height = 20 Height = 20
Caption = #20811#37325 Caption = #20811#37325
@ -1179,7 +1179,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Label26: TLabel object Label26: TLabel
Left = 8 Left = 8
Top = 339 Top = 337
Width = 42 Width = 42
Height = 20 Height = 20
Caption = #20986#32440 Caption = #20986#32440
@ -1258,7 +1258,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Label34: TLabel object Label34: TLabel
Left = 90 Left = 90
Top = 342 Top = 340
Width = 40 Width = 40
Height = 19 Height = 19
Caption = #20221#25968 Caption = #20221#25968
@ -1347,11 +1347,25 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
Font.Style = [fsBold] Font.Style = [fsBold]
ParentFont = False ParentFont = False
end end
object Label53: TLabel
Left = 10
Top = 383
Width = 80
Height = 19
Caption = #29233#36805#26631#31614
Font.Charset = GB2312_CHARSET
Font.Color = clRed
Font.Height = -19
Font.Name = #23435#20307
Font.Style = [fsBold]
ParentFont = False
end
object MJFK: TEdit object MJFK: TEdit
Left = 51 Left = 51
Top = 377 Top = 416
Width = 90 Width = 90
Height = 41 Height = 34
AutoSize = False
Font.Charset = GB2312_CHARSET Font.Charset = GB2312_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
Font.Height = -32 Font.Height = -32
@ -1397,9 +1411,9 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object BTPrint: TButton object BTPrint: TButton
Left = 10 Left = 10
Top = 460 Top = 486
Width = 171 Width = 171
Height = 93 Height = 71
Caption = #25552#20132 Caption = #25552#20132
Font.Charset = GB2312_CHARSET Font.Charset = GB2312_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
@ -1412,7 +1426,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Edit3: TEdit object Edit3: TEdit
Left = 52 Left = 52
Top = 290 Top = 288
Width = 39 Width = 39
Height = 43 Height = 43
Font.Charset = GB2312_CHARSET Font.Charset = GB2312_CHARSET
@ -1429,7 +1443,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Edit4: TEdit object Edit4: TEdit
Left = 130 Left = 130
Top = 290 Top = 288
Width = 40 Width = 40
Height = 43 Height = 43
Font.Charset = GB2312_CHARSET Font.Charset = GB2312_CHARSET
@ -1462,9 +1476,10 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object MJSJKZ: TEdit object MJSJKZ: TEdit
Left = 51 Left = 51
Top = 418 Top = 451
Width = 90 Width = 90
Height = 41 Height = 34
AutoSize = False
Font.Charset = GB2312_CHARSET Font.Charset = GB2312_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
Font.Height = -32 Font.Height = -32
@ -1494,7 +1509,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Edit6: TEdit object Edit6: TEdit
Left = 52 Left = 52
Top = 333 Top = 331
Width = 40 Width = 40
Height = 43 Height = 43
Font.Charset = GB2312_CHARSET Font.Charset = GB2312_CHARSET
@ -1562,7 +1577,7 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object ComboBox1: TComboBox object ComboBox1: TComboBox
Left = 132 Left = 132
Top = 334 Top = 332
Width = 45 Width = 45
Height = 40 Height = 40
Style = csDropDownList Style = csDropDownList
@ -1651,7 +1666,8 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
Left = 57 Left = 57
Top = 253 Top = 253
Width = 90 Width = 90
Height = 36 Height = 34
AutoSize = False
Font.Charset = GB2312_CHARSET Font.Charset = GB2312_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
Font.Height = -28 Font.Height = -28
@ -1671,9 +1687,9 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
end end
object Button7: TButton object Button7: TButton
Left = 10 Left = 10
Top = 556 Top = 559
Width = 171 Width = 171
Height = 53 Height = 49
Caption = #25171#21253#26631#31614 Caption = #25171#21253#26631#31614
Font.Charset = GB2312_CHARSET Font.Charset = GB2312_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
@ -1694,6 +1710,22 @@ object frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF
TabOrder = 21 TabOrder = 21
Visible = False Visible = False
end end
object edtaixun: TEdit
Left = 103
Top = 373
Width = 40
Height = 43
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -35
Font.Name = #23435#20307
Font.Style = [fsBold]
ParentFont = False
ReadOnly = True
TabOrder = 22
OnClick = edtaixunClick
OnKeyPress = MJstr3KeyPress
end
end end
object MovePanel1: TMovePanel object MovePanel1: TMovePanel
Left = 618 Left = 618

View File

@ -1,7 +1,7 @@
unit U_MJManageNewFDNew; unit U_MJManageNewFDNew;
interface interface
uses uses
Windows, Messages, SysUtils, Variants, math, Classes, Graphics, Controls, Windows, Messages, SysUtils, Variants, math, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, Forms, Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
@ -23,7 +23,7 @@ uses
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
dxSkinXmas2008Blue, dxSkinscxPCPainter; dxSkinXmas2008Blue, dxSkinscxPCPainter, XMLDoc, XMLIntf, DateUtils;
type type
TfrmMJManageNewFDNewSF = class(TForm) TfrmMJManageNewFDNewSF = class(TForm)
@ -270,6 +270,8 @@ type
CDS_HZ: TClientDataSet; CDS_HZ: TClientDataSet;
ADOQueryCmd: TADOQuery; ADOQueryCmd: TADOQuery;
ADOQueryTemp: TADOQuery; ADOQueryTemp: TADOQuery;
Label53: TLabel;
edtaixun: TEdit;
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject); procedure TBCloseClick(Sender: TObject);
@ -329,6 +331,7 @@ type
procedure TBCDClick(Sender: TObject); procedure TBCDClick(Sender: TObject);
procedure Edit5Click(Sender: TObject); procedure Edit5Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject); procedure ToolButton1Click(Sender: TObject);
procedure edtaixunClick(Sender: TObject);
private private
{ Private declarations } { Private declarations }
FInt, PState, PrintInt, SCInitGrid, FState, FCK: Integer; FInt, PState, PrintInt, SCInitGrid, FState, FCK: Integer;
@ -350,6 +353,7 @@ type
procedure SavedataCK(); procedure SavedataCK();
procedure PrtData(FMJID: string); procedure PrtData(FMJID: string);
procedure PrtBaoData(FBaoid: string); procedure PrtBaoData(FBaoid: string);
procedure PrtAiXunData(FMJID: string); //打印爱迅卷标签
procedure OpenCom(DllName: string); procedure OpenCom(DllName: string);
procedure CloseCom(DllName: string); procedure CloseCom(DllName: string);
procedure On1201(var Message: Tmessage); message 1201; procedure On1201(var Message: Tmessage); message 1201;
@ -1593,7 +1597,7 @@ begin
application.MessageBox('长度或者重量不能都为零!', '提示信息', 0); application.MessageBox('长度或者重量不能都为零!', '提示信息', 0);
exit; exit;
end; end;
if (strtofloatdef(trim(MJMaoZ.Text), 0) < 5) then if (strtofloatdef(trim(MJMaoZ.Text), 0) < 5) then
begin begin
application.MessageBox('重量不能小于5请检查下称的数据', '提示信息', 0); application.MessageBox('重量不能小于5请检查下称的数据', '提示信息', 0);
exit; exit;
@ -1668,7 +1672,7 @@ begin
sql.Add('select * from JYorder_Sub where Subid=''' + Trim(FSubId) + ''' and isnull(Slbname,'''')<>'''' '); sql.Add('select * from JYorder_Sub where Subid=''' + Trim(FSubId) + ''' and isnull(Slbname,'''')<>'''' ');
Open; Open;
end; end;
if ADOTmp.IsEmpty then if ADOTmp.IsEmpty then
begin begin
PlaySound('wav\没有设置标签.wav', 0, SND_FILENAME or SND_ASYNC); PlaySound('wav\没有设置标签.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox('没有设置标签', '提示', 0); Application.MessageBox('没有设置标签', '提示', 0);
@ -1730,7 +1734,10 @@ begin
begin begin
PrtData(FFFMJID); PrtData(FFFMJID);
end; end;
if Trim(edtaixun.Text) = '√' then
begin
PrtAiXunData(FFFMJID);
end;
if Trim(Edit6.Text) = '√' then if Trim(Edit6.Text) = '√' then
begin begin
if (fbaotype = '手动打包') or (fbaotype = '') then if (fbaotype = '手动打包') or (fbaotype = '') then
@ -1776,6 +1783,73 @@ begin
end; end;
procedure TfrmMJManageNewFDNewSF.PrtAiXunData(FMJID: string);
var
xml: TXmlDocument;
xmlNode: IxmlNode;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_Print_JYLab ');
SQL.Add(' @MJID=''' + Trim(FMJID) + '''');
Open;
end;
xml := TXmlDocument.Create(nil);
try
xml.Active := True;
// xml.Version := '1.0';
// xml.Encoding := 'UTF-8';
xml.DocumentElement := xml.CreateElement('Barcode', '');
/////////////////////////////XML模板/////////////////////////////////////////////
xmlNode := xml.DocumentElement.AddChild('TemplateNumber');
xmlNode.ChildNodes.Add(xml.CreateNode('030', ntText)); //模板编号
xmlNode := xml.DocumentElement.AddChild('BarcodeTitle');
xmlNode.ChildNodes.Add(xml.CreateNode('WX', ntText)); //抬头
xmlNode := xml.DocumentElement.AddChild('ProductName');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('Prtcodename').AsString), ntText)); //品名
xmlNode := xml.DocumentElement.AddChild('ColorCode');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('PRTColor').AsString), ntText)); //颜色
xmlNode := xml.DocumentElement.AddChild('ColorNumber');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('MJStr4').AsString), ntText)); //缸号
xmlNode := xml.DocumentElement.AddChild('BatchNO');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('MJStr4').AsString), ntText));
xmlNode := xml.DocumentElement.AddChild('VolumeNumber');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('MJXH').AsString), ntText)); //卷号
xmlNode := xml.DocumentElement.AddChild('Breadth');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('PRTMF').AsString), ntText)); //幅宽
xmlNode := xml.DocumentElement.AddChild('Grammage');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('PRTKZ').AsString), ntText)); //克重
xmlNode := xml.DocumentElement.AddChild('Quantity');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('MJMaoZ').AsString), ntText)); //数量
xmlNode := xml.DocumentElement.AddChild('ProductUnit');
// xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('MJTypeOther').AsString), ntText));
xmlNode.ChildNodes.Add(xml.CreateNode('KG', ntText)); //单位
xmlNode := xml.DocumentElement.AddChild('Remark');
xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('MJID').AsString), ntText)); //卷条码
// xmlNode := xml.DocumentElement.AddChild('Remark');
// xmlNode.ChildNodes.Add(xml.CreateNode(Trim(ADOQueryPrint.FieldByName('MJLen').AsString), ntText)); //备注
xml.SaveToFile('D:\aixun\' + inttostr(DateTimeToUnix(Now)) + '.xml');
// xml.SaveToFile('D:\aixun1\' + inttostr(DateTimeToUnix(Now)) + '.xml');
finally
xmlNode := nil;
xml.Free;
end;
end;
procedure TfrmMJManageNewFDNewSF.PrtData(FMJID: string); procedure TfrmMJManageNewFDNewSF.PrtData(FMJID: string);
var var
fPrintFile: string; fPrintFile: string;
@ -3026,8 +3100,15 @@ begin
if CDS_MJID.IsEmpty then if CDS_MJID.IsEmpty then
Exit; Exit;
MggCDFalg := '99'; MggCDFalg := '99';
if Trim(Edit6.Text) = '√' then
PrtData(Trim(CDS_MJID.fieldbyname('MJID').AsString)); begin
PrtData(Trim(CDS_MJID.fieldbyname('MJID').AsString));
end;
// PrtData(Trim(CDS_MJID.fieldbyname('MJID').AsString));
if Trim(edtaixun.Text) = '√' then
begin
PrtAiXunData(Trim(CDS_MJID.fieldbyname('MJID').AsString));
end;
Label16.Caption := ''; Label16.Caption := '';
BTAdd.Click; BTAdd.Click;
MJLen.SetFocus; MJLen.SetFocus;
@ -3070,7 +3151,7 @@ begin
Open; Open;
end; end;
SCreateCDS20(ADOQueryTemp, CDS_HZ); SCreateCDS20(ADOQueryTemp, CDS_HZ);
SInitCDSData20(ADOQueryTemp, CDS_HZ); SInitCDSData20(ADOQueryTemp, CDS_HZ);
with ADOQueryPrint do with ADOQueryPrint do
begin begin
@ -3097,5 +3178,17 @@ begin
end; end;
end; end;
procedure TfrmMJManageNewFDNewSF.edtaixunClick(Sender: TObject);
begin
if Trim(edtaixun.Text) = '' then
begin
edtaixun.Text := '√';
end
else
begin
edtaixun.Text := '';
end;
end;
end. end.