zhaowc
2024-08-22 13dce68bfdf0aca4b05e800494d2cd82c36ac44c
Wms/Wms/Controllers/BllAsnController.cs
@@ -14,13 +14,14 @@
using System.Threading.Tasks;
using SqlSugar;
using System.Diagnostics;
using Model.ModelDto.SysDto;
using static System.Reflection.Metadata.BlobBuilder;
namespace Wms.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class BllAsnController : ControllerBase
    {
        #region 依赖注入
@@ -33,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;
@@ -47,6 +49,7 @@
            _auditLog = auditLog;
            _labelBox = labelBox;
            _procurePlanSvc = procurePlanSvc;
            _palletUpShelfSvc = palletUpShelfSvc;
        }
        #endregion
@@ -64,7 +67,7 @@
            RefAsync<int> count = new RefAsync<int>();
            var bolls = await _arrivalNoticeSvc.GetArrivalNoticeList(model, count);
            return new SqlSugarPagedList() { Items = bolls, Total = count };
        }
        }
        [HttpPost]
@@ -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 = "" });
            }
@@ -692,7 +695,7 @@
                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)
            {
@@ -861,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)
            {
@@ -920,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)
            {
@@ -945,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)
@@ -986,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)
@@ -1128,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 });
@@ -1149,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 });
            }
@@ -1168,7 +1171,7 @@
        /// <returns>采购单信息</returns>
        [HttpPost]
        [ServiceFilter(typeof(ApiResponseActionFilter))]
        public async Task<SqlSugarPagedList>  GetProcurePlanNoticeList(ProcurePlanNoticeVm model)
        public async Task<SqlSugarPagedList> GetProcurePlanNoticeList(ProcurePlanNoticeVm model)
        {
            RefAsync<int> count = new RefAsync<int>();
            var bolls = await _procurePlanSvc.GetProcurePlanNoticeList(model, count);
@@ -1215,7 +1218,7 @@
                {
                    throw new Exception("未获取到用户信息");
                }
                _procurePlanSvc.CreateAsnByProcurePlan(Convert.ToInt32(model.Id), int.Parse(UserId));
                return Ok(new { code = 0, msg = "添加成功" });
@@ -1257,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
    }
}