zhaowc
2025-04-07 b9f7560cbe0e562a40e9515a0559a3e951f0fee6
Wms/Wms/Controllers/BllAsnController.cs
@@ -9,6 +9,8 @@
using WMS.IBLL.IBllAsnServer;
using WMS.IBLL.ILogServer;
using Model.ModelVm.BllAsnVm;
using Wms.Tools;
using Microsoft.Extensions.Options;
namespace Wms.Controllers
{
@@ -18,6 +20,7 @@
    public class BllAsnController : ControllerBase
    {
        #region 依赖注入
        private readonly ApiUrlConfig _config; //接口交互路径
        private readonly IArrivalNoticeServer _arrivalNoticeSvc;                    // 入库单据Svc 
        private readonly IPalletBindServer _PalletBindSvc;                          // 托盘绑定Svc 
        private readonly IBllBoxInfoServer _BoxInfoSvc;
@@ -29,8 +32,9 @@
        #endregion
        #region 构造函数
        public BllAsnController(IArrivalNoticeServer arrivalNoticeSvc, IPalletBindServer palletBindSvc,IBllBoxInfoServer bllBoxInfoSvc, ITaskServer taskSvc,IOperationASNServer logSvc, IPalletUnbindServer palletUnbind,IAuditLogServer auditLog,IBllLabelBoxNoServer labelBox)
        public BllAsnController(IOptions<ApiUrlConfig> setting, IArrivalNoticeServer arrivalNoticeSvc, IPalletBindServer palletBindSvc,IBllBoxInfoServer bllBoxInfoSvc, ITaskServer taskSvc,IOperationASNServer logSvc, IPalletUnbindServer palletUnbind,IAuditLogServer auditLog,IBllLabelBoxNoServer labelBox)
        {
            _config = setting.Value;
            _arrivalNoticeSvc = arrivalNoticeSvc;
            _PalletBindSvc = palletBindSvc;
            _BoxInfoSvc = bllBoxInfoSvc;
@@ -97,6 +101,11 @@
                return Ok(new { code = 1, msg = e.Message });
            }
        }
        /// <summary>
        /// 获取添加明细数据源
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetMaterialsList(GetMaterialsVm model)
        {
@@ -129,7 +138,7 @@
                }
                model.CreateUser = int.Parse(UserId);
                string strMesage = _arrivalNoticeSvc.AddArrivalNotice(model);
                string strMesage = _arrivalNoticeSvc.AddArrivalNotice(model, _config.WcsHost + _config.AddOrderTaskUrl);
                if (strMesage == "")
                {
@@ -137,7 +146,7 @@
                }
                if (strMesage.Contains("-1"))
                {
                    return Ok(new { code = 0, msg = strMesage });
                    return Ok(new { code = 1, msg = strMesage });
                }
                else
                {
@@ -357,11 +366,11 @@
        }
        [HttpGet]
        public IActionResult GetBoxInfoByBoxNo(string boxNo, string boxNo3)
        public IActionResult GetBoxInfoByBoxNo(string bindNo, string boxNo, string boxNo3)
        {
            try
            {
                var models = _PalletBindSvc.GetBoxInfoByBoxNo(boxNo, boxNo3);
                var models = _PalletBindSvc.GetBoxInfoByBoxNo(bindNo,boxNo, boxNo3);
                return Ok(new { code = 0, count= models.Count, msg = "箱支明细信息", data = models });
            }
@@ -503,7 +512,7 @@
        {
            try
            {
                var models = _PalletBindSvc.GetLocateList("W01",model.RoadwayNo,model.Row,model.Column,model.Layer,model.LocateNo,model.Page,model.Limit, out int count);
                var models = _PalletBindSvc.GetLocateList("W01",model.RoadwayNo,model.Row,model.Column,model.Layer,model.LocateNo,model.BindId,model.Page,model.Limit, out int count);
                return Ok(new { code = 0, count, msg = "获取指定储位信息", data = models });
            }
@@ -911,7 +920,7 @@
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                var list = _BoxInfoSvc.AddLabelBox(model.Id, model.IsReset, decimal.Parse(model.ArriveQty),  model.ProductionTime, model.ExpirationTime, model.StoreTime, int.Parse(userId));
                var list = _BoxInfoSvc.AddLabelBox(model.Id, model.IsReset, decimal.Parse(model.ArriveQty), model.ProductionTime, model.ExpirationTime, model.StoreTime, model.SupplierLot, int.Parse(userId));
                return Ok(new { code = 0,  msg = "生成箱码标签成功", data = list });
            }
            catch (Exception e)
@@ -946,7 +955,73 @@
            }
        }
        //根据入库单号过去单据下所有批次号
        [HttpGet]
        public IActionResult GetLotNoListByAsn(string asnNo)
        {
            try
            {
                var list = _BoxInfoSvc.GetLotNoListByAsn(asnNo);
                return Ok(new { code = 0, msg = "成功获取单据下所有批次号信息", data = list });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, count = 0, msg = e.Message });
            }
        }
        //删除单据下单个或多个批次的标签
        [HttpPost]
        public IActionResult DelLabelByAsnNo(LabelBoxInfoVm 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.DelLabelByAsnNo(model.AsnNo,model.LotNo,int.Parse(userId));
                return Ok(new { code = 0, msg = "删除成功", data = "" });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, count = 0, msg = e.Message });
            }
        }
        //编辑标签数量
        [HttpPost]
        public IActionResult EditLabelQty(EditLabelQtyVm 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.EditLabelQty(model.Id, model.Qty, int.Parse(userId));
                return Ok(new { code = 0, msg = "编辑成功", data = "" });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, count = 0, msg = e.Message });
            }
        }
        #endregion
    }