chenxy 6 лет назад
Родитель
Сommit
3a6bc94e8c

+ 14 - 5
DK.Service/PDAModuleLogic/PDAModuleLogicWorkShop3.cs

@@ -764,8 +764,13 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                         sre.Status = Constant.ServiceResultStatus.Success;
                         sre.Message = "操作成功!";
                     }
-                    catch
+                    catch (Exception ex)
                     {
+                        OutputLog.TraceLog(LogPriority.Error,
+                                        "",
+                                        System.Reflection.MethodBase.GetCurrentMethod().Name,
+                                        ex.ToString(),
+                                        LocalPath.LogExePath);
                         sre.Status = Constant.ServiceResultStatus.Success;
                         sre.Message = "自动配置班次失败!";
                     }
@@ -821,6 +826,8 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
 	                            LEFT JOIN TP_MST_USER m ON l.MONITORID = m.USERID
                             WHERE
 	                            GROUTINGLINECODE = '{jsonL["GROUTINGLINECODE"].ToString()}' --成型线号
+                             AND l.VALUEFLAG = '1'
+                             AND l.GMOULDSTATUS = 1
                             ;
                         ";
 
@@ -899,10 +906,7 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                                     AND d.GROUTINGMOULDCODE = '{jsonM[j]["GROUTINGMOULDCODE"].ToString()}'
                                 ;
                             ";
-
-
                             }
-
                         }
                         sqlStr += "END;";
 
@@ -910,8 +914,13 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                         sre.Status = Constant.ServiceResultStatus.Success;
                         sre.Message = "操作成功!";
                     }
-                    catch
+                    catch (Exception ex)
                     {
+                        OutputLog.TraceLog(LogPriority.Error,
+                                        "",
+                                        System.Reflection.MethodBase.GetCurrentMethod().Name,
+                                        ex.ToString(),
+                                        LocalPath.LogExePath);
                         sre.Status = Constant.ServiceResultStatus.NoSearchResults;
                         sre.Message = "注浆记录写入失败!";
                     }

+ 25 - 2
DK.Service/SmartDeviceService/SmartDeviceLogic.cs

@@ -178,9 +178,32 @@ namespace Dongke.IBOSS.PRD.Service.SmartDeviceService
         /// <param name="userCode"></param>
         /// <param name="groutingData"></param>
         /// <returns></returns>
-        public static ServiceResultEntity SetGroutingLineDetail(string accountCode, string userCode, string groutingData)
+        public static ServiceResultEntity SetGroutingLineDetail(string lineCode, string groutingData, SUserInfo sUserInfo)
         {
-            return PDAModuleLogic.PDAModuleLogic.SetGroutingLineDetail(groutingData, getUserInfo(accountCode, userCode));
+            IDBConnection conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
+            string sqlString = "select t.userid, u.usercode, u.username, t.groutinglineid\n" +
+            "  from tp_pc_groutingline t\n" +
+            " inner join tp_mst_user u\n" +
+            "    on u.userid = t.userid\n" +
+            " where t.groutinglinecode = :lineCode\n" +
+            " and t.valueflag='1'\n" +
+            " and t.gmouldstatus = 1";
+            OracleParameter[] paras = new OracleParameter[]
+            {
+                new OracleParameter(":lineCode", lineCode),
+            };
+            DataTable dt = conn.GetSqlResultToDt(sqlString, paras);
+            if (dt == null || dt.Rows.Count == 0)
+            {
+                ServiceResultEntity sre = new ServiceResultEntity();
+                sre.Status = Constant.ServiceResultStatus.NoSearchResults;
+                sre.Message = $"成型线{lineCode}不存在或当前状态不能注浆";
+                return sre;
+            }
+            sUserInfo.UserID = Convert.ToInt32(dt.Rows[0]["userid"]);
+            sUserInfo.UserCode = dt.Rows[0]["usercode"] + "";
+
+            return PDAModuleLogic.PDAModuleLogic.SetGroutingLineDetail(groutingData, sUserInfo);
         }
 
         /// <summary>

+ 27 - 2
WCF.Service/WCF.Contracts/ISmartDevice.cs

@@ -30,11 +30,35 @@ namespace Dongke.IBOSS.PRD.WCF.Contracts
         void AddWorkPiece(string accountCode, string userCode, string userPassword,
             int procedureID, string barcode);
 
+        /// <summary>
+        /// 自动扫描计件
+        /// </summary>
+        /// <param name="accountCode"></param>
+        /// <param name="userCode"></param>
+        /// <param name="userPassword"></param>
+        /// <param name="procedureID"></param>
+        /// <param name="barcode"></param>
+        /// <param name="remarks"></param>
+        /// <returns></returns>
         [OperationContract]
         string AddWorkPieceByStatus(string accountCode, string userCode, string userPassword,
             int procedureID, string barcode, string remarks);
 
         /// <summary>
+        /// 自动扫描计件(3车间)
+        /// </summary>
+        /// <param name="accountCode"></param>
+        /// <param name="userCode"></param>
+        /// <param name="userPassword"></param>
+        /// <param name="procedureID"></param>
+        /// <param name="barcode"></param>
+        /// <param name="remarks"></param>
+        /// <returns></returns>
+        [OperationContract]
+        string AddWorkPieceByStatus3(string accountCode, string userCode, string userPassword,
+            int procedureID, string barcode, string remarks);
+
+        /// <summary>
         /// 注浆接口 xuwei add 2019-11-19
         /// </summary>
         /// <param name="accountCode"></param>
@@ -42,7 +66,7 @@ namespace Dongke.IBOSS.PRD.WCF.Contracts
         /// <param name="groutingData"></param>
         /// <returns></returns>
         [OperationContract]
-        string SetGroutingLineDetail(string accountCode, string userCode, string groutingData, string remarks);
+        string SetGroutingLineDetail(string accountCode, string userCode, string lineCode, string groutingData, string remarks);
 
         /// <summary>
         /// 登窑、入窑、出窑 接口 xuwei add 2019-11-19
@@ -54,6 +78,7 @@ namespace Dongke.IBOSS.PRD.WCF.Contracts
         /// <param name="barCodeAndPosition"></param>
         /// <returns></returns>
         [OperationContract]
-        string AddWorkPieceKiln(string accountCode, string userCode, int procedureID, string kilnCarCode, string barCodeAndPosition, string remarks);
+        string AddWorkPieceKiln(string accountCode, string userCode, int procedureID,
+            string kilnCarCode, string barCodeAndPosition, string remarks);
     }
 }

+ 120 - 34
WCF.Service/WCF.Services/SmartDeviceService.cs

@@ -12,6 +12,7 @@ using System;
 using System.Data;
 using System.ServiceModel;
 using System.ServiceModel.Activation;
+using Dongke.IBOSS.PRD.Basics.BaseResources;
 using Dongke.IBOSS.PRD.Basics.Library;
 using Dongke.IBOSS.PRD.Service.DataModels;
 using Dongke.IBOSS.PRD.Service.PMModuleLogic;
@@ -139,20 +140,6 @@ namespace Dongke.IBOSS.PRD.WCF.Services
                 sUserInfo.UserID = Convert.ToInt32(userInfo.Rows[0]["userid"]);
                 sUserInfo.UserCode = userCode;
 
-                //DataTable barcodeTable = new DataTable();
-                //barcodeTable.TableName = "barcodeTable";
-                //barcodeTable.Columns.Add("BarCode");
-                //barcodeTable.Columns.Add("UserID");
-                //barcodeTable.Columns.Add("UserCode");
-                //barcodeTable.Columns.Add("UserName");
-                //barcodeTable.Columns.Add("LogoID");
-
-                //DataRow drCollectType = barcodeTable.NewRow();
-                //drCollectType["BarCode"] = barcode;
-                //drCollectType["UserID"] = sUserInfo.UserID;
-                //drCollectType["UserCode"] = sUserInfo.UserCode;
-                //drCollectType["UserName"] = userInfo.Rows[0]["UserName"].ToString();
-                //barcodeTable.Rows.Add(drCollectType);
                 DataTable barcodeTable = userInfo;
                 barcodeTable.Columns.Add("LogoID");
                 barcodeTable.Columns.Add("BarCode");
@@ -203,28 +190,128 @@ namespace Dongke.IBOSS.PRD.WCF.Services
         }
 
         /// <summary>
+        /// 自动扫描计件(3车间)
+        /// </summary>
+        /// <returns></returns>
+        public string AddWorkPieceByStatus3(string accountCode, string userCode, string userPassword,
+            int procedureID, string barcode, string remarks)
+        {
+            string inputCode = $" accountCode:{accountCode} userCode:{userCode} userPassword:{userPassword} procedureID:{procedureID} barcode:{barcode} remarks:{remarks}";
+            try
+            {
+                DataTable userInfo = SmartDeviceLogic.CheckUserCode(accountCode, userCode);
+                if (userInfo == null)
+                {
+                    OutputLog.TraceLog(LogPriority.Warning,
+                            this.ToString(),
+                            System.Reflection.MethodBase.GetCurrentMethod().Name,
+                            " userInfo is null " + inputCode,
+                            LocalPath.LogExePath + "SmartDevice\\");
+                    return "EU-01";
+                }
+                SUserInfo sUserInfo = new SUserInfo();
+                sUserInfo.AccountID = Convert.ToInt32(userInfo.Rows[0]["AccountID"]);
+                sUserInfo.AccountCode = accountCode;
+                sUserInfo.UserID = Convert.ToInt32(userInfo.Rows[0]["userid"]);
+                sUserInfo.UserCode = userCode;
+
+                DataTable barcodeTable = userInfo;
+                barcodeTable.Columns.Add("LogoID");
+                barcodeTable.Columns.Add("BarCode");
+                barcodeTable.Columns.Add("Remarks");
+
+                barcodeTable.Rows[0]["BarCode"] = barcode;
+                barcodeTable.Rows[0]["Remarks"] = remarks;
+
+                ProcedureEntity procedureInfo = null;
+                DataTable dt = PMModuleLogicDAL.AddWorkPiece(procedureID, barcodeTable, sUserInfo, out procedureInfo);
+
+                if (dt != null && dt.Rows.Count > 0)
+                {
+                    string out_msg = dt.Rows[0]["out_errMsg"].ToString();
+                    if (!string.IsNullOrWhiteSpace(out_msg))
+                    {
+                        OutputLog.TraceLog(LogPriority.Warning,
+                                this.ToString(),
+                                System.Reflection.MethodBase.GetCurrentMethod().Name,
+                                inputCode + JsonHelper.ToJson(dt),
+                                LocalPath.LogExePath + "SmartDevice\\");
+                        //if (out_msg.StartsWith("无效条码"))
+                        //{
+                        //    return "EP-01=" + out_msg;
+                        //}
+                        //if (out_msg.Contains("不能到达该工序"))
+                        //{
+                        //    return "EP-02=" + out_msg;
+                        //}
+                        return "EP-00=" + out_msg;
+                    }
+                }
+                return "OK";
+            }
+            catch (Exception ex)
+            {
+                OutputLog.TraceLog(LogPriority.Error,
+                        this.ToString(),
+                        System.Reflection.MethodBase.GetCurrentMethod().Name,
+                        inputCode+ex.ToString(),
+                        LocalPath.LogExePath);
+                return "EE";
+            }
+        }
+
+        /// <summary>
         /// 注浆接口 xuwei add 2019-11-19
         /// </summary>
         /// <param name="accountCode"></param>
         /// <param name="userCode"></param>
         /// <param name="groutingData"></param>
         /// <returns></returns>
-        public string SetGroutingLineDetail(string accountCode, string userCode,
+        public string SetGroutingLineDetail(string accountCode, string userCode, string lineCode,
             string groutingData, string remarks)
         {
+            string inputCode = $" accountCode:{accountCode} userCode:{userCode} lineCode:{lineCode} groutingData:{groutingData} remarks:{remarks}";
             try
             {
-                ServiceResultEntity sre = SmartDeviceLogic.SetGroutingLineDetail(accountCode, userCode, groutingData);
-                DataTable dt = sre.Data.Tables[0];
-                return dt.Rows[0]["out_errMsg"].ToString();
+                #region 验证用户 并配置参数 sUserInfo
+                DataTable userInfo = SmartDeviceLogic.CheckUserCode(accountCode, userCode);
+                if (userInfo == null)
+                {
+                    OutputLog.TraceLog(LogPriority.Warning,
+                            this.ToString(),
+                            System.Reflection.MethodBase.GetCurrentMethod().Name,
+                            " userInfo is null " + inputCode,
+                            LocalPath.LogExePath + "SmartDevice\\");
+                    return "EU-01";
+                }
+                SUserInfo sUserInfo = new SUserInfo();
+                sUserInfo.AccountID = Convert.ToInt32(userInfo.Rows[0]["AccountID"]);
+                sUserInfo.AccountCode = accountCode;
+                sUserInfo.UserID = Convert.ToInt32(userInfo.Rows[0]["userid"]);
+                sUserInfo.UserCode = userCode;
+                #endregion
+
+                ServiceResultEntity sre = SmartDeviceLogic.SetGroutingLineDetail(lineCode, groutingData, sUserInfo);
+                if (sre.Status == Constant.ServiceResultStatus.Success)
+                {
+                    return "OK";
+                }
+                else
+                {
+                    OutputLog.TraceLog(LogPriority.Warning,
+                            this.ToString(),
+                            System.Reflection.MethodBase.GetCurrentMethod().Name,
+                            inputCode + sre.Message,
+                            LocalPath.LogExePath + "SmartDevice\\");
+                    return $"EG={sre.Message}";
+                }
             }
             catch (Exception ex)
             {
                 OutputLog.TraceLog(LogPriority.Error,
                         this.ToString(),
-                        System.Reflection.MethodBase.GetCurrentMethod().Name + System.Environment.NewLine +
-                        " accountCode:" + accountCode + " userCode:" + userCode,
-                        ex.ToString(),
+                        System.Reflection.MethodBase.GetCurrentMethod().Name,
+                        inputCode+ex.ToString(),
                         LocalPath.LogExePath);
                 return "EE";
             }
@@ -240,6 +327,7 @@ namespace Dongke.IBOSS.PRD.WCF.Services
         public string AddWorkPieceKiln(string accountCode, string userCode, int procedureID,
             string kilnCarCode, string barCodeAndPosition, string remarks)
         {
+            string inputCode = $" accountCode:{accountCode} userCode:{userCode} procedureID:{procedureID} kilnCarCode:{kilnCarCode} barCodeAndPosition:{barCodeAndPosition} remarks:{remarks}";
             try
             {
                 #region 验证用户 并配置参数 sUserInfo
@@ -249,7 +337,7 @@ namespace Dongke.IBOSS.PRD.WCF.Services
                     OutputLog.TraceLog(LogPriority.Warning,
                             this.ToString(),
                             System.Reflection.MethodBase.GetCurrentMethod().Name,
-                            $" accountCode:{accountCode} userCode:{userCode} procedureID:{procedureID} kilnCarCode:{kilnCarCode} barCodeAndPosition:{barCodeAndPosition}",
+                            " userInfo is null " + inputCode,
                             LocalPath.LogExePath + "SmartDevice\\");
                     return "EU-01";
                 }
@@ -267,7 +355,7 @@ namespace Dongke.IBOSS.PRD.WCF.Services
                     OutputLog.TraceLog(LogPriority.Warning,
                                this.ToString(),
                                System.Reflection.MethodBase.GetCurrentMethod().Name,
-                            $" accountCode:{accountCode} userCode:{userCode} procedureID:{procedureID} kilnCarCode:{kilnCarCode} barCodeAndPosition:{barCodeAndPosition}",
+                               "窑车不存在" + inputCode,
                                LocalPath.LogExePath + "SmartDevice\\");
                     return "EP-01";
                 }
@@ -365,19 +453,18 @@ namespace Dongke.IBOSS.PRD.WCF.Services
                     {
                         OutputLog.TraceLog(LogPriority.Warning,
                             this.ToString(),
-                            System.Reflection.MethodBase.GetCurrentMethod().Name + System.Environment.NewLine +
-                            $" accountCode:{accountCode} userCode:{userCode} procedureID:{procedureID} kilnCarCode:{kilnCarCode} barCodeAndPosition:{barCodeAndPosition}",
-                            JsonHelper.ToJson(dt),
+                            System.Reflection.MethodBase.GetCurrentMethod().Name,
+                            inputCode + JsonHelper.ToJson(dt),
                             LocalPath.LogExePath + "SmartDevice\\");
                         //if (out_msg.StartsWith("无效条码"))
                         //{
                         //    return "EP-01";
                         //}
-                        if (out_msg.Contains("不能到达该工序"))
-                        {
-                            return "EP-02";
-                        }
-                        return "EP-00";
+                        //if (out_msg.Contains("不能到达该工序"))
+                        //{
+                        //    return "EP-02=" + out_msg;
+                        //}
+                        return "EP-00=" + out_msg;
                     }
                 }
                 return "OK";
@@ -387,9 +474,8 @@ namespace Dongke.IBOSS.PRD.WCF.Services
             {
                 OutputLog.TraceLog(LogPriority.Error,
                         this.ToString(),
-                        System.Reflection.MethodBase.GetCurrentMethod().Name + System.Environment.NewLine +
-                            $" accountCode:{accountCode} userCode:{userCode} procedureID:{procedureID} kilnCarCode:{kilnCarCode} barCodeAndPosition:{barCodeAndPosition}",
-                        ex.ToString(),
+                        System.Reflection.MethodBase.GetCurrentMethod().Name,
+                        inputCode + ex.ToString(),
                         LocalPath.LogExePath);
                 return "EE";
             }