| | |
| | | using HH.WCS.JiaTong.device; |
| | | using HH.WCS.JiaTong.dispatch; |
| | | using HH.WCS.JiaTong.LISTA.models; |
| | | using HH.WCS.JiaTong.process; |
| | | using HH.WCS.JiaTong.util; |
| | | using HH.WCS.JiaTong.wms; |
| | | using HH.WCS.JiaTong_DCJ.device; |
| | | using HH.WCS.JiaTong_DCJ.dispatch; |
| | | using HH.WCS.JiaTong_DCJ.LISTA.models; |
| | | using HH.WCS.JiaTong_DCJ.process; |
| | | using HH.WCS.JiaTong_DCJ.util; |
| | | using HH.WCS.JiaTong_DCJ.wms; |
| | | using Newtonsoft.Json; |
| | | using NLog.Fluent; |
| | | using S7.Net; |
| | |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using System.Web.UI.WebControls; |
| | | using static HH.WCS.JiaTong.api.ApiModel; |
| | | using static HH.WCS.JiaTong.api.OtherModel; |
| | | using static HH.WCS.JiaTong.LISTA.process.HttpModel; |
| | | using static HH.WCS.JiaTong.util.Settings; |
| | | using static HH.WCS.JiaTong_DCJ.api.ApiModel; |
| | | using static HH.WCS.JiaTong_DCJ.api.OtherModel; |
| | | using static HH.WCS.JiaTong_DCJ.LISTA.process.HttpModel; |
| | | using static HH.WCS.JiaTong_DCJ.util.Settings; |
| | | |
| | | namespace HH.WCS.JiaTong.api |
| | | namespace HH.WCS.JiaTong_DCJ.api |
| | | { |
| | | /// <summary> |
| | | /// apiæ¥å£è¾
å©ç±» |
| | |
| | | Location startloc = null; |
| | | lock (_lockCreateTask) |
| | | { |
| | | if (taskData.taskType == 1) //åºåºæµç¨ï¼éè¿ç©ææºå°è®¡ç®çº¿è¾¹è´§ä½ |
| | | { |
| | | note = "åºåº"; |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | //å建æçç©æç»å®ä¿¡æ¯ï¼å¹¶è®¡ç®ç»ç¹è´§ä½ |
| | | Start = taskData.pickStation; |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | { |
| | | endloc = Computeloc(CntrCode, taskData.dropStation, taskData.carrierType); |
| | | if (endloc != null) |
| | | { |
| | | End = endloc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æºå°ç¼ç :{taskData.dropStation}ï¼æªæ¾å°å¯ç¨è´§ä½"; |
| | | AddErrorInfo("寻æ¾åºåºè´§ä½å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | //endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | //if (endloc != null) |
| | | //{ |
| | | // End = taskData.dropStation; |
| | | //} |
| | | //else |
| | | //{ |
| | | // result.code = "1"; |
| | | // result.msg = $"æ ¹æ®ç»ç¹{End},æ¾ä¸å°å¯¹åºè´§ä½ï¼è¯·æ£æ¥è´§ä½è¡¨"; |
| | | // AddErrorInfo("è´§ä½æ¥æ¾å¤±è´¥", result.msg, Source); |
| | | // return result; |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "å建æçç©æä¿¡æ¯å¤±è´¥"; |
| | | AddErrorInfo("å建æç失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"Putin==> ä»»å¡èµ·ç¹:{taskData.pickStation}æ¾ä¸å°å¯¹åºè´§ä½ï¼è¯·æ£æ¥è´§ä½è¡¨"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("è´§ä½æ¥æ¾å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 2)//å
¥åºæµç¨ï¼ç´æ¥ä½¿ç¨èµ·ç¹è´§ä½åç»ç¹è´§ä½çæä»»å¡ï¼èµ·ç¹éè¦ææç |
| | | { |
| | | note = "å
¥åº"; |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = startloc.S_CODE; |
| | | var CntrRel = LocationHelper.GetLocCntrRel(startloc.S_CODE).OrderBy(a => a.T_CREATE).FirstOrDefault(); |
| | | if (CntrRel != null) |
| | | { |
| | | if (CntrRel.S_CNTR_CODE != partData.rfid) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æ ¹æ®èµ·ç¹ï¼{Start}è·åæç:{CntrRel.S_CNTR_CODE}ä¸ä¸åæçï¼{partData.rfid}ä¸ä¸è´ï¼è¯·æ£æ¥æçç æ¯å¦æ£ç¡®"; |
| | | AddErrorInfo("æçç æ ¡æ£å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | CntrCode = CntrRel.S_CNTR_CODE; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æ ¹æ®èµ·ç¹{taskData.pickStation},æ¾ä¸å°å¯¹åºè´§ä½ï¼è¯·æ£æ¥è´§ä½è¡¨"; |
| | | AddErrorInfo("è´§ä½æ¥æ¾å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æ ¹æ®ç»ç¹{End},æ¾ä¸å°å¯¹åºè´§ä½ï¼è¯·æ£æ¥è´§ä½è¡¨"; |
| | | AddErrorInfo("è´§ä½æ¥æ¾å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 3)//ç§»åºæµç¨ï¼ç´æ¥ä½¿ç¨èµ·ç¹è´§ä½åç»ç¹è´§ä½çæä»»å¡ï¼ |
| | | { |
| | | note = "åºåº"; |
| | | //å建æçç©æç»å®ä¿¡æ¯ï¼å¹¶è®¡ç®ç»ç¹è´§ä½ |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | |
| | | result.msg = $"æ ¹æ®ç»ç¹{taskData.dropStation},æ¾ä¸å°å¯¹åºè´§ä½ï¼è¯·æ£æ¥è´§ä½è¡¨"; |
| | | AddErrorInfo("è´§ä½æ¥æ¾å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | else |
| | | { |
| | | LogHelper.Info($"Createtask==> ä»»å¡ç±»åæè¯¯"); |
| | | result.code = "1"; |
| | | result.msg = "ä»»å¡ç±»åï¼{taskData.taskType}ä¸å¨è§å®èå´å
"; |
| | | AddErrorInfo("ä»»å¡ç±»åé误", result.msg, Source); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End)) |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | return result; |
| | | } |