Procházet zdrojové kódy

sop指导书 和 工位打卡

zhangzhongshuai před 3 roky
rodič
revize
77a4c2e49a

+ 49 - 0
wwwroot/main/Login/api/GetProcedure.ashx

@@ -0,0 +1,49 @@
+<%@ WebHandler Language="C#" Class="GetProcedure" %>
+
+using System.Web;
+using System.Data;
+using System.Web.SessionState;
+using System.Web.Configuration;
+using Newtonsoft.Json.Linq;
+using Curtain.DataAccess;
+using Curtain.Log;
+using DK.XuWei.WebMes;
+
+/// <summary>
+/// 获取工号配置的工位
+/// </summary>
+public class GetProcedure : IHttpHandler, IReadOnlySessionState
+{
+    public void ProcessRequest(HttpContext context)
+    {
+        using (IDataAccess conn = DataAccess.Create())
+        {
+            DataTable dt = conn.ExecuteDatatable(@"
+             SELECT  DISTINCT 
+				p.PROCEDUREID,
+				p.PROCEDURENAME 
+                FROM TP_MST_WORKSTATION W
+                  LEFT JOIN TP_SYS_WORKSTATIONTYPE T
+                    ON T.WORKSTATIONTYPEID = W.WORKSTATIONTYPEID
+                  LEFT JOIN TP_MST_WORKSTATIONUSER WU
+                    ON WU.WORKSTATIONID = W.WORKSTATIONID
+                  LEFT JOIN TP_MST_USER U
+                    ON U.USERID = WU.USERID
+                  LEFT JOIN TP_PC_PROCEDURE P
+                    ON P.PROCEDUREID = W.PROCEDUREID
+                 WHERE W.VALUEFLAG = '1'
+                   AND U.USERCODE = @USERCODE@ ",
+                new CDAParameter("USERCODE",context.Request["UserCode"])
+            );
+            context.Response.Write(new JsonResult(dt).ToJson());
+        }
+    }
+    public bool IsReusable
+    {
+        get
+        {
+            return false;
+        }
+    }
+
+}

+ 3 - 1
wwwroot/main/Login/api/GetWorkStation.ashx

@@ -38,8 +38,10 @@ public class GetWorkStation : IHttpHandler, IReadOnlySessionState
                     ON P.PROCEDUREID = W.PROCEDUREID
                  WHERE W.VALUEFLAG = '1'
                    AND U.USERCODE = @USERCODE@
+                   AND  W.PROCEDUREID = @PROCEDUREID@
                  ORDER BY W.DISPLAYNO ",
-                new CDAParameter("USERCODE",context.Request["UserCode"])
+                new CDAParameter("USERCODE",context.Request["UserCode"]),
+                new CDAParameter("PROCEDUREID",context.Request["PROCEDUREID"])
             );
             context.Response.Write(new JsonResult(dt).ToJson());
         }

+ 48 - 23
wwwroot/main/Login/login.html

@@ -80,7 +80,18 @@
         <form id="工位窗体" class="pt-5 pb-5 rounded shadow-sm bg-white position-absolute" style="width:350px;top:50%;margin-top:-815px;left:50%;margin-left:-175px;">
             <h5 class="text-center">请您确认工位</h5>
             <div class="form-row pt-3 pl-5">
+                <div class="form-group col-12">
+                    <label class="sr-only" for="登录类型">登录类型</label>
+                    <div class="input-group mb-2 ">
+                        <div class="input-group-prepend">
+                            <div class="input-group-text" style="width:40px;"><i class="fa fa-cog " aria-hidden="true"></i></div>
+                        </div>
+                        <select id="barcodeStaing" class="custom-select" style="margin-right:80px; text-align: center"onchange="ChangeSelect()">
+                        </select>
+                    </div>
+                </div>
                 <div id="工位模板" style="display:none">
+
                     <label class="checkbox-inline pt-2" style="width:260px;border-bottom:1px solid lightgray">
                         <input type="radio" name="工位选择" value="{ID}"> {NAME}
                     </label>
@@ -89,13 +100,14 @@
                 </div>
             </div>
             <div class="form-row col-12 justify-content-center">
-                <button onclick="workButton_onClick()" type="button" class="btn btn-danger" style="width:100px;">确定</button>&nbsp;&nbsp;
-                <button type="reset" class="btn btn-secondary" style="width:100px;">重置</button>
+                <button onclick="workButton_onClick()" type="button" class="btn btn-danger" style="width: 100px; margin-top: 10px;">确定</button>&nbsp;&nbsp;
+                <button type="reset" class="btn btn-secondary" style="width: 100px; margin-top: 10px;">重置</button>
             </div>
         </form>
         <!--打卡窗体-->
         <form id="打卡窗体" class="pt-5 pb-5 rounded shadow-sm bg-white position-absolute" style="width:350px;top:50%;margin-top:-815px;left:50%;margin-left:-175px;">
             <h5 class="text-center">请您确认当前工号员工</h5>
+
             <div class="form-row pt-3 pl-5">
                 <div id="工号员工模板" style="display:none">
                     <div class="row pt-1">
@@ -230,9 +242,12 @@
             });
         }
 
+
+
         //打卡数据读取
         function doRegLoad() {
 
+
             //先行加载模板工种选项
             $.get('api/GetUserJobs.ashx?UserCode=' + $('#用户').val(), function (data) {
                 var json = JSON.parse(data);
@@ -241,10 +256,8 @@
                         $('#工号员工模板 select').append('<option value="' + json["rows"][i]["JOBSID"] + '">' + json["rows"][i]["JOBSNAME"] + '</option>');
                     }
                 }
-
                 //加载打卡员工数据
                 $('#工号员工').loadHtml('api/GetWorkStationUser.ashx?UserCode=' + $('#用户').val() + '&WorkstationId=' + $('#工位').getRadioVal(), '#工号员工模板', function (data) {
-                    console.log(data);
                     $.get('api/GetClassesUser.ashx?UserCode=' + $('#用户').val(), function (data) {
                         var json = JSON.parse(data);
                         if (json['success'] == true) {
@@ -260,8 +273,6 @@
                 });
 
             });
-
-
         }
 
         //打卡数据保存 登录类型 1:打卡并登录工位 0:只打卡不登录工位
@@ -338,26 +349,40 @@
             //    $('#工位').get(0).selectedIndex = 1;
             //    workStation = data["rows"];
             //});
-
-            $('#工位').loadHtml('api/GetWorkStation.ashx?UserCode=' + $('#用户').val() , '#工位模板', function (data) {
-                console.log(data);
-                workStation = data["rows"];
-
-                //读取工位IP设置工位默认值
-                $.get('api/GetWorkStationDefault.ashx', function (data) {
-                    var json = JSON.parse(data);
-                    if (json["success"] == true) {
-                        if (json["rows"].length > 0) {
-                            console.log(json["rows"][0]["PCCODE"]);
-                            $('#工位').setRadioVal(json["rows"][0]["ID"]);
-                        }
-                    }
-                });
-                
-            });
+			$.get('api/GetProcedure.ashx?UserCode=' + $('#用户').val(), function (data) {
+                var json = JSON.parse(data);
+				if (json["success"] == true) {
+					$("#barcodeStaing").empty();
+					$("#barcodeStaing").append("<option value='0'>---请选择工序---</option>");
+					for (var i = 0; i < json.rows.length; i++) {
+						$("#barcodeStaing").append("<option value='" + json['rows'][i]['PROCEDUREID'] + "'>" + json['rows'][i]['PROCEDURENAME'] + "</option>");
+					}
+				}
+			});
+        }
+        function ChangeSelect() {
+			var procedure = document.getElementById("barcodeStaing");
+			var index = procedure.selectedIndex;
+            var myprocedure = procedure.options[index].value;
+			$('#工位').loadHtml('api/GetWorkStation.ashx?UserCode=' + $('#用户').val() + '&PROCEDUREID=' + myprocedure, '#工位模板', function (data) {
+				workStation = data["rows"];
+
+				//读取工位IP设置工位默认值
+				$.get('api/GetWorkStationDefault.ashx', function (data) {
+					var json = JSON.parse(data);
+					if (json["success"] == true) {
+						if (json["rows"].length > 0) {
+							console.log(json["rows"][0]["PCCODE"]);
+							$('#工位').setRadioVal(json["rows"][0]["ID"]);
+						}
+					}
+				});
+
+			});
 
         }
 
+
         //工位数据保存
         function doWorkSave() {
 

+ 51 - 0
wwwroot/main/SopBook/api/JumpSopBook.ashx

@@ -0,0 +1,51 @@
+<%@ WebHandler Language="C#" Class="JumpSopBook" %>
+
+using System;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.SessionState;
+using System.Configuration;
+using System.Data;
+using Newtonsoft.Json;
+using Curtain.DataAccess;
+using Newtonsoft.Json.Linq;
+
+public class JumpSopBook : IHttpHandler
+{
+    public void ProcessRequest(HttpContext context)
+    {
+        context.Response.ContentType = "text/plain";
+        using (IDataAccess conn = DataAccess.Create())
+        {
+            string barcode = context.Request["barcode"] is object ? context.Request["barcode"].ToString() : "";
+            string sqlStr = @"SELECT
+                                    'http://172.18.32.32:9300'||URL AS URL
+                                    FROM
+                                      TP_PC_SOPBOOK 
+	                                    WHERE REMARKS LIKE'%'||(
+	                                    SELECT
+	                                    DISTINCT
+			                                    substr(g.GOODSMODEL,1,instr(g.GOODSMODEL,'-',1)-1) 
+		                                    FROM
+		                                    TP_PM_GROUTINGDAILYDETAIL gd
+		                                    INNER JOIN TP_MST_GOODS g on gd.GOODSID=g.GOODSID
+		                                    WHERE  BARCODE=@barcode@ )||'%'";
+        CDAParameter parameter=  new CDAParameter("barcode", barcode, DataType.VarChar) ;
+            object Output = conn.ExecuteScalar(sqlStr, parameter);
+            JObject json = new JObject(
+                  new JProperty("success", true),
+                  new JProperty("url", Output.ToString())
+                );
+            context.Response.Write(json.ToString());
+        }
+    }
+
+    public bool IsReusable
+    {
+        get
+        {
+            return false;
+        }
+    }
+
+}

+ 1 - 2
wwwroot/main/SopBook/api/getSopBook.ashx

@@ -29,8 +29,7 @@ public class getSopBook : IHttpHandler
 	                TP_PC_SOPBOOK S
                 WHERE
 	                (S.TYPE = @TYPE@ OR @TYPE@ IS NULL)
-                    order by title
-				"
+                    order by title"
                 ,
                 new CDAParameter("TYPE",type)
              );

+ 44 - 6
wwwroot/main/SopBook/index.html

@@ -29,6 +29,7 @@
             <div class="position-relative pull-right d-none d-lg-block">
                 <a class="nav-link" href="javascript:void(0)" onclick="fullScreen(); $('#navbar').toggle();">
                     <i class="fa fa-bars" aria-hidden="true"></i>
+
                 </a>
             </div>
 
@@ -45,9 +46,13 @@
                 </div>
             </div>
 
+            <div class="form-group col-4 mb-1">
+                <label for="产品条码">产品条码</label>
+                <input onkeydown="if(event.keyCode==13) {Jump()}" type="text" class="form-control" id="urltext" placeholder="请输入" >
+                <div id="softkeyboard"></div>
+            </div>
             <!--列表数据-->
             <div class="card-deck pt-4 pb-2" id="sopList">
-
             </div>
             <div id="sopTemplate" style="display:none;">
                 <div class="col-3 pb-4">
@@ -59,10 +64,8 @@
                     </div>
                 </div>
             </div>
-
         </div>
     </div>
-
     <!--作业指导书-->
     <div class="modal fade modal-fullscreen" id="sopModal" tabindex="-1" role="dialog" aria-labelledby="sopModalLabel" aria-hidden="true">
         <div class="modal-dialog" >
@@ -94,14 +97,30 @@
     <script src="../Common/xuwell.js"></script>
 
     <script>
-
         $(document).ready(function () {
             getData(1);
+            
         });
 
         //加载数据
-        function getData(id) {
-            $('#sopList').loadHtml('api/getSopBook.ashx?type=' + id, '#sopTemplate');
+		function getData(id) {
+			$('#sopList').loadHtml('api/getSopBook.ashx?type=' + id, '#sopTemplate');
+		}
+        function Jump() {
+
+            var barcode = document.getElementById("urltext").value
+            console.log(barcode);
+			$.get('api/JumpSopBook.ashx?barcode=' + barcode, function (data) {
+				var json = JSON.parse(data);
+                if (json["success"] == true) {
+                    if (json["url"] != "" || json["url"] != null || barcode != "" || barcode != null) {
+						var urlss = json["url"]
+						showUrl(urlss);
+                    } else {
+						getData(1);
+                    }
+				}
+			});
         }
 
         function showSop(url) {
@@ -111,6 +130,7 @@
             $('#sopModal').on('show.bs.modal', function (event) {
                 document.getElementById("sopSrc").src = url;
             });
+
             $('#sopModal').off('hide.bs.modal');
             $('#sopModal').on('hide.bs.modal', function (event) { });
             $('#sopModal').off('click');
@@ -119,6 +139,24 @@
         }
 
 
+		function getData(id) {
+			$('#sopList').loadHtml('api/getSopBook.ashx?type=' + id, '#sopTemplate');
+		}
+
+        function showUrl(urlss) {
+            console.log(urlss);
+			$('#sopModal').off('show.bs.modal');
+			$('#sopModal').on('show.bs.modal', function (event) {
+				document.getElementById("sopSrc").src = urlss;
+            });
+			$('#sopModal').off('hide.bs.modal');
+			$('#sopModal').on('hide.bs.modal', function (event) { });
+			$('#sopModal').off('click');
+			$('#sopModal').on('click', function (event) { });
+			$('#sopModal').modal('show');
+		}
+
+
     </script>
 
 </body>