Administrator
2024-06-25 826e5950faf61ffa8d6442b1e17f98ffd67d26de
Wms/Wms/Controllers/UpApiController.cs
@@ -14,6 +14,8 @@
using Model.ModelVm.BllCheckVm;
using WMS.DAL;
using Microsoft.AspNetCore.Authorization;
using WMS.IBLL.IBllTransServer;
using static Model.InterFaceModel.RCSModel;
namespace Wms.Controllers
{
@@ -30,13 +32,18 @@
        private readonly IArrivalNoticeServer _arrivalNoticeSvc;
        private readonly IStockCheckServer _stockCheckSvc;//盘点单Svc 
        private readonly IProcurePlanServer _procurePlanSvc;//采购单Svs
        public UpApiController(IOptions<ApiUrlConfig> setting,IExportNoticeServer exNoticeSvc,IArrivalNoticeServer arrivalNoticeServer,IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc)
        private readonly IRcsServer _rcsserver;//RCS相关任务
        private readonly INoticeServer _noticeSvc;//二楼单据相关
        public UpApiController(IOptions<ApiUrlConfig> setting,IExportNoticeServer exNoticeSvc,IArrivalNoticeServer arrivalNoticeServer,IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc,IRcsServer rcsserver, INoticeServer noticeSvc)
        {
            _config = setting.Value;
            _exNoticeSvc = exNoticeSvc;
            _arrivalNoticeSvc = arrivalNoticeServer;
            _stockCheckSvc = stockCheckSvc;
            _procurePlanSvc = procurePlanSvc;
            _rcsserver = rcsserver;
            _noticeSvc = noticeSvc;
        }
        #endregion
@@ -396,6 +403,162 @@
                return Ok(result);
            }
        }
        #region 二楼业务
        /// <summary>
        /// RCS叫桶
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetPalletNo(Pallnetmsg pallmsg)
        {
            var result = new ErpModel { Success = -1, Message = "", };
            try
            {
                if (string.IsNullOrWhiteSpace(pallmsg.Location))
                {
                    result.Message = "叫料位置为空!";
                    return Ok(result);
                }
                _rcsserver.GetPalletNo(pallmsg);
                result.Success = 0;
                result.Message = "叫桶成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// RCS申请储位
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult ApplyLocatNo(Pallnetmsg pallmsg)
        {
            var result = new ErpModel { Success = -1, Message = "" };
            try
            {
                _rcsserver.ApplyLocatNo(pallmsg);
                result.Success = 0;
                result.Message = "申请储位成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// 入库单据下发
        /// </summary>
        /// <param name="model">入库单信息</param>
        /// <returns></returns>
        //[Authorize]
        [HttpPost]
        public IActionResult CreateAsnWork(AsnInfo model)
        {
            var result = new ErpModel { Success = -1, Message = "" };
            try
            {
                /*var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    throw new Exception("未获取到用户信息");
                }
                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(UserId))
                {
                    throw new Exception("未获取到用户信息");
                }*/
                result = _noticeSvc.CreateAsnWork(model);
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// 任务完成反馈
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult RCSFinishTask(TaskModel model)
        {
            var result = new ErpModel { Success = -1, Message = "" };
            try
            {
                /*var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    throw new Exception("未获取到用户信息");
                }
                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(UserId))
                {
                    throw new Exception("未获取到用户信息");
                }*/
                result = _noticeSvc.RCSFinishTask(model.TaskNo, model.Status);
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// 出库单据下发
        /// </summary>
        /// <param name="model">出库单信息</param>
        /// <returns></returns>
        //[Authorize]
        [HttpPost]
        public IActionResult CreateSoWork(SoInfo model)
        {
            try
            {
                /*var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    throw new Exception("未获取到用户信息");
                }
                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(UserId))
                {
                    throw new Exception("未获取到用户信息");
                }*/
                SoResInfo result = _exNoticeSvc.ErpAddExportNotice(model);
                return Ok(result);
            }
            catch (Exception e)
            {
                return Ok(new ErpModel { Success = -1, Message = e.Message });
            }
        }
        #endregion
        //箱码信息 手持组托用 (赋码或追溯下发到wms)
        //质检结果下发接口