123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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!;
- /// <summary>
- /// AGV地址
- /// </summary>
- public static string IwmsUrl
- {
- get
- {
- _IwmsUrl ??= RedisHub.Default.Check("IwmsUrl");
- if (string.IsNullOrEmpty(_IwmsUrl))
- {
- throw new KnownException($"请在Redis配置IwmsUrl", LogLevelEnum.High);
- }
- return _IwmsUrl;
- }
- }
- /// <summary>
- /// 满轮出库
- /// </summary>
- /// <param name="matCode">物料编号</param>
- /// <param name="wbCode">取货点位置</param>
- /// <param name="taskNo">任务号</param>
- /// <param name="rfid">RFID</param>
- /// <param name="matNo">材料号</param>
- /// <param name="isSurplus">改手盘标记</param>
- /// <param name="isRework">返工标记</param>
- /// <param name="matFast">快投标记</param>
- /// <param name="gradeCode">质量等级</param>
- /// <param name="wetIntoBinCode">仓位号</param>
- /// <returns></returns>
- 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<zhongTianIntoStockResponse>(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<zhongTianOutStockResponse>(IwmsUrl + "/databus/publish/zhongTianOutStock", req);
- if (res.code != AgvResponseCode.Success)
- {
- throw new KnownException(res.message, LogLevelEnum.High);
- }
- return res;
- }
- }
- }
|