chengsc
2024-08-19 5e2454c2a75cb70afc0d1933e5c29e02e21231e6
Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -826,7 +826,7 @@
        {
            try
            {
                var allotList = Db.Queryable<BllExportNotice>().Where(m => m.IsDel == "0" && m.Status == "2").Select(m => m.SONo).Distinct().ToList();
                var allotList = Db.Queryable<BllExportNotice>().Where(m => m.IsDel == "0" && (m.Status == "3" || m.Status == "4")).Select(m => m.SONo).Distinct().ToList();
                return allotList;
            }
            catch (Exception ex)
@@ -983,11 +983,11 @@
                //修改库存明细信息
                stockDetail.Status = "4";//移库锁定
                stockDetail.LockQty = stockDetail.Qty;//锁定库存数量
                //stockDetail.LockQty = stockDetail.Qty;//锁定库存数量
                Db.Updateable(stockDetail).ExecuteCommand();
                //修改库存信息
                stock.LockQty += (decimal)stockDetail.Qty;
                Db.Updateable(stock).ExecuteCommand();
                //stock.LockQty += (decimal)stockDetail.Qty;
                //Db.Updateable(stock).ExecuteCommand();
                //修改起始储位地址状态
                storageLocat.Status = "5";//0:空储位 1:有物品 2:入库中 3:出库中 4:移入中 5:移出中 
@@ -1069,7 +1069,7 @@
        /// <param name="palletNo"></param>
        /// <param name="areaNo"></param>
        /// <param name="userId"></param>
        public void AgvTransport2(string soNo, string palletNo, string areaNo, int userId, string url)
        public List<string> AgvTransport2(string soNo, string palletNo, string areaNo, int userId, string url)
        {
            if (string.IsNullOrEmpty(soNo))
            {
@@ -1084,7 +1084,7 @@
                //开启事务
                Db.BeginTran();
                List<AgvSchedulingTask> agvTaskList = new List<AgvSchedulingTask>();
                var strList = new List<string>();//错误信息集合  //0 :部分托盘已有小车等待执行或正在执行的任务
                //出库单信息
                var notice = Db.Queryable<BllExportNotice>().First(w => w.IsDel == "0" && w.SONo == soNo);
                if (notice == null)
@@ -1104,8 +1104,9 @@
                }
                else//整个出库单叫货
                {
                    string sqlStr = $"select * from DataStockDetail where PalletNo in (select PalletNo from BllExportAllot where IsDel='0' and SONo='{soNo}')";
                    stockDetailList = Db.Ado.SqlQuery<DataStockDetail>(sqlStr).ToList();
                //    string sqlStr = $"select * from DataStockDetail where PalletNo in (select PalletNo from BllExportAllot where IsDel='0' and SONo='{soNo}')";
                //    stockDetailList = Db.Ado.SqlQuery<DataStockDetail>(sqlStr).ToList();
                    stockDetailList = Db.Queryable<DataStockDetail>().Where(w => w.IsDel == "0" && w.SONo == soNo).ToList();
                }
                if (stockDetailList.Count <= 0)
                {
@@ -1117,14 +1118,10 @@
                var stock = Db.Queryable<DataStock>().Where(w => w.IsDel == "0");//库存总表
                string EndLocat = string.Empty;//目标位置
                string hasLocatNoList = string.Empty;//已分配的储位
                foreach (var item in stockDetailList)
                {
                    //任务信息
                    var logInfo = log.First(w => w.PalletNo == item.PalletNo);
                    if (logInfo != null)
                    {
                        throw new Exception($"托盘号:{item.PalletNo}已有小车等待执行或正在执行的任务!");
                    }
                    if (string.IsNullOrEmpty(item.LocatNo))
                    {
                        throw new Exception($"托盘号:{item.PalletNo}的储位信息不存在,请检查!");
@@ -1132,6 +1129,17 @@
                    if (item.WareHouseNo != "W02")
                    {
                        throw new Exception($"托盘号:{item.PalletNo}未在平库内,请检查!");
                    }
                    //任务信息
                    var logInfo = log.First(w => w.PalletNo == item.PalletNo);
                    if (logInfo != null)
                    {
                        if (!strList.Contains("1"))
                        {
                            strList.Add("1");
                        }
                        continue;
                        //throw new Exception($"托盘号:{item.PalletNo}已有小车等待执行或正在执行的任务!");
                    }
                    //起始储位信息
                    var storageLocatBegin = storageLocat.First(w => w.LocatNo == item.LocatNo);
@@ -1171,7 +1179,7 @@
                        Msg = string.Format("转运任务:{0}=>>{1}", item.LocatNo, EndLocat),
                        StartLocat = item.LocatNo,//起始位置
                        EndLocat = EndLocat,//目标位置
                        PalletNo = palletNo,//托盘码
                        PalletNo = item.PalletNo,//托盘码
                        IsSend = 1,//是否可再次下发
                        IsCancel = 1,//是否可取消
                        IsFinish = 1,//是否可完成
@@ -1194,7 +1202,7 @@
                    //修改库存明细信息
                    item.Status = "4";//移库锁定
                    item.LockQty = item.Qty;//锁定库存数量
                    //item.LockQty = item.Qty;//锁定库存数量
                    Db.Updateable(item).ExecuteCommand();
                    //修改起始储位地址状态
@@ -1203,11 +1211,16 @@
                    //修改目标储位地址状态
                    storageLocatEnd.Status = "4";//0:空储位 1:有物品 2:入库中 3:出库中 4:移入中 5:移出中 
                    Db.Updateable(storageLocatEnd).ExecuteCommand();
                    if (!strList.Contains("0"))
                    {
                        strList.Add("0");
                    }
                    var stockInfo = stock.First(w => w.SkuNo == item.SkuNo && w.LotNo == item.LotNo);
                    //修改库存信息
                    stockInfo.LockQty += (decimal)item.Qty;//锁定数量
                    Db.Updateable(stockInfo).ExecuteCommand();
                    //var stockInfo = stock.First(w => w.SkuNo == item.SkuNo && w.LotNo == item.LotNo);
                    ////修改库存信息
                    //stockInfo.LockQty += (decimal)item.Qty;//锁定数量
                    //Db.Updateable(stockInfo).ExecuteCommand();
                }
                if (string.IsNullOrEmpty(palletNo))
                {
@@ -1264,6 +1277,7 @@
                //提交事务
                Db.CommitTran();
                return strList;
            }
            catch (Exception ex)
            {