admin
4 天以前 bc2abaf0794769f9376369fb9defb17a2233e35f
Wms/Wms/Controllers/BllAsnController.cs
@@ -17,6 +17,8 @@
using Model.ModelDto.SysDto;
using static System.Reflection.Metadata.BlobBuilder;
using WMS.DAL;
using static System.Net.WebRequestMethods;
using WMS.IBLL;
namespace Wms.Controllers
{
@@ -36,10 +38,11 @@
        private readonly IBllLabelBoxNoServer _labelBox;                            // 箱码标签
        private readonly IProcurePlanServer _procurePlanSvc;                            // 箱码标签
        private readonly IPalletUpShelfServer _palletUpShelfSvc;                            // 上架记录
        private readonly IHttpServer _http;
        #endregion
        #region 构造函数
        public BllAsnController(IArrivalNoticeServer arrivalNoticeSvc, IPalletBindServer palletBindSvc, IBllBoxInfoServer bllBoxInfoSvc, ITaskServer taskSvc, IOperationASNServer logSvc, IPalletUnbindServer palletUnbind, IAuditLogServer auditLog, IBllLabelBoxNoServer labelBox, IProcurePlanServer procurePlanSvc, IPalletUpShelfServer palletUpShelfSvc)
        public BllAsnController(IArrivalNoticeServer arrivalNoticeSvc, IPalletBindServer palletBindSvc, IBllBoxInfoServer bllBoxInfoSvc, ITaskServer taskSvc, IOperationASNServer logSvc, IPalletUnbindServer palletUnbind, IAuditLogServer auditLog, IBllLabelBoxNoServer labelBox, IProcurePlanServer procurePlanSvc, IPalletUpShelfServer palletUpShelfSvc, IHttpServer http)
        {
            _arrivalNoticeSvc = arrivalNoticeSvc;
            _PalletBindSvc = palletBindSvc;
@@ -51,6 +54,8 @@
            _labelBox = labelBox;
            _procurePlanSvc = procurePlanSvc;
            _palletUpShelfSvc = palletUpShelfSvc;
            _http = http;
        }
        #endregion
@@ -150,6 +155,48 @@
                else
                {
                    return Ok(new { code = 1, msg = strMesage });
                }
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
        }
        /// <summary>
        /// 入库单据导入
        /// </summary>
        /// <param name="models"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult ImportArrivalNotice(ArrivalNoticeVms models)
        {
            try
            {
                if (models.ListArrivalNotice.Count > 50)
                {
                    throw new Exception("单次导入最多50条数据");
                }
                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("未获取到用户信息");
                }
                models.CreateUser = int.Parse(UserId);
                string strMessage = _arrivalNoticeSvc.ImportArrivalNotice(models);
                if (strMessage.Contains("-1"))
                {
                    return Ok(new { code = 1, msg = strMessage });
                }
                else
                {
                    return Ok(new { code = 0, msg = strMessage });
                }
            }
            catch (Exception e)
@@ -760,8 +807,8 @@
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                _PalletBindSvc.ArrivalSuccessBack(taskNo, int.Parse(userId));
                //_PalletBindSvc.ArrivalSuccessBack(taskNo, int.Parse(userId));
                _http.ArrivalSuccess2(taskNo, int.Parse(userId));
                return Ok(new { code = 0, msg = "成功完成任务", data = "" });
@@ -1000,8 +1047,66 @@
                return Ok(new { code = 1, count = 0, msg = e.Message });
            }
        }
        /// <summary>
        /// 拆分箱码标签
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult ChaiLableBox(LabelOperVm 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 = "未获取到当前操作人信息" });
                }
                _BoxInfoSvc.ChaiLableBox(model.BoxNo, model.ChaiQty, int.Parse(userId));
                return Ok(new { code = 0, msg = "操作成功", data = "" });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, count = 0, msg = e.Message });
            }
        }
        /// <summary>
        /// 合并箱码标签
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult MergeLableBox(LabelOperVm 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 = "未获取到当前操作人信息" });
                }
                _BoxInfoSvc.MergeLableBox(model.BoxNo, model.BoxNo2, int.Parse(userId));
                return Ok(new { code = 0, msg = "操作成功", data = "" });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, count = 0, msg = e.Message });
            }
        }
        #endregion
        #region 数据归档