hwh
2024-08-05 e85e1603b2d1c013be767a393a27ff4f2b97be81
Wms/Wms/Controllers/BllAsnController.cs
@@ -9,6 +9,13 @@
using WMS.IBLL.IBllAsnServer;
using WMS.IBLL.ILogServer;
using Model.ModelVm.BllAsnVm;
using Utility;
using Model.ModelDto.BllAsnDto;
using System.Threading.Tasks;
using SqlSugar;
using System.Diagnostics;
using Model.ModelDto.SysDto;
using static System.Reflection.Metadata.BlobBuilder;
namespace Wms.Controllers
{
@@ -27,10 +34,11 @@
        private readonly IAuditLogServer _auditLog;                                 // 审核记录
        private readonly IBllLabelBoxNoServer _labelBox;                            // 箱码标签
        private readonly IProcurePlanServer _procurePlanSvc;                            // 箱码标签
        private readonly IPalletUpShelfServer _palletUpShelfSvc;                            // 上架记录
        #endregion
        #region 构造函数
        public BllAsnController(IArrivalNoticeServer arrivalNoticeSvc, IPalletBindServer palletBindSvc,IBllBoxInfoServer bllBoxInfoSvc, ITaskServer taskSvc,IOperationASNServer logSvc, IPalletUnbindServer palletUnbind,IAuditLogServer auditLog,IBllLabelBoxNoServer labelBox, IProcurePlanServer procurePlanSvc)
        public BllAsnController(IArrivalNoticeServer arrivalNoticeSvc, IPalletBindServer palletBindSvc, IBllBoxInfoServer bllBoxInfoSvc, ITaskServer taskSvc, IOperationASNServer logSvc, IPalletUnbindServer palletUnbind, IAuditLogServer auditLog, IBllLabelBoxNoServer labelBox, IProcurePlanServer procurePlanSvc, IPalletUpShelfServer palletUpShelfSvc)
        {
            _arrivalNoticeSvc = arrivalNoticeSvc;
            _PalletBindSvc = palletBindSvc;
@@ -41,6 +49,7 @@
            _auditLog = auditLog;
            _labelBox = labelBox;
            _procurePlanSvc = procurePlanSvc;
            _palletUpShelfSvc = palletUpShelfSvc;
        }
        #endregion
@@ -51,33 +60,23 @@
        /// <param name="model">查询条件</param>
        /// <returns>入库单信息</returns>
        [HttpPost]
        public IActionResult GetArrivalNoticeList(ArrivalNoticeVm model)
        [ServiceFilter(typeof(ApiResponseActionFilter))]
        public async Task<SqlSugarPagedList> GetArrivalNoticeList(ArrivalNoticeVm model)
        {
            try
            {
                var models = _arrivalNoticeSvc.GetArrivalNoticeList(model, out int count);
                return Ok(new { code = 0, count, msg = "入库单信息", data = models });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
        }
            RefAsync<int> count = new RefAsync<int>();
            var bolls = await _arrivalNoticeSvc.GetArrivalNoticeList(model, count);
            return new SqlSugarPagedList() { Items = bolls, Total = count };
        }
        [HttpPost]
        public IActionResult GetArrivalNoticeDetailList(ArrivalNoticeDetailVm model)
        [ServiceFilter(typeof(ApiResponseActionFilter))]
        public async Task<SqlSugarPagedList> GetArrivalNoticeDetailList(ArrivalNoticeDetailVm model)
        {
            try
            {
                var models = _arrivalNoticeSvc.GetArrivalNoticeDetailList(model, out int count);
                return Ok(new { code = 0, count, msg = "入库单明细信息", data = models });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
            RefAsync<int> count = new RefAsync<int>();
            var bolls = await _arrivalNoticeSvc.GetArrivalNoticeDetailList(model, count);
            return new SqlSugarPagedList() { Items = bolls, Total = count };
        }
        /// <summary>
@@ -172,6 +171,10 @@
                {
                    throw new Exception("未获取到用户信息");
                }
                if (string.IsNullOrWhiteSpace(model.ASNNo))
                {
                    throw new Exception("单据号不可为null!");
                }
                model.CreateUser = int.Parse(UserId);
                string strMesage = _arrivalNoticeSvc.EditArrivalNotice(model);
@@ -182,7 +185,7 @@
                }
                if (strMesage.Contains("-1"))
                {
                    return Ok(new { code = 0, msg = "部分成功 "+ strMesage });
                    return Ok(new { code = 0, msg = "部分成功 " + strMesage });
                }
                else
                {
@@ -270,7 +273,7 @@
        /// <param name="reason"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult CancelOrder(int id,string reason)
        public IActionResult CancelOrder(int id, string reason)
        {
            try
            {
@@ -284,12 +287,12 @@
                {
                    throw new Exception("未获取到用户信息");
                }
                _arrivalNoticeSvc.CancelOrder(id,reason,int.Parse(userId));
                _arrivalNoticeSvc.CancelOrder(id, reason, int.Parse(userId));
                return Ok(new { code = 0, msg = "入库单撤销申请成功" });
            }
            catch (Exception e)
            {
@@ -364,13 +367,13 @@
        }
        [HttpGet]
        public IActionResult GetBoxInfoByBoxNo(string boxNo, string boxNo3,int bindNo=0)
        public IActionResult GetBoxInfoByBoxNo(string boxNo, string boxNo3, int bindNo = 0)
        {
            try
            {
                var models = _PalletBindSvc.GetBoxInfoByBoxNo(boxNo, boxNo3,bindNo);
                var models = _PalletBindSvc.GetBoxInfoByBoxNo(boxNo, boxNo3, bindNo);
                return Ok(new { code = 0, count= models.Count, msg = "箱支明细信息", data = models });
                return Ok(new { code = 0, count = models.Count, msg = "箱支明细信息", data = models });
            }
            catch (Exception e)
            {
@@ -428,7 +431,7 @@
                {
                    throw new Exception("未获取到用户信息");
                }
                _PalletBindSvc.DelBindBoxInfo(boxNo,int.Parse(userId));
                _PalletBindSvc.DelBindBoxInfo(boxNo, int.Parse(userId));
                return Ok(new { code = 0, count = 0, msg = "删除成功", data = "" });
            }
@@ -460,7 +463,7 @@
                {
                    throw new Exception("未获取到用户信息");
                }
                _PalletBindSvc.CancelPalletBind(id, reason,int.Parse(userId));
                _PalletBindSvc.CancelPalletBind(id, reason, int.Parse(userId));
                return Ok(new { code = 0, count = 0, msg = "托盘绑定撤销申请成功", data = "" });
            }
@@ -484,7 +487,7 @@
            {
                var list = _BoxInfoSvc.GetBoxInfoList(boxNo, isContinue, boxNo2);
                var num = 0;
                if (list!=null)
                if (list != null)
                {
                    num = list.Count;
                }
@@ -510,7 +513,7 @@
        {
            try
            {
                var models = _PalletBindSvc.GetLocateList("W01",model.RoadwayNo,model.Row,model.Column,model.Layer,model.LocateNo,model.StockDetailId, model.Page,model.Limit, out int count);
                var models = _PalletBindSvc.GetLocateList("W01", model.RoadwayNo, model.Row, model.Column, model.Layer, model.LocateNo, model.StockDetailId, model.Page, model.Limit, out int count);
                return Ok(new { code = 0, count, msg = "获取指定储位信息", data = models });
            }
@@ -540,7 +543,7 @@
                {
                    throw new Exception("未获取到用户信息");
                }
                _PalletBindSvc.SaveAppointSlot(model.BindId,model.LocateId,int.Parse(userId));
                _PalletBindSvc.SaveAppointSlot(model.BindId, model.LocateId, int.Parse(userId));
                return Ok(new { code = 0, count = 0, msg = "指定储位成功", data = "" });
            }
@@ -684,14 +687,15 @@
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetArrivalTaskList(GetTaskVm model)
        public async Task<IActionResult> GetArrivalTaskList(GetTaskVm model)
        {
            try
            {
                var type = new List<string>() { "0" };
                var bolls = _taskSvc.GetTaskList(type, model.Type, model.Status, model.TaskNo, model.IsSuccess, model.PalletNo, model.Msg, model.Page, model.Limit, out int count);
                RefAsync<int> count = new RefAsync<int>();
                var bolls = await _taskSvc.GetTaskList(type, model.Type, model.Status, model.TaskNo, model.IsSuccess, model.PalletNo, model.Msg, model.Page, model.Limit, count);
                return Ok(new { code = 0, count, msg = "入库任务信息", data = bolls });
                return Ok(new { code = 0, count = count.Value, msg = "入库任务信息", data = bolls });
            }
            catch (Exception e)
            {
@@ -860,9 +864,9 @@
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                _auditLog.EditAudit(model.Id,model.Status,model.Opinion, int.Parse(userId));
                _auditLog.EditAudit(model.Id, model.Status, model.Opinion, int.Parse(userId));
                return Ok(new { code = 0, count=0, msg = "审核记录列表", data = "" });
                return Ok(new { code = 0, count = 0, msg = "审核记录列表", data = "" });
            }
            catch (Exception e)
            {
@@ -919,7 +923,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, model.SupplierLot, int.Parse(userId));
                return Ok(new { code = 0,  msg = "生成箱码标签成功", data = list });
                return Ok(new { code = 0, msg = "生成箱码标签成功", data = list });
            }
            catch (Exception e)
            {
@@ -944,7 +948,7 @@
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                var list = _BoxInfoSvc.GetBuDaLabelList(model.BoxNo, model.EndBoxNo, model.BoxNo2, model.EndBoxNo2,model.Type,int.Parse(userId));
                var list = _BoxInfoSvc.GetBuDaLabelList(model.BoxNo, model.EndBoxNo, model.BoxNo2, model.EndBoxNo2, model.Type, int.Parse(userId));
                return Ok(new { code = 0, msg = "获取补打箱码标签信息", data = list });
            }
            catch (Exception e)
@@ -985,7 +989,7 @@
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                _BoxInfoSvc.DelLabelByAsnNo(model.AsnNo,model.LotNo,int.Parse(userId));
                _BoxInfoSvc.DelLabelByAsnNo(model.AsnNo, model.LotNo, int.Parse(userId));
                return Ok(new { code = 0, msg = "删除成功", data = "" });
            }
            catch (Exception e)
@@ -1127,7 +1131,7 @@
        {
            try
            {
                var type = new List<string>() { "0","1","2" };
                var type = new List<string>() { "0", "1", "2" };
                var bolls = _taskSvc.GetArchivingTaskList(type, model.Type, model.Status, model.TaskNo, model.IsSuccess, model.PalletNo, model.Msg, model.Page, model.Limit, out int count);
                return Ok(new { code = 0, count, msg = "任务信息", data = bolls });
@@ -1148,7 +1152,7 @@
        {
            try
            {
                var bolls = _logSvc.GetArchivingLogOperationList(model.ComeFrom,model.MenuName, model.Type, model.Msg, model.StartTime, model.EndTime, model.Page, model.Limit, out int count);
                var bolls = _logSvc.GetArchivingLogOperationList(model.ComeFrom, model.MenuName, model.Type, model.Msg, model.StartTime, model.EndTime, model.Page, model.Limit, out int count);
                return Ok(new { code = 0, count, msg = "入库操作日志信息", data = bolls });
            }
@@ -1164,40 +1168,36 @@
        /// 获取采购单信息
        /// </summary>
        /// <param name="model">查询条件</param>
        /// <returns>入库单信息</returns>
        /// <returns>采购单信息</returns>
        [HttpPost]
        public IActionResult GetProcurePlanNoticeList(ProcurePlanNoticeVm model)
        [ServiceFilter(typeof(ApiResponseActionFilter))]
        public async Task<SqlSugarPagedList> GetProcurePlanNoticeList(ProcurePlanNoticeVm model)
        {
            try
            {
                var models = _procurePlanSvc.GetProcurePlanNoticeList(model, out int count);
                return Ok(new { code = 0, count, msg = "入库单信息", data = models });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
            RefAsync<int> count = new RefAsync<int>();
            var bolls = await _procurePlanSvc.GetProcurePlanNoticeList(model, count);
            return new SqlSugarPagedList() { Items = bolls, Total = count };
        }
        /// <summary>
        /// 获取采购单明细信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetProcurePlanNoticeDetailList(ProcurePlanNoticeDetailVm model)
        [ServiceFilter(typeof(ApiResponseActionFilter))]
        public async Task<SqlSugarPagedList> GetProcurePlanNoticeDetailList(ProcurePlanNoticeDetailVm model)
        {
            try
            {
                var models = _procurePlanSvc.GetProcurePlanNoticeDetailList(model, out int count);
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            RefAsync<int> count = new RefAsync<int>();
            var bolls = await _procurePlanSvc.GetProcurePlanNoticeDetailList(model, count);
            stopwatch.Stop();
                return Ok(new { code = 0, count, msg = "入库单明细信息", data = models });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
            var time = stopwatch.ElapsedMilliseconds;
            return new SqlSugarPagedList() { Items = bolls, Total = count };
        }
        /// <summary>
        /// 通过采购单生成入库单据
        /// </summary>
@@ -1218,7 +1218,7 @@
                {
                    throw new Exception("未获取到用户信息");
                }
                _procurePlanSvc.CreateAsnByProcurePlan(Convert.ToInt32(model.Id), int.Parse(UserId));
                return Ok(new { code = 0, msg = "添加成功" });
@@ -1260,6 +1260,23 @@
            }
        }
        #endregion
        #region 上架任务记录
        /// <summary>
        /// 获取上架任务记录信息分页集合
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [ServiceFilter(typeof(ApiResponseActionFilter))]
        public async Task<SqlSugarPagedList> GetPalletUpShelfList(PalletUpShelfVm model)
        {
            RefAsync<int> count = new RefAsync<int>();
            var data = await _palletUpShelfSvc.GetPalletUpShelfList(model.TraceNo, model.TaskNo,model.PalletNo,model.SkuNo,model.SkuName,model.LotNo,model.Status,model.Page,model.Limit, count);
            return new SqlSugarPagedList() { Items = data, Total = count };
        }
        #endregion
    }
}