增加指定储位传参,增加对应dto模型和视图模型,修改指定储位获取数据源代码,修改pda托盘绑定判断,修改指定储位后台逻辑代码
9个文件已修改
369 ■■■■■ 已修改文件
HTML/views/ASNSetting/AppointSlot.html 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Model/ModelDto/BllSoDto/ExportNoticeDto.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Model/ModelVm/BllAsnVm/PalletBindVm.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs 262 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Wms/Controllers/BllAsnController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/ASNSetting/AppointSlot.html
@@ -127,7 +127,8 @@
                    Row: $("#Row").val(),
                    Column: $("#Column").val(),
                    Layer: $("#Layer").val(),
                    LocateNo: $("#LocateNo").val()
                    LocateNo: $("#LocateNo").val(),
                    BindId: id,
                };
                // 流水详情
                var tableIns = table.render({
Wms/Model/ModelDto/BllSoDto/ExportNoticeDto.cs
@@ -393,4 +393,31 @@
        /// </summary>
        public string UpdateUserName { get; set; }
    }
    /// <summary>
    /// 储位点信息
    /// </summary>
    public class AddressCls
    {
        /// <summary>
        /// 储位
        /// </summary>
        public string LocatNo { get; set; }
        /// <summary>
        /// 行
        /// </summary>
        public int? Row { get; set; }
        /// <summary>
        /// 列
        /// </summary>
        public int? Column { get; set; }
        /// <summary>
        /// 层
        /// </summary>
        public int? Layer { get; set; }
        /// <summary>
        /// 距离点位
        /// </summary>
        public int? DistNum { get; set; }
    }
}
Wms/Model/ModelVm/BllAsnVm/PalletBindVm.cs
@@ -175,6 +175,7 @@
        public string Column { get; set; }
        public string Layer { get; set; }
        public string LocateNo { get; set; }
        public string BindId { get; set; }
    }
    /// <summary>
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -238,7 +238,7 @@
            string sqlString = string.Empty;
            string sqlDetailStr = string.Empty;
            //0:成品入库 1:采购入库 2:中间品入库 3:退货入库 4:车间余料入库 5:其它入库 6:代储入库 7:寄存入库
            var TypeLot = "1, 2, 5, 6, 7";
            var TypeLot = "1, 2, 5, 6, 7"; //批次可为空单据类型
            try
            {
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -551,10 +551,19 @@
        #region 指定储位
        //指定储位数据源(正常的空储位)
        public List<LocatDto> GetLocateList(string houseNo, string roadwayNo, string row, string column, string layer, string locateNo, int page, int limit, out int count)
        public List<LocatDto> GetLocateList(string houseNo, string roadwayNo, string row, string column, string layer, string locateNo, string BindId, int page, int limit, out int count)
        {
            try
            {
                //获取托盘绑定
                var bindASNDetailNo = Db.Queryable<BllPalletBind>().Where(a => a.IsDel == "0" && a.Status == "0" && a.Id == int.Parse(BindId)).Select(a => a.ASNDetailNo).First();
                //获取单据明细
                var noticeDetailSkuNo = Db.Queryable<BllArrivalNoticeDetail>().Where(a => a.Id == bindASNDetailNo && a.IsDel == "0").Select(a => a.SkuNo).First();
                //获取物料
                var skuCategoryNo = Db.Queryable<SysMaterials>().Where(a => a.IsDel == "0" && a.SkuNo == noticeDetailSkuNo).Select(a => a.CategoryNo).First();
                //获取物料对应区域
                var categoryAreaNo = Db.Queryable<SysMaterialCategory>().Where(a => a.IsDel == "0" && a.CategoryNo == skuCategoryNo).Select(a => a.AreaNo).First();
                Expression<Func<SysStorageLocat, bool>> item = Expressionable.Create<SysStorageLocat>()
                   .AndIF(!string.IsNullOrWhiteSpace(roadwayNo), m => m.RoadwayNo == roadwayNo)
                   .AndIF(!string.IsNullOrWhiteSpace(row), m => m.Row == int.Parse(row))
@@ -562,6 +571,7 @@
                   .AndIF(!string.IsNullOrWhiteSpace(layer), m => m.Layer == int.Parse(layer))
                   .AndIF(!string.IsNullOrWhiteSpace(locateNo), m => m.LocatNo.Contains(locateNo))
                   .And(m => m.IsDel == "0" && m.Status == "0" && m.Flag == "0" && m.WareHouseNo == houseNo)
                   .And(m => m.AreaNo.Contains(categoryAreaNo))
                   .ToExpression();//注意 这一句 不能少
                var total = 0;
                var list = Db.Queryable<SysStorageLocat>().Where(item)
@@ -611,6 +621,59 @@
                {
                    throw new Exception("该储位状态不是空储位或标志不是正常的");
                }
                //判断当前托盘是否存在绑定信息
                if (bind.LocatNo != null)
                {
                    //分割已绑储位与新储位
                    //已绑储位
                    var bindRow = bind.LocatNo.Substring(0, 2);
                    var bindColumn = bind.LocatNo.Substring(2, 2);
                    var bindLayer = bind.LocatNo.Substring(4, 2);
                    var bindDepth = bind.LocatNo.Substring(6, 2);
                    //新储位
                    var Row = locate.LocatNo.Substring(0, 2);
                    var Column = locate.LocatNo.Substring(2, 2);
                    var Layer = locate.LocatNo.Substring(4, 2);
                    var Depth = locate.LocatNo.Substring(6, 2);
                    if (bindDepth == "02")
                    {
                        //判断排列层是否相同
                        if (bindRow == Row && bindColumn == Column && bindLayer == Layer)
                        {
                            throw new Exception("同储位深度2不可向深度1切换!");
                        }
                    }
                }
                else
                {
                    //若是深度1的 则判断深度2是否为空储位
                    if (locate.Depth == "01")
                    {
                        var locateDepth = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.Row == locate.Row && a.Column == locate.Column && a.Layer == locate.Layer && a.Depth == "02");
                        if (locateDepth != null)
                        {
                            if (locateDepth.Status != "1")
                            {
                                throw new Exception("该储位深度2不是有物品,不可绑定");
                            }
                        }
                    }
                    //判断是否为深度2的 若为深度2 则获取深度1储位 判断是否为空储位
                    if (locate.Depth == "02")
                    {
                        var locateDepth = Db.Queryable<SysStorageLocat>().First(a => a.IsDel == "0" && a.Row == locate.Row && a.Column == locate.Column && a.Layer == locate.Layer && a.Depth == "01");
                        if (locateDepth.Status != "0" || locateDepth.Flag == "2")
                        {
                            throw new Exception("该储位深度1不是空储位或标志不是正常的");
                        }
                    }
                }
                var bindIdList = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.PalletNo == bind.PalletNo && m.Status != "2").Select(m => m.Id).ToList();
                //判断是否有零箱
                foreach (var item in bindIdList)
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -1961,7 +1961,7 @@
                    }
                }
                #endregion
                var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo);
                var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo && m.Status != "2");
                var bindId = 0;
                if (bind == null)
                {
@@ -1978,7 +1978,7 @@
                        Type = "0",
                        LotNo = model.LotNo,
                        LotText = detail.LotText,
                        SupplierLot = "",
                        SupplierLot = detail.SupplierLot,
                        InspectMark = "0",
                        BitPalletMark = "1",
                        IsBale = "0",
Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -1385,7 +1385,9 @@
            {
                #region 集合 
                var outDtoList = new List<OutCommandDto>(); //出库数据的集合
                var outDto1 = new List<OutCommandDto>(); //先出库数据的集合(深度为1的储位)
                var outDto2 = new List<OutCommandDto>(); //后出库数据的集合(深度为2的储位)
                var moveDto = new List<OutCommandDto>(); //要移库数据的集合
                //记录错误信息的集合 
                var flagList = new List<int>();//1:当前要出库的储位正在移出、2 出库的托盘储位信息错误(在储位表中未查询到)、3储位损坏不能出库、4 要出库的托盘正在入库
@@ -1420,6 +1422,7 @@
                    //循环分配的信息生成出库任务
                    foreach (var item in list)
                    {
                        var taskNoStr = "";
                        string toLocation = string.Empty;//目标位置
                        string unstackingMode2 = unstackingMode;//拆垛方式,0:机器人拆垛 1:PDA拆垛
                        #region 判断是否需要拆箱
@@ -1550,7 +1553,8 @@
                        if (locate.Status == "1") //有物品
                        {
                            #region 添加出库任务
                            if (locate.Depth == "01") //深度为1
                            {
                            var taskNo = new Common().GetMaxNo("TK");
                            var exTask = new LogTask    //出库任务
                            {
@@ -1573,7 +1577,7 @@
                            Db.Insertable(exTask).ExecuteCommand();
                            logTaskList.Add(exTask);
                            outDtoList.Add(new OutCommandDto()
                                outDto1.Add(new OutCommandDto()
                            {
                                PalletNo = item.PalletNo,//托盘号
                                StartLocate = locate.LocatNo, // 起始位置
@@ -1584,6 +1588,176 @@
                                OutMode = "",  //目标地址
                                Order = 1
                            });
                            }
                            else if (locate.Depth == "02") //深度为2
                            {
                                //获取出库深度为2储位前面的储位信息
                                var slotBefore = com.GetLocateNoDepth1(locate.WareHouseNo, locate.LocatNo);
                                if (slotBefore.Status == "1") //前面的储位有货物、进行移库操作
                                {
                                    //要出库深度为2的储位前面的储位中货物是否要出库
                                    var isout = outStockDetail.Count(m => m.LocatNo == slotBefore.LocatNo);
                                    if (isout <= 0) //进行移库
                                    {
                                        //去库存表中找到储位对应的托盘码操作
                                        var stockNew = Db.Queryable<DataStockDetail>().First(m => m.LocatNo == slotBefore.LocatNo);
                                        if (stockNew == null)
                                        {
                                            var slotChange = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == slotBefore.LocatNo);
                                            slotChange.Status = "0";
                                            Db.Updateable(slotChange).ExecuteCommand();
                                        }
                                        else
                                        {
                                            //获取移库的库位
                                            var newSlot = MoveAddress(slotBefore.LocatNo, slotBefore.RoadwayNo, item.SkuNo);
                                            //当前移库库位的储位信息
                                            var locatey = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == newSlot && m.IsDel == "0");
                                            if (!string.IsNullOrEmpty(newSlot))
                                            {
                                                #region 添加出库时发生的移库任务
                                                var exYkTaskNo = new Common().GetMaxNo("TK");
                                                var exYkTask = new LogTask    //出库时产生移库任务
                                                {
                                                    TaskNo = exYkTaskNo,
                                                    Sender = "WMS",
                                                    Receiver = "WCS",
                                                    IsSuccess = 0, //是否下发成功 0失败 1成功
                                                    StartLocat = stockNew.LocatNo,//起始位置
                                                    EndLocat = newSlot,//目标位置
                                                    PalletNo = stockNew.PalletNo,//托盘码
                                                    IsSend = 1,//是否可再次下发
                                                    IsCancel = 1,//是否可取消
                                                    IsFinish = 1,//是否可完成
                                                    Type = "2",//任务类型 0 入库任务 1 出库任务  2 移库任务
                                                    Status = "0",//任务状态0:等待执行1正在执行2执行完成
                                                    OrderType = "1",//0 入库单 1 出库单  2 盘点单  3 移库单
                                                    Msg = stockNew.LocatNo + " ==>> " + newSlot + "的移库任务",
                                                };
                                                Db.Insertable(exYkTask).ExecuteCommand();
                                                moveDto.Add(new OutCommandDto()
                                                {
                                                    StartRoadway = slotBefore.RoadwayNo, //起始巷道
                                                    PalletNo = stockNew.PalletNo,//托盘号
                                                    StartLocate = stockNew.LocatNo, // 起始位置
                                                    EndLocate = newSlot, // 目标位置
                                                    EndRoadway = locatey.RoadwayNo, // 目标巷道
                                                    TaskNo = exYkTask.TaskNo, // 任务号
                                                    TaskType = "2",// 任务类型 (移库)
                                                    OutMode = "",  //目标地址
                                                    Order = 1,
                                                });
                                                #endregion
                                                #region 改变储位装填
                                                var slotChange = Db.Queryable<SysStorageLocat>().First(m => m.Id == slotBefore.Id);
                                                var slotChange2 = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == newSlot);
                                                slotChange.Status = "5"; //改变状态(正在移出)
                                                slotChange2.Status = "4"; // 改变状态(正在移入)
                                                Db.Updateable(slotChange).ExecuteCommand();
                                                Db.Updateable(slotChange2).ExecuteCommand();
                                                #endregion
                                            }
                                            else
                                            {
                                                #region 添加出库任务
                                                var exYkTaskNo1 = new Common().GetMaxNo("TK");
                                                var exYkTask1 = new LogTask    //出库移库没有库位了进行出库任务
                                                {
                                                    TaskNo = exYkTaskNo1,
                                                    Sender = "WMS",
                                                    Receiver = "WCS",
                                                    IsSuccess = 0, //是否下发成功 0失败 1成功
                                                    StartLocat = stockNew.LocatNo,//起始位置
                                                    EndLocat = "",//目标位置
                                                    PalletNo = stockNew.PalletNo,//托盘码
                                                    IsSend = 1,//是否可再次下发
                                                    IsCancel = 1,//是否可取消
                                                    IsFinish = 1,//是否可完成
                                                    Type = "1",//任务类型 0 入库任务 1 出库任务  2 移库任务
                                                    Status = "0",//任务状态0:等待执行1正在执行2执行完成
                                                    OrderType = "1",//0 入库单 1 出库单  2 盘点单  3 移库单
                                                    Msg = locate.LocatNo + "的出库任务"
                                                };
                                                Db.Insertable(exYkTask1).ExecuteCommand();
                                                outDto1.Add(new OutCommandDto()
                                                {
                                                    StartRoadway = slotBefore.RoadwayNo, //起始巷道
                                                    PalletNo = stockNew.PalletNo,//托盘号
                                                    StartLocate = stockNew.LocatNo, // 起始位置
                                                    EndLocate = "", // 目标位置
                                                    EndRoadway = "", // 目标巷道
                                                    TaskNo = exYkTask1.TaskNo, // 任务号
                                                    TaskType = "1",// 任务类型 (出库)
                                                    OutMode = "",  //目标地址
                                                    Order = 1,
                                                });
                                                #endregion
                                                #region MyRegion
                                                var slotChange = Db.Queryable<SysStorageLocat>().First(m => m.Id == slotBefore.Id);
                                                slotChange.Status = "3"; //改变状态(正在出库)
                                                Db.Updateable(slotChange).ExecuteCommand();
                                                #endregion
                                            }
                                        }
                                    }
                                }
                                else if (slotBefore.Status == "2" || slotBefore.Status == "4") //前面储位状态是入库中或者移入中
                                {
                                    flagList.Add(5);
                                    continue;
                                }
                                #region 添加出库任务
                                var taskNo1 = new Common().GetMaxNo("TK");
                                var exTask1 = new LogTask    //出库任务
                                {
                                    TaskNo = taskNo1,
                                    Sender = "WMS",
                                    Receiver = "WCS",
                                    IsSuccess = 0, //是否下发成功 0失败 1成功
                                    StartLocat = locate.LocatNo,//起始位置
                                    EndLocat = "",//目标位置
                                    PalletNo = item.PalletNo,//托盘码
                                    IsSend = 1,//是否可再次下发
                                    IsCancel = 1,//是否可取消
                                    IsFinish = 1,//是否可完成
                                    Type = "1",//任务类型 0 入库任务 1 出库任务  2 移库任务
                                    Status = "0",//任务状态0:等待执行1正在执行2执行完成
                                    OrderType = "1",//0 入库单 1 出库单  2 盘点单  3 移库单
                                    Msg = locate.LocatNo + "的出库任务"
                                };
                                Db.Insertable(exTask1).ExecuteCommand();
                                outDto2.Add(new OutCommandDto()
                                {
                                    StartRoadway = locate.RoadwayNo, //起始巷道
                                    PalletNo = item.PalletNo,//托盘号
                                    StartLocate = locate.LocatNo, // 起始位置
                                    EndLocate = "", // 目标位置
                                    EndRoadway = locate.RoadwayNo, //目标巷道
                                    TaskNo = exTask1.TaskNo, // 任务号
                                    TaskType = "1",// 任务类型 (出库)
                                    OutMode = "",  //目标地址
                                    Order = 1,
                                });
                                taskNoStr = exTask1.TaskNo;
                                #endregion
                            }
                            #endregion
                            #region 改变数据
@@ -1610,7 +1784,7 @@
                            locate.Status = "3"; //要出库的储位改变状态 正在出库
                            Db.Updateable(locate).ExecuteCommand();
                            item.TaskNo = exTask.TaskNo; // 出库分配信息中更新任务号
                            item.TaskNo = taskNoStr; // 出库分配信息中更新任务号
                            item.Status = "1"; // 出库分配信息状态改为正在执行 
                            item.UnstackingMode = unstackingMode2;//拆垛方式
                            item.OutMode = unstackingMode2 == "1" ? outMode : "";//出库口
@@ -1693,11 +1867,11 @@
                    {
                        str += "3.要出库的托盘正在入库、";
                    }
                    if (outDtoList.Count > 0)
                    if (outDto1.Count > 0)
                    {
                        // 正式运行程序放开
                        var list2 = outDtoList.Select(m => m.TaskNo).ToList();
                        var jsonData = JsonConvert.SerializeObject(outDtoList);
                        var list2 = outDto1.Select(m => m.TaskNo).ToList();
                        var jsonData = JsonConvert.SerializeObject(outDto1);
                        string response = "";
                        try
@@ -1727,7 +1901,7 @@
                    }
                    return outDtoList;
                    return outDto1;
                }
                catch (Exception e)
                {
@@ -2837,5 +3011,77 @@
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        /// 获取移库目标库位
        /// </summary>
        /// <param name="oldAddress">需要移动的库位地址</param>
        /// <param name="roadWay">巷道</param>
        /// <param name="skuNo">物料编码</param>
        /// <returns>目标库位地址 为"" 直接下发两次出库指令</returns>
        public string MoveAddress(string oldAddress, string roadWay, string skuNo)//01020201  排-列-层-深度
        {
            string nowAddress = "";
            //根据物料编码获取对应区域
            var skuCategoryNo = Db.Queryable<SysMaterials>().Where(a => a.IsDel == "0" && a.SkuNo == skuNo).Select(a => a.CategoryNo).First();
            var category = Db.Queryable<SysMaterialCategory>().First(a => a.IsDel == "0" && a.CategoryNo == skuCategoryNo);
            // 获取移库目标储位
            var row = int.Parse(oldAddress.Substring(0, 2));
            var lie = int.Parse(oldAddress.Substring(2, 2));
            var ceng = int.Parse(oldAddress.Substring(4, 2));
            var sqlString = $@"select LocatNo,[Row],[Column],Layer, (ABS(Row-{row}) + ABS([Column]-{lie}) + ABS(Layer-{ceng}))  as distNum
                                from SysStorageLocat
                                where Flag = '0' and Status = '0' and Depth = '02' and RoadwayNo = '{roadWay}' and AreaNo in '{category}'
                                order by distNum;";
            var addressModels = Db.Ado.SqlQuery<AddressCls>(sqlString).ToList();
            if (addressModels.Count > 0)   // 判断同巷道内排空库位
            {
                var listLocaete = new List<string>();
                foreach (var item in addressModels)
                {
                    // 目标内库位对应的外库位
                    string addressee = item.LocatNo.Substring(0, 6) + "01";
                    // 判断目标库位的外库位是否存在货物   (正常情况下正在移入情况不存在,因为移库先移入里面,后移入外面)
                    //SlotStatus 0: 空储位 1:有货  2:正在入库  3:正在出库   4:正在移入  5:正在移出
                    sqlString = $"select count(*) from SysStorageLocat where LocatNo = '{addressee}' and Status = '0' and Flag in ('0','1') ; ";
                    var rowNum = Db.Ado.SqlQuery<int>(sqlString).First();
                    if (rowNum == 0)
                    {
                        continue;
                    }
                    else
                    {
                        nowAddress = item.LocatNo;
                        break;
                    }
                }
            }
            if (nowAddress == "")
            {
                // 判断同巷道外排空库位
                sqlString = $@"select LocatNo,[Row],[Column],Layer, (ABS(Row-{row}) + ABS([Column]-{lie}) + ABS(Layer-{ceng}))  as distNum
                                from SysStorageLocat
                                where Flag = '0' and Status = '0' and Depth = '01' and RoadwayNo = '{roadWay}' and AreaNo  in '{category}'
                                order by distNum;";
                var adderModeling = Db.Ado.SqlQuery<AddressCls>(sqlString).ToList();
                if (adderModeling.Count > 0)
                {
                    nowAddress = adderModeling[0].LocatNo;
                }
                else
                {
                    // 库内不存在空储位
                    nowAddress = "";
                }
            }
            return nowAddress;
        }
    }
}
Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs
@@ -52,11 +52,12 @@
        /// <param name="column">列</param>
        /// <param name="layer">层</param>
        /// <param name="locateNo">储位号</param>
        /// <param name="BindId">托盘绑定id</param>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        List<LocatDto> GetLocateList(string houseNo, string roadwayNo,string row, string column,string layer,string locateNo,int page,int limit,out int count);
        List<LocatDto> GetLocateList(string houseNo, string roadwayNo,string row, string column,string layer,string locateNo, string BindId,int page,int limit,out int count);
        /// <summary>
        /// 保存指定的储位
Wms/Wms/Controllers/BllAsnController.cs
@@ -503,7 +503,7 @@
        {
            try
            {
                var models = _PalletBindSvc.GetLocateList("W01",model.RoadwayNo,model.Row,model.Column,model.Layer,model.LocateNo,model.Page,model.Limit, out int count);
                var models = _PalletBindSvc.GetLocateList("W01",model.RoadwayNo,model.Row,model.Column,model.Layer,model.LocateNo,model.BindId,model.Page,model.Limit, out int count);
                return Ok(new { code = 0, count, msg = "获取指定储位信息", data = models });
            }