using ServiceCenter.Extensions; using ServiceCenter.Logs; using ServiceCenter.Redis; using ServiceCenter.WebApi; using WCS.WorkEngineering.WebApi.Models.AGV; using WCS.WorkEngineering.WebApi.Models.AGV.Request; using WCS.WorkEngineering.WebApi.Models.AGV.Response; namespace WCS.WorkEngineering.WebApi.Controllers { public class IwmsApi { private static string _IwmsUrl = null!; /// /// AGV地址 /// public static string IwmsUrl { get { _IwmsUrl ??= RedisHub.Default.Check("IwmsUrl"); if (string.IsNullOrEmpty(_IwmsUrl)) { throw new KnownException($"请在Redis配置IwmsUrl", LogLevelEnum.High); } return _IwmsUrl; } } /// /// 满轮出库 /// /// 物料编号 /// 取货点位置 /// 任务号 /// RFID /// 材料号 /// 改手盘标记 /// 返工标记 /// 快投标记 /// 质量等级 /// 仓位号 /// public static zhongTianIntoStockResponse 满轮出库(string matCode, string wbCode, string taskNo, string rfid, string matNo, bool isSurplus, bool isRework, bool matFast, string gradeCode, string wetIntoBinCode) { var zhongTian = new zhongTianIntoStockRequest() { matCode = matCode, wbCode = wbCode, inSpoolFull = "1", getOutEmpty = false, wetIntoReturn = false, isSurplus = isSurplus == false ? "0" : "1", isRework = isRework == false ? "0" : "1", spoolNo = rfid, gradeCode = gradeCode, matFast = matFast == false ? "0" : "1", matNo = matNo, orderProcessLenOut = "0", taskNo = $"RK{taskNo}", returnDesc = "", lockFlag = "0", }; if (wetIntoBinCode.Length == 14) { zhongTian.wetInto = true; zhongTian.wetIntoBinCode = wetIntoBinCode; zhongTian.wetIntoSpec = false; zhongTian.wetSpecWbCode = ""; } else { zhongTian.wetInto = false; zhongTian.wetIntoBinCode = ""; zhongTian.wetIntoSpec = true; zhongTian.wetSpecWbCode = wetIntoBinCode; } return zhongTianIntoStock(zhongTian); //return zhongTianOutStock(new zhongTianOutStockRequest() //{ // matCode = matCode, // workAreaCode = wbCode, // outSpoolFull = "1" //}); } public static zhongTianOutStockResponse 空轮回库(string matCode, string wbCode, bool isSurplus, bool isRework, int taskNo, string RFID) { return zhongTianOutStock(new zhongTianOutStockRequest() { matCode = matCode, workAreaCode = wbCode, outSpoolFull = "0", intoEmpty = false, wetOut = "", wetOutReturn = true, spoolNo = RFID, isSurplus = isSurplus == false ? "0" : "1", isRework = isRework == false ? "0" : "1", reqCode = Guid.NewGuid().ToString().Replace("-", ""), taskNo = $"CK{wbCode}{taskNo}" }); } public static zhongTianIntoStockResponse zhongTianIntoStock(zhongTianIntoStockRequest req) { var res = APICaller.CallApi2(IwmsUrl + "/databus/publish/zhongTianIntoStock", req); if (res.code != AgvResponseCode.Success) { throw new KnownException(res.message, LogLevelEnum.High); } return res; } public static zhongTianOutStockResponse zhongTianOutStock(zhongTianOutStockRequest req) { var res = APICaller.CallApi2(IwmsUrl + "/databus/publish/zhongTianOutStock", req); if (res.code != AgvResponseCode.Success) { throw new KnownException(res.message, LogLevelEnum.High); } return res; } } }