chengsc
2024-10-24 716b29fea5945ca7dc4419d9f1f980c379312b32
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 == "")
                {
@@ -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 });
            }
@@ -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)
@@ -986,7 +995,33 @@
                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
    }