From fc9cba5f058089887aa7061d2e6b4006b9e04a9a Mon Sep 17 00:00:00 2001
From: 陈勇 <竞男@ASUNA>
Date: 星期二, 10 三月 2026 09:46:43 +0800
Subject: [PATCH] 同步
---
项目代码/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 94 ++++++++++++++++++++++++-----------------------
1 files changed, 48 insertions(+), 46 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs"
index 15a0dbd..c1dc994 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs"
@@ -31,10 +31,6 @@
WebResponseContent content = new WebResponseContent();
try
{
- //string palletCode = saveModel.MainData["palletCode"].ToString();
- //string station = saveModel.MainData["station"].ToString();
-
- // 璋冪敤BaseDal.QueryFirstAsync鏂规硶锛屾煡璇换鍔�
var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
if (task != null)
{
@@ -46,23 +42,29 @@
{
throw new Exception($"绔欏彴{input.Position}涓嶅瓨鍦�");
}
-
+
+ var carBody = _carBodyRepository.QueryFirst(x => x.PalletCode == input.PalletCode);
+ if (carBody == null) throw new Exception($"杞﹁韩{input.PalletCode}淇℃伅涓嶅瓨鍦�");
+
+ //BDCManager bDCManager = new BDCManager(_bdcConfigurationService, _locationRepository, _roadWayInfoRepository);
+
+ //await bDCManager.AddToBDC(carBody);
+
// 鑾峰彇搴撲綅
- var location = RequestLocation(stationInfo.Roadway);
+ var location = RequestLocation(stationInfo.RoadwayNo, carBody.CarType);
if (location == null)
{
return content.Error("鏃犳硶鑾峰彇璐т綅淇℃伅鎴栧簱浣嶅凡婊�");
}
-
+
var newtask = new Dt_Task
{
CurrentAddress = input.Position,
Grade = 1,
Roadway = stationInfo.Roadway,
TargetAddress = location.LocationCode,
- Dispatchertime = DateTime.Now,
-
- NextAddress = stationInfo.Roadway,
+ //Dispatchertime = DateTime.Now,
+ NextAddress = input.Position,
OrderNo = null,
PalletCode = input.PalletCode,
SourceAddress = stationInfo.stationLocation,
@@ -70,10 +72,10 @@
TaskType = (int)TaskInboundTypeEnum.Inbound,
TaskNum = await BaseDal.GetTaskNo(),
Creater = "Systeam",
-
+ PVI = input.PVI,
+
};
-
_unitOfWorkManage.BeginTran();
BaseDal.AddData(newtask);
@@ -81,7 +83,7 @@
_locationRepository.UpdateData(location);
_unitOfWorkManage.CommitTran();
- content.OK("鐢宠鍏ュ簱鎴愬姛",data: newtask);
+ content.OK("鐢宠鍏ュ簱鎴愬姛", data: newtask);
}
catch (Exception er)
{
@@ -96,24 +98,36 @@
#endregion 璇锋眰浠诲姟鍏ュ簱
#region 搴撲綅鍒嗛厤
+
#region 鑾峰彇璐т綅
object objLOCK = new object();
/// <summary>
- /// 鍙屽崌搴撲綅鍒嗛厤
+ /// 搴撲綅鍒嗛厤
/// </summary>
/// <param name="requestTask"></param>
/// <param name="locationInfos"></param>
/// <returns></returns>
- public DtLocationInfo RequestLocation(string roadwayNo)
+ public DtLocationInfo RequestLocation(string roadwayNo, int carType)
{
lock (objLOCK)
{
try
{
List<DtLocationInfo> locations = new List<DtLocationInfo>();
- locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1); //&& x.LocationType == 1
+ if (carType == 1)
+ {
+ locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1 && (x.LocationType == 1 || x.LocationType == 3)); //&& x.LocationType == 1
+ }
+ else if (carType == 2)
+ {
+ locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1 && (x.LocationType == 2 || x.LocationType == 3)); //&& x.LocationType == 1
+ }
+ else if (carType == 3)
+ {
+ locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1 && x.LocationType == 3); //&& x.LocationType == 1
+ }
- var location = GetEmptyLocation(locations);
+ var location = GetEmptyLocation(locations, carType);
if (location == null)
{
throw new Exception("搴撲綅宸叉弧");
@@ -121,7 +135,7 @@
return location;
}
catch (Exception err)
- {
+ {
Console.WriteLine(err.Message.ToString());
return null;
}
@@ -129,41 +143,29 @@
}
- private DtLocationInfo GetEmptyLocation(List<DtLocationInfo> dtLocationInfos)
+ private DtLocationInfo GetEmptyLocation(List<DtLocationInfo> dtLocationInfos, int carType)
{
- var locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Column).ThenBy(x => x.Row).ThenBy(x => x.Layer).FirstOrDefault(); //.ThenByDescending(x => x.Depth)
+ DtLocationInfo locationinfo = new DtLocationInfo();
+ if (carType == 1 || carType == 3)
+ {
+ locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault();
+ }
+ else if (carType == 2)
+ {
+ locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Layer).ThenByDescending(x => x.Column).ThenBy(x => x.Row).FirstOrDefault();
+ }
+ //else if (carType == 3)
+ //{
+ // locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Column).ThenBy(x => x.Row).ThenBy(x => x.Layer).FirstOrDefault();
+ //}
return locationinfo;
}
+
#endregion 鑾峰彇璐т綅
#endregion 搴撲綅鍒嗛厤
- public WebResponseContent confirmTask(int taskNum)
- {
- WebResponseContent content = new WebResponseContent();
- try
- {
- var taskInfo = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
- if (taskInfo == null) throw new Exception("鏈煡浠诲姟");
-
- if (taskInfo.TaskState != (int)TaskOutStatusEnum.OutFinish) throw new Exception("褰撳墠浠诲姟鏈畬鎴�,绂佹纭");
-
- var taskHty = taskInfo.Adapt<Dt_Task_Hty>();
- taskHty.FinishTime = DateTime.Now;
- taskHty.OperateType = (int)OperateTypeEnum.浜哄伐纭;
-
- BaseDal.DeleteData(taskInfo);
- _task_HtyRepository.AddData(taskHty);
-
- content.OK("纭瀹屾垚");
- }
- catch (Exception ex)
- {
- content.Error($"纭寮傚父:{ex.Message}");
- }
-
- return content;
- }
+ //public WebResponseContent
}
\ No newline at end of file
--
Gitblit v1.9.3