Commit 3803bfa9 by zxw

通道监管模式

parent 96779470
...@@ -105,5 +105,6 @@ namespace JmpCommon ...@@ -105,5 +105,6 @@ namespace JmpCommon
public bool IsPushShelfPrint { get; set; } public bool IsPushShelfPrint { get; set; }
public int PushShelfPrintType { get; set; } public int PushShelfPrintType { get; set; }
public string PushShelfPrintCom { get; set; } public string PushShelfPrintCom { get; set; }
public bool IsEnableMonitorMode { get; set; }
} }
} }
...@@ -52,6 +52,9 @@ namespace JmpServiceMgr ...@@ -52,6 +52,9 @@ namespace JmpServiceMgr
this.txtDomain = new DevComponents.DotNetBar.Controls.TextBoxX(); this.txtDomain = new DevComponents.DotNetBar.Controls.TextBoxX();
this.label10 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox(); this.groupBox5 = new System.Windows.Forms.GroupBox();
this.lb_shelfPrintType = new System.Windows.Forms.Label();
this.lb_shelfPrintCom = new System.Windows.Forms.Label();
this.cbb_shelfPrintType = new System.Windows.Forms.ComboBox();
this.chk_syncCard = new DevComponents.DotNetBar.Controls.CheckBoxX(); this.chk_syncCard = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.cbb_shelfPrintCom = new System.Windows.Forms.ComboBox(); this.cbb_shelfPrintCom = new System.Windows.Forms.ComboBox();
this.chk_pushShelfPrint = new DevComponents.DotNetBar.Controls.CheckBoxX(); this.chk_pushShelfPrint = new DevComponents.DotNetBar.Controls.CheckBoxX();
...@@ -70,9 +73,7 @@ namespace JmpServiceMgr ...@@ -70,9 +73,7 @@ namespace JmpServiceMgr
this.superTabItem2 = new DevComponents.DotNetBar.SuperTabItem(); this.superTabItem2 = new DevComponents.DotNetBar.SuperTabItem();
this.superTabControlPanel1 = new DevComponents.DotNetBar.SuperTabControlPanel(); this.superTabControlPanel1 = new DevComponents.DotNetBar.SuperTabControlPanel();
this.superTabItem1 = new DevComponents.DotNetBar.SuperTabItem(); this.superTabItem1 = new DevComponents.DotNetBar.SuperTabItem();
this.cbb_shelfPrintType = new System.Windows.Forms.ComboBox(); this.chkMonitorMode = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.lb_shelfPrintCom = new System.Windows.Forms.Label();
this.lb_shelfPrintType = new System.Windows.Forms.Label();
this.groupBox4.SuspendLayout(); this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout(); this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).BeginInit();
...@@ -357,6 +358,7 @@ namespace JmpServiceMgr ...@@ -357,6 +358,7 @@ namespace JmpServiceMgr
// groupBox5 // groupBox5
// //
this.groupBox5.BackColor = System.Drawing.Color.White; this.groupBox5.BackColor = System.Drawing.Color.White;
this.groupBox5.Controls.Add(this.chkMonitorMode);
this.groupBox5.Controls.Add(this.lb_shelfPrintType); this.groupBox5.Controls.Add(this.lb_shelfPrintType);
this.groupBox5.Controls.Add(this.lb_shelfPrintCom); this.groupBox5.Controls.Add(this.lb_shelfPrintCom);
this.groupBox5.Controls.Add(this.cbb_shelfPrintType); this.groupBox5.Controls.Add(this.cbb_shelfPrintType);
...@@ -380,6 +382,39 @@ namespace JmpServiceMgr ...@@ -380,6 +382,39 @@ namespace JmpServiceMgr
this.groupBox5.TabStop = false; this.groupBox5.TabStop = false;
this.groupBox5.Text = "其他设置"; this.groupBox5.Text = "其他设置";
// //
// lb_shelfPrintType
//
this.lb_shelfPrintType.AutoSize = true;
this.lb_shelfPrintType.Location = new System.Drawing.Point(26, 343);
this.lb_shelfPrintType.Name = "lb_shelfPrintType";
this.lb_shelfPrintType.Size = new System.Drawing.Size(75, 15);
this.lb_shelfPrintType.TabIndex = 28;
this.lb_shelfPrintType.Text = "接入类型:";
//
// lb_shelfPrintCom
//
this.lb_shelfPrintCom.AutoSize = true;
this.lb_shelfPrintCom.Location = new System.Drawing.Point(198, 343);
this.lb_shelfPrintCom.Name = "lb_shelfPrintCom";
this.lb_shelfPrintCom.Size = new System.Drawing.Size(39, 15);
this.lb_shelfPrintCom.TabIndex = 27;
this.lb_shelfPrintCom.Text = "COM:";
//
// cbb_shelfPrintType
//
this.cbb_shelfPrintType.BackColor = System.Drawing.Color.White;
this.cbb_shelfPrintType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbb_shelfPrintType.ForeColor = System.Drawing.Color.Black;
this.cbb_shelfPrintType.FormattingEnabled = true;
this.cbb_shelfPrintType.Items.AddRange(new object[] {
"COM",
"MQTT"});
this.cbb_shelfPrintType.Location = new System.Drawing.Point(107, 340);
this.cbb_shelfPrintType.Name = "cbb_shelfPrintType";
this.cbb_shelfPrintType.Size = new System.Drawing.Size(56, 23);
this.cbb_shelfPrintType.TabIndex = 26;
this.cbb_shelfPrintType.SelectedIndexChanged += new System.EventHandler(this.cbb_shelfPrintType_SelectedIndexChanged);
//
// chk_syncCard // chk_syncCard
// //
this.chk_syncCard.BackColor = System.Drawing.Color.White; this.chk_syncCard.BackColor = System.Drawing.Color.White;
...@@ -660,38 +695,20 @@ namespace JmpServiceMgr ...@@ -660,38 +695,20 @@ namespace JmpServiceMgr
this.superTabItem1.Name = "superTabItem1"; this.superTabItem1.Name = "superTabItem1";
this.superTabItem1.Text = "superTabItem1"; this.superTabItem1.Text = "superTabItem1";
// //
// cbb_shelfPrintType // chkMonitorMode
// //
this.cbb_shelfPrintType.BackColor = System.Drawing.Color.White; this.chkMonitorMode.BackColor = System.Drawing.Color.White;
this.cbb_shelfPrintType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbb_shelfPrintType.ForeColor = System.Drawing.Color.Black;
this.cbb_shelfPrintType.FormattingEnabled = true;
this.cbb_shelfPrintType.Items.AddRange(new object[] {
"COM",
"MQTT"});
this.cbb_shelfPrintType.Location = new System.Drawing.Point(107, 340);
this.cbb_shelfPrintType.Name = "cbb_shelfPrintType";
this.cbb_shelfPrintType.Size = new System.Drawing.Size(56, 23);
this.cbb_shelfPrintType.TabIndex = 26;
this.cbb_shelfPrintType.SelectedIndexChanged += new System.EventHandler(this.cbb_shelfPrintType_SelectedIndexChanged);
//
// lb_shelfPrintCom
// //
this.lb_shelfPrintCom.AutoSize = true;
this.lb_shelfPrintCom.Location = new System.Drawing.Point(198, 343);
this.lb_shelfPrintCom.Name = "lb_shelfPrintCom";
this.lb_shelfPrintCom.Size = new System.Drawing.Size(39, 15);
this.lb_shelfPrintCom.TabIndex = 27;
this.lb_shelfPrintCom.Text = "COM:";
// //
// lb_shelfPrintType
// //
this.lb_shelfPrintType.AutoSize = true; this.chkMonitorMode.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lb_shelfPrintType.Location = new System.Drawing.Point(26, 343); this.chkMonitorMode.ForeColor = System.Drawing.Color.Black;
this.lb_shelfPrintType.Name = "lb_shelfPrintType"; this.chkMonitorMode.Location = new System.Drawing.Point(177, 39);
this.lb_shelfPrintType.Size = new System.Drawing.Size(75, 15); this.chkMonitorMode.Name = "chkMonitorMode";
this.lb_shelfPrintType.TabIndex = 28; this.chkMonitorMode.Size = new System.Drawing.Size(122, 23);
this.lb_shelfPrintType.Text = "接入类型:"; this.chkMonitorMode.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.chkMonitorMode.TabIndex = 29;
this.chkMonitorMode.Text = "启用监管模式";
// //
// FrmConfig // FrmConfig
// //
...@@ -770,5 +787,6 @@ namespace JmpServiceMgr ...@@ -770,5 +787,6 @@ namespace JmpServiceMgr
private System.Windows.Forms.Label lb_shelfPrintCom; private System.Windows.Forms.Label lb_shelfPrintCom;
private System.Windows.Forms.ComboBox cbb_shelfPrintType; private System.Windows.Forms.ComboBox cbb_shelfPrintType;
private System.Windows.Forms.Label lb_shelfPrintType; private System.Windows.Forms.Label lb_shelfPrintType;
private DevComponents.DotNetBar.Controls.CheckBoxX chkMonitorMode;
} }
} }
\ No newline at end of file
...@@ -209,6 +209,8 @@ namespace JmpServiceMgr ...@@ -209,6 +209,8 @@ namespace JmpServiceMgr
lb_shelfPrintCom.Enabled = false; lb_shelfPrintCom.Enabled = false;
cbb_shelfPrintCom.Enabled = false; cbb_shelfPrintCom.Enabled = false;
} }
chkMonitorMode.Checked = MyCache.SysConfig.IsEnableMonitorMode;
} }
private void btnColse_Click(object sender, EventArgs e) private void btnColse_Click(object sender, EventArgs e)
{ {
...@@ -340,6 +342,8 @@ namespace JmpServiceMgr ...@@ -340,6 +342,8 @@ namespace JmpServiceMgr
MyCache.SysConfig.PushShelfPrintCom = ""; MyCache.SysConfig.PushShelfPrintCom = "";
} }
MyCache.SysConfig.IsEnableMonitorMode = chkMonitorMode.Checked;
MyCache.SetSystemSetp(); MyCache.SetSystemSetp();
//settings.Save(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "settings.xml"); //settings.Save(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "settings.xml");
MessageBoxEx.Show(this, "配置保存成功,软件重启后生效!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBoxEx.Show(this, "配置保存成功,软件重启后生效!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
......
...@@ -28,6 +28,8 @@ using System.Web; ...@@ -28,6 +28,8 @@ using System.Web;
using System.Windows.Forms; using System.Windows.Forms;
using JmpServiceMgr.Helper; using JmpServiceMgr.Helper;
using MQTTnet.Client; using MQTTnet.Client;
using System.Collections;
using DevComponents.DotNetBar.Controls;
namespace JmpServiceMgr namespace JmpServiceMgr
{ {
...@@ -80,7 +82,14 @@ namespace JmpServiceMgr ...@@ -80,7 +82,14 @@ namespace JmpServiceMgr
notifyIcon.Text = MyCache.SysConfig?.AppTitle ?? "通道服务"; notifyIcon.Text = MyCache.SysConfig?.AppTitle ?? "通道服务";
//winHwnd = this.Handle; //winHwnd = this.Handle;
_unique = $"TD{MachineIdentity.GetFileIdentity()}"; _unique = $"TD{MachineIdentity.GetFileIdentity()}";
if (MyCache.SysConfig?.IsEnableMonitorMode == true)
{
SetLogs("初始化管理程序:监管模式");
}
else
{
SetLogs("初始化管理程序"); SetLogs("初始化管理程序");
}
SetLogs(_unique); SetLogs(_unique);
if (MyCache.SysConfig != null) if (MyCache.SysConfig != null)
...@@ -143,18 +152,39 @@ namespace JmpServiceMgr ...@@ -143,18 +152,39 @@ namespace JmpServiceMgr
} }
} }
public void SetLogs(string msg)
public void SetLogs(string msg, Color color = default)
{
if (color == default)
{ {
color = Color.Black;
}
this.Invoke((Action)delegate this.Invoke((Action)delegate
{ {
if (txt_log.Text.Length > 30000) if (txt_log.Text.Length > 30000)
{ {
txt_log.ResetText(); txt_log.ResetText();
} }
txt_log.Text = txt_log.Text.Insert(0, $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")} - {msg}\r\n");
var txt = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")} - {msg}\r\n";
//txt_log.Text = txt_log.Text.Insert(0, txt);
AppendTextColorful(txt_log, txt, color, false);
}); });
Application.DoEvents(); Application.DoEvents();
} }
private void AppendTextColorful(RichTextBox rtBox, string text, Color color, bool addNewLine)
{
if (addNewLine)
{
text += Environment.NewLine;
}
rtBox.SelectionStart = rtBox.TextLength;
rtBox.SelectionLength = 0;
rtBox.SelectionColor = color;
rtBox.AppendText(text);
rtBox.SelectionColor = rtBox.ForeColor;
}
private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e) private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{ {
this.Show(); this.Show();
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -287,7 +288,9 @@ namespace JmpServiceMgr.Helper ...@@ -287,7 +288,9 @@ namespace JmpServiceMgr.Helper
var pushRecordEpcList = request.RFIDList.ToList(); var pushRecordEpcList = request.RFIDList.ToList();
//剔除不受通道读取的物资(仅针对件标) if (!MyCache.SysConfig.IsEnableMonitorMode)
{
//剔除不受通道读取的物资(仅针对件标) 监管模式下不生效
if (string.IsNullOrEmpty(MyCache.ChannelCfg.channelReadEquTypeJson)) if (string.IsNullOrEmpty(MyCache.ChannelCfg.channelReadEquTypeJson))
{ {
//无配置,忽略 //无配置,忽略
...@@ -329,6 +332,7 @@ namespace JmpServiceMgr.Helper ...@@ -329,6 +332,7 @@ namespace JmpServiceMgr.Helper
} }
request.RFIDList.RemoveAll(x => removeEpcList.Contains(x.RFID)); request.RFIDList.RemoveAll(x => removeEpcList.Contains(x.RFID));
} }
}
#region 箱标 #region 箱标
...@@ -508,6 +512,70 @@ namespace JmpServiceMgr.Helper ...@@ -508,6 +512,70 @@ namespace JmpServiceMgr.Helper
} }
else else
{ {
if (MyCache.SysConfig.IsEnableMonitorMode)
{
//监管模式下不上报,只解析汇报
var equList = new List<EquipmentData>();
foreach (var epcInfo in request.RFIDList)
{
var buffer = EpcConvert.ToHexByte(epcInfo.RFID);
Analyzingepc info;
try
{
info = EpcConvert.EpcAnlysing(buffer);
}
catch (Exception e)
{
if (e.Message == "CRC校验失败")
{
//过滤crc校验失败的epc
Log.ErrorLog("过滤CRC校验失败的EPC:" + epcInfo.RFID);
continue;
}
throw;
}
var equ_info = MyCache.EquInfos?.FirstOrDefault(t => t.code == info.Wzdm.ToString("X"));
if (equ_info != null)
{
//有效物资,添加
var obj = equList.FirstOrDefault(x => x.Code == equ_info.code);
if (obj != null)
{
obj.Count++;
}
else
{
equList.Add(new EquipmentData
{
Code = equ_info.code,
Name = equ_info.name,
Count = 1
});
}
}
else
{
//无效物资,过滤
}
}
if (equList.Count > 0)
{
var message = (_state == 0 ? "出库:" : "入库:") +
string.Join(",", equList.Select(x => x.Name + x.Count + "件"));
_form.SetLogs(message, Color.Red);
XfVioceMsc.Text2Voice(message);
File.AppendAllText("Monitor.log", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "|" + message + "\r\n");
}
else
{
reader.GpiTrigger.SetEmpty();
_form.SetLogs("物资已被过滤");
}
}
else
{
//正常上报
//抓拍文件路径 //抓拍文件路径
var id = MyCache.ChannelCfg.warehouseId.Replace("-", ""); var id = MyCache.ChannelCfg.warehouseId.Replace("-", "");
var url = string.Empty; var url = string.Empty;
...@@ -571,6 +639,8 @@ namespace JmpServiceMgr.Helper ...@@ -571,6 +639,8 @@ namespace JmpServiceMgr.Helper
}); });
} }
_form.SetLogs(res?.Item3); _form.SetLogs(res?.Item3);
}
reader.GpiTrigger.SetEmpty(); reader.GpiTrigger.SetEmpty();
CamHelper.SnapClear(); CamHelper.SnapClear();
} }
...@@ -641,4 +711,10 @@ namespace JmpServiceMgr.Helper ...@@ -641,4 +711,10 @@ namespace JmpServiceMgr.Helper
} }
public class EquipmentData
{
public string Name { get; set; }
public string Code { get; set; }
public int Count { get; set; }
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论