bklLiudl
2024-08-29 d58fd0905004b5c4abf138c8fb95a597130af928
bug修复
5个文件已修改
614 ■■■■■ 已修改文件
HTML/views/StatisticalReport/InOutBoundReports.html 162 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Pda/View/AsnSetting/productEnterQuantity.html 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/DataServer/StockServer.cs 405 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/StatisticalReport/InOutBoundReports.html
@@ -1,11 +1,13 @@
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>出入库报表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
        <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
        <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
        <link rel="stylesheet" href="../../css/public.css" media="all">
@@ -14,7 +16,6 @@
                margin-bottom: 1px;
                margin-right: 1px;
            }
        </style>
        
        <script>
@@ -27,6 +28,7 @@
            });
          </script>
    </head>
    <body id="body">
        <div class="layui-fluid" style="padding-bottom: 0;">
@@ -36,49 +38,51 @@
                        <div class="layui-inline zongdan" >
                            <label class="layui-form-label" style="width: 60px;">物料编码</label>
                            <div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
                                <input type="text" id="SkuNo"  name="SkuNo" placeholder="物料编码" autocomplete="off" class="layui-input">
                            <input type="text" id="SkuNo" name="SkuNo" placeholder="物料编码" autocomplete="off"
                                class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline zongdan" >
                            <label class="layui-form-label" style="width: 60px;">物料名称</label>
                            <div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
                                <input type="text" id="SkuName"  name="SkuName" placeholder="物料名称" autocomplete="off" class="layui-input">
                            <input type="text" id="SkuName" name="SkuName" placeholder="物料名称" autocomplete="off"
                                class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline mingxi">
                            <label class="layui-form-label" style="width: 60px;">批次号</label>
                            <div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
                                <input type="text" id="LotNo"  name="LotNo" placeholder="批次号" autocomplete="off" class="layui-input">
                            <input type="text" id="LotNo" name="LotNo" placeholder="批次号" autocomplete="off"
                                class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline mingxi">
                            <label class="layui-form-label" style="width: 60px;">托盘号</label>
                            <div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
                                <input type="text" id="PalletNo"  name="PalletNo" placeholder="托盘号" autocomplete="off" class="layui-input">
                            <input type="text" id="PalletNo" name="PalletNo" placeholder="托盘号" autocomplete="off"
                                class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline zhijian">
                            <label class="layui-form-label" style="width: 60px;">开始时间</label>
                            <div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
                                <input type="text" autocomplete="off" id="StartTime" class="layui-input"
                                    placeholder="开始时间">
                            <input type="text" autocomplete="off" id="StartTime" class="layui-input" placeholder="开始时间">
                            </div>
                        </div>
                        <div class="layui-inline zhijian">
                            <label class="layui-form-label" style="width: 60px;">结束时间</label>
                            <div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
                                <input type="text" autocomplete="off" id="EndTime" class="layui-input"
                                    placeholder="结束时间">
                            <input type="text" autocomplete="off" id="EndTime" class="layui-input" placeholder="结束时间">
                            </div>
                        </div>
                        <div class="layui-inline sousuo">
                            <button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
                        <button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit
                            lay-filter="LAY-app-contlist-search">
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索
                            </button>
                            <button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit
                                lay-filter="daochu">
                        <button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit lay-filter="daochu">
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>导出
                            </button> 
                        </div>
@@ -116,7 +120,8 @@
                                        <table id="LAY-app-content-list2" lay-filter="LAY-app-content-list2"></table>
                                        <!-- #region 自定义表头 -->
                                        <div class="headerSetIcon">
                                            <button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols2">
                                        <button class="layui-btn layui-btn-primary layui-btn-sm"
                                            data-type="customCols2">
                                                <i class="layui-icon">&#xe610;</i>
                                            </button>
                                        </div>
@@ -218,56 +223,6 @@
                // 表单需要的变量
                var infoOptions;
                //#region 原始非自定义列
                // infoOptions = {
                //     elem: '#LAY-app-content-list',
                //     height: 'full-164',
                //     id: 'LAY-app-content-list',
                //     page: true,
                //     limit: pageCnt,
                //     limits: pageLimits,
                //     even: true,
                //     cellMinWidth: 80, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
                //     cols:
                //     [[
                //         {
                //             title: '序号',  type: 'numbers',  fixed: 'left'
                //         },
                //         {
                //             field: 'LotNo', title: '批次号', align: 'center',
                //         },
                //         {
                //             field: 'SkuNo', title: '物料编码', align: 'center'
                //         },
                //         {
                //             field: 'SkuName', title: '物料名称', align: 'center',
                //         },
                //         {
                //             field: 'RQty', title: '入库数量', align: 'center'
                //         },
                //         {
                //             field: 'RFactQty', title: '已组数量', align: 'center',
                //         },
                //         {
                //             field: 'RCompleteQty', title: '完成数量', align: 'center'
                //         },
                //         {
                //             field: 'CQty', title: '出库数量', align: 'center'
                //         },
                //         {
                //             field: 'CAllotQty', title: '分配数量', align: 'center'
                //         },
                //         {
                //             field: 'CFactQty', title: '下架数量', align: 'center',
                //         },
                //         {
                //             field: 'CompleteQty', title: '拣货数量', align: 'center'
                //         },
                //     ]]
                // };
                //#endregion
                //#region 自定义表头
                var TotalColsArr = [[
                            {field: '',title: '序号',type:'numbers',fixed: 'left', "disabled": true},
@@ -362,81 +317,6 @@
                // 表单需要的变量
                var infoOptions2;
                //#region 原始非自定义列
                // infoOptions2 = {
                //     elem: '#LAY-app-content-list2',
                //     height: 'full-164',
                //     id: 'LAY-app-content-list2',
                //     page: true,
                //     limit: pageCnt,
                //     limits: pageLimits,
                //     even: true,
                //     cellMinWidth: 80, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
                //     cols:
                //     [[
                //     {
                //             title: '序号',  type: 'numbers',  fixed: 'left', width: 70
                //         },
                //         {
                //             field: 'ASNNo', title: '入库单号', align: 'center', width: 100
                //         },
                //         {
                //             field: 'SONo', title: '出库单号', align: 'center', width: 100
                //         },
                //         {
                //             field: 'LotNo', title: '批次号', align: 'center', width: 100
                //         },
                //         {
                //             field: 'SupplierLot', title: '供货批次', align: 'center', width: 100
                //         },
                //         {
                //             field: 'SkuNo', title: '物料编码', align: 'center', width: 100
                //         },
                //         {
                //             field: 'SkuName', title: '物料名称', align: 'center', width: 100
                //         },
                //         {
                //             field: 'PalletNo', title: '托盘号', align: 'center', width: 100
                //         },
                //         {
                //             field: 'LotText', title: '批次描述', align: 'center', width: 100
                //         },
                //         {
                //             field: 'CompleteTime', title: '入库时间', align: 'center', width: 160,
                //             templet: function(d) {
                //                 return formatDate(d.CompleteTime);
                //             },
                //         },
                //         {
                //             field: 'RQty', title: '入库数量', align: 'center', width: 100
                //         },
                //         {
                //             field: 'RFactQty', title: '已组数量', align: 'center',
                //         },
                //         {
                //             field: 'RCompleteQty', title: '完成数量', align: 'center', width: 100
                //         },
                //         {
                //             field: 'CCreateTime', title: '拣货时间', align: 'center',width: 160,
                //             templet: function(d) {
                //                 return formatDate(d.CCreateTime);
                //             },
                //         },
                //         {
                //             field: 'CQty', title: '出库数量', align: 'center', width: 100
                //         },
                //         {
                //             field: 'CAllotQty', title: '分配数量', align: 'center', width: 100
                //         },
                //         {
                //             field: 'CFactQty', title: '下架数量', align: 'center', width: 100
                //         },
                //         {
                //             field: 'CompleteQty', title: '拣货数量', align: 'center', width: 100
                //         },
                //     ]]
                // };
                //#endregion
                
                //获取明细信息
                //#region 自定义表头
@@ -604,8 +484,7 @@
                                var iframeWindow = window['layui-layer-iframe' + index],
                                    submitID = 'layuiadmin-app-form-edit',
                                    submit = layero.find('iframe').contents().find('#' + submitID);
                                    if(doing)
                                    {
                            if (doing) {
                                        doing = false;
                                        
                                        layer.close(index); //关闭弹层
@@ -717,4 +596,5 @@
            });
        </script>
    </body>
</html>
Pda/View/AsnSetting/productEnterQuantity.html
@@ -307,6 +307,18 @@
                            <tr>
                                <td>
                                    <div id="" class="layui-form-item layout-boxinfo">
                                        <label class="layui-form-label" lang>整托数量:</label>
                                        <div class="layui-input-block">
                                            <input id="FullQty" type="text" disabled placeholder="" autocomplete="off"
                                                class="layui-input">
                                        </div>
                                    </div>
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>
                                    <div id="" class="layui-form-item layout-boxinfo">
                                        <label class="layui-form-label" lang>规格/型号:</label>
                                        <div class="layui-input-block">
                                            <input id="Standard1" type="text" disabled placeholder="" autocomplete="off"
@@ -856,7 +868,7 @@
                    $("#Standard").val("");
                    $("#ImportFactQuantity").val("");
                    $("#BoxQty").val("");
                    // $("#STOCKCODE").val("");
                    //$("#FullQty").val("123");
                    // $("#BOXCODE").val("");
                    var param = {
@@ -873,9 +885,11 @@
                    });
                }
                else if (xianshiyemian == 1) {
                    // 数量
                    $("#ImportQuantity1").val("");
                    $("#Standard1").val("");
                    $("#ImportFactQuantity1").val("");
                    $("#FullQty").val("");
                    var param = {
                        Id: parseInt($("#goodSelect1").val())
@@ -887,6 +901,7 @@
                            $("#ImportQuantity1").val(res.data.Qty);
                            $("#Standard1").val(res.data.Standard);
                            $("#ImportFactQuantity1").val(res.data.FactQty + "");
                            $("#FullQty").val(res.data.UDF1);
                        }
                        else { }
                    });
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -895,12 +895,16 @@
                #region 采购计划,若是采购订单根据采购计划单自动生成入库单信息
                if (notice.Type == "1" && !string.IsNullOrEmpty(notice.OrderCode))
                {
                    // 获取采购总单信息
                    var planOrd = Db.Queryable<BllProcurePlanNotice>().First(it => it.OrderCode == notice.OrderCode && it.IsDel == "0");
                    //入库单明细
                    var noticeDetailList = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && m.ASNNo == notice.ASNNo).ToList();
                    var noticeDetailList = Db.Queryable<BllArrivalNoticeDetail>()
                        .Where(m => m.IsDel == "0" && m.ASNNo == notice.ASNNo).ToList();
                    foreach (var item in noticeDetailList)
                    {
                        //采购单明细
                        var planDetail = Db.Queryable<BllProcurePlanNoticeDetail>().First(it => it.OrderDetailCode == item.OrderDetailCode && it.IsDel == "0");
                        var planDetail = Db.Queryable<BllProcurePlanNoticeDetail>()
                            .First(it => it.ParentId == planOrd.Id && it.SkuNo == item.SkuNo && it.IsDel == "0");
                        planDetail.CompleteQty += item.CompleteQty;
                        if (planDetail.CompleteQty >= planDetail.Qty)
                        {
@@ -913,8 +917,7 @@
                        }
                        Db.Updateable(planDetail).ExecuteCommand();
                    }
                    //采购总单信息
                    var planOrd = Db.Queryable<BllProcurePlanNotice>().First(it => it.OrderCode == notice.OrderCode && it.IsDel == "0");
                    // 维护采购总单信息
                    var planDetailNum = Db.Queryable<BllProcurePlanNoticeDetail>().Count(m => m.IsDel == "0" && m.ParentId == planOrd.Id && m.Status != "2");
                    if (planDetailNum == 0)
                    {
@@ -931,7 +934,8 @@
                        }
                    }
                    //采购单明细
                    var planDetailList = Db.Queryable<BllProcurePlanNoticeDetail>().Where(it => it.ParentId == planOrd.Id && it.IsDel == "0" && it.CompleteQty < it.Qty).ToList();
                    var planDetailList = Db.Queryable<BllProcurePlanNoticeDetail>()
                        .Where(it => it.ParentId == planOrd.Id && it.IsDel == "0" && it.CompleteQty < it.Qty).ToList();
                    foreach (var item in planDetailList)
                    {
                        //判断有无正在执行的
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -106,6 +106,19 @@
                if (modelList.Count > 0)
                {
                    if (!string.IsNullOrWhiteSpace(modelList[0].PackagNo))
                    {
                        // 查询整托数量 此处UDF1用来存储整托数量。
                        var packagModel = Db.Queryable<SysPackag>().Where(m => m.PackagNo == modelList[0].PackagNo && m.IsDel == "0").First();
                        switch (packagModel.Level.ToString())
                        {
                            case "1": modelList[0].UDF1 = packagModel.L1Num.ToString(); break;
                            case "2": modelList[0].UDF1 = packagModel.L2Num.ToString(); break;
                            case "3": modelList[0].UDF1 = packagModel.L3Num.ToString(); break;
                            case "4": modelList[0].UDF1 = packagModel.L4Num.ToString(); break;
                            default: modelList[0].UDF1 = packagModel.L5Num.ToString(); break;
                        }
                    }
                    return modelList[0];
                }
@@ -277,7 +290,8 @@
            try
            {
                string sqlString = string.Empty;
                sqlString = "select b.SkuNo,b.SkuName,a.LotNo,a.Qty,a.PalletNo,a.Id from BllPalletBind a left join BllArrivalNoticeDetail b on a.ASNDetailNo = b.Id where a.IsDel = '0' and b.IsDel = '0' ";
                sqlString = "select b.SkuNo,b.SkuName,a.LotNo,a.Qty,a.PalletNo,a.Id from BllPalletBind a " +
                    "left join BllArrivalNoticeDetail b on a.ASNDetailNo = b.Id where a.IsDel = '0' and b.IsDel = '0' ";
                if (!string.IsNullOrEmpty(model.PalletNo))
                {
                    sqlString += $"and PalletNo = '{model.PalletNo}' and a.Status = '0' ";
Wms/WMS.BLL/DataServer/StockServer.cs
@@ -12,9 +12,12 @@
using Model.ModelDto.SysDto;
using Model.ModelVm.DataVm;
using Model.ModelVm.SysVm;
using MySqlConnector;
using SqlSugar;
using WMS.DAL;
using WMS.Entity.BllAsnEntity;
using WMS.Entity.BllQualityEntity;
using WMS.Entity.BllSoEntity;
using WMS.Entity.Context;
using WMS.Entity.DataEntity;
using WMS.Entity.SysEntity;
@@ -330,90 +333,92 @@
        /// <returns></returns>
        public List<TotalRecordDto> GetTotalRecord(string skuNo, string skuName, string lotNo, string startTime, string endTime)
        {
            //入库
            string rstr = "select LotNo,SkuNo,SkuName,SUM(Qty) RQty,SUM(FactQty) RFactQty,SUM(CompleteQty) RCompleteQty from BllArrivalNoticeDetail where IsDel = '0' ";
            //出库
            string cstr = "select LotNo,SkuNo,SkuName,SUM(Qty) CQty,SUM(FactQty) CFactQty,SUM(CompleteQty) CompleteQty,SUM(AllotQty) CAllotQty from BllExportNoticeDetail where IsDel = '0' ";
            //判断物料号是否为空
            if (!string.IsNullOrEmpty(skuNo))
            // 获取入库单明细信息
            var asnList = Db.Queryable<BllArrivalNoticeDetail>()
                .Where(m => m.IsDel == "0")
                .WhereIF(!string.IsNullOrEmpty(skuNo), a => a.SkuNo.Contains(skuNo))
                .WhereIF(!string.IsNullOrEmpty(skuName), a => a.SkuName.Contains(skuName))
                .WhereIF(!string.IsNullOrEmpty(lotNo), a => a.LotNo.Contains(lotNo))
                .WhereIF(!string.IsNullOrWhiteSpace(startTime), a => a.CreateTime >= Convert.ToDateTime(startTime))
                .WhereIF(!string.IsNullOrWhiteSpace(endTime), a => a.CreateTime <= Convert.ToDateTime(endTime).AddDays(1))
                .GroupBy(a => new { a.LotNo, a.SkuNo, a.SkuName })
                .Select(a => new TotalRecordDto()
            {
                rstr += " and SkuNo like @skuno";
                cstr += " and SkuNo like @skuno";
            }
            //判断物料名称是否为空
            if (!string.IsNullOrEmpty(skuName))
            {
                rstr += " and SkuName like @skuname";
                cstr += " and SkuName like @skuname";
            }
            //判断批次号是否为空
            if (!string.IsNullOrEmpty(lotNo))
            {
                rstr += " and LotNo like @lotno";
                cstr += " and LotNo like @lotno";
            }
            // liudl 时间不准确 暂时注释。
            if (!string.IsNullOrWhiteSpace(startTime))
            {
                rstr += " and UpdateTime >= @startTime";
                cstr += " and UpdateTime >= @startTime";
            }
            if (!string.IsNullOrWhiteSpace(endTime))
            {
                endTime = DateTime.Parse(endTime).AddDays(1).ToString();
                rstr += " and UpdateTime < @endTime";
                cstr += " and UpdateTime < @endTime";
            }
            rstr += " group by LotNo,SkuNo,SkuName";
            cstr += " group by LotNo,SkuNo,SkuName";
            //入库
            List<TotalRecordDto> totalHListData = Db.Ado.SqlQuery<TotalRecordDto>(rstr, new
            {
                skuno = "%" + skuNo + "%", //物料号
                skuname = "%" + skuName + "%", //物料名称
                lotno = "%" + lotNo + "%", //批次号
                startTime, //开始时间
                endTime //结束时间
            });
            List<TotalRecordDto> totalCListData = Db.Ado.SqlQuery<TotalRecordDto>(cstr, new
            {
                skuno = "%" + skuNo + "%", //物料号
                skuname = "%" + skuName + "%", //物料名称
                lotno = "%" + lotNo + "%", //批次号
                startTime, //开始时间
                endTime //结束时间
                    LotNo=a.LotNo,
                    SkuNo=a.SkuNo,
                    SkuName=a.SkuName,
                    RQty = SqlFunc.AggregateSumNoNull(a.Qty),
                    RFactQty = (decimal)SqlFunc.AggregateSum(a.FactQty),
                    RCompleteQty = (decimal)SqlFunc.AggregateSum(a.CompleteQty),
                    CQty = 0,
                    CFactQty = 0,
                    CAllotQty = 0,
                    CompleteQty = 0
            });
            //合并数据
            int a = 0;
            foreach (var h in totalHListData)
            // 获取出库单明细信息
            var soList = Db.Queryable<BllExportNoticeDetail>()
                .Where(m => m.IsDel == "0")
                .WhereIF(!string.IsNullOrEmpty(skuNo), a => a.SkuNo.Contains(skuNo))
                .WhereIF(!string.IsNullOrEmpty(skuName), a => a.SkuName.Contains(skuName))
                .WhereIF(!string.IsNullOrEmpty(lotNo), a => a.LotNo.Contains(lotNo))
                .WhereIF(!string.IsNullOrWhiteSpace(startTime), a => a.CreateTime >= Convert.ToDateTime(startTime))
                .WhereIF(!string.IsNullOrWhiteSpace(endTime), a => a.CreateTime <= Convert.ToDateTime(endTime).AddDays(1))
                .GroupBy(a => new { a.LotNo, a.SkuNo, a.SkuName })
                .Select(a => new TotalRecordDto()
            {
                if (a >= totalCListData.Count)
                    LotNo = a.LotNo,
                    SkuNo = a.SkuNo,
                    SkuName = a.SkuName,
                    RQty = 0,
                    RFactQty = 0,
                    RCompleteQty = 0,
                    CQty = SqlFunc.AggregateSumNoNull(a.Qty),
                    CFactQty = (decimal)SqlFunc.AggregateSum(a.FactQty),
                    CAllotQty = (decimal)SqlFunc.AggregateSum(a.AllotQty),
                    CompleteQty = (decimal)SqlFunc.AggregateSum(a.CompleteQty),
                });
            // 获取取样拣货信息
            var samplingList = Db.Queryable<BllSamplingDetails>()
                .Where(m => m.IsDel == "0")
                .WhereIF(!string.IsNullOrEmpty(skuNo), a => a.SkuNo.Contains(skuNo))
                .WhereIF(!string.IsNullOrEmpty(skuName), a => a.SkuName.Contains(skuName))
                .WhereIF(!string.IsNullOrEmpty(lotNo), a => a.LotNo.Contains(lotNo))
                .WhereIF(!string.IsNullOrWhiteSpace(startTime), a => a.CreateTime >= Convert.ToDateTime(startTime))
                .WhereIF(!string.IsNullOrWhiteSpace(endTime), a => a.CreateTime <= Convert.ToDateTime(endTime).AddDays(1))
                .GroupBy(a => new { a.LotNo, a.SkuNo, a.SkuName })
                .Select(a => new TotalRecordDto()
                {
                    continue;
                }
                foreach (var c in totalCListData)
                {
                    //判断出库是否拥有相同批次 且物料相同
                    if (h.LotNo == c.LotNo || h.LotNo.Contains(c.LotNo) && h.SkuNo == c.SkuNo && h.SkuName == c.SkuName)
                    {
                        h.CQty = c.CQty; //出库数量
                        h.CAllotQty = c.CAllotQty; //分配数量
                        h.CFactQty = c.CFactQty; //下架数量
                        h.CompleteQty = c.CompleteQty; //拣货数量
                                                       //h.SONo = c.SONo; //出库单号
                    LotNo = a.LotNo,
                    SkuNo = a.SkuNo,
                    SkuName = a.SkuName,
                    RQty = 0,
                    RFactQty = 0,
                    RCompleteQty = 0,
                    CQty = (decimal)SqlFunc.AggregateSum(a.CompleteQty),
                    CFactQty = 0,
                    CAllotQty = 0,
                    CompleteQty = (decimal)SqlFunc.AggregateSum(a.CompleteQty),
                });
                        a += 1;
            // 合并集合
            var dataList = Db.UnionAll(asnList, soList, samplingList)
                .GroupBy(a => new { a.LotNo, a.SkuNo, a.SkuName })
                .Select(a => new TotalRecordDto()
                {
                    LotNo = a.LotNo,
                    SkuNo = a.SkuNo,
                    SkuName = a.SkuName,
                    RQty = SqlFunc.AggregateSumNoNull(a.RQty),
                    RFactQty = (decimal)SqlFunc.AggregateSum(a.RFactQty),
                    RCompleteQty = (decimal)SqlFunc.AggregateSum(a.RCompleteQty),
                    CQty = SqlFunc.AggregateSumNoNull(a.CQty),
                    CFactQty = (decimal)SqlFunc.AggregateSum(a.CFactQty),
                    CAllotQty = (decimal)SqlFunc.AggregateSum(a.CAllotQty),
                    CompleteQty = (decimal)SqlFunc.AggregateSum(a.CompleteQty)
                }).ToList();
                        break;
                    }
                }
            }
            return totalHListData;
            return dataList;
        }
        /// <summary>
@@ -426,131 +431,139 @@
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns></returns>
        public List<TotalRecordDto> GetDetailedRecord(string skuNo, string skuName, string lotNo, string palletNo,
            string startTime, string endTime)
        public List<TotalRecordDto> GetDetailedRecord(string skuNo, string skuName, string lotNo, string palletNo,string startTime, string endTime)
        {
            //入库
            string rstr = "select notice.ASNNo,bind.LotNo,notice.SkuNo,notice.SkuName,bind.PalletNo,bind.Qty RQty,bind.Qty RFactQty,bind.Qty  RCompleteQty,bind.CompleteTime,notice.LotText,notice.SupplierLot,bind.CompleteTime from BllPalletBind bind left join BllArrivalNoticeDetail notice on bind.ASNDetailNo = notice.Id where bind.IsDel = '0' and notice.IsDel = '0'  ";
            //出库
            string cstr = "select notice.SONo,allot.LotNo,allot.TaskNo CTaskNo,allot.SkuNo,allot.SkuName,allot.PalletNo," +
                "allot.UpdateTime CCreateTime,allot.Qty CQty,allot.Qty CAllotQty,Allot.Qty CFactQty,Allot.CompleteQty CompleteQty," +
                "allot.LotText,allot.SupplierLot " +
                "from BllExportAllot allot left join BllExportNoticeDetail notice on allot.SODetailNo = notice.Id " +
                "where allot.IsDel = '0' and notice.IsDel = '0' ";
            // 获取入库单明细信息
            var asnList = Db.Queryable<BllPalletBind,BllArrivalNoticeDetail>
                ((tb1,tb2)=>new JoinQueryInfos(
                 JoinType.Left, tb1.ASNDetailNo == tb2.Id
                ))
                .Where((tb1,tb2) => tb1.IsDel == "0" && tb2.IsDel == "0")
                .WhereIF(!string.IsNullOrWhiteSpace(startTime), tb1 => tb1.CompleteTime >= Convert.ToDateTime(startTime))
                .WhereIF(!string.IsNullOrWhiteSpace(endTime), tb1 => tb1.CompleteTime <= Convert.ToDateTime(endTime).AddDays(1))
                .WhereIF(!string.IsNullOrEmpty(palletNo), tb1 => tb1.PalletNo.Contains(palletNo))
                .WhereIF(!string.IsNullOrEmpty(skuNo), (tb1,tb2) => tb2.SkuNo.Contains(skuNo))
                .WhereIF(!string.IsNullOrEmpty(skuName), (tb1, tb2) => tb2.SkuName.Contains(skuName))
                .WhereIF(!string.IsNullOrEmpty(lotNo), (tb1, tb2) => tb2.LotNo.Contains(lotNo))
                //.GroupBy((tb1,tb2) => new { tb2.LotNo, tb2.SkuNo, tb2.SkuName })
                .Select((tb1,tb2) => new TotalRecordDto()
                {
                    ASNNo = tb2.ASNNo,
                    LotNo = tb1.LotNo,
                    SkuNo = tb2.SkuNo,
                    SkuName = tb2.SkuName,
                    PalletNo = tb1.PalletNo,
                    RQty = tb1.Qty,
                    RFactQty = tb1.Qty,
                    RCompleteQty = tb1.Qty,
                    CompleteTime = tb1.CompleteTime,
                    LotText = tb1.LotText,
                    SupplierLot = tb2.SupplierLot,
            //判断物料号是否为空
            if (!string.IsNullOrEmpty(skuNo))
            {
                rstr += " and notice.SkuNo like @skuno";
                cstr += " and allot.SkuNo like @skuno";
            }
            //判断物料名称是否为空
            if (!string.IsNullOrEmpty(skuName))
            {
                rstr += " and notice.SkuName like @skuname";
                cstr += " and allot.SkuName like @skuname";
            }
            //判断批次号是否为空
            if (!string.IsNullOrEmpty(lotNo))
            {
                rstr += " and notice.LotNo like @lotno";
                cstr += " and allot.LotNo like @lotno";
            }
            //判断托盘是否为空
            if (!string.IsNullOrEmpty(palletNo))
            {
                rstr += " and bind.PalletNo like @palletno";
                cstr += " and allot.PalletNo like @palletno";
            }
            if (!string.IsNullOrWhiteSpace(startTime))
            {
                rstr += " and bind.CompleteTime >= @startTime";
                cstr += " and allot.UpdateTime >= @startTime";
            }
            if (!string.IsNullOrWhiteSpace(endTime))
            {
                endTime = DateTime.Parse(endTime).AddDays(1).ToString();
                rstr += " and bind.CompleteTime < @endTime";
                cstr += " and allot.UpdateTime < @endTime";
            }
            //rstr += " group by bind.LotNo,bind.SkuNo,bind.SkuName";
            //cstr += " group by LotNo,SkuNo,SkuName";
            //入库
            List<TotalRecordDto> totalRList = Db.Ado.SqlQuery<TotalRecordDto>(rstr, new
            {
                isdel = "0", //是否删除
                skuno = "%" + skuNo + "%", //物料号
                skuname = "%" + skuName + "%", //物料名称
                lotno = "%" + lotNo + "%", //批次号
                palletno = "%" + palletNo + "%", //托盘号
                startTime = startTime,
                endTime = endTime
            });
            //出库
            List<TotalRecordDto> totalCList = Db.Ado.SqlQuery<TotalRecordDto>(cstr, new
            {
                isdel = "0", //是否删除
                skuno = "%" + skuNo + "%", //物料号
                skuname = "%" + skuName + "%", //物料名称
                lotno = "%" + lotNo + "%", //批次号
                palletno = "%" + palletNo + "%", //托盘号
                startTime = startTime,
                endTime = endTime
                    SONo = "",
                    CTaskNo = "",
                    CCreateTime = null,
                    CQty = 0,
                    CFactQty = 0,
                    CAllotQty = 0,
                    CompleteQty = 0
            });
            //合并
            foreach (var c in totalCList)
            // 获取出库单明细信息
            var soList = Db.Queryable<BllExportAllot, BllExportNoticeDetail>
                (((tb1, tb2) => new JoinQueryInfos(
                 JoinType.Left, tb1.SODetailNo == tb2.Id
                )))
                .Where((tb1, tb2) => tb1.IsDel == "0" && tb2.IsDel == "0")
                .WhereIF(!string.IsNullOrWhiteSpace(startTime), tb1 => tb1.UpdateTime >= Convert.ToDateTime(startTime))
                .WhereIF(!string.IsNullOrWhiteSpace(endTime), tb1 => tb1.UpdateTime <= Convert.ToDateTime(endTime).AddDays(1))
                .WhereIF(!string.IsNullOrEmpty(palletNo), tb1 => tb1.PalletNo.Contains(palletNo))
                .WhereIF(!string.IsNullOrEmpty(skuNo), tb1 => tb1.SkuNo.Contains(skuNo))
                .WhereIF(!string.IsNullOrEmpty(skuName), tb1 => tb1.SkuName.Contains(skuName))
                .WhereIF(!string.IsNullOrEmpty(lotNo), tb1 => tb1.LotNo.Contains(lotNo))
                 //.GroupBy(a => new { a.LotNo, a.SkuNo, a.SkuName })
                 .Select((tb1, tb2) => new TotalRecordDto()
            {
                int i = 0;
                foreach (var r in totalRList)
                {
                    i += 1;
                    //判断入库中是否存在出库中的批次物料托盘
                    if (r.PalletNo == c.PalletNo && r.LotNo == c.LotNo && r.SkuNo == c.SkuNo && r.SkuName == c.SkuName)
                    {
                        if (r.SONo != null)
                        {
                            if (r.SONo != c.SONo)
                            {
                                totalRList.Add(c);
                            }
                        }
                        if (c.CTaskNo != "" && r.SONo == null || r.SONo == c.SONo)
                        {
                            r.SONo = c.SONo; //出库单号
                            r.CQty += c.CQty; //出库数量
                            r.CAllotQty += c.CAllotQty; //分配数量
                            r.CFactQty += c.CFactQty; //下架数量
                            r.CompleteQty += c.CompleteQty; //拣货数量
                            r.CCreateTime = c.CCreateTime; //拣货时间
                        }
                        if (r.CompleteTime == null)
                        {
                            r.RCompleteQty = 0;
                        }
                        break;
                    }
                    if (i == totalRList.Count)
                    {
                        totalRList.Add(c);
                        break;
                    }
                }
            }
            if (totalCList.Count == 0)
            {
                foreach (var r in totalRList)
                {
                    if (r.CompleteTime == null)
                    {
                        r.RCompleteQty = 0;
                        continue;
                    }
                }
            }
                     ASNNo = "",
                     LotNo = tb1.LotNo,
                     SkuNo = tb2.SkuNo,
                     SkuName = tb2.SkuName,
                     PalletNo = tb1.PalletNo,
                     RQty = 0,
                     RFactQty = 0,
                     RCompleteQty = 0,
                     CompleteTime = null,
                     LotText = tb1.LotText,
                     SupplierLot = tb2.SupplierLot,
            return totalRList;
                     SONo = tb2.SONo,
                     CTaskNo = tb1.TaskNo,
                     CCreateTime = tb1.UpdateTime,
                     CQty = tb1.Qty,
                     CFactQty = tb1.Qty,
                     CAllotQty = tb1.Qty,
                     CompleteQty = (decimal)tb1.CompleteQty
                 });
            // 获取取样拣货信息
            var samplingList = Db.Queryable<BllSamplingDetails>()
                .Where(m => m.IsDel == "0")
                .WhereIF(!string.IsNullOrEmpty(skuNo), a => a.SkuNo.Contains(skuNo))
                .WhereIF(!string.IsNullOrEmpty(skuName), a => a.SkuName.Contains(skuName))
                .WhereIF(!string.IsNullOrEmpty(lotNo), a => a.LotNo.Contains(lotNo))
                .WhereIF(!string.IsNullOrEmpty(palletNo), a => a.PalletNo.Contains(palletNo))
                .WhereIF(!string.IsNullOrWhiteSpace(startTime), a => a.CreateTime >= Convert.ToDateTime(startTime))
                .WhereIF(!string.IsNullOrWhiteSpace(endTime), a => a.CreateTime <= Convert.ToDateTime(endTime).AddDays(1))
                //.GroupBy(a => new { a.LotNo, a.SkuNo, a.SkuName })
                .Select(a => new TotalRecordDto()
                {
                    ASNNo = "",
                    LotNo = a.LotNo,
                    SkuNo = a.SkuNo,
                    SkuName = a.SkuName,
                    PalletNo = a.PalletNo,
                    RQty = 0,
                    RFactQty = 0,
                    RCompleteQty = 0,
                    CompleteTime = null,
                    LotText = "",
                    SupplierLot = "",
                    SONo = a.QcNo,
                    CTaskNo = "",
                    CCreateTime = a.CreateTime,
                    CQty = (decimal)a.CompleteQty,
                    CFactQty = 0,
                    CAllotQty = 0,
                    CompleteQty = (decimal)a.CompleteQty
                });
            // 合并集合
            var dataList = Db.UnionAll(asnList, soList, samplingList)
                .Select(a => new TotalRecordDto()
                {
                    ASNNo = a.ASNNo,
                    LotNo = a.LotNo,
                    SkuNo = a.SkuNo,
                    SkuName = a.SkuName,
                    PalletNo = a.PalletNo,
                    RQty = a.RQty,
                    RFactQty = a.RFactQty,
                    RCompleteQty = a.RCompleteQty,
                    CompleteTime = a.CompleteTime,
                    LotText = a.LotText,
                    SupplierLot = a.SupplierLot,
                    SONo = a.SONo,
                    CTaskNo = a.CTaskNo,
                    CCreateTime = a.CCreateTime,
                    CQty = a.CQty,
                    CFactQty = a.CFactQty,
                    CAllotQty = a.CAllotQty,
                    CompleteQty = a.CompleteQty
                }).ToList();
            return dataList;
        }
        #endregion