zhaowc
2025-02-28 157abc191c34e57c1b958ae74fc3de6518ca8a30
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -44,7 +44,7 @@
            try
            {
                //model.Type:单据类型 在这里代表前端页签类型:即标签页签:贴标物料; 数量页签:不贴表物料,原因:懒得加参数
                var data = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && m.Status != "3" && m.Status != "4").Select(m => m.ASNNo).ToList();
                var data = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && m.Status !="2" && m.Status != "3" && m.Status != "4").Select(m => m.ASNNo).ToList();
                var list = new List<ArrivalNoticeDetailDto>();
                if (model.Type.Contains("0"))//0贴标
                {
@@ -267,6 +267,42 @@
            }
        }
        /// <summary>
        /// 验证地码是否存在
        /// </summary>
        /// <param name="locatNo">地码</param>
        /// <returns>"":可使用 -1:不可使用(原因)</returns>
        public string IsEnableLocatNo(string locatNo)
        {
            string sqlMsg = "";
            string sqlString = string.Empty;
            try
            {
                sqlString = $"select * from SysStorageLocat where LocatNo = '{locatNo}' and WareHouseNo = 'W02' and isdel = '0';";
                var models = Db.Ado.SqlQuery<PalletBindVm>(sqlString);
                if (models.Count > 0)
                {
                    if (models[0].Status != "0")
                    {
                        sqlMsg = "-1:此库位使用中,请在库内请核实!";
                    }
                }
                else
                {
                    sqlMsg = "-1:库位不存在!";
                }
                return sqlMsg;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        // 根据箱码或托盘号获取箱支信息   liudl 
        public List<BoxInfoDto> GetBoxInfos(BoxInfoVm model)
        {
@@ -334,6 +370,7 @@
        public string BindNullPallet(PalletBindVm model)
        {
            string strMsg = "";
            string type = model.BindType == "0" ? "PDA" : "叠托机";
            try
            {
                var datetime = Db.GetDate();
@@ -441,7 +478,7 @@
                    LotText = "",
                    SupplierLot = "",
                    InspectStatus = "1",
                    Origin = "PDA",
                    Origin = type,
                    BoxNo = "",
                    BoxNo2 = "",
                    BoxNo3 = "",
@@ -462,6 +499,120 @@
                // 插入操作日志
                new OperationASNServer().AddLogOperationAsn("PDA模块", "空托入库", model.PalletNo, "添加", $"在PDA上添加了空托盘跺", (int)model.CreateUser);
                return strMsg;
            }
            catch (Exception ex)
            {
                Db.Ado.RollbackTran();
                throw ex;
            }
        }
        // 叠托机绑定空托盘
        public string BindNullPallets(PalletsBind model)
        {
            string strMsg = "";
            string type = model.BindType == "0" ? "PDA" : "叠托机";
            try
            {
                var datetime = Db.GetDate();
                //获取托盘绑定信息
                string str = "select * from BllPalletBind where IsDel = '0' and PalletNo = @palletno and Status = '0' ";
                List<PalletBindVm> list = Db.Ado.SqlQuery<PalletBindVm>(str, new
                {
                    palletno = model.PalletNo //托盘号
                });
                //判断是否已绑定该托盘
                if (list.Count > 0)
                {
                    strMsg = "-1:该托盘已被绑定!";
                    return strMsg;
                }
                if (string.IsNullOrEmpty(model.PalletNo))
                {
                    strMsg = "-1:托盘号不可为空!";
                    return strMsg;
                }
                if (model.Qty == null || model.Qty == 0)
                {
                    strMsg = "-1:空托盘数量不可为空!";
                    return strMsg;
                }
                //获取托盘信息
                var pallet = Db.Queryable<SysPallets>().First(a => a.IsDel == "0" && a.PalletNo == model.PalletNo);
                if (pallet == null)
                {
                    strMsg = "-1:托盘信息为空!";
                    return strMsg;
                }
                if (pallet.Status != "0")
                {
                    strMsg = "-1:该托盘正在使用!";
                    return strMsg;
                }
                Db.BeginTran();
                // 插入托盘绑定表
                var modelpb = new BllPalletBind
                {
                    ASNNo = "",
                    ASNDetailNo = 0,
                    TaskNo = "", //任务号
                    PalletNo = model.PalletNo,
                    Qty = (int)model.Qty,
                    Status = "0", //等待执行
                    Type = "1", //0 物料托 1 空托
                    LotNo = "",
                    LotText = "",
                    SupplierLot = "",
                    InspectMark = "0", //0 否 1 是
                    BitPalletMark = "0",
                    IsBale = "0",
                    IsBelt = "0",
                    CreateTime = Db.GetDate()
                };
                var id = Db.Insertable(modelpb).ExecuteReturnIdentity();
                var modelbb = new BllBoxInfo
                {
                    ASNNo = "",
                    ASNDetailNo = null,
                    BindNo = id,
                    PalletNo = model.PalletNo,
                    Status = "1",
                    CompleteTime = DateTime.Now,
                    Qty = (int)model.Qty,
                    FullQty = null,
                    SkuNo = "100099",
                    SkuName = "托盘",
                    LotNo = "",
                    LotText = "",
                    SupplierLot = "",
                    InspectStatus = "1",
                    Origin = type,
                    BoxNo = "",
                    BoxNo2 = "",
                    BoxNo3 = "",
                    InspectMark = "",
                    BitBoxMark = "0",
                    CreateTime = datetime
                };
                Db.Insertable(modelbb).ExecuteCommand();
                // 更改托盘使用状态
                string sqlStr = string.Empty;
                sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';";
                Db.Ado.ExecuteCommand(sqlStr);
                Db.CommitTran();
                // 插入操作日志
                new OperationASNServer().AddLogOperationAsn("PDA模块", "空托入库", model.PalletNo, "添加", $"在PDA上添加了空托盘跺", 1);
                return strMsg;
            }
@@ -1647,8 +1798,8 @@
                    SupplierLot = "",
                    InspectMark = "0",
                    BitPalletMark = "1",
                    IsBale = "0",
                    IsBelt = "0",
                    IsBale = arrivalnotice.IsBale,
                    IsBelt = arrivalnotice.IsBelt,
                    CreateUser = userId
                };
                // 插入托盘绑定表
@@ -1721,8 +1872,8 @@
                        BitPalletMark = "1",
                        InspectStatus = sku.IsInspect,// 组盘的时候就要默认设定好是否合格
                        PackagNo = sku.PackagNo,
                        IsBale = null,
                        IsBelt = null,
                        IsBale = arrivalnotice.IsBale,
                        IsBelt = arrivalnotice.IsBelt,
                        CreateUser = userId,
                        CreateTime = serverTime
                    };
@@ -2459,8 +2610,8 @@
                        SupplierLot = detail.SupplierLot,
                        InspectMark = "0",
                        BitPalletMark = "1",
                        IsBale = "0",
                        IsBelt = "0",
                        IsBale = detail.IsBale,
                        IsBelt = detail.IsBelt,
                        CreateUser = userId,
                        Demo = model.Demo,