lss
2025-05-27 59f836bf0eb00b7707c74fe8edb8fa7662c871ab
HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs
@@ -80,7 +80,7 @@
                //    AddErrorInfo("寻找出库区失败", result.msg);
                //    return result;
                //}
                int n_type = 0;  //任务来源 1.密炼立库  3.预备库 ,4.原材料库
                string Source = "";
                switch (taskData.source)
@@ -267,7 +267,9 @@
                                N_START_LAYER = 1,
                                N_END_LAYER = 1,
                                S_WMS_NO = taskData.wmsTaskNo,
                                Z_TYPE = n_type
                                Z_TYPE = n_type,
                            };
                            LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask");
                            if (WCSHelper.CreateTask(wcsTask))
@@ -302,7 +304,8 @@
                                N_START_LAYER = 1,
                                N_END_LAYER = 1,
                                S_WMS_NO = taskData.wmsTaskNo,
                                Z_TYPE = n_type
                                Z_TYPE = n_type,
                                S_MES_NO = taskData.mesTaskNo
                            };
                            var wcsTask1 = new WCSTask
                            {
@@ -322,8 +325,8 @@
                                S_WMS_NO = taskData.wmsTaskNo,
                                N_START_LAYER = 1,
                                N_END_LAYER = 1,
                                Z_TYPE = n_type
                                Z_TYPE = n_type,
                                S_MES_NO = taskData.mesTaskNo
                            };
@@ -537,7 +540,8 @@
                            N_START_LAYER = 1,
                            N_END_LAYER = 1,
                            S_WMS_NO = taskData.wmsTaskNo,
                            S_NOTE = note
                            S_NOTE = note,
                            S_MES_NO = taskData.mesTaskNo
                        };
                        LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask");
@@ -683,7 +687,7 @@
            try
            {
                //创建托盘数据绑定关系
                if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight, model.Qty))
                if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight, model.Qty, model.ProductionTime, model.MaturityTime))
                {
                    //创建成功流程
                }
@@ -791,23 +795,26 @@
                if (startloc != null)
                {
                    //根据仓库 计算库区
                    if (startloc.S_WH_CODE == "101")
                    var whcode = Settings.wareLoc.Where(a => a.AreaCode == startloc.S_WH_CODE).FirstOrDefault();
                    if (whcode != null)
                    {
                        areacode = "PMGQ";
                        areacode = whcode.PMK;
                    }
                    else
                    {
                        areacode = "PK2";
                        result.code = "1";
                        result.msg = $"根据起点仓库编码:{startloc.S_WH_CODE}未找到对应配置文件";
                        LogHelper.Info($"Putin==> {result.msg}");
                        AddErrorInfo("查找库区失败", result.msg, Source);
                    }
                    areacode = "FLPK";
                    //判断有无相同物料排
                    loc = StorageCompute(itemcode, areacode);
                    if (loc == null)
                    {
                        //无相同物料排找空排
                        loc = emptyRow(areacode);
                    }
                    //if (loc == null)
                    //{
                    //    //无相同物料排找空排
                    //    loc = emptyRow(areacode);
                    //}
                    if (loc != null)
                    {
                        End = loc.S_CODE;
@@ -885,7 +892,6 @@
                LogHelper.Error("Putin Error:" + ex.ToString(), ex);
                return result;
            }
        }
        /// <summary>
@@ -926,47 +932,48 @@
                #region 根据物料编码规则 计算出库库区
                //粉料从平库出库,其他物料需要从暂存区出库
                if (model.PartNumber.StartsWith("4X"))
                var locJt = db.Queryable<Location>().Where(a => a.S_AREA_CODE == model.WorkCenter).First();
                if (locJt == null)
                {
                    areacode = "FLPK";
                    cntrType = "PM";
                    result.code = "1";
                    result.msg = $"根据机台编码:{model.WorkCenter}未找到对应货位";
                    LogHelper.Info($"Putin==> {result.msg}");
                    AddErrorInfo("查找库区失败", result.msg, Source);
                }
                else
                //根据仓库 计算库区
                var whcode = Settings.wareLoc.Where(a => a.AreaCode == locJt.S_WH_CODE).FirstOrDefault();
                if (whcode != null)
                {
                    if (model.PartNumber.StartsWith("3"))
                    if (model.PartNumber.StartsWith("4X"))
                    {
                        cntrType = "RC";
                        areacode = "KJZCW";
                        areacode = whcode.PMK;
                        cntrType = "PM";
                    }
                    else
                    {
                        if (model.PartNumber.StartsWith("3"))
                        {
                            cntrType = "RC";
                            areacode = whcode.ZCW;
                        }
                        else
                        {
                        result.code = "1";
                        result.msg = $"创建任务失败,物料号{model.PartNumber}不属于规定物料";
                        LogHelper.Info($"ItemBack:{result.msg}");
                        AddErrorInfo("物料编码格式错误", result.msg, Source);
                        return result;
                            result.code = "1";
                            result.msg = $"创建任务失败,物料号{model.PartNumber}不属于规定物料";
                            LogHelper.Info($"ItemBack:{result.msg}");
                            AddErrorInfo("物料编码格式错误", result.msg, Source);
                            return result;
                        }
                    }
                }
                //根据物料获取对应库区
                //    var iteminfo = db.Queryable<TN_Material>().Where(a => a.S_ITEM_CODE.Trim() == itemcode).First();
                //if (iteminfo != null)
                //{
                //    areacode = iteminfo.S_WH_CODE;
                //}
                //areacode = computeArea(itemcode);
                //if (string.IsNullOrEmpty(areacode))
                //{
                //    LogHelper.Info($"PutOut==> 根据物料编码:{itemcode}找不到对应库区,请检查配置文件");
                //    result.code = "1";
                //    result.msg = $"根据物料编码:{itemcode}找不到对应库区,物料表配置";
                //    AddErrorInfo("查找库区失败", result.msg);
                //}
                //if (itemcode == "测试1")
                //{
                //    areacode = "PMJP";
                //}
                else
                {
                    result.code = "1";
                    result.msg = $"根据终点库区仓库编码:{locJt.S_WH_CODE}未找到对应配置文件";
                    LogHelper.Info($"Putin==> {result.msg}");
                    AddErrorInfo("查找库区失败", result.msg, Source);
                }
                #endregion
                #region 根据物料编码计算出库货位,送往线边位置
@@ -1083,26 +1090,26 @@
            try
            {
                #region 判断托盘绑定货位是否和下发绑定起点相同
                var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First();
                if (CntrLoc != null)
                {
                    if (CntrLoc.S_LOC_CODE != Start)
                    {
                        LogHelper.Info($"ItemBack:创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}");
                        result.code = "1";
                        result.msg = $"创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}";
                        AddErrorInfo("托盘绑定位置不同", result.msg);
                        return result;
                    }
                }
                else
                {
                    LogHelper.Info($"ItemBack:创建任务失败,托盘:{model.Rfid}未找到绑定货位");
                    result.code = "1";
                    result.msg = $"创建任务失败,托盘:{model.Rfid}未找到绑定货位";
                    AddErrorInfo("查找托盘货位失败", result.msg);
                    return result;
                }
                //var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First();
                //if (CntrLoc != null)
                //{
                //    if (CntrLoc.S_LOC_CODE != Start)
                //    {
                //        LogHelper.Info($"ItemBack:创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}");
                //        result.code = "1";
                //        result.msg = $"创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}";
                //        AddErrorInfo("托盘绑定位置不同", result.msg);
                //        return result;
                //    }
                //}
                //else
                //{
                //    LogHelper.Info($"ItemBack:创建任务失败,托盘:{model.Rfid}未找到绑定货位");
                //    result.code = "1";
                //    result.msg = $"创建任务失败,托盘:{model.Rfid}未找到绑定货位";
                //    AddErrorInfo("查找托盘货位失败", result.msg);
                //    return result;
                //}
                #endregion
                #region 根据货位楼层判断,3楼去往叠盘位 其他的回库
@@ -1139,7 +1146,7 @@
                            return result;
                        }
                    }
                    else if (startloc.S_NOTE == "PM")
                    else if (startloc.S_NOTE == "PB")
                    {
                        //找块胶堆叠区
                        var KjDploc = db.Queryable<Location>().Where(a => a.S_NOTE.Trim() == "片胶堆叠位" && a.S_WH_CODE.Trim() == startloc.S_WH_CODE).ToList();
@@ -1169,57 +1176,44 @@
                    }
                    else
                    {
                        #region 根据托盘找呼叫空托任务,并获得出库库区
                        msts = WCSHelper.GetTaskBycntrcode(model.Rfid.Trim());
                        if (msts.Count() > 0)
                        #region 根据起点货位类型,获得回库库区
                        //根据仓库 计算库区
                        var whcode = Settings.wareLoc.Where(a => a.AreaCode == startloc.S_WH_CODE).FirstOrDefault();
                        if (whcode != null)
                        {
                            msts.RemoveAll(a => string.IsNullOrEmpty(a.S_CNTR_CODE));
                            mst = msts.OrderByDescending(a => a.T_CREATE).FirstOrDefault();
                        }
                        if (mst != null)
                        {
                            LogHelper.Info($"找到出库任务:{JsonConvert.SerializeObject(mst)}");
                            areacode = mst.S_START_AREA;
                            if (startloc.S_NOTE == "PM" || string.IsNullOrEmpty(startloc.S_NOTE))
                            {
                                areacode = whcode.PMK;
                            }
                        }
                        else
                        {
                            result.code = "1";
                            result.msg = $"创建任务失败,根据托盘编码{model.Rfid}未找到托盘出库任务";
                            LogHelper.Info($"{result.msg}");
                            AddErrorInfo("查找任务失败", result.msg, Source);
                            return result;
                        }
                        if (string.IsNullOrEmpty(areacode))
                        {
                            result.code = "1";
                            result.msg = $"创建任务失败,根据托盘编码{model.Rfid}找到出库任务{mst.S_CODE}的起点库区为空";
                            LogHelper.Info($"{result.msg}");
                            result.msg = $"根据起点仓库编码:{startloc.S_WH_CODE}未找到对应配置文件";
                            LogHelper.Info($"Putin==> {result.msg}");
                            AddErrorInfo("查找库区失败", result.msg, Source);
                            return result;
                        }
                        #endregion
                        //回库货位计算库区货位
                        loc = StorageCompute(itemcode, areacode);
                        if (loc == null)
                        {
                            loc = emptyRow(areacode);
                            if (loc == null)
                            {
                                LogHelper.Info($"库区:{areacode}没有空排");
                            }
                        }
                        else
                        {
                        //if (loc == null)
                        //{
                        //    loc = emptyRow(areacode);
                        //    if (loc == null)
                        //    {
                        //        LogHelper.Info($"库区:{areacode}没有空排");
                        //    }
                        //}
                        //else
                        //{
                            result.code = "1";
                            result.msg = $"库区:{areacode}无可用货位";
                            LogHelper.Info($"{result.msg}");
                            AddErrorInfo("查找货位失败", result.msg, Source);
                            return result;
                        }
                        //    result.code = "1";
                        //    result.msg = $"库区:{areacode}无可用货位";
                        //    LogHelper.Info($"{result.msg}");
                        //    AddErrorInfo("查找货位失败", result.msg, Source);
                        //    return result;
                        //}
                    }
                }
@@ -1235,12 +1229,12 @@
                #endregion
                #region 创建任务
                if (!string.IsNullOrEmpty(Start) && loc != null)
                if (startloc != null && loc != null)
                {
                    if (startloc.N_LOCK_STATE != 0)
                    if (startloc.N_LOCK_STATE != 0 && loc.N_LOCK_STATE != 0)
                    {
                        result.code = "1";
                        result.msg = $"创建任务失败,起点{Start}有锁";
                        result.msg = $"创建任务失败,起点货位状态{startloc.N_LOCK_STATE},起点货位状态:{loc.N_LOCK_STATE}";
                        AddErrorInfo("货位有锁", result.msg);
                        return result;
                    }
@@ -1250,7 +1244,7 @@
                        S_CODE = WCSHelper.GenerateTaskNo(),
                        S_TYPE = "空工装回库",
                        S_EQ_NO = model.TaskNumber,
                        S_START_LOC = Start,
                        S_START_LOC = startloc.S_CODE,
                        S_END_LOC = loc.S_CODE,
                        S_START_WH = startloc.S_WH_CODE,
                        S_START_AREA = startloc.S_AREA_CODE,
@@ -1266,7 +1260,7 @@
                    LogHelper.Info("创建出平库任务:" + JsonConvert.SerializeObject(wcsTask));
                    if (WCSHelper.CreateTask(wcsTask))
                    {
                        LocationHelper.LockLoc(Start, 2);
                        LocationHelper.LockLoc(startloc.S_CODE, 2);
                        LocationHelper.LockLoc(loc.S_CODE, 1);
                        //  空托回库判断托盘有无绑定物料信息 如果有则删除
                        var itemcntr = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First();
@@ -1324,19 +1318,24 @@
            {
                #region 根据仓库编码判断库区 并计算出库货位
                var endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == End).First();
                //根据仓库 计算库区
                if (endloc != null)
                {
                    if (endloc.S_WH_CODE == "101")
                    var whcode = Settings.wareLoc.Where(a => a.AreaCode == endloc.S_WH_CODE).FirstOrDefault();
                    if (whcode != null)
                    {
                        // itemcode = "TP";
                        areacode = "PMGQ";
                        areacode = whcode.PMK;
                    }
                    else
                    {
                        //itemcode = "TP";
                        areacode = "PK2";
                        result.code = "1";
                        result.msg = $"根据起点仓库编码:{endloc.S_WH_CODE}未找到对应配置文件";
                        LogHelper.Info($"Putin==> {result.msg}");
                        AddErrorInfo("查找库区失败", result.msg, Source);
                    }
                    areacode = "FLPK";
                    //计算出库托盘
                    startloc = airlift(areacode, itemcode);
                    if (startloc != null)
@@ -1461,30 +1460,7 @@
            try
            {
                #region 判断托盘绑定货位是否和下发绑定起点相同
                var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First();
                if (CntrLoc != null)
                {
                    if (CntrLoc.S_LOC_CODE != Start)
                    {
                        result.code = "1";
                        result.msg = $"创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}";
                        LogHelper.Info($"ItemBack:{result.msg}");
                        AddErrorInfo("托盘绑定位置不同", result.msg, Source);
                        return result;
                    }
                }
                else
                {
                    result.code = "1";
                    result.msg = $"创建任务失败,托盘:{model.Rfid}未找到绑定货位";
                    LogHelper.Info($"ItemBack:{result.msg}");
                    AddErrorInfo("查找托盘货位失败", result.msg, Source);
                    return result;
                }
                #endregion
                #region 余料返回根据托盘找出库任务
                //余料返回根据托盘找出库任务
@@ -1519,73 +1495,111 @@
                var startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == Start).First();
                if (startloc != null)
                {
                    //粉料直接回库,其他物料需要去对应的暂存区
                    if (model.PartNumber.StartsWith("4X"))
                    var whcode = Settings.wareLoc.Where(a => a.AreaCode == startloc.S_WH_CODE).FirstOrDefault();
                    if (whcode != null)
                    {
                        areacode = "FLPK";
                        loc = StorageCompute(itemcode, areacode);
                        if (loc == null)
                        //粉料直接回库,其他物料需要去对应的暂存区
                        if (model.PartNumber.StartsWith("4X"))
                        {
                            loc = emptyRow(areacode);
                        }
                    }
                    else
                    {
                        if (model.PartNumber.StartsWith("3"))
                        {
                            areacode = "KJYLZCW";
                            areacode = whcode.PMK;
                            loc = StorageCompute(itemcode, areacode);
                            //if (loc == null)
                            //{
                            //    loc = emptyRow(areacode);
                            //}
                        }
                        else
                        {
                            result.code = "1";
                            result.msg = $"创建任务失败,物料号{model.PartNumber}不属于规定物料";
                            LogHelper.Info($"ItemBack:{result.msg}");
                            AddErrorInfo("物料编码格式错误", result.msg, Source);
                            return result;
                        }
                        var EndLocs = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == areacode).ToList();
                        if (EndLocs.Count > 0)
                        {
                            loc = EndLocs.Find(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0);
                            if (loc != null)
                            #region 判断托盘绑定货位是否和下发绑定起点相同
                            var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First();
                            if (CntrLoc != null)
                            {
                                End = loc.S_CODE;
                                if (CntrLoc.S_LOC_CODE != Start)
                                {
                                    result.code = "1";
                                    result.msg = $"创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}";
                                    LogHelper.Info($"ItemBack:{result.msg}");
                                    AddErrorInfo("托盘绑定位置不同", result.msg, Source);
                                    return result;
                                }
                            }
                            else
                            {
                                result.code = "1";
                                result.msg = $"创建任务失败,托盘:{model.Rfid}未找到绑定货位";
                                LogHelper.Info($"ItemBack:{result.msg}");
                                AddErrorInfo("查找托盘货位失败", result.msg, Source);
                                return result;
                            }
                            #endregion
                            if (model.PartNumber.StartsWith("3"))
                            {
                                areacode = whcode.ZCW;
                            }
                            else
                            {
                                result.code = "1";
                                result.msg = $"创建任务失败,物料号{model.PartNumber}不属于规定物料";
                                LogHelper.Info($"ItemBack:{result.msg}");
                                AddErrorInfo("物料编码格式错误", result.msg, Source);
                                return result;
                            }
                            var EndLocs = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == areacode).ToList();
                            if (EndLocs.Count > 0)
                            {
                                loc = EndLocs.Find(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0);
                                if (loc != null)
                                {
                                    End = loc.S_CODE;
                                }
                                else
                                {
                                    result.code = "1";
                                    result.msg = $"终点库区:{areacode}无可用货位";
                                    AddErrorInfo("查找库区失败", result.msg, Source);
                                    return result;
                                }
                            }
                            else
                            {
                                result.code = "1";
                                result.msg = $"终点库区:{areacode}无可用货位";
                                result.msg = $"根据终点库区:{areacode},未找到对应货位";
                                AddErrorInfo("查找库区失败", result.msg, Source);
                                return result;
                            }
                            //loc = StorageCompute(itemcode, areacode);
                            //if (loc == null)
                            //{
                            //    loc = emptyRow(areacode);
                            //}
                        }
                        if (loc != null)
                        {
                            End = loc.S_CODE;
                        }
                        else
                        {
                            result.code = "1";
                            result.msg = $"根据终点库区:{areacode},未找到对应货位";
                            AddErrorInfo("查找库区失败", result.msg, Source);
                            result.msg = $"库区:{areacode}无可用货位";
                            AddErrorInfo("查找货位失败", result.msg, Source);
                            return result;
                        }
                        //loc = StorageCompute(itemcode, areacode);
                        //if (loc == null)
                        //{
                        //    loc = emptyRow(areacode);
                        //}
                    }
                    if (loc != null)
                    {
                        End = loc.S_CODE;
                    }
                    else
                    {
                        result.code = "1";
                        result.msg = $"库区:{areacode}无可用货位";
                        AddErrorInfo("查找货位失败", result.msg, Source);
                        return result;
                        result.msg = $"根据起点仓库编码:{startloc.S_WH_CODE}未找到对应配置文件";
                        LogHelper.Info($"Putin==> {result.msg}");
                        AddErrorInfo("查找库区失败", result.msg, Source);
                    }
                }
                else
                {
@@ -1760,10 +1774,11 @@
                itemInfo.REMARK1 = model.StewingTime;
                itemInfo.REMARK2 = model.OverdueTime;
                itemInfo.S_MP_TYPE = model.Unit;
                if (db.Insertable<TN_Material>(itemInfo).ExecuteCommand()>0)
                if (db.Insertable<TN_Material>(itemInfo).ExecuteCommand() > 0)
                {
                    LogHelper.Info($"add:物料编码:{model.PartNumber}的物料主数据已同步");
                } ;
                }
                ;
                return result;
            }
            catch (Exception ex)
@@ -2167,51 +2182,52 @@
        internal static Location StorageCompute(string itemcode, string areacode)
        {
            var db = new SqlHelper<object>().GetInstance();
            Location result = null;
            //查询所有有托盘的排
            var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM > 0 && a.S_AREA_CODE.Trim() == areacode).OrderByDescending(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList();
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    LogHelper.Info($"有托盘排号{list[i].N_ROW},物料编码{itemcode},库区{areacode}");
                    //判断托盘物料是否相同物料信息相同
                    var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == list[i].S_CODE).First();
                    if (cntr != null)
                    {
                        if (string.IsNullOrEmpty(itemcode))//空托入库
                        {
                            var iteminfo = ContainerHelper.GetCntrItemRel(cntr.S_CNTR_CODE).FirstOrDefault();
                            if (iteminfo == null)
                            {
                                //物料相同入货位后一位货位
                                result = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a => a.S_AREA_CODE.Trim() == areacode && a.N_ROW == list[i].N_ROW && a.N_COL > list[i].N_COL).First();
                            }
                        }
                        else//满拖入库
                        {
                            var iteminfo = ContainerHelper.GetCntrItemRel(cntr.S_CNTR_CODE).FirstOrDefault();
                            if (iteminfo != null)
                            {
                                if (iteminfo.S_ITEM_CODE == itemcode)
                                {
                                    //物料相同入货位后一位货位
                                    result = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a => a.S_AREA_CODE.Trim() == areacode && a.N_ROW == list[i].N_ROW && a.N_COL > list[i].N_COL).First();
            Location result = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM == 0 && a.S_AREA_CODE.Trim() == areacode && a.N_LOCK_STATE == 0).First();
            //查询所有有托盘的排没锁的排
            // var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM > 0 && a.S_AREA_CODE.Trim() == areacode && a.N_LOCK_STATE == 0).OrderByDescending(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList();
            // if (list.Count > 0)
            //{
            //    for (int i = 0; i < list.Count; i++)
            //    {
            //        LogHelper.Info($"有托盘排号{list[i].N_ROW},物料编码{itemcode},库区{areacode}");
            //        //查询货位绑定托盘
            //        var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == list[i].S_CODE).First();
            //        if (cntr != null)
            //        {
            //            //查询托盘物料信息
            //            var iteminfo = ContainerHelper.GetCntrItemRel(cntr.S_CNTR_CODE).FirstOrDefault();
                                }
                            }
                        }
                        if (result != null)
                        {
                            return result;
                        }
                    }
                    else
                    {
                        LogHelper.Info($"根据货物编码{list[i].S_CODE}未找到托盘货位绑定关系");
                    }
                }
            }
            //            if (string.IsNullOrEmpty(itemcode))//空托入库
            //            {
            //                if (iteminfo == null)
            //                {
            //                    //物料相同入货位后一位货位
            //                    result = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a => a.S_AREA_CODE.Trim() == areacode && a.N_ROW == list[i].N_ROW && a.N_COL > list[i].N_COL && a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM == 0).First();
            //                }
            //            }
            //            else//满拖入库
            //            {
            //                if (iteminfo != null)
            //                {
            //                    if (iteminfo.S_ITEM_CODE == itemcode)
            //                    {
            //                        //物料相同入货位后一位货位
            //                        result = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a => a.S_AREA_CODE.Trim() == areacode && a.N_ROW == list[i].N_ROW && a.N_COL > list[i].N_COL && a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM == 0).First();
            //                    }
            //                }
            //            }
            //            if (result != null)
            //            {
            //                return result;
            //            }
            //        }
            //        else
            //        {
            //            LogHelper.Info($"根据货物编码{list[i].S_CODE}未找到托盘货位绑定关系");
            //        }
            //    }
            //}
            return result;
        }