From b7f53ba61fbc1844d7b92ff852762b140d46ab54 Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期一, 23 六月 2025 19:58:16 +0800
Subject: [PATCH] 最新
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 139 ++++++++++++++++++++++++----------------------
1 files changed, 73 insertions(+), 66 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 5f5eb0e..3ca768e 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -22,6 +22,7 @@
using Org.BouncyCastle.Asn1.Tsp;
using SqlSugar;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
@@ -49,6 +50,7 @@
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
using WIDESEA_TaskInfoRepository;
+using static WIDESEA_ITaskInfoService.ITaskService;
namespace WIDESEA_TaskInfoService
{
@@ -79,13 +81,13 @@
_taskHtyService = taskHtyService;
_locationInfoService = locationInfoService;
}
-
+ public string ReceiveWCSTask = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWCSTask"];
/// <summary>
/// 浠诲姟瀹屾垚
/// </summary>
/// <param name="taskNum">浠诲姟鍙�</param>
/// <returns>杩斿洖澶勭悊缁撴灉</returns>
- public WebResponseContent TaskCompleted(int taskNum)
+ public WebResponseContent TaskCompleted(int taskNum,int HowWorks)
{
try
{
@@ -93,6 +95,10 @@
if (task == null)
{
return WebResponseContent.Instance.Error("鏈壘鍒颁换鍔′俊鎭�");
+ }
+ if (HowWorks == 1)
+ {
+ WebResponseContent webResponseContent = HttpHelper.Post<WebResponseContent>(ReceiveWCSTask, task.TaskNum, "浠诲姟鍒犻櫎");
}
MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted");
if (methodInfo != null)
@@ -112,25 +118,48 @@
}
+ /// <summary>
+ /// 鍏ュ簱瀹屾垚
+ /// </summary>
+ /// <param name="task"></param>
+ /// <returns></returns>
public WebResponseContent InboundTaskCompleted(Dt_Task task)
{
decimal beforeQuantity = 0;
+ //鏌ュ簱瀛�
Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);
-
+ //鏌ヨ揣浣�
Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
-
+ Dt_StockInfoDetail dt_StockInfodetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfo.Id);
CheckCompleted(stockInfo, locationInfo);
- stockInfo.LocationCode = locationInfo.LocationCode;
+ if (stockInfo.MaterialType == (int)InventoryMaterialType.绌烘墭)
+ {
+ string currentTime = DateTime.Now.ToString("HHmmss");
+ stockInfo.PalletCode = "KTP" + currentTime;
+ }
+ stockInfo.LocationCode = task.TargetAddress;
stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt();
- _stockService.StockInfoService.Repository.UpdateData(stockInfo);
-
+ _stockService.StockInfoService.Repository.UpdateData(stockInfo);
+
+ if(dt_StockInfodetail != null)
+ {
+ dt_StockInfodetail.Status = StockStatusEmun.宸插叆搴�.ObjToInt();
+ _stockService.StockInfoDetailService.Repository.UpdateData(dt_StockInfodetail);
+ }
beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity);
int beforeStatus = locationInfo.LocationStatus;
- locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
- _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(),false);
+ if (stockInfo.MaterialType == (int)InventoryMaterialType.绌烘墭)
+ {
+ locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt();
+ }
+ else
+ {
+ locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+ }
+ _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
_basicService.LocationInfoService.Repository.UpdateData(locationInfo);
task.TaskStatus = InTaskStatusEnum.InFinish.ObjToInt();
@@ -160,7 +189,7 @@
CheckCompleted(stockInfo, locationInfo);
-
+
_stockService.StockInfoService.Repository.AddData(stockInfo);
int beforeStatus = locationInfo.LocationStatus;
@@ -172,7 +201,7 @@
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
-
+
return WebResponseContent.Instance.OK();
}
@@ -195,10 +224,10 @@
return (false, "鏈壘鍒拌揣浣嶄俊鎭�");
}
- if (isCheckStockDetail && (stockInfo.Details == null || stockInfo.Details.Count == 0))
+ /*if (isCheckStockDetail && (stockInfo.Details == null || stockInfo.Details.Count == 0))
{
return (false, "鏈壘鍒扮粍鐩樻槑缁嗕俊鎭�");
- }
+ }*/
return (true, "鎴愬姛");
}
@@ -212,26 +241,33 @@
CheckCompleted(stockInfo, locationInfo);
- stockInfo.LocationCode = locationInfo.LocationCode;
stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
_stockService.StockInfoService.Repository.UpdateData(stockInfo);
int beforeStatus = locationInfo.LocationStatus;
- if (task.Depth == 1)
+ /*if (task.Depth == 1)
{
- if (DepthTask(task)) { }
+ *//*if (DepthTask(task))
+ {
+ }
else
{
locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
_basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
_basicService.LocationInfoService.Repository.UpdateData(locationInfo);
- }
+ }*//*
+ locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
+ _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
}
else
{
locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
_basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
_basicService.LocationInfoService.Repository.UpdateData(locationInfo);
- }
+ }*/
+ locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
+ _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
@@ -244,7 +280,8 @@
_recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) - beforeQuantity, StockChangeType.Outbound);
- return OnOutboundTaskCompleted?.Invoke(task) ?? WebResponseContent.Instance.OK();
+ //return OnOutboundTaskCompleted?.Invoke(task) ?? WebResponseContent.Instance.OK();
+ return WebResponseContent.Instance.OK();
}
public WebResponseContent PalletOutboundTaskCompleted(Dt_Task task)
@@ -267,41 +304,44 @@
task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
_stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
-
+
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
return WebResponseContent.Instance.OK();
}
- public WebResponseContent RelocationTaskCompleted(Dt_Task task)
+ public WebResponseContent RelocationInTaskCompleted(Dt_Task task)
{
Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);
+ Dt_LocationInfo locationpoint = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
-
- CheckCompleted(stockInfo, locationEnd);
+ List<Dt_LocationInfo> loca = new List<Dt_LocationInfo>();
stockInfo.LocationCode = locationEnd.LocationCode;
stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt();
_stockService.StockInfoService.Repository.UpdateData(stockInfo);
-
- _basicService.LocationInfoService.RelocationFree(locationEnd, task.TaskNum);
- task.TaskStatus = InTaskStatusEnum.RelocationFinish.ObjToInt();
- BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+ locationpoint.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+
+ locationEnd.LocationStatus = locationEnd.LocationStatus == LocationStatusEnum.Lock.ObjToInt() ? LocationStatusEnum.InStock.ObjToInt() : LocationStatusEnum.Pallet.ObjToInt();
+ loca.Add(locationpoint);
+ loca.Add(locationEnd);
+ _basicService.LocationInfoService.Repository.UpdateData(loca);
+ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
return WebResponseContent.Instance.OK();
}
public bool DepthTask(Dt_Task task)
{
- Dt_LocationInfo location=_locationInfoService.Repository.QueryFirst(x=>x.LocationCode == task.SourceAddress);
- if(location != null)
+ Dt_LocationInfo location = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+ if (location != null)
{
- if(location.Row%2==0)
+ if (location.Row % 2 == 0)
{
Dt_LocationInfo locations = _locationInfoService.Repository.QueryFirst(x => x.Row == location.Row + 1 && x.Layer == location.Layer && x.Column == location.Column && x.RoadwayNo == location.RoadwayNo);
- Dt_Task tasks=BaseDal.QueryFirst(x=>x.SourceAddress == locations.LocationCode);
+ Dt_Task tasks = BaseDal.QueryFirst(x => x.SourceAddress == locations.LocationCode);
return tasks != null ? true : false;
}
else
@@ -314,39 +354,6 @@
return false;
}
- /// <summary>
- /// 鍒涘缓浠诲姟
- /// </summary>
- /// <param name="taskInfo"></param>
- /// <returns></returns>
- public Dt_Task CreateTask(Dt_Task tasks)
- {
- try
- {
- if (tasks.TaskType == (int)TaskTypeEnum.Inbound)
- {
- Dt_Task task = new Dt_Task()
- {
- TaskType = (int)TaskTypeEnum.Outbound, //浠诲姟绫诲瀷
- CreateDate = DateTime.Now,
- ModifyDate = DateTime.Now,
- Grade = 1,
- Creater = "鍒涙櫤WMS",// 鍒涘缓浜�
- };
- return task;
- }
- else
- {
- return null;
- }
-
- }
- catch (Exception ex)
- {
- //WriteLog.GetLog("鍒涘缓浠诲姟").Write($"{JsonConvert.SerializeObject(ex.Message)}{Environment.NewLine}", "鍒涘缓浠诲姟");
- throw;
- }
-
- }
- }
+
+ }
}
--
Gitblit v1.9.3