From 6be6a1e453861fa0beb818236fdd8183024074c4 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期二, 04 十一月 2025 08:21:40 +0800
Subject: [PATCH] 增加和MES对接接口
---
Wms/WMS.BLL/DataServer/StockDetailServer.cs | 171 ++++++++++++++------------------------------------------
1 files changed, 44 insertions(+), 127 deletions(-)
diff --git a/Wms/WMS.BLL/DataServer/StockDetailServer.cs b/Wms/WMS.BLL/DataServer/StockDetailServer.cs
index 6b1cfdc..f2f2563 100644
--- a/Wms/WMS.BLL/DataServer/StockDetailServer.cs
+++ b/Wms/WMS.BLL/DataServer/StockDetailServer.cs
@@ -9,6 +9,7 @@
using WMS.Entity.BllQualityEntity;
using WMS.Entity.Context;
using WMS.Entity.DataEntity;
+using WMS.Entity.SysEntity;
using WMS.IBLL.IDataServer;
namespace WMS.BLL.DataServer
@@ -37,146 +38,47 @@
/// <param name="bitBoxMark">闆剁鏍囪</param>
/// <param name="inspectStatus">璐ㄩ噺鐘舵��</param>
/// <returns></returns>
- public List<StockDetailDto> GetBindList(string skuNo, string skuName, string palletNo, string lotNo, string boxNo, string status, string inspectMark, string bitPalletMark, string bitBoxMark, string inspectStatus, string ownerNo, string ownerName, string startTime, string endTime)
+ public List<StockDetailDto> GetBindList(string wareHouseName, string areaName, string locatNo, string palletNo, string lotNo)
{
- string str = "select detail.*,house.WareHouseNo + '-' + house.WareHouseName as WareHouseName,roadway.RoadwayNo + '-' + roadway.RoadwayName as RoadwayName,area.AreaNo + '-' + area.AreaName as AreaName from DataStockDetail detail left join SysStorageRoadway roadway on detail.RoadwayNo = roadway.RoadwayNo left join SysWareHouse house on detail.WareHouseNo = house.WareHouseNo left join SysStorageArea area on detail.AreaNo = area.AreaNo where detail.IsDel = @isdel";
- //鍒ゆ柇鐗╂枡鍙锋槸鍚︿负绌�
- if (!string.IsNullOrEmpty(skuNo))
+ string str = $@"select
+ detail.*,
+ house.WareHouseNo + '-' + house.WareHouseName as WareHouseName,
+ roadway.RoadwayNo + '-' + roadway.RoadwayName as RoadwayName,
+ area.AreaNo + '-' + area.AreaName as AreaName
+ from DataStockDetail detail
+ left join SysStorageRoadway roadway on detail.RoadwayNo = roadway.RoadwayNo
+ left join SysWareHouse house on detail.WareHouseNo = house.WareHouseNo
+ left join SysStorageArea area on detail.AreaNo = area.AreaNo
+ where detail.IsDel = '0'";
+
+ //鍒ゆ柇鎵�灞炰粨搴撴槸鍚︿负绌�
+ if (!string.IsNullOrEmpty(wareHouseName))
{
- str += " and detail.SkuNo like @skuno";
+ str += $" and (house.WareHouseNo like '%{wareHouseName}%' or house.WareHouseName like '%{wareHouseName}%')";
}
- //鍒ゆ柇鐗╂枡鍚嶇О鏄惁涓虹┖
- if (!string.IsNullOrEmpty(skuName))
+ //鍒ゆ柇鎵�灞炲尯鍩熸槸鍚︿负绌�
+ if (!string.IsNullOrEmpty(areaName))
{
- str += " and detail.SkuName like @skuname";
+ str += $" and (area.AreaNo like '%{areaName}%' or area.AreaName like '%{areaName}%')";
+ }
+ //鍒ゆ柇鎵�灞炲偍浣嶆槸鍚︿负绌�
+ if (!string.IsNullOrEmpty(locatNo))
+ {
+ str += $" and detail.LocatNo like '%{locatNo}%'";
}
//鍒ゆ柇鎵樼洏鍙锋槸鍚︿负绌�
if (!string.IsNullOrEmpty(palletNo))
{
- str += " and detail.PalletNo like @palletno";
+ str += $" and detail.PalletNo like '%{palletNo}%'";
}
//鍒ゆ柇鎵规鏄惁涓虹┖
if (!string.IsNullOrEmpty(lotNo))
{
- str += " and detail.LotNo like @lotno";
+ str += $" and detail.LotNo like '%{lotNo}%'";
}
- //鍒ゆ柇闆舵墭鏍囪鏄惁涓虹┖
- if (!string.IsNullOrEmpty(bitPalletMark))
- {
- str += " and detail.BitPalletMark = @bitpalletmark";
- }
- //鍒ゆ柇璐т富缂栫爜鏄惁涓虹┖
- if (!string.IsNullOrEmpty(ownerNo))
- {
- str += " and detail.OwnerNo like @ownerNo";
- }
- //鍒ゆ柇璐т富鍚嶇О鏄惁涓虹┖
- if (!string.IsNullOrEmpty(ownerName))
- {
- str += " and detail.OwnerName like @ownerName";
- }
- if (!string.IsNullOrEmpty(startTime))
- {
- str += $" and detail.CompleteTime >= '{startTime}'";
- }
- if (!string.IsNullOrEmpty(endTime))
- {
- endTime = Convert.ToDateTime(endTime).AddDays(1).ToString();
- str += $" and detail.CompleteTime < '{endTime}'";
- }
-
- int i = 0;
- //鍦ㄧ鐮佹槑缁嗕腑鑾峰彇鐩稿簲鏁版嵁
- string boxstr = "select StockDetailId from DataBoxInfo Where IsDel = @isdel";
- //鍒ゆ柇绠辩爜鏄惁涓虹┖
- if (!string.IsNullOrEmpty(boxNo))
- {
- boxstr += " and BoxNo like @boxno";
- i = 1;
- }
- //鍒ゆ柇绠辨敮鐘舵�佹槸鍚︿负绌�
- if (!string.IsNullOrEmpty(status))
- {
- boxstr += " and Status = @status";
- i = 1;
- }
- //鍒ゆ柇妫�楠屾爣璁版槸鍚︿负绌�
- if (!string.IsNullOrEmpty(inspectMark))
- {
- boxstr += " and InspectMark = @inspectmark";
- str += " and detail.InspectMark = @inspectmark";
- i = 1;
- }
- //鍒ゆ柇闆剁鏍囪鏄惁涓虹┖
- if (!string.IsNullOrEmpty(bitBoxMark))
- {
- boxstr += " and BitBoxMark = @bitboxmark";
- i = 1;
- }
- //鍒ゆ柇璐ㄩ噺鐘舵�佹槸鍚︿负绌�
- if (!string.IsNullOrEmpty(inspectStatus))
- {
- boxstr += " and InspectStatus = @inspectstatus";
- str += " and detail.InspectStatus = @inspectstatus";
- i = 1;
- }
- //灏嗙鐮佹暟鎹繘琛屾帓搴�
- boxstr += " order by StockDetailId";
- //鏌ュ嚭绠辩爜鏄庣粏涓俊鎭�
- List<int> stockDetailId = Db.Ado.SqlQuery<int>(boxstr, new
- {
- isdel = "0", //鏄惁鍒犻櫎
- boxno = "%" + boxNo + "%", //绠辩爜
- status, //绠辨敮鐘舵��
- inspectmark = inspectMark, //妫�楠屾爣璁�
- bitboxmark = bitBoxMark, //闆剁鏍囪
- inspectstatus = inspectStatus //璐ㄩ噺鐘舵��
- });
- //鍘婚噸
- // List<int> newArr = null;
- string arr = "";
- //鍒ゆ柇鏄惁鏈夋煡绠辩爜淇℃伅
- if (i == 1)
- {
- if (stockDetailId.Count > 0)
- {
- //鍘婚噸
- arr += stockDetailId[0].ToString();
-
- for (int a = 1; a < stockDetailId.Count; a++)
- {
- if (stockDetailId[a] != stockDetailId[a - 1])
- {
- arr += ',' + stockDetailId[a].ToString();
- }
- }
- }
- if (!string.IsNullOrEmpty(arr))
- {
- str += $" and Id in ({arr})";
- }
- else
- {
- str += " and Id = ''";
- }
- }
-
//鎺掑簭
- str += " order by PalletNo,SkuNo,LotNo";
- List<StockDetailDto> boxInforList = Db.Ado.SqlQuery<StockDetailDto>(str, new
- {
- isdel = "0", //鏄惁鍒犻櫎
- skuno = "%" + skuNo + "%", //鐗╂枡鍙�
- skuname = "%" + skuName + "%", //鐗╂枡鍚嶇О
- palletno = "%" + palletNo + "%", //鎵樼洏
- lotno = "%" + lotNo + "%", //鎵规鍙�
- bitpalletmark = bitPalletMark, //闆舵墭鏍囪
- inspectmark = inspectMark, //妫�楠屾爣璁�
- inspectstatus = inspectStatus, //璐ㄩ噺鐘舵��
- ownerNo = "%" + ownerNo + "%", //璐т富缂栫爜
- ownerName = "%" + ownerName + "%" //璐т富鍚嶇О
- //stockdetailid = "(" + arr + ")" //搴撳瓨鏄庣粏id
- });
+ str += " order by PalletNo";
+ List<StockDetailDto> boxInforList = Db.Ado.SqlQuery<StockDetailDto>(str).ToList();
return boxInforList;
}
@@ -408,7 +310,7 @@
/// <summary>
/// 娣诲姞鎵樼洏搴撳瓨鏄庣粏
/// </summary>
- public void InsertStockDetail(string PalletNo,string WareHouseNo,string AreaNo,string LocatNo, string PalletStatus,int userId)
+ public void InsertStockDetail(string PalletNo,string WareHouseNo,string AreaNo,string LocatNo, string PalletStatus, string SkuNo, string SkuName, string LotNo, int userId)
{
try
{
@@ -437,6 +339,13 @@
{
throw new Exception($"搴撳瓨涓凡鏈夌紪鍙蜂负锛歿PalletNo}鐨勬槑缁嗭紝璇峰嬁閲嶅娣诲姞!");
}
+ //鐩爣鍌ㄤ綅淇℃伅
+ var locatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == LocatNo && w.Status == "0" && w.IsDel == "0");
+ if (locatInfo == null)
+ {
+ throw new Exception("鍌ㄤ綅鍦板潃涓嶅瓨鍦�!");
+ }
+
Db.BeginTran();
var comTime = DateTime.Now;
@@ -465,6 +374,10 @@
IsBale = "0",
IsBelt = "0",
+ SkuNo = SkuNo,
+ SkuName = SkuName,
+ LotNo = LotNo,
+
PalletStatus = PalletStatus,
IsDel = "0",
@@ -474,6 +387,10 @@
//鎻掑叆搴撳瓨鏄庣粏
Db.Insertable(model).ExecuteCommand();
+ locatInfo.Status = "1";//鏈夌墿鍝�
+ //淇敼鐩爣鍌ㄤ綅鐘舵��
+ Db.Updateable(locatInfo).ExecuteCommand();
+
Db.CommitTran();
}
catch (Exception e)
--
Gitblit v1.8.0