| | |
| | | using HH.WCS.Mobox3.YNJT_PT.dispatch; |
| | | using HH.WCS.Mobox3.YNJT_PT.wms; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Web.Http; |
| | | using static HH.WCS.Mobox3.YNJT_PT.api.ApiHelper; |
| | | using static HH.WCS.Mobox3.YNJT_PT.api.ApiModel; |
| | | using static HH.WCS.Mobox3.YNJT_PT.api.OtherModel; |
| | | using static HH.WCS.Mobox3.YNJT_PT.util.ExcetionHelper; |
| | | |
| | | namespace HH.WCS.Mobox3.YNJT_PT.api |
| | | { |
| | |
| | | public class WmsController : System.Web.Http.ApiController |
| | | { |
| | | |
| | | |
| | | /// <summary> |
| | | /// 1.设备信号反馈 |
| | | /// 业务场景:WCS反馈成型机胚胎下线入库信号(注:必须两托一起上报,没有两托,则补充一个空托) |
| | | /// 逻辑: |
| | | /// 1.查询成型机下线记录表,判断RFID是否存在,状态是否OK,不存在或NG异常排出 |
| | | /// 2.查询物料条码信息表(green_tire_information),保存胚胎信息 |
| | | /// 3.开始计算终点,生成任务 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public ResponseResult notifyDeviceSignal(NotifyDeviceSignalModel model) |
| | | { |
| | | LogHelper.Info("【1.设备信号反馈】notifyDeviceSignal 入参:" + JsonConvert.SerializeObject(model), "WMS"); |
| | | ResponseResult responseResult = new ResponseResult(); |
| | | try |
| | | { |
| | | switch (model.signalType) |
| | | { |
| | | case 1: |
| | | responseResult = ApiHelper.offLineRequest(model); // 下线请求 |
| | | break; |
| | | case 2: |
| | | responseResult = ApiHelper.callItemOutStock(model); // 叫料请求 |
| | | break; |
| | | case 3: |
| | | responseResult = ApiHelper.readCodeRequest(model); // 读码请求 |
| | | break; |
| | | case 4: |
| | | responseResult = ApiHelper.cxjOffLineRecord(model); // 下线记录 |
| | | break ; |
| | | case 5: |
| | | responseResult = ApiHelper.anomalyRequest(model); // 异常申请 |
| | | break; |
| | | case 6: |
| | | responseResult = ApiHelper.emptyTrayInStock(model); // 空托回库 |
| | | break; |
| | | case 7: |
| | | responseResult = ApiHelper.callEmptyTrayOutStock(model); // 空托出库 |
| | | break; |
| | | case 8: |
| | | responseResult = ApiHelper.anomalyTrayInStock(model); // 空托重置 |
| | | break; |
| | | } |
| | | } |
| | | catch (BusinessException be) |
| | | { |
| | | responseResult.code = 501; |
| | | responseResult.msg = be.Message; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Info($"WMS内部错误,错误原因:{ex.Message}", "WMS"); |
| | | LogHelper.Info(ex.StackTrace, "WMS"); |
| | | responseResult.code = 500; |
| | | responseResult.msg = $"WMS内部错误,请联系开发人员处理"; |
| | | } |
| | | LogHelper.Info("【1.设备信号反馈】notifyDeviceSignal 出参:" + JsonConvert.SerializeObject(responseResult), "WMS"); |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 2.WCS 任务状态反馈 |
| | | /// 业务场景:WCS在执行任务时,回报任务状态 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | /*[Route("notifyTaskStatus")]*/ |
| | | public ReturnResult notifyTaskStatus(TaskStatusFeedbackModel model) |
| | | { |
| | | LogHelper.Info("【2.WCS任务状态反馈】Request:" + JsonConvert.SerializeObject(model), "WMS"); |
| | | var result = ApiHelper.taskStatusFeedback(model); |
| | | LogHelper.Info("【2.WCS任务状态反馈】response:" + JsonConvert.SerializeObject(result), "WMS"); |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 3.申请终点 |
| | | /// 场景:1.堆垛机放货异常申请新终点; 2.堆垛机入库输送线堵塞申请新终点 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public ResponseResult applyDest(ApplyDestModel model) |
| | | { |
| | | LogHelper.Info("【3.申请终点】applyDest 入参:" + JsonConvert.SerializeObject(model), "WMS"); |
| | | ResponseResult responseResult = new ResponseResult(); |
| | | responseResult = ApiHelper.applyDest(model); |
| | | LogHelper.Info("【3.申请终点】applyDest 出参:" + JsonConvert.SerializeObject(responseResult), "WMS"); |
| | | return responseResult; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 4.空托盘解绑 |
| | | /// 业务场景:空托盘回主线 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public ReturnResult emptyTrayUnBind(EmptyTrayUnBindModel model) |
| | | { |
| | | LogHelper.Info("【4.空托盘解绑】Request:" + JsonConvert.SerializeObject(model), "WMS"); |
| | | var result = ApiHelper.emptyTrayUnBind(model); |
| | | LogHelper.Info("【4.空托盘解绑】response:" + JsonConvert.SerializeObject(result), "WMS"); |
| | | return result; |
| | | } |
| | | |
| | | public class EmptyTrayUnBindModel |
| | | { |
| | | public string rfid { get; set; } // 托盘号 |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 任务状态反馈模型 |
| | | /// </summary> |
| | | public class TaskStatusFeedbackModel |
| | | { |
| | | public string taskNo { get; set; } // 任务号 |
| | | public string subTaskNo { get; set; } // 子任务号 |
| | | public int status { get; set; } // 任务状态 1:开始/执行中;2:完成;3:准备取货;4:取货完成;5:准备卸货;6:卸货完成;7:异常取消;8:强制完成 |
| | | public string deviceNo { get; set; } // 设备号 |
| | | public string errCode { get; set; } // 异常代码 0.无异常 1.设备故障码、2.rfid校验失败、3.取货无货、4.放货有货 |
| | | public string loc { get; set; } // 当前货位 |
| | | } |
| | | |
| | | public class AnomalyTrayInStockModel |
| | | { |
| | | public string reqId { get; set; } |
| | | public string reqTime { get; set; } |
| | | public string startLoc { get; set; } |
| | | public string trayCode { get; set; } // 容器编码 |
| | | } |
| | | |
| | | public class EmbryoCheckOutStockModel |
| | | { |
| | | public string reqId { get; set; } |
| | | public string reqTime { get; set; } |
| | | public string trayCode { get; set; } // 容器编码 |
| | | } |
| | | |
| | | public class CallEmptyTrayOutStockModel |
| | | { |
| | | public string reqId { get; set; } |
| | | public string reqTime { get; set; } |
| | | public string endLoc { get; set; } // 终点 |
| | | } |
| | | |
| | | public class EmptyTrayInStockModel |
| | | { |
| | | public string reqId { get; set; } |
| | | public string reqTime { get; set; } |
| | | public string startLoc { get; set; } // 起点 |
| | | public string trayCode { get; set; } // 容器编码 |
| | | } |
| | | |
| | | public class ApplyDestModel |
| | | { |
| | | public string reqId { get; set; } |
| | | public string reqTime { get; set; } |
| | | public string taskNo { get; set; } // 任务号 |
| | | public int applyType { get; set; } //申请类型 1.堆垛机放货异常申请新终点; 2.堆垛机入库输送线堵塞申请新终点 |
| | | public string loc { get; set; } |
| | | } |
| | | |
| | | public class CallItemModel |
| | | { |
| | | public string reqId { get; set; } |
| | | public string reqTime { get; set; } |
| | | public List<string> locCodes { get; set; } // 硫化机工位 |
| | | } |
| | | |
| | | public class NotifyDeviceSignalModel |
| | | { |
| | | public string reqId { get; set; } |
| | | public string reqTime { get; set; } |
| | | public string loc { get; set; } |
| | | public string taskNo { get; set; } |
| | | public string cntrNo { get; set; } |
| | | public int signalType { get; set; } |
| | | public object extData { get; set; } |
| | | public string deviceNo { get; set; } |
| | | } |
| | | |
| | | public class BarcodeModel |
| | | { |
| | | public string rfid { get; set; } |
| | | public string barcode { get; set; } |
| | | } |
| | | |
| | | /* /// <summary> |
| | | /// 3.任务状态反馈 |
| | | /// 业务场景:WCS在执行任务时,回报任务状态 |
| | | /// </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; |
| | | }*/ |
| | | } |
| | | } |