姜永辉 10 месяцев назад
Родитель
Сommit
7df6df7eef
2 измененных файлов с 282 добавлено и 0 удалено
  1. 148 0
      wwwroot/mes/rpt/rpt042/rpt.ashx
  2. 134 0
      wwwroot/mes/rpt/rpt042/rpt_index.html

+ 148 - 0
wwwroot/mes/rpt/rpt042/rpt.ashx

@@ -0,0 +1,148 @@
+<%@ WebHandler Language="C#" Class="rpt" %>
+
+using System;
+using System.Web;
+using System.Web.SessionState;
+using System.Data;
+using System.Collections.Generic;
+using Curtain.DataAccess;
+using DK.XuWei.WebMes;
+using System.Linq;
+using System.Linq.Expressions;
+
+
+public class rpt : IHttpHandler, IReadOnlySessionState
+{
+    public void ProcessRequest(HttpContext context)
+    {
+        context.Response.ContentType = "text/plain";
+        using (IDataAccess conn = DataAccess.Create())
+        {
+            //获取查询条件
+            List<CDAParameter> sqlPara = new List<CDAParameter>();
+            string sqlStr = @"
+				SELECT
+	goods.GOODSCODE,
+	goods.GOODSNAME,
+	d.DICTIONARYVALUE,
+	logo.LOGONAME,
+	pfirst.createtime PFIRSTCREATETIME,
+	pfirst.usercode PFIRSTUSERCODE,
+	pfirst.username PFIRSTUSERNAME,
+	( SELECT GOODSLEVELNAME FROM TP_MST_GOODSLEVEL WHERE GOODSLEVELID = pfirst.goodsleveltypeid ) PFIRSTGOODSLEVE,
+	( SELECT GOODSLEVELNAME FROM TP_MST_GOODSLEVEL WHERE GOODSLEVELID = pd.goodsleveltypeid ) PDGOODSLEVE,
+CASE
+		
+		WHEN pd.usercode IS NULL AND pd.createtime IS NULL THEN '合计' 
+		WHEN pd.usercode IS NOT NULL  AND pd.createtime IS NULL THEN
+				'小计' ELSE TO_CHAR( pd.createtime, 'YYYY-MM-DD HH24:MI:SS' ) 
+				END AS PDCREATETIME,
+			pd.usercode PDUSERCODE,
+		CASE
+				
+				WHEN pd.username IS NULL THEN
+				TO_NCHAR( COUNT( * ) ) ELSE pd.username 
+			END AS PDUSERNAME,
+			pd.BARCODE 
+		FROM
+			(
+			SELECT
+				sc.*,
+				ROW_NUMBER ( ) OVER ( PARTITION BY sc.productiondataid, TRUNC( sc.CREATETIME ) ORDER BY sc.CREATETIME DESC ) AS rn 
+			FROM
+				tp_pm_productiondata_semicheck sc 
+			) sec
+			INNER JOIN tp_pm_productiondata pd ON sec.productiondataid = pd.productiondataid 
+			AND sec.rn = 1
+			LEFT JOIN tp_pm_productiondata pfirst ON pfirst.groutingdailydetailid = pd.groutingdailydetailid 
+			AND pfirst.checkflag = '1' 
+			AND pfirst.procedureid IN ( 13, 35 )
+			LEFT JOIN TP_MST_GOODS goods ON goods.GOODSCODE = pd.GOODSCODE
+			LEFT JOIN TP_MST_LOGO logo ON logo.LOGOID = pd.LOGOID
+			LEFT JOIN tp_pm_groutingdailydetail g ON g.groutingdailydetailid = pfirst.groutingdailydetailid
+			LEFT JOIN tp_mst_datadictionary d ON g.glazetypeid = d.dictionaryid 
+		WHERE
+			sec.valueflag = 1 ";
+            if (context.Request["firstdatebeginMaster"].ToString() != "")
+            {
+                sqlStr += " and pfirst.CREATETIME>=@firstdatebeginMaster@";
+                sqlPara.Add(new CDAParameter("firstdatebeginMaster", Convert.ToDateTime(context.Request["firstdatebeginMaster"]), DataType.DateTime));
+
+            }
+            if (context.Request["firstdateendMaster"].ToString() != "")
+            {
+                sqlStr += " and pfirst.CREATETIME<=@firstdateendMaster@";
+                sqlPara.Add(new CDAParameter("firstdateendMaster", Convert.ToDateTime(context.Request["firstdateendMaster"]).AddSeconds(1), DataType.DateTime));
+
+            }
+            if (context.Request["twodatebeginMaster"].ToString() != "")
+            {
+                sqlStr += " and sec.CREATETIME>=@twodatebeginMaster@";
+                sqlPara.Add(new CDAParameter("twodatebeginMaster", Convert.ToDateTime(context.Request["twodatebeginMaster"]), DataType.DateTime));
+
+            }
+            if (context.Request["twodateendMaster"].ToString() != "")
+            {
+                sqlStr += " and sec.CREATETIME<=@twodateendMaster@";
+                sqlPara.Add(new CDAParameter("twodateendMaster", Convert.ToDateTime(context.Request["twodateendMaster"]).AddSeconds(1), DataType.DateTime));
+
+            }
+            //产品编码 
+            if (context.Request["GOODSCODE"].ToString() != "")
+            {
+                sqlStr += " and goods.GOODSCODE=@GOODSCODE@";
+                sqlPara.Add(new CDAParameter("GOODSCODE", context.Request["GOODSCODE"]));
+            }
+            //产品条码
+            if (context.Request["BARCODE"].ToString() != "")
+            {
+                sqlStr += " and pd.BARCODE =@BARCODE@";
+                sqlPara.Add(new CDAParameter("BARCODE", context.Request["BARCODE"]));
+            }
+            //首检工号
+            if (context.Request["pfirstusercode"].ToString() != "")
+            {
+                sqlStr += " and pfirst.usercode =@pfirstusercode@";
+                sqlPara.Add(new CDAParameter("pfirstusercode", context.Request["pfirstusercode"]));
+            }
+            //复检工号
+            if (context.Request["pdusercode"].ToString() != "")
+            {
+                sqlStr += " and pd.usercode =@pdusercode@";
+                sqlPara.Add(new CDAParameter("pdusercode", context.Request["pdusercode"]));
+            }
+            //首检质量
+            if (context.Request["pfirstgoodleve"].ToString() != "")
+            {
+                sqlStr += " and pfirst.goodsleveltypeid =@pfirstgoodleve@";
+                sqlPara.Add(new CDAParameter("pfirstgoodleve", context.Request["pfirstgoodleve"]));
+            }//复检质量
+            if (context.Request["pdgoodleve"].ToString() != "")
+            {
+                sqlStr += " and pd.goodsleveltypeid =@pdgoodleve@";
+                sqlPara.Add(new CDAParameter("pdgoodleve", context.Request["pdgoodleve"]));
+            }
+            sqlStr += " GROUP BY GROUPING SETS (" +
+                "( goods.GOODSCODE, goods.GOODSNAME," +
+                    "d.DICTIONARYVALUE, logo.LOGONAME," +
+                    "pfirst.createtime, pfirst.usercode," +
+                    "pfirst.username, pfirst.goodsleveltypeid," +
+                    "pd.goodsleveltypeid, pd.createtime," +
+                    "pd.usercode, pd.username, pd.BARCODE " +
+                "), ( pD.usercode ), ( )  ) ";
+            //获取分页数据    
+            int total = 0;
+            DataTable dt = conn.ExecuteDatatable(sqlStr, sqlPara.ToArray());
+
+            string jsonStr = new JsonResult(dt) { total = total }.ToJson();
+            context.Response.Write(jsonStr);
+        }
+    }
+    public bool IsReusable
+    {
+        get
+        {
+            return false;
+        }
+    }
+}

+ 134 - 0
wwwroot/mes/rpt/rpt042/rpt_index.html

@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8" />
+	<meta name="keywords" content="dongke,mes,ibossmes">
+	<meta name="description" content="制造企业生产过程执行管理系统">
+	<meta name="author" content="xuwei">
+	<title>东科软件</title>
+	<script src="/plugins/xeasyui/xeasyui.min.js"></script>
+</head>
+<body class="easyui-layout">
+
+	<!--中部主体-->
+	<div data-options="border:false,region:'center',title:'',iconCls:'icon-grid'">
+		<!--工具条-->
+		<div id="tb" class="i-toolbar">
+			<a href="javascript:void(0)" id="btnSearch" title="搜索" class="easyui-linkbutton" iconcls="icon-search" plain="true" toggle="true" onclick="tbSearch()">搜索</a>
+			<a href="javascript:void(0)" id="btnExport" title="导出" class="easyui-linkbutton" iconcls="icon-excel" plain="true" onclick="tbExport()">导出</a>
+			<a href="javascript:void(0)" id="btnReload" title="刷新" class="easyui-linkbutton" iconcls="icon-reload" plain="true" onclick="tbReload()">刷新</a>
+			<div id="tbSearchDiv" style="display:block;padding:10px;">
+				<form id="ffMaster">
+					<div>
+						首检日期:
+						<input class="easyui-datetimebox" id="firstdatebeginMaster" name="firstdatebeginMaster" data-options="required:false,prompt:'首检开始日期!',tipPosition:'top'" style="width:180px; height:32px;">
+						-
+						<input class="easyui-datetimebox" id="firstdateendMaster" name="firstdateendMaster" data-options="required:false,prompt:'首检截止日期',tipPosition:'top'" style="width:180px; height:32px;">
+						产品编码:
+						<input class="easyui-combobox" id="GOODSCODE" name="GOODSCODE" data-options="required:false,prompt:'',tipPosition:'top',url:'../rpt.ashx?m=getGoods&select=1',method:'get',valueField:'GOODSCODE',textField:'GOODSCODE',panelHeight:'300px',editable:'true'" style="width:120px;height:32px;">
+						首检工号:
+						<input class="easyui-combobox" id="pfirstusercode" name="pfirstusercode" data-options="required:false,prompt:'',tipPosition:'top',url:'../rpt.ashx?m=getUser&select=1',method:'get',valueField:'USERCODE',textField:'USERCODE',panelHeight:'300px',editable:'true'" style="width:120px;height:32px;">
+						复检工号:
+						<input class="easyui-combobox" id="pdusercode" name="pdusercode" data-options="required:false,prompt:'',tipPosition:'top',url:'../rpt.ashx?m=getUser&select=1',method:'get',valueField:'USERCODE',textField:'USERCODE',panelHeight:'300px',editable:'true'" style="width:120px;height:32px;">
+
+					</div>
+					<div style="padding-top:10px">
+						复检日期:
+						<input class="easyui-datetimebox" id="twodatebeginMaster" name="twodatebeginMaster" data-options="required:true,prompt:'开始日期必须填写!',tipPosition:'top'" style="width:180px; height:32px;">
+						-
+						<input class="easyui-datetimebox" id="twodateendMaster" name="twodateendMaster" data-options="required:true,prompt:'截止日期必须填写',tipPosition:'top'" style="width:180px; height:32px;">
+
+						首检质量:
+						<input class="easyui-combobox" id="pfirstgoodleve" name="pfirstgoodleve" data-options="required:false,prompt:'',tipPosition:'top',url:'../rpt.ashx?m=getgoodsleve&select=1',method:'get',valueField:'GOODSLEVELID',textField:'GOODSLEVELNAME',panelHeight:'300px',editable:'true'" style="width:120px;height:32px;">
+						复检质量:
+						<input class="easyui-combobox" id="pdgoodleve" name="pdgoodleve" data-options="required:false,prompt:'',tipPosition:'top',url:'../rpt.ashx?m=getgoodsleve&select=1',method:'get',valueField:'GOODSLEVELID',textField:'GOODSLEVELNAME',panelHeight:'300px',editable:'true'" style="width:120px;height:32px;">
+						产品条码:
+						<input class="easyui-textbox" id="BARCODE" name="BARCODE" data-options="required:false,prompt:'',tipPosition:'top',url:'../rpt.ashx?m=getUser&select=1',method:'get',valueField:'USERCODE',textField:'USERCODE',panelHeight:'300px',editable:'true'" style="width:120px;height:32px;">
+
+						<a href="javascript:void(0)" id="btnSearchSubmit" title="清空" class="easyui-linkbutton" plain="false" onclick="$('#ffMaster').form('clear')">清空</a>
+						<a href="javascript:void(0)" id="btnSearchSubmit" title="搜索" class="easyui-linkbutton" plain="false" onclick="tbSearchSubmit()">搜索</a>
+
+					</div>
+				</form>
+			</div>
+		</div>
+		<table class="easyui-datagrid"
+			   id="DataGridMaster"
+			   data-options="toolbar: '#tb',method:'get',border:false,singleSelect:true,fit:true,fitColumns:true">
+			<thead>
+				<tr>
+					<th data-options="field:'ROWNO',title:'序号',width:220,align:'center',checkbox:true,hidden:true">SID</th>
+					<th data-options="field:'GOODSCODE',title:'产品编码',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'GOODSNAME',title:'产品名称',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'DICTIONARYVALUE',title:'釉料',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'LOGONAME',title:'商标',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'PFIRSTCREATETIME',title:'首检日期',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'PFIRSTUSERCODE',title:'首检工号',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'PFIRSTUSERNAME',title:'首检姓名',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'PFIRSTGOODSLEVE',title:'首检质量',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'PDGOODSLEVE',title:'复检质量',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'PDCREATETIME',title:'复检日期',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'PDUSERCODE',title:'复检工号',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'PDUSERNAME',title:'复检姓名',width:220,align:'center',sortable:false"></th>
+					<th data-options="field:'BARCODE',title:'产品条码',width:220,align:'center',sortable:false"></th>
+				</tr>
+			</thead>
+		</table>
+	</div>
+
+	<script type="text/javascript">
+		$(document).ready(function () {
+			var ctime = new Date();
+            var ctime = new Date();
+            var beginDate = ctime.getFullYear() + "-" + (ctime.getMonth() + 1) + "-" + ctime.getDate() + " 00:00:00";
+            var endDate = ctime.getFullYear() + "-" + (ctime.getMonth() + 1) + "-" + ctime.getDate() + " 23:59:59";
+            //$("#firstdatebeginMaster").datetimebox("setValue", beginDate);
+           // $("#firstdateendMaster").datetimebox("setValue", endDate);
+            $("#twodatebeginMaster").datetimebox("setValue", beginDate);
+            $("#twodateendMaster").datetimebox("setValue", endDate);
+		});
+
+		//搜索提交
+		function tbSearchSubmit() { 
+			if ($('#ffMaster').form("validate")) {
+                $('#DataGridMaster').datagridLoad({
+					title: '',
+					idField: 'SID',
+					queryParams: $('#ffMaster').serializeJson(),
+					url: 'rpt.ashx?m=master&id=' + request('id'),
+					fixWidth: 140,
+					mergeWidth: 80,
+					//取消分页功能 2022-11-14 张庭莲
+					pagination: false,
+					splitChar: '_'
+				});
+			}
+		}
+
+		//导出
+		function tbExport() {
+            var fields = $('#DataGridMaster').datagrid('getColumnFields');
+			var headers = [];
+			for (var i = 0; i < fields.length; i++) {
+				headers.push(fields[i]);
+			}
+            $('#DataGridMaster').datagridExport({
+				headers: headers,
+				fileName: '导出数据(改判清单).xls',
+                workSheet: '导出数据(改判清单)'
+			});
+		}
+
+		//搜索按钮
+		function tbSearch() {
+			$('#tbSearchDiv').toggle();
+			$('#DataGridMaster').datagrid('resize');
+		}
+
+		//刷新
+		function tbReload() {
+			tbSearchSubmit();
+		}
+	</script>
+</body>
+</html>