Преглед изворни кода

包装单一览表=>新增线号搜索, 30s刷新(包含线号搜索), 商标物料描述,商标变更物料描述和出水距合并单元格

李士越 пре 1 година
родитељ
комит
9a0b7f717c
2 измењених фајлова са 95 додато и 19 уклоњено
  1. 10 8
      wwwroot/main/packingform/index.ashx
  2. 85 11
      wwwroot/main/packingform/index.html

+ 10 - 8
wwwroot/main/packingform/index.ashx

@@ -15,14 +15,14 @@ public class index : IHttpHandler
 
         using (IDataAccess conn = DataAccess.Create())
         {
-
-            DataTable dt = conn.ExecuteDatatable(@"
-				SELECT
+            string SqlStr = @"SELECT
 					M.PACKINGLINE AS 线号,
 					G.GOODSCODE AS 产品型号,
 					G.OUTLETDISTANCE AS 出水距,
 					L.LOGONAME AS 商标,
+					G.MATERIALREMARK AS 商标物料描述,
 					NVL( ML.LOGONAME, '' ) AS 商标变更,
+					(SELECT MATERIALREMARK FROM TP_MST_GOODSLOGOSAP WHERE LOGOID= ML.LOGOID AND GOODSCODE=G.GOODSCODE) AS 商标变更物料描述,
 					GM.MATERIALCODE AS 物料编码,
 					M.PLATENUM AS 出库数量,
 					M.OUTNUM AS 已出数量,
@@ -35,11 +35,13 @@ public class index : IHttpHandler
 					LEFT JOIN TP_MST_LOGO L ON L.LOGOID = G.LOGOID
 					LEFT JOIN TP_MST_LOGO ML ON ML.LOGOID = M.LOGOID 
 				WHERE
-					M.VALUEFLAG = '1' AND M.STATUS < 2 
-					--AND TRUNC( M.CREATETIME ) = TRUNC( SYSDATE )
-				ORDER BY M.STATUS,M.PACKINGLINE, M.begintime
-				"
-            );
+					M.VALUEFLAG = '1' AND M.STATUS < 2 ";
+            if (!string.IsNullOrEmpty(context.Request["linenumber"].ToString()))
+            {
+                SqlStr += " AND M.PACKINGLINE=" + context.Request["linenumber"].ToString();
+            }
+            SqlStr += " ORDER BY M.STATUS,G.OUTLETDISTANCE";
+            DataTable dt = conn.ExecuteDatatable(SqlStr);
 
             string jsonStr = new JsonResult(dt).ToJson();
             context.Response.Write(jsonStr);

+ 85 - 11
wwwroot/main/packingform/index.html

@@ -34,9 +34,11 @@
             <div id="toolbar" class="pb-4">
                 <form id="formSearch" class="form-inline">
                     <div class="form-group pr-2">
-                        <div>状态:</div>
-                        <select id="状态" name="状态" class="custom-select" style="width:120px;">
+                        <div>线号:</div>
+                        <select id="线号" name="线号" class="custom-select" style="width:120px;">
                             <option value="">请选择...</option>
+                            <option value="1">1</option>
+                            <option value="2">2</option>
                         </select>
                     </div>
 
@@ -48,15 +50,16 @@
                 </form>
             </div>
             <!--报表数据-->
-            <table id="table" class="table table-bordered table-hover" data-toolbar="#toolbar" style="font-size:14px;">
+            <table id="table" class="table table-bordered table-hover" data-toolbar="#toolbar" style="font-size: 14px;">
                 <thead>
                     <tr>
                         <th scope="col" data-field="线号" data-sortable="true">线号</th>
-                        <th scope="col" data-field="产品型号" data-sortable="true">产品型号</th>
                         <th scope="col" data-field="出水距" data-sortable="true">水距</th>
+                        <th scope="col" data-field="产品型号" data-sortable="true">产品型号</th> 
                         <th scope="col" data-field="商标" data-sortable="true">商标</th>
+                        <th scope="col" data-field="商标物料描述" data-sortable="true">物料描述</th>
                         <th scope="col" data-field="商标变更" data-sortable="true">商标变更</th>
-                        <th scope="col" data-field="物料编码" data-sortable="true">物料编码</th>
+                        <th scope="col" data-field="商标变更物料描述" data-sortable="true">物料描述</th>
                         <th scope="col" data-field="出库数量" data-sortable="true">数量</th>
                         <th scope="col" data-field="已出数量" data-sortable="true">已出</th>
                         <th scope="col" data-field="状态" data-sortable="true">状态</th>
@@ -81,18 +84,89 @@
 
         $(document).ready(function () {
             loadData();
+            setInterval(function () { loadData(); }, 30000);
         });
 
-        function loadData() {
-            xuwell.loadTable({
-                id: '#table',
-                url: 'index.ashx?r=' + Math.random()
-            });
-        }
+         function loadData() {
+            const select = document.getElementById('线号');
+            //await xuwell.loadTable({
+            //    id: '#table',
+            //    url: 'index.ashx?linenumber=' + select.value + '&r=' + Math.random()
+            //});
+             //将原有方法提取出来 新加uptable方法
+            var $table = $('#table');
+            $table.bootstrapTable('destroy').bootstrapTable({
+                toggle: "table",
+                boolbar: '#toolbar',
+                url: 'index.ashx?linenumber=' + select.value + '&r=' + Math.random(),
+                locale: "zh-CN",
+                sortable: false,
+                sortOrder: "asc",
+                pagination: true,
+                pageNumber: 1,
+                pageSize: 10,
+                pageList: "[10, 100, 500, 1000, 2000, 5000, ALL]",
+                striped: true,
+                sidePagination: 'server', 
+                responseHandler: function (res) {
+                    return res;
+                },
+                onLoadSuccess: function (data) {
+                    if (data['success'] == false) {
+                        swal({
+                            title: '登录异常!',
+                            text: '请您先登录系统!',
+                            icon: 'error',
+                            button: '确定'
+                        }).then(function () {
+                            window.location = '../common/login.html';
+                        });
+                    }
+                    uptable(data.rows); 
+                }
+            }); 
+        };
 
         function resetForm() {
             $('#formSearch')[0].reset();
+        };
+        /**合并单元格*/
+        const uptable = (data) => {
+           /**出水距*/
+            let dataValue = null;
+            /**起始单元格 */
+            let startIndex = 0;
+            /**合并行数 */
+            let rowspan = 1;
+            data.forEach((value, index) => {
+                // 初始化
+                if (dataValue === null) {
+                    dataValue = value.出水距;
+                    startIndex = index;
+                }
+                //检测到变化点
+                else if (value.出水距 !== dataValue) {
+                    //合并前一个组并且只合并数量大于1的组
+                    if (rowspan > 1) {
+                        $('#table').bootstrapTable('mergeCells', { index: startIndex, field: '出水距', rowspan: rowspan })
+                    }
+                    // 更新状态
+                    dataValue = value.出水距;
+                    startIndex = index;
+                    rowspan = 1;
+                }
+                else {
+                    // 同一组,增加计数
+                    rowspan++;
+                }
+            });
+
+            // 处理最后一个组(如果数组以同一组结束且数量大于1)
+            if (dataValue !== null && rowspan > 1) {
+                $('#table').bootstrapTable('mergeCells', { index: startIndex, field: '出水距', rowspan: rowspan })
+            }
         }
+ 
     </script>
 
 </body>