2 Commits c9f648c96d ... 6271ee1ce4

Author SHA1 Message Date
  陈子杰 6271ee1ce4 Merge branch '75豪德众益洋智能家居' of http://www.imaodou.com.cn:30030/c_jack/EICP3.0_69 into 75豪德众益洋智能家居 4 months ago
  陈子杰 d6484fb695 滚线增加Mes报工对接 4 months ago

+ 237 - 0
SCADA_DAQ/Customer/Models/MesModel.cs

@@ -0,0 +1,237 @@
+using Newtonsoft.Json;
+using SCADA.CommonLib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SCADA_DAQ.Customer.Models
+{
+    public class MesModel : ObservableObject
+    {
+
+        /// <summary>
+        /// 条码
+        /// </summary>
+        public string barCode
+        {
+            get { return _barCode; }
+            set
+            {
+                if (value != _barCode)
+                {
+                    _barCode = value;
+                    OnPropertyChanged(nameof(barCode));
+                }
+            }
+        }
+        private string _barCode;
+
+        /// <summary>
+        /// 设备编号
+        /// </summary>
+        /// 
+        [AutoViewProperty("设备编号",Icon = "SlotMachine")]
+        public string station
+        {
+            get { return _station; }
+            set
+            {
+                if (value != _station)
+                {
+                    _station = value;
+                    OnPropertyChanged(nameof(station));
+                }
+            }
+        }
+        private string _station;
+
+
+        /// <summary>
+        /// 公司ID
+        /// </summary>
+        /// 
+        [AutoViewProperty("公司ID", Icon = "Domain")]
+
+        public string companyId
+        {
+            get { return _companyId; }
+            set
+            {
+                if (value != _companyId)
+                {
+                    _companyId = value;
+                    OnPropertyChanged(nameof(companyId));
+                }
+            }
+        }
+        private string _companyId;
+
+
+        /// <summary>
+        /// 明细作业
+        /// </summary>
+        /// 
+        [AutoViewProperty("明细作业", Icon = "Opera")]
+
+        public string detailOperation
+        {
+            get { return _detailOperation; }
+            set
+            {
+                if (value != _detailOperation)
+                {
+                    _detailOperation = value;
+                    OnPropertyChanged(nameof(detailOperation));
+                }
+            }
+        }
+        private string _detailOperation;
+
+
+        /// <summary>
+        /// 车间号
+        /// </summary>
+        /// 
+        [AutoViewProperty("车间号", Icon = "Warehouse")]
+
+        public string workShopId
+        {
+            get { return _workShopId; }
+            set
+            {
+                if (value != _workShopId)
+                {
+                    _workShopId = value;
+                    OnPropertyChanged(nameof(workShopId));
+                }
+            }
+        }
+        private string _workShopId;
+
+
+        /// <summary>
+        /// 结束时间
+        /// </summary>
+        public DateTime finishTime
+        {
+            get { return _finishTime; }
+            set
+            {
+                if (value != _finishTime)
+                {
+                    _finishTime = value;
+                    OnPropertyChanged(nameof(finishTime));
+                }
+            }
+        }
+        private DateTime _finishTime;
+
+
+        /// <summary>
+        /// 开始时间
+        /// </summary>
+        public DateTime startTime
+        {
+            get { return _startTime; }
+            set
+            {
+                if (value != _startTime)
+                {
+                    _startTime = value;
+                    OnPropertyChanged(nameof(startTime));
+                }
+            }
+        }
+        private DateTime _startTime;
+
+
+        /// <summary>
+        /// 工单号
+        /// </summary>
+        public string workId
+        {
+            get { return _workId; }
+            set
+            {
+                if (value != _workId)
+                {
+                    _workId = value;
+                    OnPropertyChanged(nameof(workId));
+                }
+            }
+        }
+        private string _workId;
+
+    }
+
+    /// <summary>
+    /// 报工接口返回
+    /// </summary>
+    public class ResultMesModel : ObservableObject
+    {
+
+        /// <summary>
+        /// 状态码
+        /// </summary>
+        /// 
+        [JsonProperty("code")]
+        public int code
+        {
+            get { return _code; }
+            set
+            {
+                if (value != _code)
+                {
+                    _code = value;
+                    OnPropertyChanged(nameof(code));
+                }
+            }
+        }
+        private int _code;
+
+
+        /// <summary>
+        /// 返回结果
+        /// </summary>
+        /// 
+        [JsonProperty("result")]
+
+        public bool result
+        {
+            get { return _result; }
+            set
+            {
+                if (value != _result)
+                {
+                    _result = value;
+                    OnPropertyChanged(nameof(result));
+                }
+            }
+        }
+        private bool _result;
+
+
+        /// <summary>
+        /// 返回消息
+        /// </summary>
+        /// 
+        [JsonProperty("message")]
+
+        public string message
+        {
+            get { return _message; }
+            set
+            {
+                if (value != _message)
+                {
+                    _message = value;
+                    OnPropertyChanged(nameof(message));
+                }
+            }
+        }
+        private string _message;
+
+    }
+}

+ 22 - 10
SCADA_DAQ/Customer/Service/ScannerService.cs

@@ -1,5 +1,6 @@
 using SCADA;
 using SCADA.Comm;
+using SCADA.CommonCtrl;
 using SCADA.CommonLib;
 using SCADA.CommonLib.Helper;
 using SCADA.CommonLib.Service;
@@ -108,7 +109,7 @@ namespace SCADA_DAQ.Customer.Service
 
             var barcodeTask = BoardTasks.Where(t => t.BoardID == barcode).FirstOrDefault();
             var api = new WebApiHelper(_ScannerServiceConfig.Url);
-            if (barcode != "NoRead" &&  (barcodeTask != null && Math.Min(barcodeTask.Width,barcodeTask.Height) > 250))
+            if (barcode != "NoRead" &&  (barcodeTask != null && Math.Min(barcodeTask.Width,barcodeTask.Height) > 150))
             {
                 //先判断是否异型 
                 if (barcodeTask.IsAbnormalShape)
@@ -139,12 +140,7 @@ namespace SCADA_DAQ.Customer.Service
 
                         });
                         Plc1.GetListenReg(SortingDeliveryMachine.Tag_CodeMatch).WriteReg(1);
-                        var mesApi = new WebApiHelper(_ScannerServiceConfig.MesUrl);
-                        var mesResult = mesApi.POST<CodeApiModel>(new { panelCode = barcode });
-                        if (mesResult.Data != null && mesResult.Data.success == true)
-                        {
-                            Log.Info("Mes接口调用成功");
-                        }
+                        
                     }
                     else
                     {
@@ -153,8 +149,6 @@ namespace SCADA_DAQ.Customer.Service
                         Plc1.GetListenReg(SortingDeliveryMachine.Tag_CodeMatch).WriteReg(2);
                         //Plc1.GetListenReg(SortingDeliveryMachine.Tag_IsLeftovers).WriteReg(1);
                         Plc1.LeftLoversOrAbnormal.Enqueue(1);
-
-
                     }
                 }
 
@@ -165,7 +159,7 @@ namespace SCADA_DAQ.Customer.Service
                 //Plc1.GetListenReg(SortingDeliveryMachine.Tag_IsLeftovers).WriteReg(1);
                 Plc1.LeftLoversOrAbnormal.Enqueue(1);
 
-                Log.Info($"没有获取到条码或尺寸小于250");
+                Log.Info($"没有获取到条码或尺寸小于150");
             }
             
             
@@ -213,5 +207,23 @@ namespace SCADA_DAQ.Customer.Service
             Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;
             return base.Stop();
         }
+
+        public void MesUpLoad(string barcode)
+        {
+            var mesApi = new WebApiHelper(_ScannerServiceConfig.MesUrl);
+            _ScannerServiceConfig.MesSetting.barCode = barcode;
+            _ScannerServiceConfig.MesSetting.finishTime = DateTime.Now;
+            //_ScannerServiceConfig.MesSetting.workId = Env.DAL.App_Hold_BoardInfo.GetData<BoardTaskModel>(t=>t.BoardID == barcode).Select(t=>t.OrderNo);
+
+            var mesResult = mesApi.POST<ResultMesModel>(_ScannerServiceConfig.MesSetting);
+            if (mesResult.Data != null && mesResult.Data.result == true)
+            {
+                Log.Info("Mes报工接口调用成功!");
+            }
+            else
+            {
+                Log.Info("Mes报工接口调用失败!");
+            }
+        }
     }
 }

+ 35 - 3
SCADA_DAQ/Customer/Service/ScannerServiceConfig.cs

@@ -1,4 +1,5 @@
 using SCADA.CommonLib;
+using SCADA_DAQ.Customer.Models;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -12,12 +13,11 @@ namespace SCADA_DAQ.Customer.Service
     /// </summary>
     public class ScannerServiceConfig : ObservableObject
     {
-
         /// <summary>
         /// 接口地址
         /// </summary>
         /// 
-        [AutoViewProperty("接口Url",Icon = "Api")]
+        [AutoViewProperty("缓存仓Url",Icon = "Api")]
         public string Url
         {
             get { return _Url; }
@@ -32,7 +32,13 @@ namespace SCADA_DAQ.Customer.Service
         }
         private string _Url;
 
-        [AutoViewProperty("Mes接口Url", Icon = "Api")]
+
+        /// <summary>
+        /// mesUrl
+        /// </summary>
+        /// 
+        [AutoViewProperty("MesUrl", Icon = "Api")]
+
         public string MesUrl
         {
             get { return _MesUrl; }
@@ -47,5 +53,31 @@ namespace SCADA_DAQ.Customer.Service
         }
         private string _MesUrl;
 
+
+
+        /// <summary>
+        /// Mes数据
+        /// </summary>
+        /// 
+        [AutoViewProperty("Mes报工接口参数", Icon = "Api")]
+
+        public MesModel MesSetting
+        {
+            get { return _MesSetting; }
+            set
+            {
+                if (value != _MesSetting)
+                {
+                    _MesSetting = value;
+                    OnPropertyChanged(nameof(MesSetting));
+                }
+            }
+        }
+        private MesModel _MesSetting;
+
+
+
+
+
     }
 }

+ 0 - 9
SCADA_DAQ/Customer/Views/Menu/UctFrmSorting/UctFrmSortingMain.xaml.cs

@@ -80,15 +80,6 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
             ShowFlag.DataContext = plc.GetListenReg(SortMachine.Tag_RunStateFlag);
             CameraBtn.DataContext = plc.GetListenReg(SortMachine.Tag_CameraEnable);
             plc.BaseDevice.RegReadValueChanged += BaseDevice_RegReadValueChanged;
-            plc.BaseDevice.PropertyChanged += BaseDevice_PropertyChanged;
-        }
-
-        private void BaseDevice_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
-        {
-            if (e.PropertyName == "IsAlarm")
-            {
-
-            }
         }