From 14f174a37b0368167610119ee1b8ce7b610b5a9d Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 11 五月 2024 18:27:23 +0800
Subject: [PATCH] 优化人工出库逻辑
---
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs | 16 +------
代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail.cs | 17 ++++++++
代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail_hty.cs | 9 ++++
代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs | 31 +++++++++++++--
代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs | 8 ++++
代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs | 34 ++++++++++++++---
6 files changed, 89 insertions(+), 26 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs"
index 2b3a160..3220d46 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs"
@@ -47,20 +47,10 @@
#region
dt_stationinfo stationinfo = null;
- if (Station.area == "1")
- {
- //鏌ユ壘褰撳墠璐т綅鍚屽垪鏄惁瀛樺湪鍏ュ簱浠诲姟
- if (stationinfoRepository.Find(x => x.column == Station.column && x.area == "1" && x.location_state == LocationStateEnum.InBusy.ToString()).Any()) continue;
+ //鏌ユ壘褰撳墠璐т綅鍚岃鏄惁瀛樺湪鍏ュ簱浠诲姟
+ if (stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.location_state == LocationStateEnum.InBusy.ToString()).Any()) continue;
- stationinfo = stationinfoRepository.Find(x => x.column == Station.column && x.enable && x.area == "1" && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.line).FirstOrDefault();
- }
- else
- {
- //鏌ユ壘褰撳墠璐т綅鍚屽垪鏄惁瀛樺湪鍏ュ簱浠诲姟
- if (stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.location_state == LocationStateEnum.InBusy.ToString()).Any()) continue;
-
- stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
- }
+ stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
if (stationinfo != null)
{
if (stationinfoRepository.Find(x => x.line == stationinfo.line && x.area == stationinfo.area && x.column > stationinfo.column && !x.enable).Any())
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail.cs"
index 846d7c3..e5fe082 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail.cs"
@@ -77,7 +77,22 @@
[Editable(true)]
public string heatBatchID { get; set; }
-
+ /// <summary>
+ ///瀹屾垚鏃堕棿
+ /// </summary>
+ [Display(Name = "瀹屾垚鏃堕棿")]
+ [Column(TypeName = "datetime")]
+ [Editable(true)]
+ public DateTime? FinishTime { get; set; }
+
+ /// <summary>
+ ///宸ュ崟鐘舵��
+ /// </summary>
+ [Display(Name = "宸ュ崟鐘舵��")]
+ [MaxLength(20)]
+ [Column(TypeName = "nvarchar(20)")]
+ [Editable(true)]
+ public string Status { get; set; }
}
}
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail_hty.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail_hty.cs"
index 3e2288e..73fe824 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail_hty.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_detail_hty.cs"
@@ -105,6 +105,13 @@
[Editable(true)]
public string compeletor { get; set; }
-
+ /// <summary>
+ ///宸ュ崟鐘舵��
+ /// </summary>
+ [Display(Name = "宸ュ崟鐘舵��")]
+ [MaxLength(20)]
+ [Column(TypeName = "nvarchar(20)")]
+ [Editable(true)]
+ public string Status { get; set; }
}
}
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs"
index 9731b2a..c58bcb0 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs"
@@ -179,6 +179,14 @@
public DateTime CreateTime { get; set; }
/// <summary>
+ ///瀹屾垚鏃堕棿
+ /// </summary>
+ [Display(Name = "瀹屾垚鏃堕棿")]
+ [Column(TypeName = "datetime")]
+ [Editable(true)]
+ public DateTime? FinishTime { get; set; }
+
+ /// <summary>
///鍒涘缓鑰�
/// </summary>
[Display(Name = "鍒涘缓鑰�")]
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs"
index ec2d131..64201bf 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs"
@@ -36,6 +36,7 @@
using WIDESEA_Comm.MES_Info;
using System.Reflection;
using static System.Collections.Specialized.BitVector32;
+using WIDESEA_Comm;
namespace WIDESEA_WMS.Services
{
@@ -246,7 +247,7 @@
detail detail = new detail();
detail.sn = inventory.SN;
lists.Add(detail);
- str = str == "" ? inventory.SN : "," + inventory.SN;
+ str += str == "" ? inventory.SN : "," + inventory.SN;
}
agvInWarehousePara outWarehousePara = new agvInWarehousePara()
{
@@ -271,11 +272,31 @@
foreach (var inventory in inventorys)
{
var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();
- var bindSNS = station.bindSN.Split(",");
- station.bindSN = ToMesServer.OperStr(bindSNS, inventory.SN);
- var billetS = station.billetID.Split(",");
- station.billetID = ToMesServer.OperStr(billetS, inventory.BilletNumber.ToString());
station.quantity = station.quantity - 1;
+ if (station.quantity == 0)
+ {
+ station.stationType = string.Empty;
+ station.heatNumber = string.Empty;
+ station.Number = string.Empty;
+ station.billetID = string.Empty;
+ station.bindSN = string.Empty;
+ station.enable = false;
+ station.tray_status = string.Empty;
+ station.location_state = LocationStateEnum.Empty.ToString();
+ }
+ else
+ {
+ var bindSNS = station.bindSN.Split(",");
+ station.bindSN = ToMesServer.OperStr(bindSNS, inventory.SN);
+ var billetS = station.billetID.Split(",");
+ station.billetID = ToMesServer.OperStr(billetS, inventory.BilletNumber.ToString());
+ }
+
+ #region 鍙栨秷璺熻釜DbContext涓璺熻釜鐨勫疄浣�
+ var currentEntry = stationinfoRepository.DbContext.ChangeTracker.Entries<dt_stationinfo>().FirstOrDefault();
+ if (currentEntry != null) currentEntry.State = EntityState.Detached;
+ #endregion
+
stationinfoRepository.Update(station, true);
_repository.Delete(inventory, true);
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
index 61acc33..332d8f8 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing Microsoft.EntityFrameworkCore;
+using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
@@ -47,6 +48,7 @@
list.Add(SN);
}
var inventoryList = inventoryRepository.Find(x => list.Contains(x.SN)).ToList();
+
foreach (var inventorys in inventoryList.GroupBy(x => x.stationCode))
{
try
@@ -57,7 +59,7 @@
detail detail = new detail();
detail.sn = inventory.SN;
lists.Add(detail);
- str = str == "" ? inventory.SN : "," + inventory.SN;
+ str += str == "" ? inventory.SN : "," + inventory.SN;
}
agvInWarehousePara outWarehousePara = new agvInWarehousePara()
{
@@ -82,11 +84,31 @@
foreach (var inventory in inventorys)
{
var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();
- var bindSNS = station.bindSN.Split(",");
- station.bindSN = OperStr(bindSNS, inventory.SN);
- var billetS = station.billetID.Split(",");
- station.billetID = OperStr(billetS, inventory.BilletNumber.ToString());
station.quantity = station.quantity - 1;
+ if (station.quantity == 0)
+ {
+ station.stationType = string.Empty;
+ station.heatNumber = string.Empty;
+ station.Number = string.Empty;
+ station.billetID = string.Empty;
+ station.bindSN = string.Empty;
+ station.enable = false;
+ station.tray_status = string.Empty;
+ station.location_state = LocationStateEnum.Empty.ToString();
+ }
+ else
+ {
+ var bindSNS = station.bindSN.Split(",");
+ station.bindSN = OperStr(bindSNS, inventory.SN);
+ var billetS = station.billetID.Split(",");
+ station.billetID = OperStr(billetS, inventory.BilletNumber.ToString());
+ }
+
+ #region 鍙栨秷璺熻釜DbContext涓璺熻釜鐨勫疄浣�
+ var currentEntry = stationinfoRepository.DbContext.ChangeTracker.Entries<dt_stationinfo>().FirstOrDefault();
+ if (currentEntry != null) currentEntry.State = EntityState.Detached;
+ #endregion
+
stationinfoRepository.Update(station, true);
inventoryRepository.Delete(inventory, true);
}
--
Gitblit v1.9.3