From 76b08b437e41cb6a3118c87636bc1777a110185a Mon Sep 17 00:00:00 2001
From: chengsc <11752@DESKTOP-DS49RCP>
Date: 星期六, 18 一月 2025 11:44:06 +0800
Subject: [PATCH] 修改异常问题
---
Wms/WMS.BLL/SysServer/StorageLocatServer.cs | 217 +++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 180 insertions(+), 37 deletions(-)
diff --git a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
index f722153..83c4ef3 100644
--- a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
+++ b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
@@ -2,16 +2,19 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
+using System.Runtime.Intrinsics.X86;
using System.Text;
using System.Threading.Tasks;
using Model.ModelDto.SysDto;
using Model.ModelVm.SysVm;
using SqlSugar;
+using WMS.BLL.LogServer;
using WMS.DAL;
using WMS.Entity.BllAsnEntity;
using WMS.Entity.Context;
using WMS.Entity.DataEntity;
using WMS.Entity.SysEntity;
+using WMS.IBLL.ILogServer;
using WMS.IBLL.ISysServer;
using WMS.IDAL.ISysInterface;
@@ -110,6 +113,7 @@
try
{
var data = LocatRst.GetOneById(id);
+ //var data = Db.Queryable<SysStorageLocat>().First(m=>m.Id == id);
return data;
}
catch (Exception e)
@@ -118,13 +122,30 @@
throw;
}
}
-
+ public List<SysStorageLocat> GetStorageLocat(List<int> id)
+ {
+ try
+ {
+ var SysStorageLocats = new List<SysStorageLocat>();
+ foreach (var item in id)
+ {
+ var storage = LocatRst.GetOneById(item);
+ SysStorageLocats.Add(storage);
+ }
+ return SysStorageLocats;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ throw;
+ }
+ }
public bool EditStorageLocat(EditLocateVm model, int userId)
{
try
{
- var bl = LocatRst.EditStorageLocat(model.Id, model.Status, model.Flag, model.Temperature, userId);
+ var bl = LocatRst.EditStorageLocat(model.Id, model.Status, model.Flag, model.Temperature,model.Area, userId);
return bl;
}
@@ -277,6 +298,116 @@
}
catch (Exception e)
{
+ throw new Exception(e.Message);
+ }
+ }
+ public bool EditStorageLocatListNew(EditLocateListNewVm model, int userId)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(model.RoadWayNo))
+ {
+ throw new Exception("宸烽亾涓嶈兘涓虹┖");
+ }
+ bool isRow = false;
+ if (model.Row != null)
+ {
+ if (model.Row <= 0)
+ {
+ throw new Exception("鎺掗渶瑕佸ぇ浜�0");
+ }
+ isRow = true;
+ }
+ bool isColumn = false;
+ if (model.Column != null)
+ {
+ if (model.Column <= 0)
+ {
+ throw new Exception("鍒楅渶瑕佸ぇ浜�0");
+ }
+ isColumn = true;
+ }
+ bool isLayer = false;
+ if (model.Layer != null )
+ {
+ if (model.Column <= 0)
+ {
+ throw new Exception("灞傞渶瑕佸ぇ浜�0");
+ }
+ isLayer = true;
+ }
+ bool isDepth = false;
+ if (model.Dept != null)
+ {
+ if (model.Dept != 1 && model.Dept != 2)
+ {
+ throw new Exception("娣卞害鍙兘涓�1鎴�2");
+ }
+ isDepth = true;
+ }
+ Expression<Func<SysStorageLocat, bool>> item = Expressionable.Create<SysStorageLocat>() //鍒涘缓琛ㄨ揪寮�
+ .AndIF(isRow, it => it.Row == model.Row)
+ .AndIF(isColumn, it => it.Column == model.Column)
+ .AndIF(isLayer, it => it.Layer == model.Layer)
+ .AndIF(isDepth, it => it.Depth == "0"+model.Dept)
+ .AndIF(!string.IsNullOrWhiteSpace(model.RoadWayNo), it => it.RoadwayNo == model.RoadWayNo)
+ .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
+ var locateList = Db.Queryable<SysStorageLocat>().Where(item).ToList();
+ if (locateList.Count == 0)
+ {
+ throw new Exception($"鏈煡璇㈠埌鐩稿搴旂殑鍌ㄤ綅淇℃伅");
+ }
+
+ var com = new Common();
+ var i = 0;
+ Db.BeginTran();
+ foreach (var locate in locateList)
+ {
+ if (model.Flag == "2" && locate.Depth == "01")//鏍囪瘑鏄崯鍧忎笖娣卞害鏄�01鏃� 闇�鎶婃繁搴︿负2鐨勫偍浣嶇粰灞忚斀
+ {
+ var locate2 = com.GetLocateNoDepth2(locate.WareHouseNo, locate.LocatNo);
+ if (locate2.Flag == "0" && !locateList.Contains(locate2))
+ {
+ locate2.Flag = "1";
+ locate2.UpdateUser = userId;
+ locate2.UpdateTime = DateTime.Now;
+ var m = Db.Updateable(locate2).ExecuteCommand();
+ }
+
+ }
+ if (model.Flag == "0" && locate.Depth == "02")//鏍囪瘑鏄甯镐笖娣卞害鏄�02鏃� 闇�鍒ゆ柇娣卞害涓�1鐨勫偍浣嶇姸鎬佹槸鍚︽甯�
+ {
+ var locate1 = com.GetLocateNoDepth1(locate.WareHouseNo, locate.LocatNo);
+
+ if (locate1.Flag == "2")
+ {
+ throw new Exception($"闇�鍏堜慨鏀箋locate1.LocatNo}鐨勫偍浣嶆爣璇嗕负涓嶆槸鎹熷潖");
+ }
+ }
+
+ if (!string.IsNullOrEmpty(model.Status))
+ {
+ locate.Status = model.Status;
+ }
+ if (!string.IsNullOrEmpty(model.Flag))
+ {
+ locate.Flag = model.Flag;
+ }
+ if (!string.IsNullOrEmpty(model.AreaNo))
+ {
+ locate.AreaNo = model.AreaNo;
+ }
+ locate.UpdateUser = userId;
+ locate.UpdateTime = DateTime.Now;
+ i = Db.Updateable(locate).ExecuteCommand();
+ }
+ Db.CommitTran();
+ return i > 0;
+
+ }
+ catch (Exception e)
+ {
+ Db.RollbackTran();
throw new Exception(e.Message);
}
}
@@ -473,8 +604,8 @@
int b = 0; //1锛氭湁鐗╁搧
int c = 0; //2锛氬叆搴撲腑
int d = 0; //3锛氬嚭搴撲腑
- //int e = 0; //4锛氱Щ鍏ヤ腑
- //int f = 0; //5锛氱Щ鍑轰腑
+ int e = 0; //4锛氱Щ鍏ヤ腑
+ int f = 0; //5锛氱Щ鍑轰腑
int g = 0; //6锛氭崯鍧廫灞忚斀
foreach (var item in getLocateVms)
@@ -503,18 +634,18 @@
d = 1; //3锛氬嚭搴撲腑
continue;
}
- ////4锛氱Щ鍏ヤ腑
- //if (item.Status == "4")
- //{
- // e = 1; //4锛氱Щ鍏ヤ腑
- // continue;
- //}
- ////5锛氱Щ鍑轰腑
- //if (item.Status == "5")
- //{
- // f = 1; //5锛氱Щ鍑轰腑
- // continue;
- //}
+ //4锛氱Щ鍏ヤ腑
+ if (item.Status == "4")
+ {
+ e = 1; //4锛氱Щ鍏ヤ腑
+ continue;
+ }
+ //5锛氱Щ鍑轰腑
+ if (item.Status == "5")
+ {
+ f = 1; //5锛氱Щ鍑轰腑
+ continue;
+ }
//6锛氭崯鍧廫灞忚斀
if (item.Status == "6")
{
@@ -559,24 +690,24 @@
getLocateVm.Status = "3";
getLocateVms.Add(getLocateVm);
}
- ////4锛氱Щ鍏ヤ腑
- //if (e == 0)
- //{
- // getLocateVm = new GetLocateVm();
- // getLocateVm.WareHouseNo = wareHouseNo; //浠撳簱鍙�
- // getLocateVm.StatusNum = "0";
- // getLocateVm.Status = "4";
- // getLocateVms.Add(getLocateVm);
- //}
- ////5锛氱Щ鍑轰腑
- //if (f == 0)
- //{
- // getLocateVm = new GetLocateVm();
- // getLocateVm.WareHouseNo = wareHouseNo; //浠撳簱鍙�
- // getLocateVm.StatusNum = "0";
- // getLocateVm.Status = "5";
- // getLocateVms.Add(getLocateVm);
- //}
+ //4锛氱Щ鍏ヤ腑
+ if (e == 0)
+ {
+ getLocateVm = new GetLocateVm();
+ getLocateVm.WareHouseNo = wareHouseNo; //浠撳簱鍙�
+ getLocateVm.StatusNum = "0";
+ getLocateVm.Status = "4";
+ getLocateVms.Add(getLocateVm);
+ }
+ //5锛氱Щ鍑轰腑
+ if (f == 0)
+ {
+ getLocateVm = new GetLocateVm();
+ getLocateVm.WareHouseNo = wareHouseNo; //浠撳簱鍙�
+ getLocateVm.StatusNum = "0";
+ getLocateVm.Status = "5";
+ getLocateVms.Add(getLocateVm);
+ }
//6锛氭崯鍧廫灞忚斀
if (g == 0)
{
@@ -635,7 +766,12 @@
{
try
{
- string str = "select RoadwayNo,RoadwayName,WareHouseNo from SysStorageRoadway where IsDel = @isdel and WareHouseNo = @warehouseno";
+ string str = "select RoadwayNo,RoadwayName,WareHouseNo from SysStorageRoadway where IsDel = @isdel";
+
+ if (!string.IsNullOrWhiteSpace(wareHouseNo))
+ {
+ str += " and WareHouseNo = @warehouseno";
+ }
List<RoadwayDto> roadway = Db.Ado.SqlQuery<RoadwayDto>(str, new
{
@@ -667,7 +803,7 @@
throw new Exception("鏈壘鍒板搴斿偍浣�");
}
//鏈夌墿鍝併�佸嚭搴撲腑鏁版嵁婧愶紙搴撳瓨鏄庣粏琛級
- if (storageLocat.Status == "1" || storageLocat.Status == "3")
+ if (storageLocat.Status == "1" || storageLocat.Status == "3" || storageLocat.Status == "5")
{
//搴撳瓨鏄庣粏
List<DataStockDetail> stockDetailList = Db.Queryable<DataStockDetail>().Where(w => w.LocatNo == locatNo && w.IsDel == "0").ToList();
@@ -696,7 +832,8 @@
else if (storageLocat.Status == "2")
{
//鎵樼洏缁戝畾淇℃伅
- List<BllPalletBind> palletBindList = Db.Queryable<BllPalletBind>().Where(w => w.LocatNo == locatNo && w.IsDel == "0").ToList();
+ List<BllPalletBind> palletBindList = Db.Queryable<BllPalletBind>()
+ .Where(w => w.LocatNo == locatNo && w.IsDel == "0" && w.Status == "1").ToList();
if (palletBindList == null || palletBindList.Count <= 0)
{
throw new Exception("鏈壘鍒板搴旂殑鎵樼洏缁戝畾淇℃伅");
@@ -744,6 +881,12 @@
case "3":
model.Status = "鍑哄簱涓�";
break;
+ case "4":
+ model.Status = "绉诲叆涓�";
+ break;
+ case "5":
+ model.Status = "绉诲嚭涓�";
+ break;
default:
model.Status = "";
break;
--
Gitblit v1.8.0