| | |
| | | // AddErrorInfo("寻æ¾åºåºåºå¤±è´¥", result.msg); |
| | | // return result; |
| | | //} |
| | | |
| | | string state = "çå¾
"; |
| | | int n_type = 0; //任塿¥æº 1.å¯ç¼ç«åº 3.é¢å¤åº ,4.åææåº |
| | | string Source = ""; |
| | | switch (taskData.source) |
| | |
| | | case "YBK": |
| | | n_type = 2; |
| | | Source = "é¢å¤åº"; |
| | | if (taskData.taskType == 1) |
| | | { |
| | | state = "çå¾
æ¨é"; |
| | | } |
| | | break; |
| | | |
| | | } |
| | |
| | | AddErrorInfo("åºåºæ¥æ¾å¤±è´¥", result.msg); |
| | | return result; |
| | | } |
| | | int pri = 1; |
| | | var area = Settings.wareLoc.Where(a => a.AreaCode == endloc.S_WH_CODE).First(); |
| | | if (area != null) |
| | | { |
| | | if (area.XbAreaCodes.Contains(endloc.S_AREA_CODE)) |
| | | { |
| | | pri = 2; |
| | | } |
| | | } |
| | | |
| | | //å建wcsä»»å¡ |
| | | var wcsTask = new WCSTask |
| | | { |
| | |
| | | S_END_AREA = endloc.S_AREA_CODE, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = CntrCode, |
| | | N_PRIORITY = pri, |
| | | N_PRIORITY = 1, |
| | | Z_TYPE = n_type, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | S_WMS_NO = taskData.wmsTaskNo, |
| | | S_NOTE = note, |
| | | S_B_STATE = state, |
| | | S_MES_NO = taskData.mesTaskNo |
| | | |
| | | }; |
| | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// é¢å¤åºä»»å¡ç¶æä¸å |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static Result MstStateInquire(MstStateInquire model) |
| | | { |
| | | Result result = new Result() { code = "0", msg = "ç¶æä¸åæå" }; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | if (model == null) |
| | | { |
| | | LogHelper.Info($"MstStateInquire==> åæ°ä¸ºnull"); |
| | | result.code = "1"; |
| | | result.msg = "åæ°ä¸ºnullå¼ï¼è¯·æ£æ¥åæ°æ ¼å¼"; |
| | | AddErrorInfo("åæ°ä¸ºç©º", result.msg); |
| | | return result; |
| | | } |
| | | try |
| | | { |
| | | //æ¾å°ä»»å¡ï¼ä¿®æ¹ä»»å¡ç¶æ |
| | | var task = db.Queryable<WCSTask>().Where(a => a.S_EQ_NO.Trim() == model.taskNum).First(); |
| | | if (task != null) |
| | | { |
| | | if (task.S_B_STATE != "çå¾
æ¨é") |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æ¨é失败ï¼ä»»å¡å·²ç»å¤ç"; |
| | | AddErrorInfo("æ¨é失败", result.msg); |
| | | return result; |
| | | } |
| | | task.S_B_STATE = "çå¾
"; |
| | | if (db.Updateable(task).UpdateColumns(a => new { a.S_B_STATE }).ExecuteCommand() < 0) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æ¨é失败ï¼ä¿®æ¹ä»»å¡ç¶æå¤±è´¥ï¼è¯·éæ°ä¸å"; |
| | | AddErrorInfo("æ¨é失败", result.msg); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æ ¹æ®ä¸åä»»å¡å·{model.taskNum}æªæ¾å°å¯¹åºä»»å¡"; |
| | | AddErrorInfo("æªæ¾å°ä»»å¡", result.msg); |
| | | return result; |
| | | } |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = ex.ToString(); |
| | | LogHelper.Error("TrayItembind Errorï¼" + ex.ToString(), ex); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç¹å¯¹ç¹ä»»å¡å建 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static Result CreatTask(CreatTask model) |
| | | { |
| | | Result result = new Result() { code = "0", msg = "ç¹å¯¹ç¹ä»»å¡å建æå" }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "åæ°ä¸ºnull"; |
| | | AddErrorInfo("åæ°ä¸ºç©º", result.msg, Source); |
| | | return result; |
| | | } |
| | | string Start = ""; //åè´§ç¹ |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | // string CntrCode = model.partData.rfid;//æçç¼ç |
| | | // string ItemCode = model.partData.partNumber;//ç©æç¼ç |
| | | string End = ""; |
| | | string CntrCode = ""; |
| | | Location endloc = new Location(); |
| | | Location startloc = new Location(); |
| | | try |
| | | { |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == model.InitialLocation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = model.InitialLocation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æ ¹æ®èµ·ç¹{model.InitialLocation},æ¾ä¸å°å¯¹åºè´§ä½ï¼è¯·æ£æ¥è´§ä½è¡¨"; |
| | | AddErrorInfo("è´§ä½æ¥æ¾å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == model.TargetLocation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = model.TargetLocation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æ ¹æ®ç»ç¹{model.TargetLocation},æ¾ä¸å°å¯¹åºè´§ä½ï¼è¯·æ£æ¥è´§ä½è¡¨"; |
| | | AddErrorInfo("è´§ä½æ¥æ¾å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | #region åå»ºä»»å¡ |
| | | if (!string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End)) |
| | | { |
| | | if (startloc.N_LOCK_STATE != 0) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"å建任å¡å¤±è´¥ï¼èµ·ç¹{Start}æé"; |
| | | AddErrorInfo("è´§ä½æé", result.msg); |
| | | return result; |
| | | } |
| | | //å建wcsä»»å¡ |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | // S_TYPE = model.taskData.taskType.ToString(), |
| | | // S_EQ_NO = model.taskData.taskNum, |
| | | S_START_LOC = Start, |
| | | S_END_LOC = End, |
| | | N_CNTR_COUNT = 1, |
| | | S_START_WH = startloc.S_WH_CODE, |
| | | S_START_AREA = startloc.S_AREA_CODE, |
| | | S_END_WH = endloc.S_WH_CODE, |
| | | S_END_AREA = endloc.S_AREA_CODE, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = CntrCode, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | N_PRIORITY = 1, |
| | | // N_TYPE = n_type |
| | | |
| | | |
| | | }; |
| | | LogHelper.Info("å建任å¡ï¼" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | //LocationHelper.LockLoc(Start, 2); |
| | | //LocationHelper.LockLoc(End, 1); |
| | | LogHelper.Info("åå»ºä»»å¡æå"); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"ä»»å¡å建失败"; |
| | | AddErrorInfo("ä»»å¡å建失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "å建任å¡å¤±è´¥ï¼æªæ¾å°å¯¹åºçåè´§ç¹æå¸è´§ç¹"; |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | | return result; |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"ç©æä¸»æ°æ®å建失败 é误信æ¯ï¼{ex}"; |
| | | LogHelper.Error("ç¹å¯¹ç¹ä»»å¡ Errorï¼" + ex.ToString(), ex); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | |
| | | public static object _Point = new object(); |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | internal static Result Point(PointModel model) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "å
¥å¹³åºä»»å¡ä¸åæå" }; |
| | | Result result = new Result() { code = "200", msg = "ä»»å¡ä¸åæå" }; |
| | | string Source = "Mes"; |
| | | |
| | | if (model == null) |
| | |
| | | AddErrorInfo("è´§ä½æ¥æ¾å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | //å¤æèµ·ç¹æ¯å¦ç»å®å
¶ä»æç |
| | | var CntrRel = LocationHelper.GetLocCntrRel(startloc.S_CODE).OrderBy(a => a.T_CREATE).FirstOrDefault(); |
| | | if (CntrRel != null) |
| | | { |
| | | if (CntrRel.S_CNTR_CODE != model.Rfid) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"æ ¹æ®èµ·ç¹ï¼{model.InitialLocation}è·åæç:{CntrRel.S_CNTR_CODE}ä¸ä¸åæçï¼{model.Rfid}ä¸ä¸è´ï¼è¯·æ£æ¥æçç æ¯å¦æ£ç¡®"; |
| | | AddErrorInfo("æçç æ ¡æ£å¤±è´¥", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LocationHelper.BindingLoc(startloc.S_CODE, new List<string> { model.Rfid }); |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // //å¤æèµ·ç¹æ¯å¦ç»å®å
¶ä»æç |
| | | // var CntrRel = LocationHelper.GetLocCntrRel(startloc.S_CODE).OrderBy(a => a.T_CREATE).FirstOrDefault(); |
| | | // if (CntrRel != null) |
| | | // { |
| | | // if (CntrRel.S_CNTR_CODE != model.Rfid) |
| | | // { |
| | | // result.code = "1"; |
| | | // result.msg = $"æ ¹æ®èµ·ç¹ï¼{model.InitialLocation}è·åæç:{CntrRel.S_CNTR_CODE}ä¸ä¸åæçï¼{model.Rfid}ä¸ä¸è´ï¼è¯·æ£æ¥æçç æ¯å¦æ£ç¡®"; |
| | | // AddErrorInfo("æçç æ ¡æ£å¤±è´¥", result.msg, Source); |
| | | // return result; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // LocationHelper.BindingLoc(startloc.S_CODE, new List<string> { model.Rfid }); |
| | | // } |
| | | //} |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == model.TargetLocation).First(); |
| | | if (endloc == null) |
| | | { |
| | |
| | | RequestList<UploadLoc> result1 = new RequestList<UploadLoc>(); |
| | | List<UploadLoc> listuploadloc = new List<UploadLoc>(); |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | //è·åæ¶é´æ³ |
| | | var time = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds(); |
| | | result1.RequestId = "æåAGV" + time; |
| | | result1.UseToken = "iFQ5fExGrLYLXliHYWzs"; |
| | | foreach (var item in model) |
| | | { |
| | | var loc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == item.Location).First(); |
| | | if (loc != null) |
| | | { |
| | | UploadLoc upload = new UploadLoc(); |
| | | //è·åæ¶é´æ³ |
| | | var time = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds(); |
| | | result1.RequestId = "æåAGV" + time; |
| | | result1.UseToken = "iFQ5fExGrLYLXliHYWzs"; |
| | | upload.LocationNum = loc.S_CODE; |
| | | upload.Type = loc.S_TYPE; |
| | | upload.LockState = loc.S_LOCK_STATE; |
| | | upload.WorkCenter = loc.S_AREA_CODE; |
| | | upload.Warehouse = loc.S_AREA_CODE; |
| | | |
| | | upload.locationNum = loc.S_CODE; |
| | | upload.type = loc.S_TYPE; |
| | | upload.lockState = loc.S_LOCK_STATE; |
| | | upload.workCenter = loc.S_AREA_CODE; |
| | | upload.warehouse = loc.S_AREA_CODE; |
| | | listuploadloc.Add(upload); |
| | | } |
| | | else |
| | |
| | | var url = Settings.tableUrls.Find(a => a.id == 3); |
| | | if (url != null) |
| | | { |
| | | LogHelper.Info($"è´§ä½ä¸æ¥ä¸æ¥ï¼å°å:{url}ï¼å
容ï¼{date}"); |
| | | LogHelper.Info($"è´§ä½ä¸æ¥ä¸æ¥ï¼å°å:{url.url}ï¼å
容ï¼{date}"); |
| | | var r = httpHelper.MesWebPost(url.url, date); |
| | | result = JsonConvert.DeserializeObject<Result>(r); |
| | | if (result.code == "200") |
| | |
| | | result.code = "1"; |
| | | result.msg = result.msg; |
| | | } |
| | | ApiHelper.AddInfo("Mes", "Mesç¹å¯¹ç¹ä»»å¡ä¸å", JsonConvert.SerializeObject(date), JsonConvert.SerializeObject(result), "Post", url.url); |
| | | ApiHelper.AddInfo("Mes", "è´§ä½åæ¥", JsonConvert.SerializeObject(date), JsonConvert.SerializeObject(result), "Post", url.url); |
| | | |
| | | } |
| | | else |