zhaowc
2025-01-20 f2bc08e28dda7022202f07217f6a3c150f818af7
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -21,6 +21,7 @@
using WMS.Entity.SysEntity;
using WMS.IBLL.IBllAsnServer;
using WMS.Entity.BllQualityEntity;
using WMS.Entity.BllCheckEntity;
namespace WMS.BLL.BllAsnServer
{
@@ -180,6 +181,7 @@
                //判断托盘绑定信息中是否有
                var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == detail.Id && m.PalletNo == model.PalletNo && m.Status != "2");
                var bindId = 0;
                var boxQtyZong = model.Detail.Sum(m => m.Qty);
                if (bind == null)
                {
                    bind = new BllPalletBind
@@ -189,7 +191,7 @@
                        PalletNo = model.PalletNo,
                        PalletNo2 = "",
                        PalletNo3 = "",
                        Qty = model.Qty,
                        Qty = boxQtyZong,
                        FullQty = pNum,
                        Status = "0",//等待执行
                        Type = model.Type, //托盘类型  0物料托  1空托盘托
@@ -213,7 +215,8 @@
                }
                else
                {
                    throw new Exception("组盘信息重复");
                    //throw new Exception("组盘信息重复");
                    return;
                }
@@ -316,8 +319,8 @@
                                Standard = box.Standard,
                                PackageStandard = box.PackageStandard,
                                StoreTime = box.StoreTime,
                                QtyCount = (int)box.QtyCount,
                                QtyOrd = (int)box.QtyOrd,
                                QtyCount = box.QtyCount.HasValue? (int)box.QtyCount : 0,
                                QtyOrd = box.QtyOrd.HasValue ? (int)box.QtyOrd : 0,
                                CreateUser = userId,
                                CreateTime = comTime,
                            };
@@ -493,6 +496,7 @@
                    .GroupBy((a, b) => new
                    {
                        a.PalletNo,
                        a.BindNo,
                        a.BoxNo,
                        a.SkuNo,
                        a.SkuName,
@@ -510,6 +514,7 @@
                    .Select((a, b) => new BoxInfoDto()
                    {
                        BoxNo = a.BoxNo,
                        BindNo = a.BindNo,
                        PalletNo = a.PalletNo,
                        Qty = SqlFunc.AggregateSum(a.Qty),
                        FullQty = a.FullQty,
@@ -540,9 +545,10 @@
        /// <param name="boxNo">箱码</param>
        /// <param name="boxNo3">支码</param>
        /// <returns></returns>
        public List<BoxInfoDto> GetBoxInfoByBoxNo(string boxNo, string boxNo3)
        public List<BoxInfoDto> GetBoxInfoByBoxNo(string bindNo, string boxNo, string boxNo3)
        {
            Expression<Func<BllBoxInfo, bool>> item = Expressionable.Create<BllBoxInfo>()
                .AndIF(!string.IsNullOrWhiteSpace(bindNo), it => it.BindNo == int.Parse(bindNo))
                .AndIF(!string.IsNullOrWhiteSpace(boxNo), it => it.BoxNo == boxNo.Trim())
                .AndIF(!string.IsNullOrWhiteSpace(boxNo3), it => it.BoxNo3.Contains(boxNo3.Trim()))
                .And(m => m.IsDel == "0")
@@ -1181,7 +1187,7 @@
                            EndLocate = beingTask.EndLocat, // 目标位置
                            EndRoadway = beingTask.EndRoadway, //  目标巷道
                            TaskNo = beingTask.TaskNo, // 任务号
                            TaskType = "0",// 任务类型 (出库)
                            TaskType = "0",// 任务类型 (入库)
                            OutMode = "",  //目标地址
                            Order = 1
                        };
@@ -1903,9 +1909,9 @@
                                EndLocate = beingTask.EndLocat, // 目标位置
                                EndRoadway = beingTask.EndRoadway,                           //  目标巷道
                                TaskNo = beingTask.TaskNo, // 任务号
                                TaskType = "0",// 任务类型 (出库)
                                TaskType = "0",// 任务类型 (出库)
                                OutMode = "",  //目标地址
                                Order = 1
                                Order = 1
                            };
                            if (beingTask.IsSuccess == 0)
                            {
@@ -2522,6 +2528,7 @@
                                SkuName = boxInfo.SkuName,
                                Standard = sku.Standard,
                                ProductionTime = boxInfo.ProductionTime,
                                ExpirationTime = boxInfo.ExpirationTime,
                                SupplierLot = boxInfo.SupplierLot,
                                InspectStatus = boxInfo.InspectStatus,
                                InspectMark = boxInfo.InspectMark,
@@ -2695,6 +2702,7 @@
                                    SkuName = demo.SkuName,
                                    Standard = noticeDetail.Standard,
                                    ProductionTime = demo.ProductionTime,
                                    ExpirationTime = demo.ExpirationTime,
                                    SupplierLot = demo.SupplierLot,
                                    InspectStatus = demo.InspectStatus,
                                    InspectMark = demo.InspectMark,
@@ -3180,6 +3188,87 @@
        }
        //申请缠膜入库
        public int RequestPackWcs(string palletNo)
        {
            try
            {
                int t = -1;
                //验证托盘条码是否为空
                if (string.IsNullOrEmpty(palletNo))
                {
                    throw new Exception("未找到该托盘条码:"+ palletNo);
                }
                var palletBindList = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo && m.Status == "1").OrderByDescending(m=>m.CreateTime).First();
                if (palletBindList.IsBale == "1")
                {
                    t = 1;
                }
                return t;
            }
            catch  (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        //申请拆膜出库
        public int RequestUnPackWcs(string palletNo)
        {
            try
            {
                int t = -1;
                //验证托盘条码是否为空
                if (string.IsNullOrEmpty(palletNo))
                {
                    throw new Exception("未找到该托盘条码:" + palletNo);
                }
                var palletBindList = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo && m.LocatNo.Substring(0,1) != "B").First();
                if (palletBindList.IsBale == "2")
                {
                    palletBindList.IsBale = "0";
                    Db.Updateable(palletBindList).ExecuteCommand();
                    t = 1;
                }
                return t;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        //缠膜完成
        public int RequestPackedWcs(string palletNo)
        {
            try
            {
                int t = -1;
                //验证托盘条码是否为空
                if (string.IsNullOrEmpty(palletNo))
                {
                    throw new Exception("未找到该托盘条码:" + palletNo);
                }
                var palletBindList = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo && m.Status == "1").OrderByDescending(m => m.CreateTime).First();
                if (palletBindList.IsBale == "1")
                {
                    palletBindList.IsBale = "2";
                    Db.Updateable(palletBindList).ExecuteCommand();
                    t = 1;
                }
                return t;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        ////重新下发入库任务
        //public OutCommandDto AgainSendAsnTask(string taskNo, int userId, string url)