From d49aedf1a71838f3dcb6c762895c601174937c0b Mon Sep 17 00:00:00 2001
From: liulijun <liulijun@hnkhzn.com>
Date: 星期五, 06 二月 2026 17:32:34 +0800
Subject: [PATCH] 添加库存平面图
---
项目代码/WMS/WMSServices/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 116 insertions(+), 0 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs"
index a3e3666..40d503e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs"
@@ -86,5 +86,121 @@
return WebResponseContent.Instance.Error(e.Message);
}
}
+
+ /// <summary>
+ /// 鏌ヨ鏉′欢璐т綅
+ /// </summary>
+ /// <param name="row"></param>
+ /// <param name="warehouseId"></param>
+ /// <returns></returns>
+ [HttpPost, HttpGet, Route("GetLocationStatus")]
+ public WebResponseContent GetLocationStatus(int row, int warehouseId = 0)
+ {
+ List<int> layers;
+ if (warehouseId == 0)
+ {
+ layers = _repository.QueryData(x => x.Row == row).Select(x => x.Layer).Distinct().ToList();
+ }
+ else
+ {
+ layers = _repository.QueryData(x => x.Row == row && x.WarehouseId == warehouseId).Select(x => x.Layer).Distinct().ToList();
+ }
+
+ List<object> listObj = new List<object>();
+ foreach (var item in layers)
+ {
+ object locationObj;
+ if (warehouseId == 0)
+ {
+ locationObj = _repository.QueryData(x => x.Row == row && x.Layer == item)
+ .OrderBy(x => x.Columns)
+ .Select(x => new
+ {
+ layer = x.Layer.ToString().PadLeft(2, '0'),
+ row = x.Row.ToString().PadLeft(2, '0'),
+ column = x.Columns.ToString().PadLeft(2, '0'),
+ locationCode = x.LocationCode,
+ location_lock = x.LocationStatus
+ }).ToList();
+ }
+ else
+ {
+ locationObj = _repository.QueryData(x => x.Row == row && x.Layer == item && x.WarehouseId == warehouseId)
+ .OrderBy(x => x.Columns)
+ .Select(x => new
+ {
+ layer = x.Layer.ToString().PadLeft(2, '0'),
+ row = x.Row.ToString().PadLeft(2, '0'),
+ column = x.Columns.ToString().PadLeft(2, '0'),
+ locationCode = x.LocationCode,
+ location_lock = x.LocationStatus
+ }).ToList();
+ }
+
+ object obj = new { layer = item, locationObj };
+ listObj.Add(obj);
+ }
+
+ return WebResponseContent.Instance.OK("鎴愬姛", listObj);
+ }
+
+ /// <summary>
+ /// 鏌ヨ鍏ㄩ儴璐т綅
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost, HttpGet, Route("GetRow")]
+ public WebResponseContent GetRow()
+ {
+ List<int> listRow = _repository.QueryData().Select(x => x.Row).Distinct().ToList();
+ return WebResponseContent.Instance.OK("鎴愬姛", listRow);
+ }
+
+ /// <summary>
+ /// 鏌ヨ璐т綅RFID
+ /// </summary>
+ /// <param name="requestData"></param>
+ /// <returns></returns>
+ [HttpPost, Route("GetRfid")]
+ public WebResponseContent GetRfid([FromBody] dynamic requestData)
+ {
+ try
+ {
+ if (requestData == null)
+ {
+ return WebResponseContent.Instance.Error("璇锋眰鏁版嵁涓虹┖");
+ }
+
+ // 妫�鏌ocationCodes瀛楁鏄惁瀛樺湪涓斾笉涓簄ull锛堝吋瀹筶ocationCode锛�
+ if (requestData.locationCodes == null && requestData.locationCode == null)
+ {
+ return WebResponseContent.Instance.Error("璐т綅缂栧彿鏁扮粍涓嶈兘涓虹┖");
+ }
+
+ // 杞崲涓簊tring[]锛屼紭鍏堜娇鐢╨ocationCodes
+ string[] locationCode = null;
+ var locationCodeField = requestData.locationCodes ?? requestData.locationCode;
+ if (locationCodeField is Newtonsoft.Json.Linq.JArray)
+ {
+ locationCode = ((Newtonsoft.Json.Linq.JArray)locationCodeField).ToObject<string[]>();
+ }
+ else
+ {
+ return WebResponseContent.Instance.Error("璐т綅缂栧彿蹇呴』鏄暟缁勬牸寮�");
+ }
+
+ // 妫�鏌arehouseId瀛楁鏄惁瀛樺湪
+ int warehouseId = 0;
+ if (requestData.warehouseId != null)
+ {
+ warehouseId = Convert.ToInt32(requestData.warehouseId);
+ }
+
+ return Service.GetRfid(locationCode, warehouseId);
+ }
+ catch (Exception ex)
+ {
+ return WebResponseContent.Instance.Error($"鍙傛暟瑙f瀽澶辫触: {ex.Message}");
+ }
+ }
}
}
--
Gitblit v1.9.3