chengsc
2024-10-15 86985a3e211ab4cc1e94a696c15a6f77d21c462a
修改出库单据问题
6个文件已修改
178 ■■■■ 已修改文件
HTML/views/SOSetting/ExportNotice.html 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Model/ModelDto/BllSoDto/ExportNoticeDetailDto.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllSoServer/ExportNoticeDetailServer.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/SOSetting/ExportNotice.html
@@ -387,7 +387,11 @@
                    <script type="text/html" id="table-content-list2">
                        {{# function GetBtn2(d){
                                var html = '';
                                if((d.StatusZ == "2" || d.StatusZ == "3"|| d.StatusZ == "4") && (d.Type == "1" || d.Type == "2" || d.Type == "3") && d.IsWave == "0"){
                                    html += `<a class="layui-btn layui-btn-normal layui-btn-xs shoufenClass" lay-event="wan">
                                        <i class="layui-icon layui-icon-ok"></i>手动分配
                                    </a>`;
                                }
                                if((d.Status == "0" ||d.Status == "1") && d.Qty > d.AllotQty && d.IsWave == "0"){ 
                                    html += `<a class="layui-btn layui-btn-normal layui-btn-xs shoufenClass" lay-event="wan">
                                                <i class="layui-icon layui-icon-ok"></i>手动分配
Wms/Model/ModelDto/BllSoDto/ExportNoticeDetailDto.cs
@@ -19,6 +19,15 @@
        /// Desc:出库单号
        /// </summary>           
        public string SONo { get; set; }
        /// <summary>
        /// Desc:单据类型
        /// </summary>
        public string Type { get; set; }
        /// <summary>
        /// Desc:总单状态
        /// </summary>
        public string StatusZ { get; set; }
        /// <summary>
        /// Desc:物料编码
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -2247,29 +2247,29 @@
                            factQty += box.Qty;
                            boxFullQty += box.Qty;
                        }
                        if (boxFullQty > bNum)
                        {
                            throw new Exception($"绑定失败,{g.Key}箱码绑定数量大于该物品包装数量!");
                        }
                        //if (boxFullQty > bNum)
                        //{
                        //    throw new Exception($"绑定失败,{g.Key}箱码绑定数量大于该物品包装数量!");
                        //}
                    }
                    Db.Updateable(boxInfoList).ExecuteCommand();
                    // 更新托盘绑定表
                    bind.Qty += factQty;
                }
                if (bind.FullQty < bind.Qty && isDeposit == 0 && isTextTable == 0)
                {
                    throw new Exception("托盘绑定数量已超出该物料包装数量");
                }
                //if (bind.FullQty < bind.Qty && isDeposit == 0 && isTextTable == 0)
                //{
                //    throw new Exception("托盘绑定数量已超出该物料包装数量");
                //}
                if (bind.FullQty == bind.Qty)
                if (bind.FullQty <= bind.Qty)
                {
                    bind.BitPalletMark = "0";
                }
                if (bind.Qty > pNum && isDeposit == 0 && isTextTable == 0)
                {
                    throw new Exception($"绑定失败,{bind.PalletNo}托盘绑定数量大于该物品托盘包装数量!");
                }
                //if (bind.Qty > pNum && isDeposit == 0 && isTextTable == 0)
                //{
                //    throw new Exception($"绑定失败,{bind.PalletNo}托盘绑定数量大于该物品托盘包装数量!");
                //}
                Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand();
                // 更改入库单明细已组数量
Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -520,6 +520,7 @@
                    Db.Updateable(pallet).ExecuteCommand();
                    //修改出库单明细拣货数量
                    noticeDetail.CompleteQty += pickQty;
                    noticeDetail.Status = "2";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                    var num = Db.Queryable<BllExportNoticeDetail>()
@@ -527,7 +528,10 @@
                    if (num <= 0)
                    {
                        notice.Status = "4"; //更改为执行完成
                        noticeDetail.Status = "3";
                        Db.Updateable(noticeDetail).ExecuteCommand();
                    }
                    //修改出库单信息
                    Db.Updateable(notice).ExecuteCommand();
                }
@@ -739,6 +743,7 @@
                    }
                    //修改出库单明细拣货数量
                    noticeDetail.CompleteQty += pickQty;
                    noticeDetail.Status = "2";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                    var num = Db.Queryable<BllExportNoticeDetail>()
@@ -746,6 +751,9 @@
                    if (num <= 0)
                    {
                        notice.Status = "4"; //更改为执行完成
                        noticeDetail.Status = "3";
                        Db.Updateable(noticeDetail).ExecuteCommand();
                    }
                    //修改出库单信息
                    Db.Updateable(notice).ExecuteCommand();
@@ -940,6 +948,7 @@
                //修改出库单明细拣货数量
                noticeDetail.CompleteQty += int.Parse(PickQty);
                noticeDetail.Status = "2";
                Db.Updateable(noticeDetail).ExecuteCommand();
                var num = Db.Queryable<BllExportNoticeDetail>()
@@ -947,6 +956,8 @@
                if (num <= 0)
                {
                    notice.Status = "4"; //更改为执行完成
                    noticeDetail.Status = "3";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                }
                //修改出库单信息
                Db.Updateable(notice).ExecuteCommand();
@@ -3857,10 +3868,14 @@
                {
                    throw new Exception("未查询到该出库单的信息");
                }
                if (notice.Type != "1" && notice.Type != "2" && notice.Type != "3")
                {
                if (notice.Status != "3")
                {
                    throw new Exception("出库单的状态不是正在执行,不能拣货");
                }
                }
                //出库单明细
                var noticeDetail = Db.Queryable<BllExportNoticeDetail>()
                    .First(m => m.IsDel == "0" && m.Id == int.Parse(soDetailId));
@@ -3897,7 +3912,7 @@
                #region 拼托信息
                var sdId = 0;
                bool isNew = false;
                var pinStockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew && m.SkuNo == allot.SkuNo && m.LotNo == allot.LotNo);
                var pinStockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew);
                if (pinStockDetail != null)
                {
                    if (palletNo != palletNoNew)//非整托拣货
@@ -4068,6 +4083,7 @@
                   
                    //修改出库单明细拣货数量
                    noticeDetail.CompleteQty += pickQty;
                    noticeDetail.Status = "2";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                    var num = Db.Queryable<BllExportNoticeDetail>()
@@ -4075,6 +4091,8 @@
                    if (num <= 0)
                    {
                        notice.Status = "4"; //更改为执行完成
                        noticeDetail.Status = "3";
                        Db.Updateable(noticeDetail).ExecuteCommand();
                    }
                    //修改出库单信息
                    Db.Updateable(notice).ExecuteCommand();
@@ -4083,7 +4101,7 @@
                {
                    var biaoShi = "0";//0:整箱拣货、1:散支拣货、2:数量拣货
                    List<DataBoxInfo> boxInfos;
                    var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == boxNo);
                    var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == boxNo && m.StockDetailId == stockDetail.Id);
                    if (boxInfo.Count() == 0)
                    {
                        throw new Exception("未查询到该箱码及追溯码的信息");
@@ -4220,6 +4238,8 @@
                        }
                        else//数量拣货
                        {
                            var boxInfo2 = Db.Queryable<DataBoxInfo>().First(m => m.IsDel == "0" && m.BoxNo == boxNo && m.StockDetailId == sdId);
                            if (decimal.Parse(pickQty1) == item.Qty)
                            {
                                //修改库存箱码明细
@@ -4231,9 +4251,53 @@
                            }
                            else
                            {
                                if (boxInfo2 == null)
                                {
                                    var dataBoxInfo = new DataBoxInfo()
                                    {
                                        StockDetailId = sdId,
                                        BindNo = item.BindNo,
                                        BoxNo = item.BoxNo,
                                        BoxNo2 = item.BoxNo2,
                                        BoxNo3 = item.BoxNo3,
                                        PalletNo = item.PalletNo,
                                        PalletNo2 = item.PalletNo2,
                                        PalletNo3 = item.PalletNo3,
                                        Qty = decimal.Parse(pickQty1),
                                        FullQty = item.FullQty,
                                        Status = "4",
                                        LotNo = item.LotNo,
                                        LotText = item.LotText,
                                        SkuNo = item.SkuNo,
                                        SkuName = item.SkuName,
                                        Standard = item.Standard,
                                        ProductionTime = item.ProductionTime,
                                        SupplierLot = item.SupplierLot,
                                        InspectMark = item.InspectMark,
                                        BitBoxMark = "1",
                                        InspectStatus = item.InspectStatus,
                                        InspectTime = item.InspectTime,
                                    };
                                    Db.Insertable(dataBoxInfo).ExecuteCommand();
                                }
                                else
                                {
                                    boxInfo2.Qty += decimal.Parse(pickQty1);
                                    item.BitBoxMark = boxInfo2.Qty>= boxInfo2.FullQty? "0":"1" ;//零箱标识
                                    Db.Updateable(boxInfo2).ExecuteCommand();
                                }
                                item.Qty -= decimal.Parse(pickQty1);
                                item.BitBoxMark = "1";//零箱标识
                                if (item.Qty<=0)
                                {
                                    Db.Deleteable(item).ExecuteCommand();
                                }
                                else
                                {
                                Db.Updateable(item).ExecuteCommand();
                                }
                            }
                            pickQty += int.Parse(pickQty1);
@@ -4300,6 +4364,7 @@
                    }
                    //修改出库单明细拣货数量
                    noticeDetail.CompleteQty += pickQty;
                    noticeDetail.Status = "2";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                    var num = Db.Queryable<BllExportNoticeDetail>()
@@ -4307,17 +4372,21 @@
                    if (num <= 0)
                    {
                        notice.Status = "4"; //更改为执行完成
                        noticeDetail.Status = "3";
                        Db.Updateable(noticeDetail).ExecuteCommand();
                    }
                    //修改出库单信息
                    Db.Updateable(notice).ExecuteCommand();
                }
                if (isNew)
                {
                    sd.Qty = pickQty;
                    sd.LockQty = pickQty;
                    var sd2 = Db.Queryable<DataStockDetail>().First(m=>m.Id == sdId);
                    sd2.Qty = pickQty;
                    sd2.LockQty = pickQty;
                    Db.Updateable(sd).ExecuteCommand();
                    Db.Updateable(sd2).ExecuteCommand();
                }
                else
                {
@@ -4633,6 +4702,7 @@
                //修改出库单明细拣货数量
                noticeDetail.CompleteQty += int.Parse(PickQty);
                noticeDetail.Status = "2";
                Db.Updateable(noticeDetail).ExecuteCommand();
                var num = Db.Queryable<BllExportNoticeDetail>()
@@ -4640,6 +4710,8 @@
                if (num <= 0)
                {
                    notice.Status = "4"; //更改为执行完成
                    noticeDetail.Status = "3";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                }
                //修改出库单信息
                Db.Updateable(notice).ExecuteCommand();
Wms/WMS.BLL/BllSoServer/ExportNoticeDetailServer.cs
@@ -40,12 +40,15 @@
                    .LeftJoin<SysPackag>((a,b)=> a.PackagNo == b.PackagNo)
                    .LeftJoin<SysUserInfor>((a,b,c)=> a.CreateUser == c.Id)
                    .LeftJoin<SysUserInfor>((a,b,c,d)=> a.UpdateUser == d.Id)
                    .Select((a, b, c, d) => new ExportNoticeDetailDto()
                    .LeftJoin<BllExportNotice>((a, b, c, d, e) => a.SONo == e.SONo)
                    .Select((a, b, c, d, e) => new ExportNoticeDetailDto()
                    {
                        Id = a.Id,
                        Status = a.Status,
                        Origin = notice.Origin,
                        SONo = a.SONo,
                        Type = e.Type,
                        StatusZ = e.Status,
                        SkuNo = a.SkuNo,
                        SkuName = a.SkuName,
                        Standard = a.Standard,
Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -433,12 +433,12 @@
                        inspectStatus = "0";
                        break;
                    case "4"://不合格品出库
                        skuType = "(0,1,2,3)";
                        skuType = "(0,1,2,3,4)";
                        inspectStatus = "2";
                        break;
                    case "5"://中间品出库
                        skuType = "(4)";
                        inspectStatus = "0,1";
                        inspectStatus = "1";
                        break;
                    case "6"://代储出库
                        skuType = "(0,1,2,3,4)";
@@ -3217,6 +3217,14 @@
                {
                    throw new Exception("获取失败,未找到指定出库单!");
                }
                var notice = Db.Queryable<BllExportNotice>().First(a => a.SONo == detail.SONo);
                if (notice == null)
                {
                    throw new Exception("获取失败,未找到指定出库单!");
                }
                if (notice.Type != "1" && notice.Type != "2" && notice.Type != "3")
                {
                if (detail.Status != "0" && detail.Status != "1" && detail.AllotQty >= detail.Qty)
                {
                    throw new Exception("获取失败,出库单状态不是等待执行或分配中!");
@@ -3225,15 +3233,13 @@
                {
                    throw new Exception("获取失败,出库单已分配完成!");
                }
                var notice = Db.Queryable<BllExportNotice>().First(a => a.SONo == detail.SONo);
                if (notice == null)
                {
                    throw new Exception("获取失败,未找到指定出库单!");
                }
                if (notice.Status == "3" && detail.AllotQty >= detail.Qty || notice.Status == "4" || notice.Status == "5")
                {
                    throw new Exception("获取失败,出库单状态不允许!");
                }
                }
                #endregion
                Expression<Func<DataStockDetail, bool>> item = Expressionable.Create<DataStockDetail>()
@@ -3284,20 +3290,22 @@
                {
                    throw new Exception("操作失败,未找到指定出库单详情!");
                }
                if (detail.AllotQty >= detail.Qty || (detail.Status != "0" && detail.Status != "1"))
                {
                    throw new Exception("操作失败,出库单已分配完成!");
                }
                var notice = Db.Queryable<BllExportNotice>().First(a => a.IsDel == "0" && a.SONo == detail.SONo);
                if (notice == null)
                {
                    throw new Exception("操作失败,未找到指定出库单!");
                }
                if (notice.Type != "1" && notice.Type != "2" && notice.Type !="3")
                {
                    if (detail.AllotQty >= detail.Qty || (detail.Status != "0" && detail.Status != "1"))
                    {
                        throw new Exception("操作失败,出库单已分配完成!");
                    }
                if (notice.Status == "3" && detail.AllotQty >= detail.Qty || notice.Status == "4" || notice.Status == "5")
                {
                    throw new Exception("操作失败,出库单已分配完成!");
                }
                #endregion
                //单据明细需要的出库数量
                var needQty = detail.Qty - detail.AllotQty;
@@ -3307,6 +3315,11 @@
                {
                    throw new Exception("操作失败,出库数量与计划数量不一致!");
                }
                }
                #endregion
                var stockIds = model.StockList.Select(a => a.StockId).ToList();
                //库存明细
                var stockList = Db.Queryable<DataStockDetail>().Where(a => stockIds.Contains(a.Id)).ToList();
@@ -3315,7 +3328,7 @@
                var allots = Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && m.SODetailNo == detail.Id && m.Status == "0").ToList();
                //库存总表
                //var stockz = Db.Queryable<DataStock>().First(d => d.IsDel == "0" && d.SkuNo == detail.SkuNo && d.LotNo == detail.LotNo);
                var stockz = Db.Queryable<DataStock>().First(d => d.IsDel == "0" && d.SkuNo == detail.SkuNo && d.LotNo == detail.LotNo);
                var allotList = new List<BllExportAllot>();
                decimal outQtys = 0;
@@ -3352,7 +3365,7 @@
                            IsBelt = stock.IsBelt,
                            Qty = st.Qty,
                            CompleteQty = 0,
                            Status = "0",
                            Status = notice.Status == "4"? "2":"0",
                            LogisticsId = notice.LogisticsId,
                            IsAdvance = "0",
                            OutMode = "",//出库口
@@ -3371,11 +3384,12 @@
                    //库存明细
                    stock.LockQty += st.Qty;
                    stock.Status = stock.LockQty == stock.Qty ? "2" : "1";
                    if (detail.AllotQty+ st.Qty > detail.Qty)
                    {
                    //库存总表
                    //stockz.LockQty += st.Qty;
                    //Db.Updateable(stockz).ExecuteCommand();
                        stockz.LockQty += (decimal)detail.AllotQty + st.Qty - detail.Qty;
                        Db.Updateable(stockz).ExecuteCommand();
                    }
                    Db.Updateable(stock).UpdateColumns(it => new { it.LockQty, it.Status }).ExecuteCommand();
                    outQtys += st.Qty;