Преглед на файлове

Merge branch 'master' of ssh://pscg.dongkesoft.com:9003/mes/hg5020

chenxy преди 6 години
родител
ревизия
3877578341

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

@@ -71,6 +71,31 @@ namespace Dongke.IBOSS.PRD.Service.SmartDeviceService
             }
         }
 
+        //xuwei add 2019-11-19 增加 按窑车号 查询窑车数据 方法
+        public static DataTable getKilnCarByCode(string kilnCarCode)
+        {
+            IDBConnection conn = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
+            conn.Open();
+            DataTable kilnCar = conn.GetSqlResultToDt($@"
+                SELECT
+	                k.KILNID,
+	                k.KILNCODE,
+	                k.KILNNAME,
+	                c.KILNCARID,
+	                c.KILNCARCODE,
+	                c.KILNCARNAME
+                FROM
+	                TP_MST_KILN k
+	                LEFT JOIN TP_MST_KILNCAR c ON k.KILNID = c.KILNID
+                WHERE
+	                c.VALUEFLAG = '1' 
+	                AND c.KILNCARCODE = '{kilnCarCode}'
+            ");
+            conn.Close();
+            return kilnCar;
+        }
+        //xuwei end
+
         //xuwei add 2019-11-15 增加 plc 的 注浆 登窑 入窑 卸窑 方法
 
         /// <summary>
@@ -159,7 +184,7 @@ namespace Dongke.IBOSS.PRD.Service.SmartDeviceService
         }
 
         /// <summary>
-        /// 登窑 入窑 卸窑
+        /// 登窑 入窑 卸窑 
         /// </summary>
         /// <param name="accountCode"></param>
         /// <param name="userCode"></param>
@@ -167,7 +192,7 @@ namespace Dongke.IBOSS.PRD.Service.SmartDeviceService
         /// <param name="barcodeTable"></param>
         /// <param name="procedureInfo"></param>
         /// <returns></returns>
-        public static ServiceResultEntity AddWorkPiece(string accountCode, string userCode, int procedureID, DataTable barcodeTable, out ProcedureEntity procedureInfo)
+        public static ServiceResultEntity AddWorkPieceKiln(string accountCode, string userCode, int procedureID, DataTable barcodeTable, out ProcedureEntity procedureInfo)
         {
             ServiceResultEntity sre = new ServiceResultEntity();
             DataTable dt = PMModuleLogic.PMModuleLogicDAL.AddWorkPiece(procedureID, barcodeTable, getUserInfo(accountCode, userCode), out procedureInfo);

+ 25 - 0
WCF.Service/WCF.Contracts/ISmartDevice.cs

@@ -1,5 +1,8 @@
 
+using Dongke.IBOSS.PRD.WCF.DataModels;
+using System.Data;
 using System.ServiceModel;
+using System.ServiceModel.Web;
 
 namespace Dongke.IBOSS.PRD.WCF.Contracts
 {
@@ -30,5 +33,27 @@ namespace Dongke.IBOSS.PRD.WCF.Contracts
         [OperationContract]
         string AddWorkPieceByStatus(string accountCode, string userCode, string userPassword,
             int procedureID, string barcode, string remarks);
+
+        /// <summary>
+        /// 注浆接口 xuwei add 2019-11-19
+        /// </summary>
+        /// <param name="accountCode"></param>
+        /// <param name="userCode"></param>
+        /// <param name="groutingData"></param>
+        /// <returns></returns>
+        [OperationContract]
+        string SetGroutingLineDetail(string accountCode, string userCode, string groutingData);
+
+        /// <summary>
+        /// 登窑、入窑、出窑 接口 xuwei add 2019-11-19
+        /// </summary>
+        /// <param name="accountCode"></param>
+        /// <param name="userCode"></param>
+        /// <param name="procedureID"></param>
+        /// <param name="kilnCarCode"></param>
+        /// <param name="barCodeAndPosition"></param>
+        /// <returns></returns>
+        [OperationContract]
+        string AddWorkPieceKiln(string accountCode, string userCode, int procedureID, string kilnCarCode, string barCodeAndPosition = "");
     }
 }

+ 171 - 0
WCF.Service/WCF.Services/SmartDeviceService.cs

@@ -18,6 +18,7 @@ using Dongke.IBOSS.PRD.Service.PMModuleLogic;
 using Dongke.IBOSS.PRD.Service.SmartDeviceService;
 using Dongke.IBOSS.PRD.WCF.Contracts;
 using Dongke.IBOSS.PRD.WCF.DataModels;
+using Newtonsoft.Json.Linq;
 
 namespace Dongke.IBOSS.PRD.WCF.Services
 {
@@ -197,5 +198,175 @@ namespace Dongke.IBOSS.PRD.WCF.Services
                 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, string groutingData)
+        {
+            try
+            {
+                ServiceResultEntity sre = SmartDeviceLogic.SetGroutingLineDetail(accountCode, userCode, groutingData);
+                DataTable dt = sre.Data.Tables[0];
+                return dt.Rows[0]["out_errMsg"].ToString();
+            }
+            catch(Exception ex)
+            {
+                OutputLog.TraceLog(LogPriority.Error,
+                        this.ToString(),
+                        System.Reflection.MethodBase.GetCurrentMethod().Name + System.Environment.NewLine +
+                        " accountCode:" + accountCode + " userCode:" + userCode ,
+                        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 AddWorkPieceKiln(string accountCode, string userCode, int procedureID,string kilnCarCode, string barCodeAndPosition="")
+        {
+            try
+            {
+                #region 验证用户 并配置参数 sUserInfo
+                DataTable userInfo = SmartDeviceLogic.CheckUserCode(accountCode, userCode);
+                if (userInfo == null)
+                {
+                    OutputLog.TraceLog(LogPriority.Warning,
+                            this.ToString(),
+                            System.Reflection.MethodBase.GetCurrentMethod().Name,
+                            " accountCode:" + accountCode + " userCode:" + userCode + " procedureID:" + procedureID ,
+                            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
+
+                #region 按窑车号取窑车信息
+                DataTable carInfo = SmartDeviceLogic.getKilnCarByCode(kilnCarCode);
+                #endregion
+
+                #region 配置参数 barcodeTable
+
+                //入窑参数
+                //"Barcode": "11100000012",
+                //"KilnCarName": "TK21",
+                //"KilnCode": "TK2",
+                //"UserCode": "F8",
+                //"UserID": 55,
+                //"UserName": "胡贤万",
+                //"KilnCarID": 35,
+                //"KilnName": "新窑炉",
+                //"KilnCarPosition": 2,
+                //"KilnCarCode": "TK21",
+                //"KilnID": 3
+                DataTable barcodeTable = new DataTable();
+
+                //入窑 卸窑 配置参数 barcodeTable
+                if (barCodeAndPosition == "")
+                {
+                    barcodeTable.TableName = "barcodeTable";
+                    barcodeTable.Columns.Add("UserID");
+                    barcodeTable.Columns.Add("UserCode");
+                    barcodeTable.Columns.Add("UserName");
+                    barcodeTable.Columns.Add("KilnCode");
+                    DataRow drCollectType = barcodeTable.NewRow();
+                    drCollectType["UserID"] = userInfo.Rows[0]["UserID"].ToString();
+                    drCollectType["UserCode"] = userInfo.Rows[0]["UserCode"].ToString();
+                    drCollectType["UserName"] = userInfo.Rows[0]["UserName"].ToString();
+                    drCollectType["KilnCode"] = carInfo.Rows[0]["KilnCode"].ToString();
+                    barcodeTable.Rows.Add(drCollectType);
+                }
+
+                //登窑 添加数据 配置参数 barcodeTable
+                if (barCodeAndPosition != "")
+                {
+                    barcodeTable.TableName = "barcodeTable";
+                    barcodeTable.Columns.Add("UserID");
+                    barcodeTable.Columns.Add("UserCode");
+                    barcodeTable.Columns.Add("UserName");
+                    barcodeTable.Columns.Add("BarCode");
+                    barcodeTable.Columns.Add("KilnID");
+                    barcodeTable.Columns.Add("KilnCode");
+                    barcodeTable.Columns.Add("KilnName");
+                    barcodeTable.Columns.Add("KilnCarCode");
+                    barcodeTable.Columns.Add("KilnCarID");
+                    barcodeTable.Columns.Add("KilnCarName");
+                    barcodeTable.Columns.Add("KilnCarPosition");
+                    JArray barCodeArray = JArray.Parse(barCodeAndPosition);
+                    for(int i=0;i< barCodeArray.Count;i++)
+                    {
+                        DataRow drCollectType = barcodeTable.NewRow();
+                        drCollectType["BarCode"] = barCodeArray[i]["barCode"].ToString();
+                        drCollectType["UserID"] = userInfo.Rows[0]["UserID"].ToString();
+                        drCollectType["UserCode"] = userInfo.Rows[0]["UserCode"].ToString();
+                        drCollectType["UserName"] = userInfo.Rows[0]["UserName"].ToString();
+                        drCollectType["KilnID"] = carInfo.Rows[0]["KilnID"].ToString();
+                        drCollectType["KilnCode"] = carInfo.Rows[0]["KilnCode"].ToString();
+                        drCollectType["KilnName"] = carInfo.Rows[0]["KilnName"].ToString();
+                        drCollectType["KilnCarID"] = carInfo.Rows[0]["KilnCarID"].ToString();
+                        drCollectType["KilnCarName"] = carInfo.Rows[0]["KilnCarName"].ToString();
+                        drCollectType["KilnCarPosition"] = barCodeArray[i]["kilnCarPosition"].ToString();
+                        barcodeTable.Rows.Add(drCollectType);
+                    }
+                }
+
+                #endregion
+
+                #region 调用原始业务逻辑
+                ProcedureEntity procedureInfo = null;
+                ServiceResultEntity sre = SmartDeviceLogic.AddWorkPieceKiln(accountCode, userCode, procedureID, barcodeTable, out procedureInfo);
+                DataTable dt = sre.Data.Tables[0];
+                #endregion
+
+                #region 输出结果
+                string out_msg = dt.Rows[0]["out_errMsg"].ToString();
+                if (dt != null && dt.Rows.Count > 0 && !string.IsNullOrWhiteSpace(out_msg))
+                {
+                    OutputLog.TraceLog(LogPriority.Warning,
+                            this.ToString(),
+                            System.Reflection.MethodBase.GetCurrentMethod().Name + System.Environment.NewLine +
+                            " accountCode:" + accountCode + " userCode:" + userCode + " procedureID:" + procedureID ,
+                            JsonHelper.ToJson(dt),
+                            LocalPath.LogExePath + "SmartDevice\\");
+                    if (out_msg.StartsWith("无效条码"))
+                    {
+                        return "EP-01";
+                    }
+                    if (out_msg.Contains("不能到达该工序"))
+                    {
+                        return "EP-02";
+                    }
+                    return "EP-00";
+                }
+                return "OK";
+                #endregion
+            }
+            catch (Exception ex)
+            {
+                OutputLog.TraceLog(LogPriority.Error,
+                        this.ToString(),
+                        System.Reflection.MethodBase.GetCurrentMethod().Name + System.Environment.NewLine +
+                        " accountCode:" + accountCode + " userCode:" + userCode + "procedureID:"+ procedureID ,
+                        ex.ToString(),
+                        LocalPath.LogExePath);
+                return "EE";
+            }
+        }
+
     }
 }

+ 1 - 1
WCF.Service/WCF.Services/WCF.Services.csproj

@@ -195,7 +195,7 @@
       <Name>Service.DataModels</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\DK.Service\SmartDeviceService\SmartDeviceService.csproj">
-      <Project>{0B637813-6AE3-4AEE-8317-0FF1EC7C0584}</Project>
+      <Project>{0b637813-6ae3-4aee-8317-0ff1ec7c0584}</Project>
       <Name>SmartDeviceService</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\DK.Service\SystemModuleLogic\SystemModuleLogic.csproj">

+ 18 - 0
WCF.Service/WCF.WebHosting/Properties/PublishProfiles/xuwei-mes.pubxml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
+自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。 
+-->
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+    <PublishProvider>FileSystem</PublishProvider>
+    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
+    <LastUsedPlatform>Any CPU</LastUsedPlatform>
+    <SiteUrlToLaunchAfterPublish />
+    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
+    <ExcludeApp_Data>False</ExcludeApp_Data>
+    <publishUrl>\\xuwei-mes\d$\dkmes\wwwroot</publishUrl>
+    <DeleteExistingFiles>False</DeleteExistingFiles>
+  </PropertyGroup>
+</Project>

+ 1 - 0
WCF.Service/WCF.WebHosting/WCF.WebHosting.csproj

@@ -66,6 +66,7 @@
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
     <None Include="Properties\PublishProfiles\WebHosting发布.pubxml" />
+    <None Include="Properties\PublishProfiles\xuwei-mes.pubxml" />
     <None Include="Web.Debug.config">
       <DependentUpon>Web.config</DependentUpon>
     </None>