杨前锦
2025-05-15 91443c26b77da527c0dfc4d6c3e45e349e581ecf
印尼佳通人工出入库问题修复
3个文件已修改
69 ■■■■ 已修改文件
HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs
@@ -506,7 +506,7 @@
            ReturnResult result = new ReturnResult();
            try
            {
                Location startLoc = WMSHelper.GetoutStockStartLoc(model.itemCode , model.endLoc);
                Location startLoc = WMSHelper.GetoutStockStartLoc(model.itemCode,model.trayCode , model.endLoc);
                Location endLoc = LocationHelper.GetLoc(model.endLoc);
                if (startLoc != null)
@@ -777,27 +777,9 @@
            ReturnResult result = new ReturnResult();
            try
            {
                Location startLoc = LocationHelper.GetLoc(Settings.baseTrayInBufferLoc);
                Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0, 1);
                Location endLoc = LocationHelper.GetLoc(loc);
                var agvJBLoc = Settings.getAgvJBLoc(loc);
                if (startLoc != null && startLoc.N_CURRENT_NUM == 1 && agvJBLoc.type == 1)
                {
                   var locCntrRels = LocationHelper.GetLocCntrRel(startLoc.S_CODE);
                    if (locCntrRels.Count > 0)
                    {
                        var container = ContainerHelper.GetCntr(locCntrRels[0].S_CNTR_CODE);
                        if (container.N_TYPE != 0)
                        {
                            startLoc = null;
                        }
                    }
                }
                if(startLoc == null || startLoc.N_CURRENT_NUM != 1)
                {
                    startLoc = WMSHelper.GetEmptyTrayStartLoc(0);
                }
                if (startLoc != null)
                {
@@ -885,7 +867,7 @@
                var mst = WMSHelper.GetWmsTask(wmsTaskNo);
                if (mst != null && mst.N_B_STATE < 2) 
                {
                    Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0);
                    Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0,0);
                    Location endLoc = LocationHelper.GetLoc(loc);
                    if (startLoc != null)
@@ -1004,7 +986,7 @@
                                if(mst.N_B_STATE != 2)
                                {
                                    // 创建下个任务
                                    if (cst.S_TYPE.Contains("出库") && !cst.S_TYPE.Contains("母拖"))
                                    if (cst.S_TYPE.Contains("出库") && !cst.S_TYPE.Contains("母拖") && !cst.S_TYPE.Contains("人工"))
                                    {
                                        WCSCore.createLastTask(cst.S_END_LOC, mst, 2);
                                    }
@@ -1290,6 +1272,7 @@
        public class CreateOutOrderModel
        {
            public string taskNo { get; set; } // 任务号
            public string trayCode { get; set; } // 任务号
            public string itemCode { get; set; } // 物料编码
            public string endLoc { get; set; } // 终点货位
            public int priority { get; set; } = 0; // 优先级 默认0
HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs
@@ -33,7 +33,7 @@
                var cst = WCSHelper.GetTaskByStartAndEnd(endLoc.S_CODE);
                if (cst == null) 
                {
                    ApiHelper.baseTrayOutStock(endLoc.S_CODE, null);
                    ApiHelper.baseTrayOutStockAgv(endLoc.S_CODE, null);
                }
            }
        }
HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs
@@ -419,25 +419,35 @@
            return result;
        }
       /// <summary>
       /// 获取空托开始货位
       /// </summary>
       /// <param name="trayType"></param>
       /// <returns></returns>
        public static Location GetEmptyTrayStartLoc(int trayType)
        /// <summary>
        /// 获取空托开始货位
        /// </summary>
        /// <param name="trayType"></param>
        /// <param name="exclude">是否排除母拖缓存位 0.不排除 1.排除</param>
        /// <returns></returns>
        public static Location GetEmptyTrayStartLoc(int trayType ,int exclude = 1)
        {
            Location result = null;
            try
            {
                // 1、查询当前库区-排-物料 有托盘的货位
                var db = new SqlHelper<object>().GetInstance();
                result = db.Queryable<Location>()
                var query = db.Queryable<Location>()
                     .LeftJoin<LocCntrRel>((a, b) => a.S_CODE == b.S_LOC_CODE)
                     .LeftJoin<Container>((a, b, c) => b.S_CNTR_CODE == c.S_CODE)
                     .LeftJoin<CntrItemRel>((a,b,c,d) => c.S_CODE == d.S_CNTR_CODE)
                     .Where((a, b, c, d) => a.S_AREA_CODE == Settings.storeAreaCode && (trayType == 0 && a.N_CURRENT_NUM == 1 || trayType > 0 && a.N_CURRENT_NUM > 0) && a.N_LOCK_STATE == 0 && (a.C_ENABLE != "禁用" && a.C_ENABLE != "N") && c.N_TYPE == trayType && d.S_ITEM_CODE == null)
                     .OrderByDescending((a, b, c, d) => a.N_LAYER)
                     .First();
                     .LeftJoin<CntrItemRel>((a, b, c, d) => c.S_CODE == d.S_CNTR_CODE)
                     .Where((a, b, c, d) => a.S_AREA_CODE == Settings.storeAreaCode && (trayType == 0 && a.N_CURRENT_NUM == 1 || trayType > 0 && a.N_CURRENT_NUM > 0) && a.N_LOCK_STATE == 0 && (a.C_ENABLE != "禁用" && a.C_ENABLE != "N") && c.N_TYPE == trayType && d.S_ITEM_CODE == null);
                if (exclude == 1)
                {
                    query = query.Where((a, b, c, d) => a.S_CODE != Settings.baseTrayInBufferLoc);
                }
                else
                {
                    query = query.OrderByDescending((a, b, c, d) => a.S_CODE == Settings.baseTrayInBufferLoc);
                }
                result = query.OrderByDescending((a, b, c, d) => a.N_LAYER).First();
            }
            catch (Exception ex)
            {
@@ -488,8 +498,9 @@
        /// </summary>
        /// <param name="itemCode"></param>
        /// <param name="jbLoc"></param>
        /// <param name="trayCode"></param>
        /// <returns></returns>
        public static Location GetoutStockStartLoc(string itemCode ,string jbLoc = null)
        public static Location GetoutStockStartLoc(string itemCode ,string trayCode = null ,string jbLoc = null)
        {
            LogHelper.Info("【获取出库开始货位】", "WMS");
            var db = new SqlHelper<object>().GetInstance();
@@ -511,6 +522,11 @@
                                    && c.S_EXPIRATION_TIME != null
                                    );
                if (trayCode != null)
                {
                    query = query.Where((a, b, c) => c.S_CNTR_CODE == trayCode);
                }
                if (jbLoc != null) 
                {
                    List<int> roadwayList = new List<int>();