Administrator
2024-02-04 415c17f207966603c4c60c408f0e0bfdc3763ca7
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -676,7 +676,7 @@
                #endregion
                #region 地码信息(储位信息)
                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LocatNo && w.Status == "0");
                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LocatNo && w.Status == "0" && w.WareHouseNo == "W02");
                if (storageLocat == null)
                {
                    strMsg = "-1:储位信息不存在或非空闲状态,请核查!";
@@ -922,6 +922,8 @@
                        //修改组托状态
                        palletbindInfo.Status = "2"; //2 入库完成
                        palletbindInfo.WareHouseNo = "W02";//所属仓库
                        palletbindInfo.LocatNo = model.LocatNo;//储位地址
                        palletbindInfo.UpdateTime = serverTime;
                        palletbindInfo.UpdateUser = model.CreateUser;
                        palletbindInfo.CompleteTime = serverTime; //完成时间
@@ -1087,7 +1089,12 @@
                    #endregion
                    #endregion
                }
                }
                storageLocat.Status = "1";
                storageLocat.UpdateTime= serverTime; //修改时间
                storageLocat.UpdateUser = model.CreateUser; //修改人
                //修改储位状态
                Db.Updateable(storageLocat).ExecuteCommand();
                new OperationASNServer().AddLogOperationAsn("PDA模块", "平库入库", model.PalletNo, "完成", $"在PDA上完成单据号为:{model.ASNNo}的托盘码为:{model.PalletNo}的平库入库操作", (int)model.CreateUser);
@@ -1660,8 +1667,48 @@
                throw ex;
            }
        }
        // 根据单据号获取单据明细列表
        public List<ArrivalNoticeDetailDto> GetBindArrivalNoticeDetails(ArrivalNoticeVm model)
        {
            string sqlString = string.Empty;
            try
            {
                sqlString = $"select * from BllArrivalNoticeDetail where ASNNo = '{model.ASNNo}' and isdel='0' order by CreateTime;";
                var modelList = Db.Ado.SqlQuery<ArrivalNoticeDetailDto>(sqlString);
                List<ArrivalNoticeDetailDto> noticeList = new List<ArrivalNoticeDetailDto>();
                foreach (var item in modelList)
                {
                    if (string.IsNullOrEmpty(item.LotNo))
                    {
                        noticeList.Add(item);
                    }
                    else
                    {
                        string[] LotNoList = item.LotNo.Split(';');
                        foreach (var item2 in LotNoList)
                        {
                            ArrivalNoticeDetailDto entry = new ArrivalNoticeDetailDto();
                            entry = item;
                            entry.LotNo = item2;
                            noticeList.Add(entry);
                        }
                    }
                }
                return noticeList;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 绑定托盘
        /// </summary>
        /// <param name="model"></param>
        /// <param name="userId"></param>
        /// <param name="origin"></param>
        public void BindPallet(PdaPalletBindVm model, int userId, string origin)
        {
            try
@@ -1679,6 +1726,19 @@
                if (string.IsNullOrEmpty(model.PalletNo))
                {
                    throw new Exception("-1:托盘号不可为空!");
                }
                if (string.IsNullOrEmpty(model.LotNo))
                {
                    throw new Exception("-1:物料批次不可为空!");
                }
                else
                {
                    //从物料名称-批次中取出批次
                    int indexOfDash = model.LotNo.IndexOf("-");
                    if (indexOfDash != -1)
                    {
                        model.LotNo = model.LotNo.Substring(indexOfDash + 1);
                    }
                }
                //判断物料数量是否为0 为0判断箱码信息 不为0继续
                if (model.SkuQty == 0)
@@ -1708,7 +1768,7 @@
                    throw new Exception("未查询到托盘信息,请核实!");
                }
                // 验证入库单明细是否存在
                var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo);
                var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo));
                if (detail == null)
                {
                    throw new Exception("-1:当前物料及批次与单据无关联,请核实!");
@@ -1784,7 +1844,7 @@
                        FullQty = pNum,
                        Status = "0",
                        Type = "0",
                        LotNo = detail.LotNo,
                        LotNo = model.LotNo,
                        LotText = detail.LotText,
                        SupplierLot = "",
                        InspectMark = "0",
@@ -1793,6 +1853,10 @@
                        IsBelt = "0",
                        CreateUser = userId
                    };
                    if (model.SkuQty > pNum)
                    {
                        throw new Exception($"绑定失败,{model.PalletNo}托盘绑定数量大于该物品托盘包装数量!");
                    }
                    // 插入托盘绑定表
                    bindId = Db.Insertable(bind).ExecuteReturnIdentity();
                }
@@ -1850,7 +1914,7 @@
                                continue;
                            }
                            //箱内物料批次与单据明细不符合
                            if (box.SkuNo != detail.SkuNo || box.LotNo != detail.LotNo)
                            if (box.SkuNo != detail.SkuNo || box.LotNo != model.LotNo)
                            {
                                throw new Exception($"-1:{box.BoxNo}箱内物料及批次与单据不一致,请核实!");
                            }
@@ -1886,6 +1950,10 @@
                {
                    bind.BitPalletMark = "0";
                }
                if (bind.Qty > pNum)
                {
                    throw new Exception($"绑定失败,{bind.PalletNo}托盘绑定数量大于该物品托盘包装数量!");
                }
                Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand();
                // 更改入库单明细已组数量
@@ -1915,7 +1983,7 @@
                //添加托盘记录表数据
                sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','组盘','0',getDate(),{userId},NULL,NULL);";
                Db.Ado.ExecuteCommand(sqlStr);
                new OperationASNServer().AddLogOperationAsn("PDA模块", "托盘绑定1", model.AsnNo, "添加", $"添加了托盘码为:{model.PalletNo}、{msgStr}的组盘信息", userId);
                new OperationASNServer().AddLogOperationAsn("PDA模块", "托盘绑定", model.AsnNo, "添加", $"添加了托盘码为:{model.PalletNo}、{msgStr}的组盘信息", userId);
                Db.CommitTran();
            }