From 24490a8b8f992ad0d3c531c08455842ff8aef93c Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 23 五月 2024 15:27:00 +0800
Subject: [PATCH] 优化任务下发逻辑
---
代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs | 34 ++++++++++++++++++++++++++++------
1 files changed, 28 insertions(+), 6 deletions(-)
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