wxw
2025-04-24 3e19792c0061879ebe17ea04264c4c1f86bb3504
Wms/Wms/Controllers/DownApiController.cs
@@ -21,6 +21,7 @@
using Microsoft.Extensions.Logging;
using ZXing.QrCode.Internal;
using Model.ModelVm.BllCheckVm;
using Model.ModelVm.SysVm;
namespace Wms.Controllers
{
@@ -40,7 +41,8 @@
        private readonly IWaveMageServer _waveSvc;//任务同步Svc
        private readonly IRcsServer _rcsserver;//RCS相关任务
        private readonly INoticeServer _noticeSvc;//二楼单据相关
        public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IBllTaskSyncServer taskSyncSvc, IWaveMageServer waveSvc, IRcsServer rcsserver, INoticeServer noticeSvc)
        private readonly IHopperTransportServer _hopper;//二楼单据相关
        public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IBllTaskSyncServer taskSyncSvc, IWaveMageServer waveSvc, IRcsServer rcsserver, INoticeServer noticeSvc, IHopperTransportServer hopper)
        {
            _config = setting.Value;
            _exNoticeSvc = exNoticeSvc;
@@ -51,6 +53,7 @@
            _waveSvc = waveSvc;
            _rcsserver = rcsserver;
            _noticeSvc = noticeSvc;
            _hopper = hopper;
        }
        #region WMS接口 调用下游系统接口 
@@ -642,15 +645,6 @@
        }
        #endregion
        #region PDA
        //空托指令下发(出库)
        #endregion
        #region 二楼业务
        /// <summary>
        /// RCS叫桶
@@ -1122,5 +1116,204 @@
            }
        }
        #endregion
        #region JC37 料斗转运3、4楼业务
        /// <summary>
        /// 获取区域根据角色
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetAreaListByUser()
        {
            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 model = _hopper.GetAreaListByUser(int.Parse(userId));
                return Ok(new { data = model, code = 0, msg = "" });
            }
            catch (Exception e)
            {
                return Ok(new { data = "", code = 1, msg = e.Message });
            }
        }
        /// <summary>
        /// 获取储位根据区域
        /// </summary>
        /// <param name="areaNo"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetLocatByArea(string areaNo)
        {
            try
            {
                var model = _hopper.GetLocatByArea(areaNo);
                return Ok(new { data = model, code = 0, msg = "" });
            }
            catch (Exception e)
            {
                return Ok(new { data = "", code = 1, msg = e.Message });
            }
        }
        /// <summary>
        /// 获取罐类型根据区域
        /// </summary>
        /// <param name="areaNo"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetPlnStatusByArea(string areaNo)
        {
            try
            {
                var model = _hopper.GetPlnStatusByArea(areaNo);
                return Ok(new { data = model, code = 0, msg = "" });
            }
            catch (Exception e)
            {
                return Ok(new { data = "", code = 1, msg = e.Message });
            }
        }
        /// <summary>
        /// 获取物料根据罐类型
        /// </summary>
        /// <param name="palletStatus"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetSkuByStatus(string palletStatus)
        {
            try
            {
                var model = _hopper.GetSkuByStatus(palletStatus);
                return Ok(new { data = model, code = 0, msg = "" });
            }
            catch (Exception e)
            {
                return Ok(new { data = "", code = 1, msg = e.Message });
            }
        }
        /// <summary>
        /// 获取批次根据物料
        /// </summary>
        /// <param name="skuNo"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetLotNoBySku(string skuNo)
        {
            try
            {
                var model = _hopper.GetLotNoBySku(skuNo);
                return Ok(new { data = model, code = 0, msg = "" });
            }
            catch (Exception e)
            {
                return Ok(new { data = "", code = 1, msg = e.Message });
            }
        }
        /// <summary>
        /// 获取物料
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetSku()
        {
            try
            {
                var model = _hopper.GetSku();
                return Ok(new { data = model, code = 0, msg = "" });
            }
            catch (Exception e)
            {
                return Ok(new { data = "", code = 1, msg = e.Message });
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult jiaoLiaoHopper(HopperModel 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 = "未获取到当前操作人信息" });
                }
                _hopper.jiaoLiaoHopper(model.AreaNo,model.LocateNo,model.PlnStatus,model.Standard,model.SkuNo,model.LotNo,"", int.Parse(userId));
                return Ok(new { data = model, code = 0, msg = "" });
            }
            catch (Exception e)
            {
                return Ok(new { data = "", code = 1, msg = e.Message });
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult jiaoCheHopper(HopperModel 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 = "未获取到当前操作人信息" });
                }
                _hopper.jiaoCheHopper(model.AreaNo, model.LocateNo,model.PlnNo, model.PlnStatus, model.Weight , model.SkuNo, model.LotNo, int.Parse(userId));
                return Ok(new { data = model, code = 0, msg = "" });
            }
            catch (Exception e)
            {
                return Ok(new { data = "", code = 1, msg = e.Message });
            }
        }
        #endregion
    }
}