From 48df8080d7befac9fff4f5345750699c592512f6 Mon Sep 17 00:00:00 2001
From: chengsc <11752@DESKTOP-DS49RCP>
Date: 星期三, 07 五月 2025 08:21:28 +0800
Subject: [PATCH] 修改问题
---
Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs | 179 +++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 148 insertions(+), 31 deletions(-)
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
index a0e216c..142058b 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -6,6 +6,7 @@
using System.Threading.Tasks;
using Dm;
using Model.InterFaceModel;
+using Model.ModelDto;
using Model.ModelDto.BllCheckDto;
using Model.ModelDto.PdaDto;
using Newtonsoft.Json;
@@ -689,7 +690,7 @@
{
throw Oops.Bah("鎵樼洏鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
}
- if (models.WareHouseNo != "W02")
+ if (models.WareHouseNo != "W04")
{
throw Oops.Bah("璇ユ墭鐩樻湭鍦ㄥ钩搴撳唴,璇锋鏌�!");
}
@@ -719,7 +720,7 @@
{
throw Oops.Bah("鎵樼洏鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
}
- if (models.WareHouseNo != "W02")
+ if (models.WareHouseNo != "W04")
{
throw Oops.Bah("璇ユ墭鐩樻湭鍦ㄥ钩搴撳唴,璇锋鏌�!");
}
@@ -729,14 +730,9 @@
throw Oops.Bah("鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
}
- if (storageLocat.AreaNo.Contains("B0"))
- {
- storageArea = await Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.AreaNo.Contains("B0") && w.WareHouseNo == "W02").OrderBy(o => o.AreaNo).ToListAsync();
- }
- else
- {
- storageArea = await Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.AreaNo.Contains("B1") && w.WareHouseNo == "W02").OrderBy(o => o.AreaNo).ToListAsync();
- }
+
+ storageArea = await Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.AreaNo != storageLocat.AreaNo && w.WareHouseNo == "W04").OrderBy(o => o.AreaNo).ToListAsync();
+
}
return storageArea;
}
@@ -817,7 +813,7 @@
{
throw Oops.Bah("鎵�閫夊尯鍩熶俊鎭笉瀛樺湪,璇锋鏌�!");
}
- EndLocat = await GetLocat(areaNo, stockDetail.SkuNo, stockDetail.LotNo, palletNo);
+ EndLocat = await GetLocat(areaNo);
}
else
{
@@ -846,7 +842,7 @@
var storageLocatEnd = new SysStorageLocat();
if (!string.IsNullOrEmpty(areaNo))
{
- storageLocatEnd = await Db.Queryable<SysStorageLocat>().FirstAsync(w => w.IsDel == "0" && w.LocatNo == EndLocat && w.Flag == "0" && w.Status == "0");
+ storageLocatEnd = await Db.Queryable<SysStorageLocat>().FirstAsync(w => w.IsDel == "0" && w.LocatNo == EndLocat && w.Flag == "0");
if (storageLocatEnd == null)
{
throw Oops.Bah("鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
@@ -1019,7 +1015,7 @@
throw Oops.Bah($"鎵樼洏鍙凤細{item.PalletNo}鎵�鍦ㄧ殑鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
}
//鑾峰彇鐩爣鍌ㄤ綅
- EndLocat = await GetLocat(areaNo, item.SkuNo, item.LotNo, palletNo);
+ EndLocat = await GetLocat(areaNo);
if (string.IsNullOrEmpty(EndLocat))
{
throw Oops.Bah("鍒嗛厤鐩爣鍌ㄤ綅澶辫触,璇锋鏌�!");
@@ -1101,28 +1097,23 @@
/// <param name="skuNo"></param>
/// <param name="lotNo"></param>
/// <returns></returns>
- private async Task<string> GetLocat(string areaNo, string skuNo, string lotNo, string palletNo, string hasLocatNoList = "")
+ private async Task<string> GetLocat(string areaNo)
{
string endLocat = string.Empty;//鐩爣鍌ㄤ綅
- //褰撶劧鍖哄煙鎵�鏈夊偍浣嶄俊鎭�
- var storageLocatList = await Db.Queryable<SysStorageLocat>().Where(w => w.WareHouseNo == "W02" && w.AreaNo == areaNo).ToListAsync();
- //鍚屽尯鍩熷悓鎵规鐗╂枡鐨勫偍浣嶄俊鎭�
- List<string> locatList = await Db.Queryable<DataStockDetail>().Where(w => w.IsDel == "0" && w.SkuNo == skuNo && w.LotNo == lotNo && w.WareHouseNo == "W02" && w.AreaNo == areaNo && w.PalletNo != palletNo)
- .OrderByDescending(o => o.LocatNo).Select(s => s.LocatNo).Distinct().ToListAsync();
- foreach (var item in locatList)
- {
- var locatInfo = storageLocatList.Where(w => w.LocatNo == item).First();
+ //褰撳墠鍖哄煙鎵�鏈夊偍浣嶄俊鎭�
+ var storageLocatList = await Db.Queryable<SysStorageLocat>().Where(w => w.WareHouseNo == "W04" && w.AreaNo == areaNo).ToListAsync();
+
+ var locatInfo2 = storageLocatList.Where(w => w.IsDel == "0" && w.Flag == "0" && w.Status == "0")
+ .OrderByDescending(m => m.Layer).OrderByDescending(m => m.Column).OrderByDescending(m => m.Row).First();
- var locatInfo2 = storageLocatList.Where(w => w.IsDel == "0" && w.Status == "0" && w.Flag == "0" && w.LocatNo != locatInfo.LocatNo && w.Row == locatInfo.Row && !hasLocatNoList.Contains(w.LocatNo))
- .OrderByDescending(o => o.Column).First();
- if (locatInfo2 != null)
- {
- endLocat = locatInfo2.LocatNo;
- }
+ if (locatInfo2 != null)
+ {
+ endLocat = locatInfo2.LocatNo;
}
+
if (string.IsNullOrEmpty(endLocat))
{
- var locatInfo3 = storageLocatList.Where(w => w.IsDel == "0" && w.Flag == "0" && w.Status == "0" && !hasLocatNoList.Contains(w.LocatNo))
+ var locatInfo3 = storageLocatList.Where(w => w.IsDel == "0" && w.Flag == "0")
.OrderByDescending(m => m.Layer).OrderByDescending(m => m.Column).OrderByDescending(m => m.Row).First();
if (locatInfo3 != null)
@@ -1216,7 +1207,7 @@
}
#endregion
- #region 绠辩爜鎷嗙璐存爣
+ #region 绠辩爜鎷嗙璐存爣銆佷汉宸ョ‘璁ゆ敹璐�
/// <summary>
/// 鎷嗙娣诲姞鏍囩
/// </summary>
@@ -1252,7 +1243,18 @@
Db.Updateable(boxInfo).ExecuteCommand();
var boxStr = boxInfo.BoxNo.Substring(0, boxInfo.BoxNo.Length - 6);//鑾峰彇绠辩爜鍓嶇紑-闄ゅ悗鍏綅娴佹按澶�
- var maxBoxCode = Db.Queryable<BllBoxInfo>().Where(m => m.BoxNo.Contains(boxStr) && m.IsDel == "0" && m.Origin == "WMS鐢熸垚").Max(a => a.BoxNo);
+ var maxBoxCode1 = Db.Queryable<BllBoxInfo>().Where(m => m.BoxNo.Contains(boxStr) && m.IsDel == "0" && m.Origin == "WMS鐢熸垚").Max(a => a.BoxNo);
+
+ var maxBoxCode2 = Db.Queryable<DataBoxInfo>().Where(m => m.BoxNo.Contains(boxStr) && m.IsDel == "0").Max(a => a.BoxNo);
+ //濡傛灉缁撴灉涓�0锛屽垯璇存槑涓や釜瀛楃涓茬浉绛夛紱 ABC BCE
+ //濡傛灉缁撴灉灏忎簬0锛屽垯璇存槑绗竴涓瓧绗︿覆灏忎簬绗簩涓瓧绗︿覆锛�
+ //濡傛灉缁撴灉澶т簬0锛屽垯璇存槑绗竴涓瓧绗︿覆澶т簬绗簩涓瓧绗︿覆銆�
+ var maxBoxCode = maxBoxCode1;
+ var bol = String.CompareOrdinal(maxBoxCode1, maxBoxCode2);
+ if (bol<0)
+ {
+ maxBoxCode = maxBoxCode2;
+ }
var boxNoNew = maxBoxCode.Substring(0, maxBoxCode.Length - 6) + (int.Parse(maxBoxCode.Substring(maxBoxCode.Length - 6, 6)) + 1).ToString().PadLeft(6, '0');
// 娣诲姞鏂扮鐮佷俊鎭�
@@ -1296,6 +1298,121 @@
throw new Exception(e.Message);
}
}
+
+
+ public string GetReceiptSoNoByPallet(string palletNo)
+ {
+ try
+ {
+ var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.PalletNo == palletNo).GroupBy(m=>m.SONo).Select(m=>m.SONo).ToList();
+ if (stockDetail.Count == 0)
+ {
+ throw new Exception("娌℃湁鏌ヨ鍒版墭鐩樺簱瀛樹俊鎭�");
+ }
+ if (stockDetail.Count != 1)
+ {
+ throw new Exception("搴撳瓨鎵樼洏涓嶆槸鍞竴鍑哄簱鍗�");
+ }
+ var detail = stockDetail.First();
+ if (string.IsNullOrWhiteSpace(detail))
+ {
+ throw new Exception("鎵樼洏娌℃湁鍑哄簱鍗曚俊鎭�");
+ }
+ var task = Db.Queryable<LogTask>().First(m => m.PalletNo == palletNo && m.IsDel == "0" && m.Status == "5");
+ if (task == null)
+ {
+ throw new Exception("娌℃湁鏌ヨ鍒版墭鐩樹换鍔′俊鎭�");
+ }
+ if (task.Status != "5")
+ {
+ throw new Exception("浠诲姟鐘舵�佷笉鏄瓑寰呯‘璁�");
+ }
+ return detail;
+ }
+ catch (Exception e)
+ {
+ throw new Exception(e.Message);
+ }
+ }
+
+
+ /// <summary>
+ /// 浜哄伐纭鏀惰揣
+ /// </summary>
+ /// <param name="palletNo"></param>
+ /// <param name="userId"></param>
+ public void ConfirmReceipt(string palletNo, int userId)
+ {
+ try
+ {
+ Db.BeginTran();
+ var task = Db.Queryable<LogTask>().First(m => m.PalletNo == palletNo && m.IsDel == "0" && m.Status == "5");
+ if (task == null)
+ {
+ throw new Exception("娌℃湁鏌ヨ鍒版墭鐩樹换鍔′俊鎭�");
+ }
+ if (task.Status != "5")
+ {
+ throw new Exception("浠诲姟鐘舵�佷笉鏄瓑寰呯‘璁�");
+ }
+ //浠诲姟鐘舵�佸彉鏇翠负鎵ц瀹屾垚
+ task.Status = "2";
+ Db.Updateable(task).ExecuteCommand();
+ var locatList = Db.Queryable<SysStorageLocat>().Where(m=>m.WareHouseNo == "W04" && (m.AreaNo == "B06" || m.AreaNo == "B07") && m.IsDel == "0").ToList();
+ var locat = locatList.FirstOrDefault(m => m.LocatNo == task.EndLocat);
+ //鍒ゆ柇鎵樼洏鍌ㄤ綅鏄惁鍦ㄨ溅闂�
+ if (locat == null)
+ {
+ throw new Exception("鍌ㄤ綅淇℃伅娌℃湁鍦ㄨ溅闂村伐浣嶄笂");
+ }
+ locat.Status = "0";
+ Db.Updateable(locat).ExecuteCommand();
+ //鍒ゆ柇鎵樼洏淇℃伅
+ var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo).ToList();
+ foreach (var item in stockDetail)
+ {
+ if (item.UDF5 != "1" || string.IsNullOrWhiteSpace(item.SONo))
+ {
+ continue;
+ }
+
+ //item.WareHouseNo = "";
+ //item.RoadwayNo = "";
+ //item.AreaNo = "";
+ item.LocatNo = "";
+ item.PalletNo = "";
+ item.LockQty = 0; // 閿佸畾鏁伴噺鏇翠负0
+ item.Status = "0"; // 鐘舵�佸彉涓哄緟鍒嗛厤
+ var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.StockDetailId == item.Id).ToList();
+ foreach (var item2 in boxInfo)
+ {
+ item2.Status = "2"; //鐘舵�佸彉涓哄凡鍏ュ簱
+ }
+
+ Db.Updateable(boxInfo).ExecuteCommand();
+ }
+ Db.Updateable(stockDetail).ExecuteCommand();
+ //鎵樼洏鍙樻洿鐘舵��
+ var pallet = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == palletNo);
+ if (pallet == null)
+ {
+ throw new Exception("娌℃湁鏌ヨ鍒版墭鐩樹俊鎭�");
+ }
+ pallet.Status = "0";
+ Db.Updateable(pallet).ExecuteCommand();
+ //娣诲姞鎿嶄綔鏃ュ織
+ new OperationCrServer().AddLogOperationCr("搴撳唴浣滀笟", "鎿嶄綔鏃ュ織", palletNo, "缂栬緫", $"杞﹂棿鏀惰揣锛歿palletNo}鎵樼洏鏀惰揣", userId);
+ Db.CommitTran();
+ }
+ catch (Exception e)
+ {
+ Db.RollbackTran();
+ throw new Exception(e.Message);
+ }
+ }
+
+
+
#endregion
}
--
Gitblit v1.8.0