| | |
| | | using Model.ModelVm.PdaVm; |
| | | using WMS.IBLL.IPdaServer; |
| | | using WMS.Entity.DataEntity; |
| | | using WMS.Entity.SysEntity; |
| | | using Wms.Tools; |
| | | using Microsoft.Extensions.Options; |
| | | |
| | | namespace Wms.Controllers |
| | | { |
| | |
| | | public class PdaCrController : ControllerBase |
| | | { |
| | | private readonly IPdaCrServer _pdaCrSvc; |
| | | |
| | | public PdaCrController(IPdaCrServer pdaCrSvc) |
| | | private readonly ApiUrlConfig _config; //接口交互路径 |
| | | public PdaCrController(IPdaCrServer pdaCrSvc, IOptions<ApiUrlConfig> setting) |
| | | { |
| | | _pdaCrSvc = pdaCrSvc; |
| | | _config = setting.Value; |
| | | } |
| | | |
| | | #region 盘点 |
| | |
| | | { |
| | | try |
| | | { |
| | | var list = _pdaCrSvc.GetStockCheckLogList(model.CrNo, model.CrDetail, model.PalletNo, model.BoxNo); |
| | | var list = _pdaCrSvc.GetStockCheckLogList(model.CrNo, model.CrDetail, model.PalletNo, model.BoxNo,model.isContinue); |
| | | |
| | | return Ok(new { code = 0, msg = "要盘点的箱码信息", data = list }); |
| | | } |
| | |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | |
| | | _pdaCrSvc.CrSetCheck(model.CrNo, model.CrDetail, model.PalletNo, model.BoxNo, model.BoxNo3, model.Result, model.Qty, int.Parse(userId)); |
| | | _pdaCrSvc.CrSetCheck(model.CrNo, model.CrDetail, model.PalletNo, model.BoxNo, model.BoxNo3, model.Result, model.Qty,model.isContinue, int.Parse(userId)); |
| | | |
| | | return Ok(new { code = 0, msg = "盘点完成", data = "" }); |
| | | } |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region AGV转运 |
| | | /// <summary> |
| | | /// 获取托盘所在储位地址 |
| | | /// </summary> |
| | | /// <param name="palletNo"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetPalletLocatNo(string palletNo) |
| | | { |
| | | try |
| | | { |
| | | string result = _pdaCrSvc.GetPalletLocatNo(palletNo); |
| | | |
| | | return Ok(new { data = result, code = 0, msg = "成功" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"异常:{e.Message}" }); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 获取托盘所在楼层所有区域 |
| | | /// </summary> |
| | | /// <param name="palletNo"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetStorageArea(string palletNo) |
| | | { |
| | | try |
| | | { |
| | | List<SysStorageArea> result = _pdaCrSvc.GetStorageArea(palletNo); |
| | | |
| | | return Ok(new { data = result, code = 0, msg = "成功" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"异常:{e.Message}" }); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 获取托盘所在楼层所有区域 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetRunSoNoticeList() |
| | | { |
| | | try |
| | | { |
| | | List<string> result = _pdaCrSvc.GetRunSoNoticeList(); |
| | | |
| | | return Ok(new { data = result, code = 0, msg = "成功" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"异常:{e.Message}" }); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 根据托盘号获取托盘上物料信息 |
| | | /// </summary> |
| | | /// <param name="palletNo"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetSkuInfoByPalletNo(string palletNo) |
| | | { |
| | | try |
| | | { |
| | | List<DataStockDetail> result = _pdaCrSvc.GetSkuInfoByPalletNo(palletNo); |
| | | |
| | | return Ok(new { data = result, code = 0, msg = "成功" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"异常:{e.Message}" }); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 根据出库单号获取分配的托盘信息 |
| | | /// </summary> |
| | | /// <param name="soNo"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetPalletNoListBySoNo(string soNo) |
| | | { |
| | | try |
| | | { |
| | | List<string> result = _pdaCrSvc.GetPalletNoListBySoNo(soNo); |
| | | |
| | | return Ok(new { data = result, code = 0, msg = "成功" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"异常:{e.Message}" }); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// agv转运呼叫小车 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AgvTransport(PdaAgvTransportVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(userId)) |
| | | { |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var uId = int.Parse(userId); |
| | | _pdaCrSvc.AgvTransport(model.PalletNo, model.AreaNo, model.Ruku, uId, _config.WcsHost + _config.GenAgvSchedulingTask); |
| | | |
| | | return Ok(new { data = "", code = 0, msg = "成功" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"异常:{e.Message}" }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// agv转运呼叫小车取货 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AgvTransport2(PdaAgvTransportVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(userId)) |
| | | { |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var uId = int.Parse(userId); |
| | | var str = _pdaCrSvc.AgvTransport2(model.SoNo,model.PalletNo, model.AreaNo, uId, _config.WcsHost + _config.GenAgvSchedulingTask); |
| | | var msgStr = ""; |
| | | if (str.Contains("0")) |
| | | { |
| | | msgStr += "成功"; |
| | | } |
| | | if (str.Contains("1")) |
| | | { |
| | | msgStr += "部分托盘已有小车等待执行或正在执行的任务"; |
| | | } |
| | | |
| | | |
| | | return Ok(new { data = "", code = 0, msg = msgStr }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"异常:{e.Message}" }); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 人工转运 |
| | | |
| | | /// <summary> |
| | | /// 人工转运 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult ArtificialTransport(PdaArtificialTransportVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(userId)) |
| | | { |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var uId = int.Parse(userId); |
| | | _pdaCrSvc.ArtificialTransport(model.PalletNo, model.LocatNo, model.EndLocatNo, _config.MesHost + _config.MesGetTokenUrl,_config.MesHost+_config.MesBeiLiaoUrl, uId); |
| | | |
| | | return Ok(new { data = "", code = 0, msg = "成功" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"异常:{e.Message}" }); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 箱码查询 |
| | | /// <summary> |
| | | /// pda箱码查询 |
| | | /// </summary> |
| | | /// <param name="boxNo">箱码</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetBoxQueryList(string boxNo) |
| | | { |
| | | try |
| | | { |
| | | DataBoxDto stockList = _pdaCrSvc.GetBoxQueryList(boxNo); |
| | | if (stockList == null) |
| | | { |
| | | return Ok(new { data = stockList, code = 1, msg = "无数据" }); |
| | | } |
| | | return Ok(new { data = stockList, code = 0, msg = "成功" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"异常:{e.Message}" }); |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |