using System; using System.Collections.Generic; using System.Text; using WIDESEA.Common; using WIDESEA.Core.Utilities; using WIDESEA.Entity.DomainModels; using WIDESEA_Entity.DomainModels; namespace WIDESEA_Services { public class WCSApi { /// /// 发送任务给WCS /// /// 任务信息 /// public static WebResponseContent SendTaskToWCS(List taskinfo) { WebResponseContent content = new WebResponseContent(); try { content = HttpHelper>.GetHttpRequestData( taskinfo, WCSAPIAddress.IPAddress + WCSAPIAddress.ReceiveTaskFromWMS); if (!content.Status) throw new Exception($"发送任务给WCS调用失败:" + content.Message); content.OK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// /// 给测量设备测量完毕后,更新WCS任务状态 /// /// 任务信息 /// public static WebResponseContent UpdateWcsTaskState(SaveModel saveModel) { WebResponseContent content = new WebResponseContent(); try { content = HttpHelper.GetHttpRequestData( saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.UpdateWcsTaskState); if (!content.Status) { throw new Exception($"更新WCS任务状态调用失败:" + content.Message); } content.OK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// /// 取消WCS中的任务 /// /// 任务信息 /// public static WebResponseContent CancelTaskToWCS(SaveModel saveModel) { WebResponseContent content = new WebResponseContent(); try { content = HttpHelper.GetHttpRequestData( saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.CancelTaskFromWMS); if (!content.Status) { throw new Exception($"发送任务给WCS调用失败:" + content.Message); } content.OK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// /// WMS发起,由WCS去切换线体的模式 /// /// /// public static WebResponseContent ChangeLineModel(SaveModel saveModel) { WebResponseContent content = new WebResponseContent(); try { content = HttpHelper.GetHttpRequestData( saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.ChangeInboundLineModel); if (!content.Status) { throw new Exception($"切换线体的模式WCS调用失败:" + content.Message); } content.OK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// /// WMS发起,由WCS去切换线体的模式 /// /// /// public static WebResponseContent GetInboundLineCurrentModel(SaveModel saveModel) { WebResponseContent content = new WebResponseContent(); try { content = HttpHelper.GetHttpRequestData( saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.GetInboundLineCurrentModel); if (!content.Status) { throw new Exception($"获取入库线体当前模式状态WCS调用失败:" + content.Message); } content.OK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// /// 当托盘码校验不一致时,可由人工触发继续继续 /// /// /// public static WebResponseContent CheckBarcodeSameOk(SaveModel saveModel) { WebResponseContent content = new WebResponseContent(); try { content = HttpHelper.GetHttpRequestData( saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.CheckBarcodeSameOk); if (!content.Status) { throw new Exception($"失败:" + content.Message); } content.OK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// /// 称重后,由人工触发继续任务 /// /// /// public static WebResponseContent WeightCheckOk(SaveModel saveModel) { WebResponseContent content = new WebResponseContent(); try { content = HttpHelper.GetHttpRequestData( saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.WeightCheckOk); if (!content.Status) { throw new Exception($"失败:" + content.Message); } content.OK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// /// 当WCS执行入库任务时,检测到与测量出库任务冲突时,调用此接口更换目的货位,置位原来货位 /// /// /// public static WebResponseContent ChangeLocationIdWhenConflict(SaveModel saveModel) { WebResponseContent content = new WebResponseContent(); try { content = HttpHelper.GetHttpRequestData( saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.UpdateWcsTaskInformation); if (!content.Status) { throw new Exception($"失败:" + content.Message); } content.OK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// /// 取消测量,直接回库 /// /// /// public static WebResponseContent CancelAMeasureTask(SaveModel saveModel) { WebResponseContent content = new WebResponseContent(); try { content = HttpHelper.GetHttpRequestData( saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.CancelAMeasureTask); if (!content.Status) { throw new Exception($"失败:" + content.Message); } content.OK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } } }