lss
2025-06-13 1285aeec470dfa1b953878a714e3bc58bba83dec
HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs
@@ -12,6 +12,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.ServiceModel;
using System.Threading;
using System.Threading.Tasks;
@@ -1076,8 +1077,18 @@
                #endregion
                #region 任务创建
                if (!string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End))
                if (string.IsNullOrEmpty(Start))
                {
                    result.code = "1";
                    result.msg = "创建任务失败,未找到对应的取货点";
                    return result;
                }
                if (string.IsNullOrEmpty(End))
                {
                    result.code = "1";
                    result.msg = "创建任务失败,未找到对应的卸货点";
                    return result;
                }
                    if (loc.N_LOCK_STATE != 0)
                    {
                        result.code = "1";
@@ -1119,13 +1130,7 @@
                        AddErrorInfo("任务创建失败", result.msg, Source);
                        return result;
                    }
                }
                else
                {
                    result.code = "1";
                    result.msg = "创建任务失败,未找到对应的取货点或卸货点";
                    return result;
                }
                #endregion
                return result;
@@ -1424,7 +1429,6 @@
                    #region 根据仓库编码判断库区 并计算出库货位
                    var endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == End).First();
                    //根据仓库 计算库区
                    if (endloc != null)
                    {
                        var whcode = Settings.wareLoc.Where(a => a.AreaCode == endloc.S_WH_CODE).FirstOrDefault();
@@ -1440,7 +1444,6 @@
                            AddErrorInfo("查找库区失败", result.msg, Source);
                            return result;
                        }
                        //计算出库托盘
                        startloc = LocationHelper.GetLocByAreacode(areacode, model.CarrierType);
@@ -1460,7 +1463,14 @@
                                AddErrorInfo("查找托盘失败", result.msg, Source);
                                return result;
                            }
                        }
                        else
                        {
                            result.code = "1";
                            result.msg = $"创建空工装呼叫任务==>根据库区:{areacode},托盘类型:{model.CarrierType}找不到对应空托";
                            LogHelper.Info($"callfixture:{result.msg}");
                            AddErrorInfo("查找托盘失败", result.msg, Source);
                            return result;
                        }
                    }
@@ -2285,19 +2295,20 @@
                    if (loccntr != null)
                    {
                        string cntrcode = loccntr.S_CNTR_CODE;
                        var CntrItem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntrcode).First();
                        if (CntrItem != null)
                        {
                            if (LocationHelper.UnBindingLoc(loc, new List<string>() { cntrcode }))
                            {
                                LogHelper.Info($"清除托盘货位关系成功");
                            }
                            //清除托盘物料绑定关系
                            db.Deleteable<CntrItemDetail>().Where(it => it.S_CNTR_CODE.Trim() == CntrItem.S_CNTR_CODE).ExecuteCommand();
                        }
                        else
                        {
                            LogHelper.Info($"ClearLocCntr 托盘{cntrcode}无物料绑定关系");
                        }
                        if (LocationHelper.UnBindingLoc(loc, new List<string>() { cntrcode }))
                        {
                            LogHelper.Info($"清除托盘货位关系成功");
                        }
                    }
@@ -2683,6 +2694,21 @@
            }
        }
        //internal static bool CreateCntrLoc(taskData taskData)
        //{
        //    if ( taskData == null)
        //    {
        //        LogHelper.Info($"CreateCntrIteminfo==> 立库任务下发参数有空,创建物料托盘绑定关系失败");
        //        return false;
        //    }
        //    else
        //    {
        //        LocationHelper.BindingLoc(taskData.pickStation,new  List<string>() { taskData.rfid });
        //    }
        //}
        private static object _lockLocation = new object();
        /// <summary>
        /// 根据托盘编码,机台编码,工装类型计算机台线边区域