From 207071d20e664a1d50863418d852624760f8b6da Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期六, 21 二月 2026 13:13:04 +0800
Subject: [PATCH] 添加wms基础代码
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 52 +++++++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs | 97 +++++++++++++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs | 67 +++++++++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/MapSynchronizationDto.cs | 44 ++++++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 116 +++++++++++++++-
5 files changed, 359 insertions(+), 17 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/MapSynchronizationDto.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/MapSynchronizationDto.cs"
new file mode 100644
index 0000000..91f949d
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/MapSynchronizationDto.cs"
@@ -0,0 +1,44 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_DTO.WMS
+{
+ /// <summary>
+ /// 鍦板浘缂栧彿鍚屾
+ /// </summary>
+ public class MapSynchronizationDto
+ {
+ /// <summary>
+ /// 鐐逛綅
+ /// </summary>
+ public string pointCod { get; set; }
+
+ /// <summary>
+ /// 鐐逛綅绫诲瀷
+ /// </summary>
+ public string pointType { get; set; }
+
+
+ /// <summary>
+ /// 涔夊姟绫诲瀷锛�1 闈㈡枡锛�2 鎴愬搧锛�3瑁佸壀锛�4閰嶅锛�
+ /// </summary>
+ public int buinessType { get; set; }
+ }
+
+ public enum WMStakeType
+ {
+
+ Fabric=1,
+
+ Finishedproduct,
+
+ Cutting,
+
+ Accessories
+
+ }
+
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
index 0f8da62..12a656e 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
@@ -33,6 +33,8 @@
using WIDESEAWCS_DTO.WMS;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.LocationEnum;
+using Microsoft.VisualBasic;
+using System.Web;
namespace WIDESEAWCS_ITaskInfoService
{
@@ -222,5 +224,55 @@
/// <param name="locationStatusEnum"></param>
/// <returns></returns>
WebResponseContent UpdateLocationStatus(string LocationCode, DeviceTypeEnum deviceTypeEnum, LocationStatusEnum locationStatusEnum);
+
+
+ WebResponseContent ModifyWMSLayoutZone(WMSUpdateLocationArea wMSUpdateLocationArea);
+
+ /// <summary>
+ /// 瀹瑰櫒娴佸姩璇锋眰
+ /// </summary>
+ /// <param name="wMSContainerFlow"></param>
+ /// <returns></returns>
+ WebResponseContent ContainerFlow(WMSContainerFlow wMSContainerFlow);
+
+ /// <summary>
+ /// 鍖哄煙搴撲綅淇℃伅鏌ヨ
+ /// </summary>
+ /// <param name="AreaCode">鍖哄煙鍙�</param>
+ /// <returns></returns>
+ WebResponseContent LocationInquiry(string AreaCode);
+
+
+ /// <summary>
+ /// 鍦板浘鍚屾
+ /// </summary>
+ /// <param name="mapSynchronizationDto"></param>
+ /// <returns></returns>
+ public WebResponseContent MapSynchronize(MapSynchronizationDto mapSynchronizationDto);
+
+
+ /// <summary>
+ /// 鍑哄叆搴撳畬鎴�
+ /// </summary>
+ /// <param name=""></param>
+ /// <returns></returns>
+ public WebResponseContent InandoutCompleted(WMSInOutBoundCompleteFeedback wMSInOutBoundCompleteFeedback);
+
+
+ /// <summary>
+ /// 鏂欑楠岃瘉
+ /// </summary>
+ /// <param name="taskCode">浠诲姟鍙�</param>
+ /// <param name="containerCode">瀹瑰櫒缂栫爜</param>
+ /// <returns></returns>
+ public WebResponseContent MaterialBoxInspection(string taskCode ,string containerCode);
+
+
+ /// <summary>
+ /// wcs绉诲簱鏁版嵁鍥炰紶
+ /// </summary>
+ /// <param name="wMSMoveLocationFeedback"></param>
+ /// <returns></returns>
+ public WebResponseContent WcsMovingDataBack(WMSMoveLocationFeedback wMSMoveLocationFeedback);
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs"
index c3d1c8e..284ff52 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs"
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using System.Threading.Tasks;
using WIDESEAWCS_Core;
using WIDESEAWCS_DTO.WMS;
using WIDESEAWCS_ITaskInfoService;
@@ -34,9 +35,26 @@
/// <param name="wMSCancelTask"></param>
/// <returns></returns>
[HttpPost, Route("CancelWMSTask"), AllowAnonymous]
- public WebResponseContent CancelWMSTask([FromBody] WMSCancelTask wMSCancelTask)
+ public object CancelWMSTask([FromBody] WMSCancelTask wMSCancelTask)
{
- return _taskService.CancelWMSTask(wMSCancelTask);
+ WebResponseContent content = _taskService.CancelWMSTask(wMSCancelTask);
+ if (!content.Status)
+ {
+ return new
+ {
+ code = "404",
+ msg = content.Message
+ };
+ }
+ else
+ {
+ return new
+ {
+ code = "0",
+ msg = content.Message,
+ data = content.Data
+ };
+ }
}
/// <summary>
@@ -45,10 +63,81 @@
/// <param name="updateTaskPriority"></param>
/// <returns></returns>
[HttpPost, Route("UpdateWMSTaskPriority"), AllowAnonymous]
- public WebResponseContent UpdateWMSTaskPriority([FromBody] WMSUpdateTaskPriority updateTaskPriority)
+ public object UpdateWMSTaskPriority([FromBody] WMSUpdateTaskPriority updateTaskPriority)
{
- return _taskService.UpdateWMSTaskPriority(updateTaskPriority);
+ WebResponseContent content = _taskService.UpdateWMSTaskPriority(updateTaskPriority);
+ if (!content.Status)
+ {
+ return new
+ {
+ code = "404",
+ msg = content.Message
+ };
+ }
+ else
+ {
+ return new
+ {
+ code = "0",
+ msg = content.Message,
+ data = content.Data
+ };
+ }
}
+ /// <summary>
+ /// 淇敼搴撲綅鍒嗗尯
+ /// </summary>
+ /// <param name="WMSUpdateLocationArea"></param>
+ /// <returns></returns>
+ [HttpPost, Route("ModifyWMSLayoutZone"), AllowAnonymous]
+ public object ModifyWMSLayoutZone([FromBody] WMSUpdateLocationArea wMSUpdateLocationArea)
+ {
+ WebResponseContent content = _taskService.ModifyWMSLayoutZone(wMSUpdateLocationArea);
+ if (!content.Status)
+ {
+ return new
+ {
+ code = "404",
+ msg = content.Message
+ };
+ }
+ else
+ {
+ return new
+ {
+ code = "0",
+ msg = content.Message,
+ data = content.Data
+ };
+ }
+ }
+
+ /// <summary>
+ /// 鍖哄煙搴撲綅淇℃伅鏌ヨ
+ /// </summary>
+ /// <param name="AreaCode">鍖哄煙鍙�</param>
+ /// <returns></returns>
+ public object LocationInquiry(string AreaCode)
+ {
+ WebResponseContent content = _taskService.LocationInquiry(AreaCode);
+ if (!content.Status)
+ {
+ return new
+ {
+ code = "404",
+ msg = content.Message
+ };
+ }
+ else
+ {
+ return new
+ {
+ code = "0",
+ msg = content.Message,
+ data = content.Data
+ };
+ }
+ }
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
index 6b91064..b5a59b2 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
@@ -158,15 +158,37 @@
{
try
{
+ int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt();//杩欓噷鎴戜笉鐭ラ亾鏄粈涔堢被鍨�
+ //鑾峰彇璐т綅淇℃伅
+ Dt_HKLocationInfo? kLSLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.WarehouseId.ToString() == taskDTO.toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == containerType);
+ if (kLSLocationInfo == null) throw new Exception($"鏈壘鍒扮粓鐐瑰簱鍖恒�恵taskDTO.toAreaCode}銆戝彲鐢ㄧ┖璐т綅锛�");
+ Dt_Task dt_Task = new Dt_Task()
+ {
+ TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ WMSTaskNum = taskDTO.taskCode,
+ WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ Grade = taskDTO.taskPriority,
+ PalletCode = taskDTO.containerCode,
+ Roadway = kLSLocationInfo.RoadwayNo,
+ TaskState = TaskStatusEnum.New.ObjToInt(),
+ TaskType = taskType,
+ SourceAddress = taskDTO.fromLocationCode,
+ CurrentAddress = taskDTO.fromLocationCode,
+ NextAddress = kLSLocationInfo.LocationCode,
+ TargetAddress = kLSLocationInfo.LocationCode,
+ Creater = "WMS",
+ };
+ kLSLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt();
Db.Ado.BeginTran();
-
+ BaseDal.AddData(dt_Task);
+ _hKLocationInfoService.Repository.UpdateData(kLSLocationInfo);
Db.Ado.CommitTran();
return WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
Db.Ado.RollbackTran();
- return WebResponseContent.Instance.Error(ex.Message);
+ throw new Exception(ex.Message);
}
}
/// <summary>
@@ -179,17 +201,54 @@
{
try
{
+ Dt_HKLocationInfo? hKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode);
+ if (hKLocationInfo == null) throw new Exception($"鏈壘鍒拌捣鐐瑰簱浣嶃�恵taskDTO.fromLocationCode}銆戯紒");
+ if (hKLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鍙嚭搴擄紒");
+ Dt_Task dt_Task = new Dt_Task()
+ {
+ TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ WMSTaskNum = taskDTO.taskCode,
+ WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ Grade = taskDTO.taskPriority,
+ PalletCode = taskDTO.containerCode,
+ Roadway = hKLocationInfo.RoadwayNo,
+ TaskState = TaskStatusEnum.New.ObjToInt(),
+ TaskType = taskType,
+ SourceAddress = taskDTO.fromLocationCode,
+ CurrentAddress = taskDTO.fromLocationCode,
+ NextAddress = taskDTO.toLocationCode,
+ TargetAddress = taskDTO.toLocationCode,
+ Creater = "WMS",
+ };
+ hKLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt();
Db.Ado.BeginTran();
-
+ BaseDal.AddData(dt_Task);
+ _hKLocationInfoService.Repository.UpdateData(hKLocationInfo);
Db.Ado.CommitTran();
return WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
Db.Ado.RollbackTran();
- return WebResponseContent.Instance.Error(ex.Message);
+ throw new Exception(ex.Message);
}
}
#endregion
+
+
+ #region 5 璺ㄦゼ灞傝繍杈撲换鍔″垱寤�
+ public WebResponseContent CarryTask(TaskDTO taskDTO, int taskType)
+ {
+ return WebResponseContent.Instance.OK();
+ }
+ #endregion
+
+
+ #region 6 瑁佸壀閫佽揣
+ public WebResponseContent CJCarryTaske(TaskDTO taskDTO, int taskType)
+ {
+ return WebResponseContent.Instance.OK();
+ }
+ #endregion
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 1179514..abb3c4b 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -19,6 +19,7 @@
using SqlSugar;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
+using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
@@ -107,6 +108,12 @@
case (int)TaskTypeEnum.CJOutbound:
CreateHKNewOutTask(task, item.taskType);
break;
+ case (int)TaskTypeEnum.Carry:
+ CarryTask(task, item.taskType);
+ break;
+ case (int)TaskTypeEnum.CJCarry:
+ CJCarryTaske(task, item.taskType);
+ break;
default:
break;
}
@@ -133,12 +140,9 @@
{
Dt_Task dt_Task = BaseDal.QueryFirst(x => x.WMSTaskNum == wMSCancelTask.TaskCode);
if (dt_Task == null) throw new Exception("鏈煡璇㈠埌浠诲姟鍙风浉鍏充换鍔�");
- if (dt_Task.TaskType == TaskTypeEnum.MLInbound.ObjToInt() || dt_Task.TaskType == TaskTypeEnum.CPInbound.ObjToInt() || dt_Task.TaskType == TaskTypeEnum.CJInbound.ObjToInt())
- dt_Task.TaskType = TaskInStatusEnum.InCancel.ObjToInt();
- else if (dt_Task.TaskType == TaskTypeEnum.MLOutbound.ObjToInt() || dt_Task.TaskType == TaskTypeEnum.CPOutbound.ObjToInt() || dt_Task.TaskType == TaskTypeEnum.CJOutbound.ObjToInt())
- dt_Task.TaskType = TaskOutStatusEnum.OutCancel.ObjToInt();
+ dt_Task.TaskType = TaskOutStatusEnum.OutCancel.ObjToInt();
BaseDal.UpdateData(dt_Task);
- content.OK();
+ content.OK("鍙栨秷浠诲姟鎴愬姛",dt_Task);
}
catch (Exception ex)
{
@@ -162,7 +166,7 @@
if (dt_Task == null) throw new Exception("鏈煡璇㈠埌浠诲姟鍙风浉鍏充换鍔�");
dt_Task.Grade = updateTaskPriority.taskPriority;
BaseDal.UpdateData(dt_Task);
- content.OK();
+ content.OK("淇敼浠诲姟浼樺厛绾ф垚鍔�", dt_Task);
}
catch (Exception ex)
{
@@ -175,21 +179,45 @@
/// 淇敼搴撲綅鍒嗗尯
/// </summary>
/// <returns></returns>
+ ///
+
public WebResponseContent ModifyWMSLayoutZone(WMSUpdateLocationArea wMSUpdateLocationArea)
{
WebResponseContent content = new WebResponseContent();
try
{
+ var rgv = new List<Dt_RGVLocationInfo>();
+ var kls=new List<Dt_KLSLocationInfo>();
+ var hk=new List<Dt_HKLocationInfo>();
if(wMSUpdateLocationArea.WarehouseId == 1)
{
foreach (var LocationCode in wMSUpdateLocationArea.LocationCodes)
{
Dt_RGVLocationInfo dt_RGVLocationInfo = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
- UpdateLocationCode(dt_RGVLocationInfo,wMSUpdateLocationArea.UpdateAreaCode);
-
+ rgv.Add(dt_RGVLocationInfo);
}
}
-
+ if (wMSUpdateLocationArea.WarehouseId == 2)
+ {
+ foreach (var LocationCode in wMSUpdateLocationArea.LocationCodes)
+ {
+ Dt_KLSLocationInfo dt_KLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+ kls.Add(dt_KLSLocationInfo);
+ }
+ }
+ if (wMSUpdateLocationArea.WarehouseId == 3)
+ {
+ foreach (var LocationCode in wMSUpdateLocationArea.LocationCodes)
+ {
+ Dt_HKLocationInfo dt_HKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+ hk.Add(dt_HKLocationInfo);
+ }
+ }
+ Db.Ado.BeginTran();
+ _rGVLocationInfoService.UpdateData(rgv);
+ _kLSLocationInfoService.UpdateData(kls);
+ _hKLocationInfoService.UpdateData(hk);
+ Db.Ado.CommitTran();
content.OK();
}
catch (Exception ex)
@@ -742,5 +770,75 @@
return Db.Ado.GetScalar($"SELECT NEXT VALUE FOR {sequenceName}").ObjToInt();
}
}
+
+ /// <summary>
+ /// 瀹瑰櫒娴佸姩璇锋眰
+ /// </summary>
+ /// <param name="wMSContainerFlow"></param>
+ /// <returns></returns>
+ /// <exception cref="NotImplementedException"></exception>
+ public WebResponseContent ContainerFlow(WMSContainerFlow wMSContainerFlow)
+ {
+ return WebResponseContent.Instance.Error("璇ユ帴鍙f殏鏈疄鐜�");
+ }
+
+
+ /// <summary>
+ /// 鍖哄煙搴撲綅淇℃伅鏌ヨ
+ /// </summary>
+ /// <param name="AreaCode"></param>
+ /// <returns></returns>
+ /// <exception cref="NotImplementedException">鍖哄煙鍙�</exception>
+ public WebResponseContent LocationInquiry(string AreaCode)
+ {
+ if (AreaCode == null)
+ {
+ //鏌ヨ杈撻�佺嚎绌烘墭缂撳瓨淇℃伅鏃惰繑鍥炵┖浣嶆暟閲�
+ }
+ return WebResponseContent.Instance.OK();
+
+ }
+
+
+ /// <summary>
+ /// 鍦板浘鍚屾
+ /// </summary>
+ /// <param name="mapSynchronizationDto"></param>
+ /// <returns></returns>
+ public WebResponseContent MapSynchronize(MapSynchronizationDto mapSynchronizationDto)
+ {
+ return WebResponseContent.Instance;
+ }
+
+ /// <summary>
+ /// 鍑哄叆搴撳畬鎴�
+ /// </summary>
+ /// <param name=""></param>
+ /// <returns></returns>
+ /// <exception cref="NotImplementedException"></exception>
+ public WebResponseContent InandoutCompleted(WMSInOutBoundCompleteFeedback wMSInOutBoundCompleteFeedback)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// 鏂欑楠岃瘉
+ /// </summary>
+ /// <param name="taskCode">浠诲姟鍙�</param>
+ /// <param name="containerCode">瀹瑰櫒缂栫爜</param>
+ /// <returns></returns>
+ public WebResponseContent MaterialBoxInspection(string taskCode, string containerCode)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// wcs绉诲簱鏁版嵁鍥炰紶
+ /// </summary>
+ /// <param name="wMSMoveLocationFeedback"></param>
+ public WebResponseContent WcsMovingDataBack(WMSMoveLocationFeedback wMSMoveLocationFeedback)
+ {
+ throw new NotImplementedException();
+ }
}
}
--
Gitblit v1.9.3