From 314076388f664f8ce1a1d19c4c9717fe54634e05 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 18 四月 2026 15:51:51 +0800
Subject: [PATCH] Merge branch 'dev' of http://115.159.85.185:8098/r/SuZhouGuanHong/ShanMeiXinNengYuan into dev
---
Code/WMS/WIDESEA_WMSClient/src/views/Home.vue | 1
Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs | 12 +
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Record/LocationStatusChangeRecordController.cs | 25 ++++
Code/WMS/WIDESEA_WMSClient/public/webconfig.js | 2
Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue | 48 ++++++-
Code/WMS/WIDESEA_WMSClient/src/views/basic/locationInfo.vue | 2
/dev/null | 0
Code/WMS/WIDESEA_WMSClient/src/extension/basic/extend/GetLocationStatus.vue | 1
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_AGV.cs | 149 +++++++++++++++++++++---
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs | 67 +++++++++++
Code/WMS/WIDESEA_WMSClient/src/api/http.js | 2
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Dashboard/DashboardController.cs | 13 +-
Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task.vue | 18 +-
Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task_hty.vue | 18 +-
14 files changed, 294 insertions(+), 64 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSClient/public/webconfig.js b/Code/WMS/WIDESEA_WMSClient/public/webconfig.js
index 207a38c..66b8aeb 100644
--- a/Code/WMS/WIDESEA_WMSClient/public/webconfig.js
+++ b/Code/WMS/WIDESEA_WMSClient/public/webconfig.js
@@ -1,4 +1,4 @@
window.webConfig = {
"webApiBaseUrl": "http://localhost:9291/",
- "webApiProduction":"http://localhost:9291/"
+ "webApiProduction":"http://192.168.60.30:9291/"
}
\ No newline at end of file
diff --git a/Code/WMS/WIDESEA_WMSClient/src/api/http.js b/Code/WMS/WIDESEA_WMSClient/src/api/http.js
index 70a500f..0a82b23 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/api/http.js
+++ b/Code/WMS/WIDESEA_WMSClient/src/api/http.js
@@ -15,7 +15,7 @@
axios.defaults.baseURL = window.webConfig.webApiBaseUrl;
}
else if (process.env.NODE_ENV == 'debug') {
- axios.defaults.baseURL = 'http://127.0.0.1:8098/';
+ axios.defaults.baseURL = window.webConfig.webApiBaseUrl;
}
else if (process.env.NODE_ENV == 'production') {
diff --git a/Code/WMS/WIDESEA_WMSClient/src/extension/basic/extend/GetLocationStatus.vue b/Code/WMS/WIDESEA_WMSClient/src/extension/basic/extend/GetLocationStatus.vue
index a861f7d..69e4ebf 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/extension/basic/extend/GetLocationStatus.vue
+++ b/Code/WMS/WIDESEA_WMSClient/src/extension/basic/extend/GetLocationStatus.vue
@@ -200,6 +200,7 @@
open(row) {
this.row = row;
this.showDetialBox = true;
+ this.tableData = [];
this.getDetailData();
this.getDictionaryData();
},
diff --git a/Code/WMS/WIDESEA_WMSClient/src/views/Home.vue b/Code/WMS/WIDESEA_WMSClient/src/views/Home.vue
index cb29f02..a14728a 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/views/Home.vue
+++ b/Code/WMS/WIDESEA_WMSClient/src/views/Home.vue
@@ -104,6 +104,7 @@
async loadOverview() {
try {
const res = await this.http.get("/api/Dashboard/Overview");
+ console.log("鎬昏鏁版嵁", res.Data);
if (res.Status && res.Data) {
this.overviewData = res.Data;
this.updateTodayChart();
diff --git a/Code/WMS/WIDESEA_WMSClient/src/views/basic/locationInfo.vue b/Code/WMS/WIDESEA_WMSClient/src/views/basic/locationInfo.vue
index 43d8a94..829120d 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/views/basic/locationInfo.vue
+++ b/Code/WMS/WIDESEA_WMSClient/src/views/basic/locationInfo.vue
@@ -81,7 +81,7 @@
field: "locationCode",
title: "璐т綅缂栧彿",
type: "string",
- width: 200,
+ width: 120,
align: "left",
},
{
diff --git a/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue b/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue
index 6337909..de418eb 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue
+++ b/Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue
@@ -1,12 +1,8 @@
<template>
<div class="stock-chat-container">
<el-tabs v-model="activeWarehouse" @tab-change="onWarehouseChange">
- <el-tab-pane
- v-for="wh in warehouseList"
- :key="wh.warehouseId || wh.id"
- :label="wh.warehouseName"
- :name="wh.warehouseId || wh.id"
- />
+ <el-tab-pane v-for="wh in warehouseList" :key="wh.warehouseId || wh.id" :label="wh.warehouseName"
+ :name="wh.warehouseId || wh.id" />
</el-tabs>
<div class="toolbar">
@@ -57,11 +53,15 @@
<div v-if="selectedLocation" class="detail-content">
<el-descriptions :column="2" border>
<el-descriptions-item label="璐т綅缂栧彿">{{ selectedLocation.locationCode }}</el-descriptions-item>
- <el-descriptions-item label="璐т綅鐘舵��">{{ getLocationStatusText(selectedLocation.locationStatus) }}</el-descriptions-item>
+ <el-descriptions-item label="璐т綅鐘舵��">{{ getLocationStatusText(selectedLocation.locationStatus)
+ }}</el-descriptions-item>
<el-descriptions-item label="鎵樼洏缂栧彿">{{ selectedLocation.palletCode || '鏃�' }}</el-descriptions-item>
- <el-descriptions-item label="搴撳瓨鐘舵��">{{ getStockStatusText(selectedLocation.stockStatus) }}</el-descriptions-item>
- <el-descriptions-item label="鎬诲簱瀛�">{{ selectedLocation.stockQuantity }}{{ selectedLocation.unit || '' }}</el-descriptions-item>
- <el-descriptions-item label="鍑哄簱鏃ユ湡">{{ selectedLocation.outboundDate }}{{ selectedLocation.unit || '' }}</el-descriptions-item>
+ <el-descriptions-item label="搴撳瓨鐘舵��">{{ getStockStatusText(selectedLocation.stockStatus)
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鎬诲簱瀛�">{{ selectedLocation.stockQuantity }}{{ selectedLocation.unit || ''
+ }}</el-descriptions-item>
+ <el-descriptions-item label="鍑哄簱鏃ユ湡">{{ selectedLocation.outboundDate }}{{ selectedLocation.unit || ''
+ }}</el-descriptions-item>
</el-descriptions>
<div v-if="selectedLocation.details && selectedLocation.details.length > 0" class="detail-table">
@@ -766,6 +766,16 @@
async function loadWarehouseData(warehouseId) {
try {
+ // 娓呴櫎楂樹寒妗�
+ if (selectionOutline) {
+ selectionOutline.visible = false
+ }
+ selectedLocation.value = null
+
+ // 娓呯┖绛涢�夋潯浠�
+ filterStockStatus.value = null
+ filterMaterielCode.value = null
+ filterBatchNo.value = null
const res = await proxy.http.get(`/api/StockInfo/Get3DLayout?warehouseId=${warehouseId}`)
if (res.status && res.data) {
const data = res.data
@@ -1139,9 +1149,25 @@
}
async function onWarehouseChange(warehouseId) {
+ // 娓呴櫎閫変腑鐨勯珮浜
+ if (selectionOutline) {
+ selectionOutline.visible = false
+ }
+ // 娓呴櫎閫変腑鐨勮揣浣嶆暟鎹�
+ selectedLocation.value = null
+
+ // 娓呯┖鎵�鏈夌瓫閫夋潯浠�
+ filterStockStatus.value = null
+ filterMaterielCode.value = null
+ filterBatchNo.value = null
+
+ // 娓呯┖绛涢�夐�夐」鍒楄〃
+ materielCodeList.value = []
+ batchNoList.value = []
+
+ // 鍔犺浇鏂颁粨搴撴暟鎹�
await loadWarehouseData(warehouseId)
}
-
function onWindowResize() {
if (!canvasContainer.value || !camera || !renderer) {
return
diff --git a/Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task.vue b/Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task.vue
index fc337f4..6eda01e 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task.vue
+++ b/Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task.vue
@@ -110,14 +110,14 @@
field: "sourceAddress",
title: "璧峰鍦板潃",
type: "int",
- width: 220,
+ width: 120,
align: "left",
},
{
field: "targetAddress",
title: "鐩爣鍦板潃",
type: "string",
- width: 220,
+ width: 120,
align: "left",
},
{
@@ -141,13 +141,13 @@
width: 90,
align: "left",
},
- {
- field: "grade",
- title: "浼樺厛绾�",
- type: "int",
- width: 80,
- align: "left",
- },
+ // {
+ // field: "grade",
+ // title: "浼樺厛绾�",
+ // type: "int",
+ // width: 80,
+ // align: "left",
+ // },
{
field: "depth",
title: "娣卞害",
diff --git a/Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task_hty.vue b/Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task_hty.vue
index d780f6e..3621bf7 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task_hty.vue
+++ b/Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task_hty.vue
@@ -110,14 +110,14 @@
field: "sourceAddress",
title: "璧峰鍦板潃",
type: "int",
- width: 220,
+ width: 120,
align: "left",
},
{
field: "targetAddress",
title: "鐩爣鍦板潃",
type: "string",
- width: 220,
+ width: 120,
align: "left",
},
// {
@@ -142,13 +142,13 @@
align: "left",
hidden: true,
},
- {
- field: "grade",
- title: "浼樺厛绾�",
- type: "int",
- width: 80,
- align: "left",
- },
+ // {
+ // field: "grade",
+ // title: "浼樺厛绾�",
+ // type: "int",
+ // width: 80,
+ // align: "left",
+ // },
{
field: "depth",
title: "娣卞害",
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
index c1af291..1c2483b 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
@@ -1,4 +1,5 @@
-锘縰sing WIDESEA_Core.BaseRepository;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_DTO.Stock;
using WIDESEA_Model.Models;
@@ -55,6 +56,13 @@
/// </summary>
/// <param name="warehouseId">浠撳簱ID</param>
/// <returns>3D甯冨眬DTO</returns>
- Task<Stock3DLayoutDTO> Get3DLayoutAsync(int warehouseId);
+ Task<Stock3DLayoutDTO> Get3DLayoutAsync(int warehouseId);
+
+ /// <summary>
+ /// 浣跨敤浜嬪姟鍒犻櫎搴撳瓨鍜屾槑缁嗕俊鎭紙鍏堟煡璇㈠啀鍒犻櫎锛�
+ /// </summary>
+ /// <param name="stockId">搴撳瓨ID</param>
+ /// <returns>鍒犻櫎缁撴灉</returns>
+ Task<WebResponseContent> DeleteStockWithDetailsAsync(int stockId);
}
}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
index 0fd9881..9a84608 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -30,6 +30,8 @@
/// </summary>
private readonly IWarehouseService _warehouseService;
private readonly IRecordService _recordService;
+ private readonly IUnitOfWorkManage _unitOfWorkManage;
+ private readonly IStockInfoDetailService _stockInfoDetailService;
/// <summary>
/// 鏋勯�犲嚱鏁�
@@ -39,11 +41,15 @@
IRepository<Dt_StockInfo> baseDal,
ILocationInfoService locationInfoService,
IWarehouseService warehouseService,
- IRecordService recordService) : base(baseDal)
+ IRecordService recordService,
+ IUnitOfWorkManage unitOfWorkManage,
+ IStockInfoDetailService stockInfoDetailService) : base(baseDal)
{
_locationInfoService = locationInfoService;
_warehouseService = warehouseService;
_recordService = recordService;
+ _unitOfWorkManage = unitOfWorkManage;
+ _stockInfoDetailService = stockInfoDetailService;
}
/// <summary>
@@ -316,5 +322,64 @@
Locations = locationItems
};
}
+
+ /// <summary>
+ /// 浣跨敤浜嬪姟鍒犻櫎搴撳瓨鍜屾槑缁嗕俊鎭紙鍏堟煡璇㈠啀鍒犻櫎锛�
+ /// </summary>
+ /// <param name="stockId">搴撳瓨ID</param>
+ /// <returns>鍒犻櫎缁撴灉</returns>
+ public async Task<WebResponseContent> DeleteStockWithDetailsAsync(int stockId)
+ {
+ if (stockId <= 0)
+ return WebResponseContent.Instance.Error("搴撳瓨ID鏃犳晥");
+
+ _unitOfWorkManage.BeginTran();
+ try
+ {
+ // 鍏堟煡璇㈠簱瀛樹俊鎭紙鍖呭惈鏄庣粏锛�
+ var stockInfo = await BaseDal.QueryDataNavFirstAsync(x => x.Id == stockId);
+ if (stockInfo == null)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error("搴撳瓨璁板綍涓嶅瓨鍦�");
+ }
+
+ // 鏌ヨ骞跺垹闄ゅ簱瀛樻槑缁嗚褰�
+ var existingDetails = await _stockInfoDetailService.Repository.QueryDataAsync(x => x.StockId == stockId);
+ if (existingDetails != null && existingDetails.Any())
+ {
+ var deleteDetailResult = await _stockInfoDetailService.Repository.DeleteDataAsync(existingDetails);
+ if (!deleteDetailResult)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error("鍒犻櫎搴撳瓨鏄庣粏璁板綍澶辫触");
+ }
+ }
+
+ // 鍒犻櫎搴撳瓨涓昏褰�
+ var deleteStockResult = await BaseDal.DeleteDataAsync(stockInfo);
+ if (!deleteStockResult)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error("鍒犻櫎搴撳瓨涓昏褰曞け璐�");
+ }
+
+ _unitOfWorkManage.CommitTran();
+
+ // 璁板綍搴撳瓨鍙樻洿鏃ュ織
+ var saveRecordResult = await _recordService.AddStockChangeRecordAsync(stockInfo, null, StockChangeTypeEnum.Outbound, remark: "搴撳瓨鍒犻櫎");
+ if (!saveRecordResult)
+ {
+ return WebResponseContent.Instance.Error("搴撳瓨鍙樻洿璁板綍淇濆瓨澶辫触");
+ }
+
+ return WebResponseContent.Instance.OK("搴撳瓨鍒犻櫎鎴愬姛");
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error($"鍒犻櫎搴撳瓨鍜屾槑缁嗘椂鍙戠敓寮傚父: {ex.Message}");
+ }
+ }
}
}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_AGV.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_AGV.cs
index b054e73..74dfd61 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_AGV.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_AGV.cs
@@ -1,5 +1,6 @@
using Mapster;
using System.Text.Json;
+using WIDESEA_Common.Constants;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
@@ -8,6 +9,7 @@
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Task;
+using WIDESEA_IStockService;
using WIDESEA_Model.Models;
namespace WIDESEA_TaskInfoService
@@ -168,7 +170,7 @@
return response.OK();
if (task.TaskStatus == (int)TaskInStatusEnum.InNew)
- return CancelAgvInboundTask(task);
+ return await CancelAgvInboundTask(task);
if (task.TaskStatus == (int)TaskOutStatusEnum.OutNew)
return await CancelAgvOutboundTaskAsync(task);
@@ -300,35 +302,117 @@
return response.Error($"褰撳墠鎵樼洏{dto.TrayNumber}宸茬粡鍏ュ簱浜�");
// 鍒涘缓搴撳瓨鏄庣粏
+ var details = new Dt_StockInfoDetail
+ {
+ MaterielCode = dto.ProductNo,
+ MaterielName = dto.ProductName,
+ StockQuantity = int.TryParse(dto.Quantity, out int quantity) ? quantity : 0,
+ Unit = dto.UomCode,
+ OrderNo = dto.ProductNo,
+ ProductionDate =dto.ProductionDate,
+ EffectiveDate = dto.LowerLimitTime,
+ SerialNumber = dto.TrayNumber,
+ Status = (int)StockStatusEmun.鍏ュ簱纭,
+ InboundOrderRowNo = 1,
+ Creater = StockConstants.AGV_USER,
+ CreateDate = DateTime.Now,
+ Remark = $"AGV鍏ュ簱浠诲姟鍒涘缓锛屼换鍔″彿锛歿dto.TaskId}"
+ };
+
+ // 鍒涘缓搴撳瓨涓昏褰�
+ var stock = new Dt_StockInfo
+ {
+ PalletCode = dto.TrayNumber,
+ PalletType = dto.Floor,
+ WarehouseId = dto.YinYang == 1 ? (int)WarehouseEnum.FJ1 : (int)WarehouseEnum.ZJ1,
+ StockStatus = (int)StockStatusEmun.鍏ュ簱纭,
+ Creater = StockConstants.AGV_USER,
+ CreateDate = DateTime.Now,
+ Remark = $"AGV鍏ュ簱浠诲姟鍒涘缓锛屼换鍔″彿锛歿dto.TaskId}",
+ Details = new List<Dt_StockInfoDetail> { details }
+ };
task.TaskType = (int)TaskInboundTypeEnum.Inbound;
task.TaskStatus = (int)TaskInStatusEnum.InNew;
task.CurrentAddress = task.SourceAddress;
- var addResult = await BaseDal.AddDataAsync(task) > 0;
- return addResult ? null : response.Error("鍏ュ簱浠诲姟鍒涘缓澶辫触");
+ _unitOfWorkManage.BeginTran();
+ try
+ {
+ // 鍏堝垱寤轰换鍔�
+ var taskResult = await BaseDal.AddDataAsync(task) > 0;
+ if (!taskResult)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return response.Error("鍏ュ簱浠诲姟鍒涘缓澶辫触");
+ }
+ var result = _stockInfoService.Repository.AddData(stock, x => x.Details);
+ if (result)
+ {
+ _unitOfWorkManage.CommitTran();
+ return null;
+ }
+ else
+ {
+ _unitOfWorkManage.RollbackTran();
+ return response.Error("搴撳瓨淇℃伅鍒涘缓澶辫触");
+ }
+ // 浣跨敤搴撳瓨鏈嶅姟娣诲姞搴撳瓨涓昏褰曞拰鏄庣粏
+ //var stockResult = await _stockInfoService.AddStockWithDetailsUsingTransactionAsync(stock);
+
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return response.Error($"鍏ュ簱浠诲姟鍒涘缓寮傚父锛歿ex.Message}");
+ }
}
// 鍑哄簱鍒涘缓
private async Task<AGVResponse?> CreateAgvOutboundTaskAsync(Dt_Task task, ApplyInOutDto dto)
{
AGVResponse response = new AGVResponse();
+
+ // 妫�鏌ュ簱瀛樻槸鍚﹀瓨鍦�
var stockInfo = await _stockInfoService.GetStockInfoAsync(dto.TrayNumber);
if (stockInfo == null)
return response.Error($"鏈壘鍒版墭鐩榹dto.TrayNumber}鐨勫簱瀛樹俊鎭�");
- //if (stockInfo.WarehouseId != dto.YinYang)
- // return response.Error($"鎵樼洏{dto.TrayNumber}涓嶅睘浜庡綋鍓峽(dto.YinYang == 1 ? "闃存瀬" : "闃虫瀬")}");
+ // 妫�鏌ュ簱瀛樻槸鍚︽湁鏄庣粏锛堝嵆鏄惁鐪熺殑鏈夊簱瀛橈級
+ if (stockInfo.Details == null || !stockInfo.Details.Any())
+ return response.Error($"鎵樼洏{dto.TrayNumber}娌℃湁搴撳瓨鏄庣粏锛屾棤娉曞嚭搴�");
+ // 妫�鏌ュ簱瀛樻�绘暟閲忔槸鍚﹀ぇ浜�0
+ var totalQuantity = stockInfo.Details.Sum(d => d.StockQuantity);
+ if (totalQuantity <= 0)
+ return response.Error($"鎵樼洏{dto.TrayNumber}搴撳瓨鏁伴噺涓嶈冻锛屾棤娉曞嚭搴�");
+
+ // 鏍规嵁dto鍙傛暟杩涗竴姝ラ獙璇佸簱瀛樹俊鎭�
+ if (!string.IsNullOrEmpty(dto.ProductNo))
+ {
+ // 妫�鏌ュ簱瀛樻槑缁嗕腑鏄惁鍖呭惈鎸囧畾鐨勭墿鏂欑紪鐮�
+ var hasMatchingMaterial = stockInfo.Details.Any(d => d.MaterielCode == dto.ProductNo);
+ if (!hasMatchingMaterial)
+ return response.Error($"鎵樼洏{dto.TrayNumber}涓病鏈夌墿鏂欑紪鐮佷负{dto.ProductNo}鐨勫簱瀛橈紝鏃犳硶鍑哄簱");
+ }
+
+ // 妫�鏌ュ簱瀛樼姸鎬佹槸鍚﹀厑璁稿嚭搴�
if (stockInfo.StockStatus != (int)StockStatusEmun.鍏ュ簱瀹屾垚)
return response.Error($"鎵樼洏{dto.TrayNumber}姝e湪绉诲姩涓紝璇风◢鍚庯紒");
+ // 妫�鏌ヨ揣浣嶄俊鎭�
var locationInfo = await _locationInfoService.GetLocationInfo(stockInfo.LocationCode);
if (locationInfo == null)
return response.Error($"鏈壘鍒版墭鐩榹stockInfo.LocationCode}鐨勮揣浣嶄俊鎭�");
+ // 妫�鏌ヨ揣浣嶇姸鎬佹槸鍚﹀厑璁稿嚭搴�
if (locationInfo.LocationStatus != (int)LocationStatusEnum.InStock)
return response.Error($"褰撳墠璐т綅{locationInfo.LocationStatus}鐘舵�佷俊鎭敊璇�");
+
+ // 楠岃瘉浠撳簱ID鏄惁鍖归厤锛堟牴鎹甦to鐨勯槾闃虫瀬鍙傛暟锛�
+ var expectedWarehouseId = dto.YinYang == 1 ? (int)WarehouseEnum.FJ1 : (int)WarehouseEnum.ZJ1;
+ if (stockInfo.WarehouseId != expectedWarehouseId)
+ return response.Error($"鎵樼洏{dto.TrayNumber}涓嶅湪棰勬湡鐨勪粨搴撲腑锛屾棤娉曞嚭搴�");
task.TaskType = (int)TaskOutboundTypeEnum.Outbound;
task.TaskStatus = (int)TaskOutStatusEnum.OutNew;
@@ -454,7 +538,8 @@
task.TaskStatus = (int)TaskOutStatusEnum.OutFinish;
_unitOfWorkManage.BeginTran();
- var deleteStockResult = _stockInfoService.DeleteData(stockInfo);
+ //var deleteStockResult = _stockInfoService.DeleteData(stockInfo)
+ var deleteStockResult = await _stockInfoService.DeleteStockWithDetailsAsync(stockInfo.Id);
var updateLocationResult = _locationInfoService.UpdateData(locationInfo);
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
if (!deleteStockResult.Status || !updateLocationResult.Status)
@@ -499,23 +584,23 @@
if (existingStock != null)
return response.Error($"鎵樼洏{task.PalletCode}鐨勫簱瀛樹俊鎭凡瀛樺湪锛岃鍕块噸澶嶅叆搴�");
- Dt_StockInfo stockInfo = new Dt_StockInfo
- {
- PalletCode = task.PalletCode,
- StockStatus = (int)StockStatusEmun.鍏ュ簱纭,
- LocationCode = locationInfo.LocationCode,
- WarehouseId = task.WarehouseId,
- Creater = "AGV",
- CreateDate = DateTime.Now
- };
+ //Dt_StockInfo stockInfo = new Dt_StockInfo
+ //{
+ // PalletCode = task.PalletCode,
+ // StockStatus = (int)StockStatusEmun.鍏ュ簱纭,
+ // LocationCode = locationInfo.LocationCode,
+ // WarehouseId = task.WarehouseId,
+ // Creater = "AGV",
+ // CreateDate = DateTime.Now
+ //};
locationInfo.LocationStatus = (int)LocationStatusEnum.FreeLock;
_unitOfWorkManage.BeginTran();
var updateTaskResult = BaseDal.UpdateData(task);
var updateLocationResult = _locationInfoService.UpdateData(locationInfo);
- var addStockResult = _stockInfoService.AddData(stockInfo);
- if (!updateTaskResult || !updateLocationResult.Status || !addStockResult.Status)
+ //var addStockResult = _stockInfoService.AddData(stockInfo);
+ if (!updateTaskResult || !updateLocationResult.Status /*|| !addStockResult.Status*/)
{
_unitOfWorkManage.RollbackTran();
return response.Error("鍏ュ簱瀹屾垚鍚庯紝鏈湴浠诲姟銆佸簱瀛樻垨璐т綅鏇存柊澶辫触");
@@ -526,15 +611,35 @@
}
// AGV鍏ュ簱鍙栨秷
- private AGVResponse CancelAgvInboundTask(Dt_Task task)
+ private async Task<AGVResponse> CancelAgvInboundTask(Dt_Task task)
{
AGVResponse response = new AGVResponse();
task.TaskStatus = (int)TaskInStatusEnum.InCancel;
-
+
_unitOfWorkManage.BeginTran();
- BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
- _unitOfWorkManage.CommitTran();
- return response.OK();
+ try
+ {
+ var stockInfo = await _stockInfoService.GetStockInfoAsync(task.PalletCode);
+ if (stockInfo != null)
+ {
+ var deleteResult = await _stockInfoService.DeleteStockWithDetailsAsync(stockInfo.Id);
+ if (!deleteResult.Status)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return response.Error($"鍒犻櫎搴撳瓨澶辫触: {deleteResult.Message}");
+ }
+ }
+
+ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+
+ _unitOfWorkManage.CommitTran();
+ return response.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return response.Error($"鍙栨秷鍏ュ簱浠诲姟鏃跺彂鐢熷紓甯�: {ex.Message}");
+ }
}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Dashboard/DashboardController.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Dashboard/DashboardController.cs
index 0d6498d..cd8bcce 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Dashboard/DashboardController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Dashboard/DashboardController.cs
@@ -1,3 +1,4 @@
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using WIDESEA_Core;
@@ -22,7 +23,7 @@
/// <summary>
/// 鎬昏鏁版嵁
/// </summary>
- [HttpGet("Overview")]
+ [HttpGet("Overview"), AllowAnonymous]
public async Task<WebResponseContent> Overview()
{
try
@@ -76,7 +77,7 @@
/// SqlSugar 鐨� GroupBy 涓嶆敮鎸佸 .Date 杩欐牱鐨勮绠楀垪鐩存帴鐢熸垚 SQL GROUP BY锛�
/// 鍥犳閲囩敤姝ゆ柟寮忎互纭繚璺ㄦ暟鎹簱鍏煎鎬с��
/// </remarks>
- [HttpGet("DailyStats")]
+ [HttpGet("DailyStats"), AllowAnonymous]
public async Task<WebResponseContent> DailyStats([FromQuery] int days = 30)
{
try
@@ -117,7 +118,7 @@
/// 娉ㄦ剰锛氭暟鎹湪 SQL 灞傝繃婊ゅ悗锛屽湪搴旂敤灞傛寜 ISO 8601 鍛ㄩ敭鍒嗙粍銆�
/// 鍛ㄩ敭涓� "YYYY-Www" 鏍煎紡锛屾棤娉曠洿鎺ュ湪 SQL 灞傜敤 GROUP BY 瀹炵幇銆�
/// </remarks>
- [HttpGet("WeeklyStats")]
+ [HttpGet("WeeklyStats"), AllowAnonymous]
public async Task<WebResponseContent> WeeklyStats([FromQuery] int weeks = 12)
{
try
@@ -168,7 +169,7 @@
/// SqlSugar 鐨� GroupBy 涓嶆敮鎸佸尶鍚嶅璞� (Year, Month) 鐩存帴鏄犲皠鍒� SQL GROUP BY锛�
/// 鍥犳閲囩敤姝ゆ柟寮忎互纭繚璺ㄦ暟鎹簱鍏煎鎬с��
/// </remarks>
- [HttpGet("MonthlyStats")]
+ [HttpGet("MonthlyStats"), AllowAnonymous]
public async Task<WebResponseContent> MonthlyStats([FromQuery] int months = 12)
{
try
@@ -205,7 +206,7 @@
/// <summary>
/// 搴撳瓨搴撻緞鍒嗗竷
/// </summary>
- [HttpGet("StockAgeDistribution")]
+ [HttpGet("StockAgeDistribution"), AllowAnonymous]
public async Task<WebResponseContent> StockAgeDistribution()
{
try
@@ -235,7 +236,7 @@
/// <remarks>
/// 浣跨敤 SQL GROUP BY 鍦ㄦ暟鎹簱灞傞潰鑱氬悎锛岄伩鍏嶅姞杞藉叏閮ㄥ簱瀛樿褰曞埌鍐呭瓨銆�
/// </remarks>
- [HttpGet("StockByWarehouse")]
+ [HttpGet("StockByWarehouse"), AllowAnonymous]
public async Task<WebResponseContent> StockByWarehouse()
{
try
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Record/LocationStatusChangeRecordController.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Record/LocationStatusChangeRecordController.cs
index 8df163d..88febce 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Record/LocationStatusChangeRecordController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Record/LocationStatusChangeRecordController.cs
@@ -17,7 +17,30 @@
{
public LocationStatusChangeRecordController(ILocationStatusChangeRecordService service) : base(service)
{
+ }
+ /// <summary>
+ /// 鏍规嵁ID鑾峰彇璐т綅鐘舵�佸彉鍔ㄨ褰�
+ /// </summary>
+ /// <param name="id">璐т綅鐘舵�佸彉鍔ㄨ褰旾D</param>
+ /// <returns>璐т綅鐘舵�佸彉鍔ㄨ褰曚俊鎭�</returns>
+ [HttpPost("GetLocationState"), AllowAnonymous]
+ public WebResponseContent GetLocationState(int id)
+ {
+ try
+ {
+ if (id <= 0)
+ return WebResponseContent.Instance.Error("ID鍙傛暟鏃犳晥");
+
+ var records = Service.Repository.QueryData(x => x.LocationId == id);
+ if (records == null || records.Count == 0)
+ return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑璐т綅鐘舵�佸彉鍔ㄨ褰�");
+
+ return WebResponseContent.Instance.OK(null, records);
+ }
+ catch (Exception ex)
+ {
+ return WebResponseContent.Instance.Error($"鑾峰彇璐т綅鐘舵�佸彉鍔ㄨ褰曞け璐�: {ex.Message}");
+ }
}
-
}
}
diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\346\236\201\345\215\267\345\272\223AGV\346\216\245\345\217\243/~$\346\236\201\345\215\267\345\272\223\345\207\272\345\205\245\345\272\223.docx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\346\236\201\345\215\267\345\272\223AGV\346\216\245\345\217\243/~$\346\236\201\345\215\267\345\272\223\345\207\272\345\205\245\345\272\223.docx"
deleted file mode 100644
index 59f5e8e..0000000
--- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\346\236\201\345\215\267\345\272\223AGV\346\216\245\345\217\243/~$\346\236\201\345\215\267\345\272\223\345\207\272\345\205\245\345\272\223.docx"
+++ /dev/null
Binary files differ
--
Gitblit v1.9.3