Administrator
2024-03-13 f2dc0484c97dc430279fe45a09a15c967a60a2b9
Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -1284,6 +1284,72 @@
            }
        }
        //根据托盘号获取取样类型
        public string GetSampleType(string palletNo)
        {
            try
            {
                var type = "";
                var detail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNo);
                if (detail== null)
                {
                    throw new Exception("当前托盘未在库存中");
                }
                //怎么判断当前托盘是库外要取样的托盘,正常出库剩余托盘目前这种情况也能拣货啊,也没有分配信息
                var allot = Db.Queryable<BllExportAllot>().First(m =>
                    m.IsDel == "0" && m.PalletNo == palletNo && m.Status != "5" && m.Status != "6");
                if (allot!=null)
                {
                    var soNo = Db.Queryable<BllExportNotice>()
                        .First(m => m.IsDel == "0" && m.SONo == allot.SONo);
                    if (soNo == null)
                    {
                        throw new Exception("未找到托盘上出库单据信息");
                    }
                    if (soNo.Type != "3")
                    {
                        throw new Exception("该托盘不是取样托盘");
                    }
                    type = "0";//库内取样
                }
                else
                {
                    type = "1";//库前取样
                }
                return type;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        //根据托盘号获取入库单据
        public List<string> GetAsnNoByPallet(string palletNo)
        {
            try
            {
                var type = "";
                var detail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNo);
                if (detail == null)
                {
                    throw new Exception("当前托盘未在库存中");
                }
                var list = new List<string>();
                if (string.IsNullOrWhiteSpace(detail.ASNNo))
                {
                    throw new Exception("未查询到该托盘的入库单信息");
                }
                list.Add(detail.ASNNo);
                return list;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
    }
}