From 1e29c520440adc28292d87a000c11e6898bda1ac Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期四, 30 十月 2025 13:29:33 +0800
Subject: [PATCH] 物料标签增加补打标签和合并标签功能
---
Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs | 175 +++++++++++++++++++++++++++++++++++
Wms/Wms/Controllers/BllAsnController.cs | 58 +++++++++++
Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs | 6 +
Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs | 11 +-
Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs | 16 +++
HTML/views/ASNSetting/LabelBox.html | 8 +
6 files changed, 269 insertions(+), 5 deletions(-)
diff --git a/HTML/views/ASNSetting/LabelBox.html b/HTML/views/ASNSetting/LabelBox.html
index 0c14273..b3e85e2 100644
--- a/HTML/views/ASNSetting/LabelBox.html
+++ b/HTML/views/ASNSetting/LabelBox.html
@@ -125,6 +125,14 @@
style="margin-left: 5px;" lay-event="BuDaLabel" id="BuDaLabel">
<i class="layui-icon layui-icon-print layuiadmin-button-btn"></i>琛ユ墦鏍囩
</button>
+ <button class="layui-btn layui-btn-sm layuiadmin-btn-list layui-btn-normal buDaLabelClass"
+ style="margin-left: 5px;" lay-event="ChaiLabel" id="ChaiLabel">
+ <i class="layui-icon layui-icon-edit layuiadmin-button-btn"></i>鎷嗗垎鏍囩
+ </button>
+ <button class="layui-btn layui-btn-sm layuiadmin-btn-list layui-btn-normal buDaLabelClass"
+ style="margin-left: 5px;" lay-event="MergeLabel" id="MergeLabel">
+ <i class="layui-icon layui-icon-edit layuiadmin-button-btn"></i>鍚堝苟鏍囩
+ </button>
<button class="layui-btn layui-btn-sm layuiadmin-btn-list layui-btn-danger delLabelClass"
style="margin-left: 5px;" lay-event="delLabel" id="delLabel">
<i class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>鍒犻櫎鏍囩
diff --git a/Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs b/Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs
index 90d717e..ef24f05 100644
--- a/Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs
+++ b/Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs
@@ -236,4 +236,10 @@
public int? userId { get; set; }
}
+ public class LabelOperVm
+ {
+ public string BoxNo { get; set; }
+ public string BoxNo2 { get; set; }
+ public decimal ChaiQty { get; set; }
+ }
}
diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
index cb79491..ae97734 100644
--- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -15,6 +15,9 @@
using WMS.Entity.Context;
using WMS.Entity.SysEntity;
using WMS.IBLL.IBllAsnServer;
+using WMS.Entity.DataEntity;
+using Dm;
+using System.Reflection;
namespace WMS.BLL.BllAsnServer
{
@@ -1745,6 +1748,178 @@
throw new Exception(e.Message);
}
}
+ /// <summary>
+ /// 鎷嗗垎绠辩爜鏍囩
+ /// </summary>
+ /// <param name="boxNo"></param>
+ /// <param name="chaiQty"></param>
+ /// <param name="userId"></param>
+ /// <exception cref="Exception"></exception>
+ public void ChaiLableBox(string boxNo,decimal chaiQty, int userId)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(boxNo))
+ {
+ throw new Exception("璇疯緭鍏ユ媶绠辩鐮�");
+ }
+ if (chaiQty <= 0)
+ {
+ throw new Exception("璇疯緭鍏ユ媶鍒嗘暟閲�");
+ }
+ //鏍囩淇℃伅
+ var boxList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.BoxNo == boxNo).ToList();
+ if (boxList.Count != 1)
+ {
+ throw new Exception("璇ョ鐮佷俊鎭敊璇紝瀛樺湪澶氫釜姝ょ鐮佷俊鎭�");
+ }
+ var boxInfo = boxList.First();
+ if (boxInfo.Qty <= chaiQty)
+ {
+ throw new Exception("鎷嗙鏁伴噺澶х瓑浜庡綋鍓嶇鍐呮暟閲�");
+ }
+ if (boxInfo.Status != "0")
+ {
+ throw new Exception("璇ョ鐮佷笉鏄湭缁勬墭鐘舵�侊紝涓嶅厑璁告媶绠憋紒");
+ }
+
+ //寮�鍚簨鍔�
+ Db.BeginTran();
+
+ boxInfo.Qty -= chaiQty;
+ boxInfo.BitBoxMark = "1";
+ //鏇存柊绠辩爜搴撳瓨琛�
+ Db.Updateable(boxInfo).ExecuteCommand();
+
+ var boxStr = boxInfo.BoxNo.Substring(0, boxInfo.BoxNo.Length - 6);//鑾峰彇绠辩爜鍓嶇紑-闄ゅ悗鍏綅娴佹按澶�
+ 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');
+
+ // 娣诲姞鏂扮鐮佷俊鎭�
+ var boxModel = new BllBoxInfo()
+ {
+ ASNNo = boxInfo.ASNNo,
+ ASNDetailNo = boxInfo.ASNDetailNo,
+ BoxNo = boxNoNew,
+ BoxNo2 = "",
+ BoxNo3 = "",
+ Qty = chaiQty,
+ FullQty = boxInfo.FullQty,
+ Status = "0",//寰呯粍鎵�
+ BindNo = null,
+ PalletNo = "",
+ SkuNo = boxInfo.SkuNo,
+ SkuName = boxInfo.SkuName,
+ LotNo = boxInfo.LotNo,
+ Standard = boxInfo.Standard,
+ PackageStandard = boxInfo.PackageStandard,
+ SupplierLot = boxInfo.SupplierLot,
+ InspectMark = boxInfo.InspectMark,
+ BitBoxMark = "1",
+ InspectStatus = "0",
+
+ ProductionTime = boxInfo.ProductionTime,
+ StoreTime = boxInfo.StoreTime,
+ ExpirationTime = boxInfo.ExpirationTime,
+
+ Origin = "WMS",
+ CreateUser = userId,
+ CreateTime = DateTime.Now,
+ };
+ Db.Insertable(boxModel).ExecuteCommand();
+
+ //娣诲姞鎿嶄綔鏃ュ織
+ new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鐗╂枡鏍囩", boxNo, "缂栬緫", $"鎷嗗垎浜嗙鐮亄boxInfo}鏁伴噺{chaiQty}鍒版柊绠辩爜{boxNoNew}", userId);
+ //鎻愪氦浜嬪姟
+ Db.CommitTran();
+ }
+ catch (Exception e)
+ {
+ //鍥炴粴浜嬪姟
+ Db.RollbackTran();
+ throw new Exception(e.Message);
+ }
+ }
+ /// <summary>
+ /// 鍚堝苟绠辩爜鏍囩
+ /// </summary>
+ /// <param name="boxNo"></param>
+ /// <param name="boxNo2"></param>
+ /// <param name="userId"></param>
+ public void MergeLableBox(string boxNo,string boxNo2, int userId)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(boxNo) || string.IsNullOrEmpty(boxNo2))
+ {
+ throw new Exception("璇疯緭鍏ヨ鍚堝苟鐨勭鐮�");
+ }
+ //鏍囩淇℃伅
+ var boxList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.BoxNo == boxNo).ToList();
+ if (boxList.Count != 1)
+ {
+ throw new Exception($"{boxNo}璇ョ鐮佷俊鎭敊璇紝瀛樺湪澶氫釜姝ょ鐮佷俊鎭�");
+ }
+ var boxInfo = boxList.First();
+ if (boxInfo.Status != "0")
+ {
+ throw new Exception($"{boxNo}璇ョ鐮佷笉鏄湭缁勬墭鐘舵�侊紝涓嶅厑璁稿悎骞讹紒");
+ }
+ var boxList2 = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.BoxNo == boxNo2).ToList();
+ if (boxList2.Count != 1)
+ {
+ throw new Exception($"{boxNo2}璇ョ鐮佷俊鎭敊璇紝瀛樺湪澶氫釜姝ょ鐮佷俊鎭�");
+ }
+ var boxInfo2 = boxList2.First();
+ if (boxInfo2.Status != "0")
+ {
+ throw new Exception($"{boxNo2}璇ョ鐮佷笉鏄湭缁勬墭鐘舵�侊紝涓嶅厑璁稿悎骞讹紒");
+ }
+ if (boxInfo.SkuNo != boxInfo2.SkuNo || boxInfo.LotNo != boxInfo2.LotNo)
+ {
+ throw new Exception($"涓や釜绠辩爜涓嶆槸鐗╂枡鎵规淇℃伅涓嶄竴鑷达紝涓嶅厑璁稿悎骞讹紒");
+ }
+ if (boxInfo.ASNNo != boxInfo2.ASNNo || boxInfo.ASNDetailNo != boxInfo2.ASNDetailNo)
+ {
+ throw new Exception($"涓や釜绠辩爜涓嶆槸鎵�灞炲叆搴撳崟淇℃伅涓嶄竴鑷达紝涓嶅厑璁稿悎骞讹紒");
+ }
+ if (boxInfo.Qty + boxInfo2.Qty > boxInfo.FullQty)
+ {
+ throw new Exception($"涓や釜绠辩爜鍚堝苟鍚庢暟閲忚秴杩囨弧绠辨暟閲忥紝涓嶅厑璁稿悎骞讹紒");
+ }
+ //寮�鍚簨鍔�
+ Db.BeginTran();
+
+ boxInfo.Qty += boxInfo2.Qty;
+ //鏇存柊绠辩爜搴撳瓨琛�
+ Db.Updateable(boxInfo).ExecuteCommand();
+ //鍒犻櫎琚悎骞剁鐮佷俊鎭�
+ Db.Deleteable(boxInfo2).ExecuteCommand();
+
+ //娣诲姞鎿嶄綔鏃ュ織
+ new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鐗╂枡鏍囩", boxNo, "缂栬緫", $"灏唟boxNo2}绠辩爜鍚堝苟鍒颁簡{boxNo}绠辩爜涓�", userId);
+ //鎻愪氦浜嬪姟
+ Db.CommitTran();
+
+ }
+ catch (Exception e)
+ {
+ //鍥炴粴浜嬪姟
+ Db.RollbackTran();
+ throw new Exception(e.Message);
+ }
+ }
#endregion
#region 鏁版嵁褰掓。
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
index 4653959..b056793 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -1871,13 +1871,14 @@
throw new Exception("搴撳瓨鎵樼洏娌℃湁淇℃伅");
}
var locate = stockDetail.First().LocatNo;
- var locatList = Db.Queryable<SysStorageLocat>().Where(m=>m.WareHouseNo == "W04" && (m.AreaNo == "B06" || m.AreaNo == "B07" || m.AreaNo == "B09") && m.IsDel == "0").ToList();
+ //var locatList = Db.Queryable<SysStorageLocat>().Where(m=>m.WareHouseNo == "W04" && (m.AreaNo == "B06" || m.AreaNo == "B07" || m.AreaNo == "B09") && m.IsDel == "0").ToList();
+ var locatList = Db.Queryable<SysStorageLocat>().Where(m => m.WareHouseNo == "W04" && m.IsDel == "0").ToList();
var locat = locatList.FirstOrDefault(m => m.LocatNo == locate);
//鍒ゆ柇鎵樼洏鍌ㄤ綅鏄惁鍦ㄨ溅闂�
- if (locat == null)
- {
- throw new Exception("鍌ㄤ綅淇℃伅娌℃湁鍦ㄨ溅闂村伐浣嶄笂");
- }
+ //if (locat == null)
+ //{
+ // throw new Exception("鍌ㄤ綅淇℃伅娌℃湁鍦ㄨ溅闂村伐浣嶄笂");
+ //}
locat.Status = "0";
Db.Updateable(locat).ExecuteCommand();
//鍒ゆ柇鎵樼洏淇℃伅
diff --git a/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs b/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
index 25c4efa..55af8db 100644
--- a/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
+++ b/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
@@ -83,6 +83,22 @@
/// <param name="lotNo">鎵规鍙�</param>
/// <param name="userId">鎿嶄綔浜篒D</param>
void DelLabelByAsnNo(string asnNo, string lotNo, int userId);
+
+ /// <summary>
+ /// 鎷嗗垎绠辩爜鏍囩
+ /// </summary>
+ /// <param name="boxNo"></param>
+ /// <param name="chaiQty"></param>
+ /// <param name="userId"></param>
+ /// <exception cref="Exception"></exception>
+ void ChaiLableBox(string boxNo, decimal chaiQty, int userId);
+ /// <summary>
+ /// 鍚堝苟绠辩爜鏍囩
+ /// </summary>
+ /// <param name="boxNo"></param>
+ /// <param name="boxNo2"></param>
+ /// <param name="userId"></param>
+ void MergeLableBox(string boxNo, string boxNo2, int userId);
#endregion
#region 鏁版嵁褰掓。
diff --git a/Wms/Wms/Controllers/BllAsnController.cs b/Wms/Wms/Controllers/BllAsnController.cs
index 59cb896..d22d098 100644
--- a/Wms/Wms/Controllers/BllAsnController.cs
+++ b/Wms/Wms/Controllers/BllAsnController.cs
@@ -1047,8 +1047,66 @@
return Ok(new { code = 1, count = 0, msg = e.Message });
}
}
+ /// <summary>
+ /// 鎷嗗垎绠辩爜鏍囩
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ [HttpPost]
+ public IActionResult ChaiLableBox(LabelOperVm model)
+ {
+ try
+ {
+ //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
+ var claimsIdentity = this.User.Identity as ClaimsIdentity;
+ if (claimsIdentity == null)
+ {
+ return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+ }
+ var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+ if (string.IsNullOrWhiteSpace(userId))
+ {
+ return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+ }
+ _BoxInfoSvc.ChaiLableBox(model.BoxNo, model.ChaiQty, int.Parse(userId));
+ return Ok(new { code = 0, msg = "鎿嶄綔鎴愬姛", data = "" });
+ }
+ catch (Exception e)
+ {
+ return Ok(new { code = 1, count = 0, msg = e.Message });
+ }
+ }
+ /// <summary>
+ /// 鍚堝苟绠辩爜鏍囩
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ [HttpPost]
+ public IActionResult MergeLableBox(LabelOperVm model)
+ {
+ try
+ {
+ //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
+ var claimsIdentity = this.User.Identity as ClaimsIdentity;
+ if (claimsIdentity == null)
+ {
+ return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+ }
+ var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+ if (string.IsNullOrWhiteSpace(userId))
+ {
+ return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+ }
+ _BoxInfoSvc.MergeLableBox(model.BoxNo, model.BoxNo2, int.Parse(userId));
+ return Ok(new { code = 0, msg = "鎿嶄綔鎴愬姛", data = "" });
+ }
+ catch (Exception e)
+ {
+ return Ok(new { code = 1, count = 0, msg = e.Message });
+ }
+ }
#endregion
#region 鏁版嵁褰掓。
--
Gitblit v1.8.0