From 01cc5773457f68274ef1b2d9d9daca8983761828 Mon Sep 17 00:00:00 2001
From: 杨前锦 <1010338399@qq.com>
Date: 星期四, 05 六月 2025 17:33:03 +0800
Subject: [PATCH] 佳通bug优化

---
 HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/WmsController.cs |  257 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 257 insertions(+), 0 deletions(-)

diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/WmsController.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/WmsController.cs
new file mode 100644
index 0000000..9aa224c
--- /dev/null
+++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/WmsController.cs
@@ -0,0 +1,257 @@
+锘�+using HH.WCS.Mobox3.FJJT.wms;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Web.Http;
+using static HH.WCS.Mobox3.FJJT.api.ApiHelper;
+using static HH.WCS.Mobox3.FJJT.api.ApiModel;
+using static HH.WCS.Mobox3.FJJT.util.ExcetionHelper;
+
+namespace HH.WCS.Mobox3.FJJT.api
+{
+    /// <summary>
+    /// 绗笁鏂硅皟鐢ㄧ殑鎺ュ彛
+    /// </summary>
+    /*[RoutePrefix("api")]*/
+    public class WmsController : System.Web.Http.ApiController
+    {
+        /// <summary>
+        /// 1.绌哄伐瑁呭嚭搴�+        /// 涓氬姟鍦烘櫙锛�+        /// 1.鐩磋繛娴佺▼鍒濆鍖栵紝琛ュ厖绌哄伐瑁�+        /// 2.闈炵洿杩炴祦绋嬶紝鍥哄畾绔欏彴鑷姩琛ュ厖绌哄伐瑁�+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+       /* [Route("emptyPalletOutStock")]*/
+        public ResponseResult emptyPalletOutStock(OutStockModel model)
+        {
+            LogHelper.Info("emptyPalletOutStock 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            ResponseResult responseResult = new ResponseResult();
+            try
+            {
+                responseResult = ApiHelper.emptyPalletOutStock(model);
+            }
+            catch (BusinessException be)
+            {
+                responseResult.code = 501;
+                responseResult.msg = be.Message;
+            }
+            catch (Exception ex) 
+            {
+                responseResult.code = 500;
+                responseResult.msg = $"WMS鍐呴儴閿欒锛岃鑱旂郴寮�彂浜哄憳澶勭悊";
+                WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, $"WMS鍐呴儴閿欒: 绌哄伐瑁呭嚭搴撻敊璇紝閿欒鍘熷洜锛歿ex.Message}");
+            }
+            
+            LogHelper.Info("emptyPalletOutStock 鍑哄弬锛� + JsonConvert.SerializeObject(responseResult), "WMS");
+            return responseResult;
+        }
+
+       
+        /// <summary>
+        /// 2.璁惧淇″彿鍙嶉
+        /// 涓氬姟鍦烘櫙锛�+        /// 1.涓嬬嚎璇锋眰锛屾満鍙扮敓浜у畬鎴愬悗锛屾弧鏂欏伐瑁呴�鍑烘満鍙版椂锛學CS涓嬪彂涓嬬嚎璇锋眰婊℃枡鍏ュ簱
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        /*[Route("notifyDeviceSignal")]*/
+        public ResponseResult notifyDeviceSignal(DeviceSignalFeedbackModel model) {
+            LogHelper.Info("notifyDeviceSignal 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            ResponseResult responseResult = new ResponseResult();
+            try
+            {
+                if (model.signalType == 1)  // 鐗╂枡涓嬬嚎鍏ュ簱璇锋眰
+                {
+                    OffLineRequest request = new OffLineRequest() { loc = model.loc, cntrNo = model.cntrNo, jtNo = model.deviceNo };
+                    responseResult = ApiHelper.offLineProcess(request);
+                }
+                else if (model.signalType == 3)  // 璇荤爜鍏ュ簱璇锋眰
+                {
+                    ReadCodeRequest request = new ReadCodeRequest() { loc = model.loc, cntrNo = model.cntrNo };
+                    responseResult = ApiHelper.readCodeProcess(request);
+                }
+                else if (model.signalType == 5)  // 寮傚父宸ヨ鍏ュ簱璇锋眰
+                {
+                    OffLineRequest request = new OffLineRequest() { loc = model.loc, cntrNo = model.cntrNo, jtNo = model.deviceNo };
+                    responseResult = ApiHelper.offLineProcess(request);
+                }
+            }
+            catch (BusinessException be)
+            {
+                responseResult.code = 501;
+                responseResult.msg = be.Message;
+            }
+            catch (Exception ex)
+            {
+                responseResult.code = 500;
+                responseResult.msg = $"WMS鍐呴儴閿欒锛岃鑱旂郴寮�彂浜哄憳澶勭悊";
+                WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, $"WMS鍐呴儴閿欒: 璁惧淇″彿鍙嶉閿欒锛岄敊璇師鍥狅細{ex.Message}");
+            }
+            LogHelper.Info("notifyDeviceSignal 鍑哄弬锛� + JsonConvert.SerializeObject(responseResult), "WMS");
+            return responseResult;
+        }
+
+        /// <summary>
+        /// 3.浠诲姟鐘舵�鍙嶉
+        /// 涓氬姟鍦烘櫙锛歐CS鍦ㄦ墽琛屼换鍔℃椂锛屽洖鎶ヤ换鍔$姸鎬�+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        /*[Route("notifyTaskStatus")]*/
+        public ResponseResult notifyTaskStatus(TaskStatusFeedbackModel model) {
+            LogHelper.Info("notifyTaskStatus 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            var result = ApiHelper.taskStatusFeedback(model);
+            LogHelper.Info("notifyTaskStatus 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS");
+            return result;
+        }
+
+        /// <summary>
+        /// 3.鐢宠缁堢偣
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+       /* [Route("applyDest")]*/
+        public ResponseResult applyDest(ApplyDestinationModel model)
+        {
+            LogHelper.Info("applyDest 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            var result = ApiHelper.applyDest(model);
+            LogHelper.Info("applyDest 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS");
+            return result;
+        }
+
+        /// <summary>
+        /// 4.鑾峰彇鎵樼洏鐗╂枡淇℃伅
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+       /* [Route("findTrayItemInfo")]*/
+        public ResponseResult findTrayItemInfo(FindTrayItemInfoModel model)
+        {
+            LogHelper.Info("findTrayItemInfo 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            var result = ApiHelper.findTrayItemInfo(model);
+            LogHelper.Info("findTrayItemInfo 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS");
+            return result;
+        }
+
+        /// <summary>
+        /// 5.璁惧鎶ヨ涓婃姤
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+       /* [Route("notifyAlarm")]*/
+        public ResponseResult notifyAlarm(DeviceAlertorFeedbackModel model)
+        {
+            LogHelper.Info("notifyAlarm 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            var result = ApiHelper.notifyAlarm(model);
+            LogHelper.Info("notifyAlarm 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS");
+            return result;
+        }
+
+        /// <summary>
+        /// 5.瑙g粦璐т綅
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+      /*  [Route("notifyAlarm")]*/
+        public ResponseResult unBindingLoc(LocModel model)
+        {
+            LogHelper.Info("UnBindingLoc 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            ResponseResult result = new ResponseResult();
+            LocationHelper.UnBindingLoc(model.locCode);
+            LogHelper.Info("UnBindingLoc 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS");
+            return result;
+        }
+
+        /// <summary>
+        /// 6.缁戝畾璐т綅
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        /*[Route("notifyAlarm")]*/
+        public ResponseResult bindingLoc(LocCntrModel model)
+        {
+            LogHelper.Info("BindingLoc 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            ResponseResult result = new ResponseResult();
+            LocationHelper.BindingLoc(model.locCode, new List<string>() { model.cntrCode });
+            LogHelper.Info("BindingLoc 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS");
+            return result;
+        }
+
+        /// <summary>
+        /// 7.鍒囨崲绔欏彴灞炴�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+       /* [Route("notifyAlarm")]*/
+        public ResponseResult switchStationAttribute(SwitchStationAttributeModel model)
+        {
+            LogHelper.Info("switchStationAttribute 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            ResponseResult result = new ResponseResult();
+            result = ApiHelper.switchStationAttribute(model);
+            LogHelper.Info("switchStationAttribute 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS");
+            return result;
+        }
+
+        /// <summary>
+        /// 8.WCS鍙嶉璐т綅鐘舵�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        /* [Route("notifyAlarm")]*/
+        public ResponseResult locStateFeedBack(LocStateFeedBackModel model)
+        {
+            LogHelper.Info("locStateFeedBack 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS");
+            ResponseResult result = new ResponseResult();
+            bool bo = ApiHelper.locStateFeedBack(model);
+            if (!bo) 
+            {
+                result.code = 201;
+            }
+            LogHelper.Info("locStateFeedBack 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS");
+            return result;
+        }
+
+        public class LocStateFeedBackModel 
+        {
+            public string reqId { get; set; }
+            public string reqTime { get; set; }
+            public string loc_code { get; set; } // 绔欏彴缂栫爜
+            public string type { get; set; } // 璇锋眰绫诲瀷 1 鍏佽鍙栬揣 2 鍏佽鏀捐揣
+            public string req_no { get; set; } // 绔欏彴缂栫爜
+        }
+
+        public class SwitchStationAttributeModel
+        {
+            public string reqId { get; set; }
+            public string reqTime { get; set; }
+            public string locCode { get; set; } // 绔欏彴缂栫爜
+            public string signalType { get; set; } // 1.agv涓婃枡妯″紡 2.浜哄伐妯″紡
+        }
+
+        public class LocCntrModel
+        {
+            public string locCode { get; set; }
+            public string cntrCode { get; set; }
+        }
+
+        public class OutStockModel
+        {
+            public string endLocCode { get; set; }
+            public string reqId { get; set; }
+            public string reqTime { get; set; }
+        }
+    }
+}

--
Gitblit v1.9.1