From b7308bba3d7ffad271ce7fc7a93c8c45d76be87d Mon Sep 17 00:00:00 2001 From: 杨前锦 <1010338399@qq.com> Date: 星期五, 13 六月 2025 17:21:03 +0800 Subject: [PATCH] 优化印尼佳通-硫化胚胎出入库逻辑策略优化 --- HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HanAo.cs | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 161 insertions(+), 0 deletions(-) diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HanAo.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HanAo.cs new file mode 100644 index 0000000..62db83c --- /dev/null +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HanAo.cs @@ -0,0 +1,161 @@ +锘縰sing HH.WCS.Mobox3.FJJT.util; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Web.Services.Description; + +namespace HH.WCS.Mobox3.FJJT.dispatch { + /// <summary> + /// 鍥借嚜璋冨害杈呭姪绫�+ /// </summary> + public class HanAo { + private static readonly HttpHelper apiHelper = new HttpHelper(); + private static readonly string baseUrl = Settings.HASeverUrl; + //private static readonly string logName = "hanao"; + + + public static bool CreateOrder(TaskInfoModel model) { + var msg = ""; + var result = true; + var request = JsonConvert.SerializeObject(model); + var response = apiHelper.Post(baseUrl + ":9001/wcs-admin/api/receive", request); + msg = $"[hanao-CreateOrder] request={request} response={response}"; + Console.WriteLine(msg); + if (response != "") { + try { + var dataResult = JsonConvert.DeserializeObject<HAResult>(response); + if (dataResult.code == "0") { + result = true; + } + } + catch (Exception ex) { + Console.WriteLine(ex.Message); + } + } + else { + msg = "[hanao-CreateOrder]鍒涘缓璁㈠崟澶辫触"; + Console.WriteLine(msg); + } + + LogHelper.Info(msg,"鏉ゥ"); + return result; + } + public static bool CancelOrder(CancelModel model) { + bool result = false; + string msg = ""; + var request = JsonConvert.SerializeObject(model); + var response = apiHelper.Post(baseUrl + ":9002/wcs-admin/api/cancel", request); + msg = $"[hanao-CancelOrder] request={request};response={response}"; + Console.WriteLine(msg); + if (response != "") { + var dataResult = JsonConvert.DeserializeObject<HAResult>(response); + if (dataResult.code == "0") { + result = true; + } + } + else { + msg = "[hanao-CancelOrder]鍙栨秷璁㈠崟澶辫触"; + Console.WriteLine(msg); + } + LogHelper.Info(msg, "鏉ゥ"); + return result; + } + public static bool QueryDevice(DeviceInfoModel model) { + bool result = false; + string msg = ""; + var request = JsonConvert.SerializeObject(model); + var response = apiHelper.Get(baseUrl + ":9003//wcs-admin/api/dvc-state/", request); + msg = $"[hanao-QueryDeviceResult] request={request};response={response}"; + Console.WriteLine(msg); + if (response != "") { + var dataResult = JsonConvert.DeserializeObject<HAResult>(response); + if (dataResult.code == "0") { + result = true; + } + } + else { + msg = "[hanao-QueryOrderResult]鏌ヨ璁㈠崟淇℃伅澶辫触"; + Console.WriteLine(msg); + } + LogHelper.Info(msg, "鏉ゥ"); + return result; + } + + + public class TaskInfoModel { + /// <summary> + /// 璇锋眰pk + /// </summary> + public string requestPk { get; set; } + /// <summary> + /// 鎵樼洏鏉$爜 + /// </summary> + public string contNo { get; set; } + /// <summary> + /// 鎵樼洏绫诲瀷 + /// </summary> + public string contType { get; set; } = ""; + /// <summary> + /// 浠诲姟绫诲瀷 1-鍏ュ簱 2-鍑哄簱 3-绉诲簱 + /// </summary> + public string trkType { get; set; } + /// <summary> + /// 1-999锛堝�瓒婂ぇ浼樺厛绾ц秺楂橈級 + /// </summary> + public string trkPrty { get; set; } = "1"; + public string frmPos { get; set; } + public string toPos { get; set; } + public string noticeInfo { get; set; } = ""; + /// <summary> + /// 0-绌烘墭鐩�1-瀹炵墿 + /// </summary> + public string isFull { get; set; } = "0"; + public string groupNo { get; set; } = ""; + public string clientCode { get; set; } = "WMS"; + /// <summary> + /// 鏍煎紡锛�022-11-11 11:32:08 + /// </summary> + public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + } + public class HAResult { + public string code { get; set; } + public string msg { get; set; } + public string requestPk { get; set; } + } + public class CancelModel { + public string requestPk { get; set; } + public string contNo { get; set; } + public string clientCode { get; set; } + public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + public class DeviceInfoModel { + public string requestPk { get; set; } + public string dvcNo { get; set; } + public string clientCode { get; set; } + public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + public class TaskStateInfoModel { + public string requestPk { get; set; } + public string contNo { get; set; } + /// <summary> + /// 鍙屾柟绯荤粺鍏卞悓瀹氫箟 1-鍏ュ簱 2-鍑哄簱 3-绉诲簱 锛堝悗缁鏈夊鍔犲啀鍗忓畾锛�+ /// </summary> + public string noticeType { get; set; } + public string curPos { get; set; } + public string noticeInfo { get; set; } + /// <summary> + /// 0-鎴愬姛 锛堝叆搴撲笂鏋跺畬鎴�鍑哄簱涓嬫灦瀹屾垚/搴撳唴绉诲簱瀹屾垚锛氱Щ搴撳彧涓婃姤鏈�粓绉诲簱涓婃灦锛�鎴�鍏朵粬-寮傚父鐮�鍙嶉鐩稿叧缁撴灉鍘熷洜锛學MS鏍规嵁鎯呭喌澶勭悊 + /// 1-鍏ュ簱鏈夎揣 2-鍏ヨ繙杩戞湁璐�3-鍑哄簱鏃犺揣 4-鍑鸿繙杩戞湁璐� + /// </summary> + public string code { get; set; } + public string result { get; set; } + public string clientCode { get; set; } + public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + + } + + +} + -- Gitblit v1.9.1