分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-05-11 14f174a37b0368167610119ee1b8ce7b610b5a9d
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using 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);
                            }