| | |
| | | case "YBK": |
| | | n_type = 2; |
| | | Source = "é¢å¤åº"; |
| | | state = "çå¾
æ¨é"; |
| | | if (taskData.taskType == 1) |
| | | { |
| | | state = "çå¾
æ¨é"; |
| | | } |
| | | break; |
| | | |
| | | } |
| | |
| | | /// <returns></returns> |
| | | internal static Result MstStateInquire(MstStateInquire model) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "ç¶æä¸åæå" }; |
| | | Result result = new Result() { code = "0", msg = "ç¶æä¸åæå" }; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | if (model == null) |
| | | { |
| | |
| | | var task = db.Queryable<WCSTask>().Where(a => a.S_EQ_NO.Trim() == model.taskNum).First(); |
| | | if (task != null) |
| | | { |
| | | task.S_B_STATE ="çå¾
"; |
| | | db.Updateable(task).UpdateColumns(a => new { a.S_B_STATE}).ExecuteCommand(); |
| | | 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 |
| | | { |
| | |
| | | |
| | | } |
| | | |
| | | /// <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> |
| | |
| | | if (loc != null) |
| | | { |
| | | UploadLoc upload = new UploadLoc(); |
| | | |
| | | |
| | | upload.locationNum = loc.S_CODE; |
| | | upload.type = loc.S_TYPE; |
| | | upload.lockState = loc.S_LOCK_STATE; |