From f40ba2a9fb9d3c2ece08e9a7cd987d4744dccab2 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 17 六月 2025 15:22:05 +0800
Subject: [PATCH] 优化库内移库,堆垛机和穿梭车交互逻辑
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 70 +++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 0 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 892f1db..03b36b5 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -17,6 +17,7 @@
using AutoMapper;
using MailKit.Search;
+using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using SqlSugar;
using System;
@@ -38,6 +39,7 @@
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Stock;
+using WIDESEA_DTO.WCSInfo;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
using WIDESEA_IInboundService;
@@ -249,6 +251,72 @@
return WebResponseContent.Instance.OK();
}
+ public WebResponseContent ModifyBarcode(string barcode, string newBarcode)
+ {
+ WebResponseContent webResponseContent = new WebResponseContent();
+ try
+ {
+ Dt_Task? dt_Task = BaseDal.QueryFirst(x => x.PalletCode == barcode);
+ if (dt_Task == null) throw new Exception($"鏈壘鍒版墭鐩樺彿涓恒�恵barcode}銆戠殑浠诲姟锛�");
+ if (TaskEnumHelper.GetTaskTypeGroup(dt_Task.TaskType) != TaskTypeGroup.InboundGroup)
+ throw new Exception($"鍙彲淇敼鍏ュ簱浠诲姟,濡傞渶淇敼鍏朵粬浠诲姟绫诲瀷璇疯仈绯荤鐞嗗憳锛�");
+ var stock = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == newBarcode);
+ if (stock != null) throw new Exception($"鎵樼洏鍙枫�恵newBarcode}銆戝凡瀛樺湪搴撳瓨淇℃伅锛�");
+ stock = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == barcode);
+ if (stock == null) throw new Exception($"鎵樼洏鍙枫�恵barcode}銆戞湭鎵惧埌搴撳瓨淇℃伅锛�");
+ stock.PalletCode = newBarcode;
+ dt_Task.PalletCode = newBarcode;
+ Db.Ado.BeginTran();
+ WMSTaskDTO wMSTaskDTOs = _mapper.Map<WMSTaskDTO>(dt_Task);
+ var ResultData = HttpHelper.PostAsync(WCSInterfaceAddress.ModifyBarcode, wMSTaskDTOs.ToJson(), headers: new Dictionary<string, string>());
+ if (ResultData.Result == null) throw new Exception($"WCS鍝嶅簲瓒呮椂");
+ WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result);
+ if (content == null) throw new Exception($"WCS鏃犲搷搴�");
+ if (!content.Status) throw new Exception(content.Message);
+ BaseDal.UpdateData(dt_Task);
+ _stockService.StockInfoService.Repository.UpdateData(stock);
+ Db.Ado.CommitTran();
+ webResponseContent.OK();
+ }
+ catch (Exception ex)
+ {
+ Db.Ado.RollbackTran();
+ webResponseContent.Error(ex.Message);
+ }
+ return webResponseContent;
+ }
+ public WebResponseContent CancelTask(WMSTaskDTO WMStask)
+ {
+ WebResponseContent webResponseContent = new WebResponseContent();
+ try
+ {
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == WMStask.TaskNum && x.TaskType == WMStask.TaskType);
+ if (task == null) return WebResponseContent.Instance.Error("鏈壘鍒颁换鍔′俊鎭�");
+ Dt_StockInfo? _StockInfo = _stockService.StockInfoService.GetStockByPalletCode(task.PalletCode);
+ if (_StockInfo != null)
+ {
+ Dt_StockInfoDetail? detail = _StockInfo.Details.FirstOrDefault();
+ if (detail != null)
+ {
+ Dt_InboundOrder dt_InboundOrder = _inboundService.InbounOrderService.GetInboundOrder(detail.OrderNo);
+ Dt_InboundOrderDetail? inboundOrderDetail = dt_InboundOrder.Details.FirstOrDefault(x => x.BatchNo == detail.BatchNo);
+ if (inboundOrderDetail != null)
+ {
+ inboundOrderDetail.ReceiptQuantity--;
+ _inboundService.InboundOrderDetailService.Repository.UpdateData(inboundOrderDetail);
+ }
+ _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(_StockInfo.Details, OperateType.AGV鍒犻櫎);
+ }
+ _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(_StockInfo, OperateType.AGV鍒犻櫎);
+ }
+ BaseDal.DeleteAndMoveIntoHty(task, /*App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 :*/ OperateType.AGV鍒犻櫎);
+ }
+ catch (Exception ex)
+ {
+ webResponseContent.Error(ex.Message);
+ }
+ return webResponseContent;
+ }
/// <summary>
/// 鍚屾浠诲姟鐘舵��
/// </summary>
@@ -333,6 +401,8 @@
if (Sourcelocation != null)
{
/*if (task.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt())*/
+ if (BaseDal.QueryFirst(x => x.SourceAddress == task.SourceAddress && x.TaskState < TaskOutStatusEnum.SC_OutFinish.ObjToInt()) == null)
+ Sourcelocation.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
Sourcelocation.CurrentQty--;
if (Sourcelocation.CurrentQty <= 0)
{
--
Gitblit v1.9.3