From 57be7d35e105350c8828e6ab0a411a9f69f203a2 Mon Sep 17 00:00:00 2001
From: test <15284381150@163.com>
Date: 星期一, 15 九月 2025 13:45:56 +0800
Subject: [PATCH] 修改PDA库存查询
---
Pda/View/HouseDataSetting/stockQuery.html | 14 +++
Wms/Wms/Controllers/PdaCrController.cs | 7 +
Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs | 193 ++++++++++++++++++++++++++++++++++++++++++++++-
Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs | 3
4 files changed, 205 insertions(+), 12 deletions(-)
diff --git a/Pda/View/HouseDataSetting/stockQuery.html b/Pda/View/HouseDataSetting/stockQuery.html
index 8180398..cd09a14 100644
--- a/Pda/View/HouseDataSetting/stockQuery.html
+++ b/Pda/View/HouseDataSetting/stockQuery.html
@@ -111,6 +111,15 @@
autocomplete="off" class="layui-input">
</div>
</div>
+ <!-- 绠辩爜 -->
+ <div id="" class="layui-form-item layout-input" style="margin-top: 5px;">
+ <label class="layui-form-label">绠辩爜</label>
+ <div class="layui-input-block">
+ <input id="BoxNo" type="text" lay-verify="stock" placeholder="绠辩爜"
+ autocomplete="off" class="layui-input">
+ </div>
+ </div>
+ <!-- -->
<div id="" class="layui-form-item layout-input" style="margin-top: 5px;">
<label class="layui-form-label">鐗╂枡缂栫爜</label>
<div class="layui-input-block">
@@ -236,13 +245,14 @@
function clear(){
$("#LocatNo").val('');
$("#PalletNo").val('');
+ $("#BoxNo").val('');
$("#SkuNo").val("");
$("#SkuName").val("");
$("#Standard").val("");
}
$("#btnQuery").click(function(){
- if($('#LocatNo').val() == '' && $('#PalletNo').val() == '' && $('#SkuName').val() == ''){
+ if($('#LocatNo').val() == '' && $('#PalletNo').val() == '' && $('#BoxNo').val() == '' && $('#SkuName').val() == ''){
// layer.msg("璇疯緭鍏ユ煡璇㈡潯浠�", {
// icon: 2,
// time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
@@ -252,6 +262,7 @@
var param = {
LocatNo: $('#LocatNo').val(),
PalletNo: $('#PalletNo').val(),
+ BoxNo:$('#BoxNo').val(),
};
sendData(IP + "/PdaCr/GetStockQueryList", param, 'get', function(res) {
console.log("搴撳瓨鏌ヨ锛�",res)
@@ -259,6 +270,7 @@
clear();
$("#LocatNo").val(res.data[0].LocatNo);
$("#PalletNo").val(res.data[0].PalletNo);
+ $("#BoxNo").val(res.data[0].BoxNo);
$("#SkuNo").val(res.data[0].SkuNo);
$("#SkuName").val(res.data[0].SkuName);
$("#Standard").val(res.data[0].Standard);
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
index f1138ed..0f6f459 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -417,15 +417,25 @@
/// <param name="locatNo">鍌ㄤ綅缂栧彿</param>
/// <param name="palletNo">鎵樼洏鍙�</param>
/// <returns></returns>
- public async Task<List<DataStockDetail>> GetStockQueryList(string locatNo, string palletNo)
+ //public async Task<List<DataStockDetail>> GetStockQueryList(string locatNo, string palletNo)
+ //{
+ // return await Db.Queryable<DataStockDetail>()
+ // .Where(s => s.IsDel == "0" && s.LocatNo.Contains(locatNo) || s.PalletNo.Contains(palletNo))
+ // .OrderBy(s => new { s.LotNo, s.LocatNo, s.PalletNo })
+ // .ToListAsync();
+ //}
+ public async Task<List<DataStockDetail>> GetStockQueryList(string locatNo, string palletNo, string boxNo)
{
return await Db.Queryable<DataStockDetail>()
- .Where(s => s.IsDel == "0" && s.LocatNo.Contains(locatNo) || s.PalletNo.Contains(palletNo))
- .OrderBy(s => new { s.LotNo, s.LocatNo, s.PalletNo })
- .ToListAsync();
-
+ .LeftJoin<DataBoxInfo>((stk, box) => stk.LotNo == box.LotNo)
+ .Where((stk, box) => stk.IsDel == "0")
+ .WhereIF(!string.IsNullOrWhiteSpace(locatNo),(stk, box) => stk.LocatNo.Contains(locatNo))
+ .WhereIF(!string.IsNullOrWhiteSpace(palletNo),(stk, box) => stk.PalletNo.Contains(palletNo))
+ .WhereIF(!string.IsNullOrWhiteSpace(boxNo),(stk, box) => box.BoxNo.Contains(boxNo))
+ .OrderBy((stk, box) => new { stk.LotNo, stk.LocatNo, stk.PalletNo, box.BoxNo })
+ .Select((stk, box) => stk)
+ .ToListAsync();
}
-
#endregion
#region 鎵樼洏鍙樻洿锛堟墭鐩樿В缁戠粦瀹氾級
@@ -779,7 +789,7 @@
/// <param name="palletNo"></param>
/// <param name="areaNo"></param>
/// <param name="ruku"></param>
- public async Task AgvTransport(string palletNo, string areaNo, string ruku, string url, int userId)
+ /*public async Task AgvTransport(string palletNo, string areaNo, string ruku, string url, int userId)
{
try
{
@@ -945,6 +955,175 @@
{
throw new Exception(e.Message);
}
+ }*/
+
+ public async Task AgvTransport(string palletNo, string areaNo, string ruku, string url, int userId)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(palletNo))
+ {
+ throw Oops.Bah("璇锋壂鎻忔墭鐩樻潯鐮侊紒");
+ }
+ if (string.IsNullOrEmpty(areaNo) && string.IsNullOrEmpty(ruku))
+ {
+ throw Oops.Bah("璇烽�夋嫨鐩爣鍖哄煙鎴栧叆搴撳彛锛�");
+ }
+ if (!string.IsNullOrEmpty(areaNo) && !string.IsNullOrEmpty(ruku))
+ {
+ throw Oops.Bah("鐩爣鍖哄煙鍜屽叆搴撳彛涓嶈兘鍚屾椂閫夋嫨锛�");
+ }
+ string EndLocat = string.Empty;//鐩爣浣嶇疆
+
+ var log = await Db.Queryable<LogTask>().FirstAsync(w => w.IsDel == "0" && w.PalletNo == palletNo && (w.Status == "0" || w.Status == "1"));
+ if (log != null)
+ {
+ throw Oops.Bah("璇ユ墭鐩樺凡鏈夌瓑寰呮墽琛屾垨姝e湪鎵ц鐨勪换鍔�!");
+ }
+ var stockDetail = await Db.Queryable<DataStockDetail>().FirstAsync(w => w.IsDel == "0" && w.PalletNo == palletNo);
+ if (stockDetail == null)
+ {
+ throw Oops.Bah("鎵樼洏涓婄墿鏂欏簱瀛樻槑缁嗕俊鎭笉瀛樺湪,璇锋鏌�!");
+ }
+ if (!string.IsNullOrEmpty(areaNo))
+ {
+ var storageArea = await Db.Queryable<SysStorageArea>().FirstAsync(w => w.IsDel == "0" && w.AreaNo == areaNo);
+ if (storageArea == null)
+ {
+ throw Oops.Bah("鎵�閫夊尯鍩熶俊鎭笉瀛樺湪,璇锋鏌�!");
+ }
+ EndLocat = await GetLocat(areaNo);
+ }
+ else
+ {
+ EndLocat = ruku;
+ }
+ var stock = await Db.Queryable<DataStock>().FirstAsync(w => w.IsDel == "0" && w.SkuNo == stockDetail.SkuNo && w.LotNo == stockDetail.LotNo);
+ if (stock == null)
+ {
+ throw Oops.Bah("鎵樼洏涓婄墿鏂欏簱瀛樹俊鎭笉瀛樺湪,璇锋鏌�!");
+ }
+ if (string.IsNullOrEmpty(stockDetail.LocatNo))
+ {
+ throw Oops.Bah("鎵樼洏鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+ }
+ if (stockDetail.WareHouseNo != "W04")
+ {
+ throw Oops.Bah("璇ユ墭鐩樻湭鍦ㄥ钩搴撳唴,璇锋鏌�!");
+ }
+
+ //璧峰鍌ㄤ綅淇℃伅
+ var storageLocat = await Db.Queryable<SysStorageLocat>().FirstAsync(w => w.IsDel == "0" && w.LocatNo == stockDetail.LocatNo);
+ if (storageLocat == null)
+ {
+ throw Oops.Bah("鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+ }
+ //鐩爣鍌ㄤ綅淇℃伅
+ //var storageLocatEnd = new SysStorageLocat();
+
+ var storageLocatEnd = await Db.Queryable<SysStorageLocat>().FirstAsync(w => w.IsDel == "0" && w.LocatNo == EndLocat && w.Flag == "0");
+ if (storageLocatEnd == null)
+ {
+ throw Oops.Bah("鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+ }
+
+
+ //娣诲姞鍑哄簱浠诲姟
+ var taskNo = new Common().GetMaxNo("TK");
+ var moveTask = new LogTask
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "WCS",
+ IsSuccess = 0, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+
+ StartLocat = stockDetail.LocatNo,//璧峰浣嶇疆
+ EndLocat = EndLocat,//鐩爣浣嶇疆
+ PalletNo = palletNo,//鎵樼洏鐮�
+ Msg = string.Format("杞繍浠诲姟锛歿0}=>>{1}", stockDetail.LocatNo, EndLocat),
+ IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 1,//鏄惁鍙彇娑�
+ IsFinish = 1,//鏄惁鍙畬鎴�
+ Type = "2",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "0",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "3",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+
+ CreateTime = DateTime.Now
+ };
+ await Db.Insertable(moveTask).ExecuteCommandAsync();
+
+ //淇敼搴撳瓨鏄庣粏淇℃伅
+ //stockDetail.Status = "4";//绉诲簱閿佸畾
+ //stockDetail.LockQty = stockDetail.Qty;//閿佸畾搴撳瓨鏁伴噺
+ //await Db.Updateable(stockDetail).ExecuteCommandAsync();
+ ////淇敼搴撳瓨淇℃伅
+ //stock.LockQty += (decimal)stockDetail.Qty;
+ //await Db.Updateable(stock).ExecuteCommandAsync();
+
+ //淇敼璧峰鍌ㄤ綅鍦板潃鐘舵��
+ storageLocat.Status = "5";//0锛氱┖鍌ㄤ綅 1锛氭湁鐗╁搧 2锛氬叆搴撲腑 3锛氬嚭搴撲腑 4锛氱Щ鍏ヤ腑 5锛氱Щ鍑轰腑
+ await Db.Updateable(storageLocat).ExecuteCommandAsync();
+
+ //淇敼鐩爣鍌ㄤ綅鍦板潃鐘舵��
+ if (storageLocatEnd != null)
+ {
+ storageLocatEnd.Status = "4";//0锛氱┖鍌ㄤ綅 1锛氭湁鐗╁搧 2锛氬叆搴撲腑 3锛氬嚭搴撲腑 4锛氱Щ鍏ヤ腑 5锛氱Щ鍑轰腑
+ await Db.Updateable(storageLocatEnd).ExecuteCommandAsync();
+ }
+ //娣诲姞鎿嶄綔鏃ュ織璁板綍
+ var k = new OperationCrServer().AddLogOperationCr("PDA妯″潡", "AGV杞繍", palletNo, "绉诲簱", $"PDA鍛煎彨灏忚溅瀵规墭鐩樺彿锛歿palletNo}鍙戣捣杞繍", userId);
+
+ var outDto = new List<OutCommandDto>
+ {
+ new OutCommandDto()
+ {
+ TaskNo = moveTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "2",// 浠诲姟绫诲瀷 0鍏� 1鍑� 2绉�
+ PalletNo = moveTask.PalletNo,//鎵樼洏鍙�
+
+ StartLocate = moveTask.StartLocat, // 璧峰浣嶇疆
+ EndLocate = EndLocat, // 鐩爣浣嶇疆
+
+ Order = 999,
+ Type = PLCTypeEnum.AGV
+
+ }
+ };
+
+ // 姝e紡杩愯绋嬪簭鏀惧紑
+ var list2 = outDto.Select(m => m.TaskNo).ToList();
+ var jsonData = JsonConvert.SerializeObject(outDto);
+ string response = "";
+
+ try
+ {
+ var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
+ response = HttpHelper.DoPost(url, jsonData, "涓嬪彂缁橶CS鍑哄簱鍛戒护", "WCS");
+ var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
+
+ //瑙f瀽杩斿洖鏁版嵁
+ var wcsModel = JsonConvert.DeserializeObject<WcsModel2>(response);
+ if (wcsModel.code == 200)
+ {
+ // 鏇存敼浠诲姟鐨勫彂閫佽繑鍥炴椂闂�//
+ new TaskServer().EditTaskIssueOk(list2, time1, time2);
+ }
+ else
+ {
+ new TaskServer().EditTaskIssueNo(list2, time1, time2, wcsModel.message);
+ throw new Exception(wcsModel.message);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+
+ }
+ catch (Exception e)
+ {
+ throw new Exception(e.Message);
+ }
}
/// <summary>
/// 鍛煎彨agv杞繍绌烘墭鐩�
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
index 541550c..88d203c 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
@@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Model.ModelDto;
using Model.ModelDto.BllCheckDto;
+using Model.ModelDto.DataDto;
using Model.ModelDto.PdaDto;
using WMS.Entity.DataEntity;
using WMS.Entity.SysEntity;
@@ -64,7 +65,7 @@
/// <param name="locatNo">鍌ㄤ綅缂栧彿</param>
/// <param name="palletNo">鎵樼洏鍙�</param>
/// <returns></returns>
- Task<List<DataStockDetail>> GetStockQueryList(string locatNo, string palletNo);
+ Task<List<DataStockDetail>> GetStockQueryList(string locatNo, string palletNo, string boxno);
#endregion
diff --git a/Wms/Wms/Controllers/PdaCrController.cs b/Wms/Wms/Controllers/PdaCrController.cs
index 8faedc6..7634087 100644
--- a/Wms/Wms/Controllers/PdaCrController.cs
+++ b/Wms/Wms/Controllers/PdaCrController.cs
@@ -17,6 +17,7 @@
using System.Security.Cryptography;
using Wms.Tools;
using Microsoft.Extensions.Options;
+using Model.ModelDto.DataDto;
namespace Wms.Controllers
{
@@ -117,13 +118,13 @@
/// </summary>
/// <param name="locatNo">鍌ㄤ綅缂栧彿</param>
/// <param name="palletNo">鎵樼洏鍙�</param>
- /// <param name="skuName">鐗╂枡鍚嶇О</param>
+ /// <param name="boxno">绠辩爜</param>
/// <returns></returns>
[HttpGet]
[ServiceFilter(typeof(ApiResponseActionFilter))]
- public async Task<List<DataStockDetail>> GetStockQueryList(string locatNo, string palletNo)
+ public async Task<List<DataStockDetail>> GetStockQueryList(string locatNo, string palletNo, string boxno)
{
- return await _pdaCrSvc.GetStockQueryList(locatNo, palletNo);
+ return await _pdaCrSvc.GetStockQueryList(locatNo, palletNo, boxno);
}
#endregion
--
Gitblit v1.8.0