1
huanghongfeng
2025-06-06 f5b8c1ae89286dada20ea433ffac84f4c9e72a29
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
@@ -12,6 +12,7 @@
using MailKit.Search;
using System.Reflection.Metadata;
using static WIDESEA_ITaskInfoService.ITaskService;
using WIDESEA_Common.Log;
namespace WIDESEA_TaskInfoService
{
@@ -239,6 +240,7 @@
                                MaterialType = (int)InventoryMaterialType.空托,
                                Materialweight = 0,
                                Wlstatus = (int)InventoryMaterialStatus.空托,
                                Mgeneratetime = DateTime.Now,
                            };
                            _stockService.StockInfoService.Repository.AddData(dt_Stock);
                        }
@@ -263,19 +265,23 @@
                        {
                            string[] targetCodes = dt_StockInfo.PalletCode.Split("*");
                            Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodes[0]);
                            if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Startingcolumn != 0)
                            if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Terminationcolumn != 0)
                            {
                                newLocation = _basicService.LocationInfoService.GetLocation2(newSourceAddress.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Startingcolumn);
                                newLocation = _basicService.LocationInfoService.GetLocation2(newSourceAddress.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Terminationcolumn);
                                WriteLog.GetLog("库位获取日志,GetLocation").Write($"原材料入库获取库位,传入值,RoadwayNo:{newSourceAddress.RoadwayNo},类型:{Locationtype},区间为:{dt_Inbound.Startingcolumn}与{dt_Inbound.Terminationcolumn}=============获取到的库位为:{newLocation.LocationCode}", $"库位获取日志,GetLocation2");
                            }
                            else
                            {
                                newLocation = _basicService.LocationInfoService.GetLocation(newSourceAddress.RoadwayNo, Locationtype);
                                WriteLog.GetLog("库位获取日志,GetLocation").Write($"原材料入库获取库位,传入值,RoadwayNo:{newSourceAddress.RoadwayNo},类型:{Locationtype},=============获取到的库位为:{newLocation.LocationCode}", $"库位获取日志,GetLocation,成品接口里面");
                            }
                            
                        }
                        else
                        {
                            newLocation = _basicService.LocationInfoService.GetLocation(newSourceAddress.RoadwayNo, Locationtype);
                            WriteLog.GetLog("库位获取日志,GetLocation").Write($"原材料入库获取库位,传入值,RoadwayNo:{newSourceAddress.RoadwayNo},类型:{Locationtype},=============获取到的库位为:{newLocation.LocationCode}", $"库位获取日志,GetLocation");
                        }
                        
@@ -405,6 +411,8 @@
            }
        }
        public static List<int> InventoryCode = new List<int>() { 0,1,2,4,5,6};  //0:待检   1:合格    2:不合格  4:退货   5:返工    6:特采
        /// <summary>
        /// è§£æžåº“å­˜
        /// </summary>
@@ -416,13 +424,20 @@
            {
                string[] targetCodes = generate.PalletCode.Split("*");
                if (targetCodes.Length == 4)
                if (targetCodes.Length == 5)
                {
                    Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodes[0]);
                    if(dt_Inbound != null)
                    bool isContained = InventoryCode.Contains(int.Parse(targetCodes[4]));
                    if(!isContained)
                    {
                        Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == generate.PalletCode);
                        return content = WebResponseContent.Instance.Error($"第五位物料状态编码解析错误:{generate.PalletCode}");
                    }
                    if (dt_Inbound != null)
                    {
                        string PalletCodetarget = string.Join("*", targetCodes.Take(3));
                        Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode.Contains(PalletCodetarget));
                        if (dt_Inbound.OrderType == (int)InventoryMaterialType.原材料)   //0为原材料编码
                        {
                            List<Dt_LocationInfo> locationInfos = _basicService.LocationInfoService.Repository.QueryData(x => x.RoadwayNo == "2" && x.LocationStatus == (int)LocationStatusEnum.Free && x.Depth == 1 && x.EnableStatus == (int)EnableStatusEnum.Normal && x.LocationType == (int)LocationTypeEnum.MaterialsCube);
@@ -438,7 +453,8 @@
                                    CreateDate = DateTime.Now,
                                    MaterialType = (int)InventoryMaterialType.原材料,
                                    Materialweight = decimal.Parse(targetCodes[3]),
                                    Wlstatus = (int)InventoryMaterialStatus.待检,
                                    Wlstatus = int.Parse(targetCodes[4]),
                                    Mgeneratetime=DateTime.Now,
                                };
                                _unitOfWorkManage.BeginTran();
                                _stockService.StockInfoService.Repository.AddData(dt_Stock);
@@ -506,7 +522,8 @@
                                    CreateDate = DateTime.Now,
                                    MaterialType = (int)InventoryMaterialType.成品,
                                    Materialweight = decimal.Parse(targetCodes[3]),
                                    Wlstatus = (int)InventoryMaterialStatus.待检,
                                    Wlstatus = int.Parse(targetCodes[4]),
                                    Mgeneratetime = DateTime.Now,
                                };
                                _unitOfWorkManage.BeginTran();
                                _stockService.StockInfoService.Repository.AddData(dt_Stock);
@@ -560,7 +577,7 @@
            }
            catch (Exception ex)
            {
                return content=WebResponseContent.Instance.Error($"系统巷道入库接口解析错误:错误:{ex.Message}");
                return content=WebResponseContent.Instance.Error($"托盘条码错误,导致系统错误:{ex.Message}");
                throw;
            }
        }