Browse Source

1、2、3车间托盘库存判断;13、14车间任务取消时记录

Administrator 2 years ago
parent
commit
1c46219013

BIN
DLL/PLC.Siemens.dll


+ 1 - 0
Projects/永冠/WCS.Service/WebApi/WMS/Request/GetProductInfoRequest.cs

@@ -9,5 +9,6 @@ namespace WCS.Service.Entity
     public class GetProductInfoRequest
     {
         public string BarCode { get; set; }
+        public bool IsOk { get; set; }
     }
 }

+ 31 - 2
Projects/永冠/WCS.Service/WebApi/WMS/WMS.cs

@@ -3,6 +3,8 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
+using WCS.Core;
+using WCS.Entity.Protocol;
 using WCS.Service.Entity;
 using WCS.Service.Helpers;
 
@@ -90,7 +92,7 @@ namespace WCS.Service
                 throw new Exception(res.First().ResMessage);
         }
 
-        public static GetProductInfoResponse GetProductInfo(string barcode, string dev)
+        public static GetProductInfoResponse GetProductInfo(string barcode, string dev,bool isok = false)
         {
             var res = APICaller.CallApi<GetProductInfoResponse>(Url + "/api/Task/GetProductInfo", new GetProductInfoRequest
             {
@@ -99,7 +101,34 @@ namespace WCS.Service
             try
             {
                 if (!res.ResType)
-                    throw new Exception(res.ResMessage);
+                    if (res.ResMessage.Contains("请联系仓库"))
+                    {
+                        var tpType = res.Memo3;//
+                        if (tpType == "1")//2195
+                        {
+                            var station_2195 = Device.Find("2195").Device<IStation521, IStation520>();
+                            if (station_2195.Data.PH_STATUS && station_2195.Data.PH_STATUS2)
+                                WMS.GetProductInfo(barcode, dev, true);
+                        }
+                        else if (tpType == "2")//2198   2192
+                        {
+                            var muTP = Device.Find("2192", "2198").Select(v => v.Device<IStation521, IStation520>());
+                            if (muTP.Any(v => v.Data.PH_STATUS && v.Data.PH_STATUS2))
+                            {
+                                WMS.GetProductInfo(barcode, dev, true);
+                            }
+                        }
+                        else if (tpType == "3")//2201 
+                        {
+                            var station_2201 = Device.Find("2201").Device<IStation521, IStation520>();
+                            if (station_2201.Data.PH_STATUS && station_2201.Data.PH_STATUS2)
+                                WMS.GetProductInfo(barcode, dev, true);
+                        }
+                    }
+                    else 
+                    {
+                        throw new Exception(res.ResMessage);
+                    }                   
                 if (res.ChildContainerType <= 0 || res.ChildContainerType > 9)
                     throw new Exception("托盘类型错误");
                 if (res.LoadCount <= 0)

+ 1 - 0
Projects/永冠/WCS.Service/Works/Stations/成品车间.cs

@@ -101,6 +101,7 @@ namespace WCS.Service.Works.Stations
                 db.Default.SaveChanges();
 
                 var info = WMS.GetProductInfo(barcode, dev.Entity.CODE);
+
                 if (workShop > 0 && workShop < 4)
                 {
                     addr = info.IsLeft == 1 ? 2161 : 2153;

+ 1 - 0
Projects/永冠/WCS.Service/Works/Stations/车间出入口.cs

@@ -288,6 +288,7 @@ namespace WCS.Service.Works.Stations
                     task.STATUS = WCS.Entity.TaskStatus.已取消;
                     task.UPDATETIME = DateTime.Now;
                     db.Default.SaveChanges();
+                    task.CreateStatusLog(db, $"任务[{task.ID}]取消,检测值[{dev.Data.HEIGHT}]");
                 }
 
                 dev.Data2.TASKNUM = task.ID;