From e561870f9644a5e80925346485fe623da678177f Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期二, 14 十月 2025 10:20:57 +0800
Subject: [PATCH] 调整WMS出库逻辑,原辅料可选择成品库出库;
---
Wms/WMS.BLL/Logic/AllotLocation.cs | 96 ++++++++++++++++++++++++++++++------------------
1 files changed, 60 insertions(+), 36 deletions(-)
diff --git a/Wms/WMS.BLL/Logic/AllotLocation.cs b/Wms/WMS.BLL/Logic/AllotLocation.cs
index 190b34e..10284fe 100644
--- a/Wms/WMS.BLL/Logic/AllotLocation.cs
+++ b/Wms/WMS.BLL/Logic/AllotLocation.cs
@@ -38,12 +38,12 @@
dataStock = dataStock.Where(m => m.LotNo == lotNo);
}
//搴撳瓨鏌ユ壘鐩稿悓鐗╂枡/鎵规鐨勫贩閬�
- var yiYouRoad = dataStock.GroupBy(m => m.RoadwayNo).Select(m => m.RoadwayNo).OrderBy(m => m).ToList();
- foreach (var l in yiYouRoad)
+ var yiYouRoad = dataStock.GroupBy(m => m.RoadwayNo).Select(m => m.RoadwayNo).ToList();
+ foreach (var l in yiYouRoad.OrderBy(m=>m).ToList())
{
// 鍒ゆ柇褰撳墠宸烽亾(缁�)鏄惁鏈夌┖浣欏偍浣�
- var locateCount = db.Queryable<SysStorageLocat>().Count(m => m.Status == "0" && m.Flag == "0" && areaList.Contains(m.AreaNo) && m.RoadwayNo == l);
+ var locateCount = db.Queryable<SysStorageLocat>().Count(m => m.IsDel=="0" && m.Status == "0" && m.Flag == "0" && areaList.Contains(m.AreaNo) && m.RoadwayNo == l);
var bindNum = db.Queryable<LogTask>().Where(m => m.IsDel == "0" && (m.Status == "0" || m.Status == "1") && m.EndRoadway == l)
.GroupBy(m => m.PalletNo).Select(m => m.PalletNo).Count();
@@ -78,18 +78,18 @@
}
}
- if (bl)
+ }
+ if (bl)
+ {
+ // 鍒ゆ柇褰撳墠宸烽亾(缁�)鏄惁鏈夌┖浣欏偍浣�
+
+ var locateCount = db.Queryable<SysStorageLocat>().Count(m => m.Status == "0" && m.Flag == "0" && areaList.Contains(m.AreaNo) && m.RoadwayNo == l);
+
+ var bindNum = db.Queryable<LogTask>().Where(m => m.IsDel == "0" && (m.Status == "0" || m.Status == "1") && m.EndRoadway == l)
+ .GroupBy(m => m.PalletNo).Select(m => m.PalletNo).Count();
+ if (locateCount - bindNum > 0)
{
- // 鍒ゆ柇褰撳墠宸烽亾(缁�)鏄惁鏈夌┖浣欏偍浣�
-
- var locateCount = db.Queryable<SysStorageLocat>().Count(m => m.Status == "0" && m.Flag == "0" && areaList.Contains(m.AreaNo) && m.RoadwayNo == l);
-
- var bindNum = db.Queryable<LogTask>().Where(m => m.IsDel == "0" && (m.Status == "0" || m.Status == "1") && m.EndRoadway == l)
- .GroupBy(m => m.PalletNo).Select(m => m.PalletNo).Count();
- if (locateCount - bindNum > 0)
- {
- return l;
- }
+ return l;
}
}
}
@@ -110,7 +110,7 @@
var db = DataContext.Db;
// 鍒ゆ柇褰撳墠宸烽亾(缁�)鏄惁鏈夌┖浣欏偍浣�
- var locateList = db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && m.RoadwayNo == roadwayNo && areaList.Contains(m.AreaNo)).ToList();
+ var locateList = db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && m.RoadwayNo == roadwayNo && areaList.Contains(m.AreaNo) && m.Status == "0").ToList();
if (locateList.Count(m => m.Status == "0") > 0)
{
var bl = GetLocateASCOrDesc(roadwayNo);
@@ -145,7 +145,7 @@
var locate = db.Queryable<SysStorageLocat>().First(m => m.IsDel == "0" && m.RoadwayNo == roadStr);
var a = locate.LocatNo.Substring(2,2);//鍌ㄤ綅鍒�
var b = locate.AisleOne.Substring(2, 2);//閫氶亾鍙e垪
- return int.Parse(a) < int.Parse(b);
+ return int.Parse(a) > int.Parse(b);
}
/// <summary>
@@ -165,6 +165,17 @@
var locatList2 = db.Queryable<SysStorageLocat>().Where(m => m.IsDel == "0" && m.RoadwayNo == locate.RoadwayNo && m.Column > a).ToList();
if (bl)
{
+ if (locatList1.Count(m => str2.Contains(m.Status)) > 0)
+ {
+ return false;
+ }
+ if (locatList2.Count(m => str1.Contains(m.Status)) > 0)
+ {
+ return false;
+ }
+ }
+ else
+ {
if (locatList1.Count(m => str1.Contains(m.Status)) > 0)
{
return false;
@@ -173,17 +184,6 @@
{
return false;
}
- }
- else
- {
- if (locatList1.Count(m => str2.Contains(m.Status)) > 0)
- {
- return false;
- }
- if (locatList2.Count(m => str1.Contains(m.Status)) > 0)
- {
- return false;
- }
}
return true;
@@ -292,10 +292,14 @@
/// <param name="areaList">鍖哄煙闆嗗悎</param>
/// <param name="roadwayNo">宸烽亾鍙�(鍙┖)</param>
/// <returns></returns>
- public SysStorageLocat GetSuiTableLocate(string houseNo, List<string> areaList,string roadwayNo = "")
+ public SysStorageLocat GetSuiTableLocate(string houseNo, List<string> areaList,string roadwayNo = "",string ceng = "")
{
try
{
+ if (string.IsNullOrWhiteSpace(ceng))
+ {
+ throw new Exception($"鐢宠璐ф灦搴撲綅灞傛暟涓嶈兘涓虹┖");
+ }
var db = DataContext.Db;
/* 1.鍏堝垽鏂粨搴擄紙绔嬪簱鎴栬�呭钩搴擄級
* 2.濡傛灉鏄珛搴� 鍐嶅垽鏂槸鍚︽寚瀹氬贩閬撳彿
@@ -308,6 +312,22 @@
var roadList = db.Queryable<SysStorageLocat>().Where(m => m.WareHouseNo == houseNo && areaList.Contains(m.AreaNo) )
.GroupBy(m=>m.RoadwayNo).Select(m=>m.RoadwayNo).ToList();
+
+ if (houseNo == "W02")
+ {
+ //涓�妤煎贩閬�
+ var conveyList1 = new List<string>() { "LR01", "LR02", "LR03", "LR04", "LR05", "LR06", "LR07", "LR08" };
+ //浜屾ゼ宸烽亾
+ var conveyList2 = new List<string>() { "LR09", "LR10", "LR11", "LR12" };
+ if (ceng == "1")
+ {
+ roadList = roadList.Where(m => conveyList1.Contains(m)).ToList();
+ }
+ else if (ceng == "2")
+ {
+ roadList = roadList.Where(m => conveyList2.Contains(m)).ToList();
+ }
+ }
//鏁版嵁瀛楀吀(鑾峰彇瀛楀吀涓粨搴撶被鍨�)
var dic = db.Queryable<SysDictionary>().First(m => m.Id.ToString() == house.Type);
@@ -334,7 +354,7 @@
//鏌ヨ璇ュ贩閬撳苟涓旀爣蹇椾负姝e父鐨勭殑鍌ㄤ綅
roadwayList.Add(roadway);
- var locate = GetLocateByRoadways(roadwayList,areaList,true,houseNo);
+ var locate = GetLocateByRoadways(roadwayList,areaList,true,houseNo, ceng);
if (locate == null)
{
throw new Exception($"{roadwayNo}宸烽亾娌℃湁鍚堥�傜殑绌哄偍浣�");
@@ -346,7 +366,7 @@
{
var roadwayList = db.Queryable<SysStorageRoadway>().Where(m => m.WareHouseNo == houseNo && m.Status == "0" && roadList.Contains(m.RoadwayNo)).OrderBy(m => new { m.Priority, m.RoadwayNo }).ToList();
- var locate = GetLocateByRoadways(roadwayList,areaList,false, houseNo);
+ var locate = GetLocateByRoadways(roadwayList,areaList,false, houseNo,ceng);
if (locate == null)
{
throw new Exception($"{houseNo}浠撳簱宸插惎鐢ㄧ殑宸烽亾涓病鏈夊悎閫傜殑绌哄偍浣�");
@@ -380,7 +400,7 @@
/// <param name="areaList">鍖哄煙闆嗗悎</param>
/// <param name="isRoadway">鏄惁鎸囧畾宸烽亾</param>
/// <returns></returns>
- private SysStorageLocat GetLocateByRoadways(List<SysStorageRoadway> roadways,List<string> areaList,bool isRoadway = false ,string houseNo = "W01")
+ private SysStorageLocat GetLocateByRoadways(List<SysStorageRoadway> roadways,List<string> areaList,bool isRoadway = false ,string houseNo = "W02",string ceng = "")
{
try
{
@@ -469,7 +489,7 @@
var count = 0;
do
{
- locate = GetLocateByRoadway(l.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count);
+ locate = GetLocateByRoadway(l.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count, ceng);
if (locate != null)
{
break;
@@ -503,7 +523,7 @@
var count = 0;
do
{
- locate = GetLocateByRoadway(log.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count);
+ locate = GetLocateByRoadway(log.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count,ceng);
if (locate != null)
{
break;
@@ -531,7 +551,7 @@
var count = 0;
do
{
- locate = GetLocateByRoadway(item.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count);
+ locate = GetLocateByRoadway(item.RoadwayNo, topOrBom, leftOrRight, areaList, list, ref count,ceng);
if (locate != null)
{
break;
@@ -575,7 +595,7 @@
/// <param name="areaList">鍖哄煙闆嗗悎</param>
/// <param name="locateNoStr">鎺掗櫎鐨勫偍浣嶉泦鍚�</param>
/// <returns></returns>
- private SysStorageLocat GetLocateByRoadway(string roadwayNo, int topOrBom, int leftOrRight,List<string> areaList,List<string> locateNoStr,ref int count)
+ private SysStorageLocat GetLocateByRoadway(string roadwayNo, int topOrBom, int leftOrRight,List<string> areaList,List<string> locateNoStr,ref int count,string ceng = "")
{
var db = DataContext.Db;
var str = "";
@@ -596,7 +616,11 @@
foreach (var area in areaList)
{
- var sql = $@"select * from SysStorageLocat where IsDel = 0 and Flag = 0 and [Status] = 0 and RoadwayNo = '{roadwayNo}' and AreaNo = '{area}' and LocatNo not in({str}) ";
+ var sql = $@"select * from SysStorageLocat where IsDel = 0 and Layer!= '3' and Flag = 0 and [Status] = 0 and RoadwayNo = '{roadwayNo}' and AreaNo = '{area}' and LocatNo not in({str}) ";
+ //if (!string.IsNullOrWhiteSpace(ceng))
+ //{
+ // sql += $"and Layer = '{ceng}' ";
+ //}
sql += "order by ";
sql += topOrBom == 0 ? "Layer desc, " : "Layer, ";
sql += leftOrRight == 0 ? "[Column], " : "[Column] desc, ";
--
Gitblit v1.8.0