Procházet zdrojové kódy

修改乾润对接设备Ex_HGS3_QR验证防伪码

dk-xuwei před 4 roky
rodič
revize
caa12e65ad

+ 1 - 2
DK.Service/PDAModuleLogic/PDAModuleLogicWorkShop3.cs

@@ -2465,8 +2465,7 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
         /// <summary>
         /// 校验防伪码
         /// </summary>
-        /// <param name="barcode">产品条码</param>ram>
-        /// <param name="procedureID">工序ID</param>ram>
+        /// <param name="barCode">产品条码</param>
         /// <param name="securityCode">防伪码</param>
         /// 陈强 2021-08-11 新建
         /// <returns>int</returns>

+ 139 - 1
WCF.Service/WCF.Ex_HGS3_QRS/Ex_HGS3_QR.cs

@@ -12,13 +12,16 @@
 using System;
 using System.Collections;
 using System.Data;
-using System.Net;
 using System.ServiceModel;
 using System.ServiceModel.Activation;
+
 using Curtain.DataAccess;
+
+using Dongke.IBOSS.PRD.Basics.BaseResources;
 using Dongke.IBOSS.PRD.Basics.DataAccess;
 using Dongke.IBOSS.PRD.Basics.Library;
 using Dongke.IBOSS.PRD.Service.DataModels;
+using Dongke.IBOSS.PRD.Service.PDAModuleLogic;
 using Dongke.IBOSS.PRD.Service.PMModuleLogic;
 using Dongke.IBOSS.PRD.Service.SmartDeviceService;
 using Dongke.IBOSS.PRD.WCF.DataModels;
@@ -182,6 +185,141 @@ namespace Dongke.IBOSS.PRD.WCF.ExHGS3QRS
             }
         }
 
+
+        /// <summary>
+        /// 恒洁三水三车间对接乾润扫码(增加防伪码参数用于釉坯库(入)节点进行验证)2021-08-26 xuwei add
+        /// </summary>
+        /// <param name="barcode"></param>
+        /// <param name="securitycode"></param>
+        /// <param name="procedure_no"></param>
+        /// <param name="road_no"></param>
+        /// <param name="weight"></param>
+        /// <param name="procedure_in"></param>
+        /// <returns></returns>
+        public string AddWorkInfoHGS3_QR2(string barcode, string securitycode, string procedure_no, string road_no, double weight, int procedure_in = 1)
+        {
+            //修正参数,去掉多余的特殊字符
+            barcode = barCodeFix(barcode);
+            road_no = roadNoFix(road_no);
+
+            string inputCode = $" barcode:{barcode} procedure_no:{procedure_no} road_no:{road_no} weight:{weight}";
+            string returnMessage = "OK";
+            string[] barCodes = barcode.Split(',');
+            Hashtable goodsInfo = new Hashtable();
+
+            try
+            {
+                #region 必须:定义一个条码和多条码的返回值
+                if (barCodes.Length > 1)
+                {
+                    //多个条码时只返回OK和barcode
+                    returnMessage = $"OK:{barcode}";
+                }
+                else
+                {
+                    //一个条码时,获取注浆信息
+                    goodsInfo = getGroutingDailyDetail(barCodes[0]);
+                    if (goodsInfo.Count == 0)
+                    {
+                        return $"NG:条码[{barCodes[0]}]不存在";
+                    }
+
+                    //定义返回信息 OK: 返回字符串(条码#型号#SKU码#结果#智能:1\连体:2#高压:1\普通:2)
+                    returnMessage = $"OK:{goodsInfo["barcode"]}#{goodsInfo["goodscode"]}#{goodsInfo["materialcode"]}#{goodsInfo["level"]}#{goodsInfo["zhineng"]}#{goodsInfo["gaoya"]}#{goodsInfo["lineno"]}";
+                }
+                #endregion
+
+                #region 必须:读取设备对接点配置信息 TP_SYS_SMARTDEVICEPOINT
+                DataTable smartDevicePoint = getSmartDevicePoint(procedure_no, road_no);
+                if (smartDevicePoint.Rows.Count == 0)
+                {
+                    OutputLog.TraceLog(LogPriority.Warning,
+                        this.ToString(),
+                        System.Reflection.MethodBase.GetCurrentMethod().Name,
+                        inputCode + "NG:设备对接工序点未配置",
+                        LocalPath.LogExePath + "SmartDevice\\");
+                    return "NG:设备对接工序点未配置";
+                }
+                #endregion
+
+                #region 特定:二车间卸窑库,不验证,不计件,只支持一个条码=====================
+                //2021-01-14 要求二车间验证此工序,有漏扫的停止在这里 xuwei modify
+                //if (barCodes.Length == 1 && procedure_no == "2_1_1")
+                //{
+                //    return $"OK:{goodsInfo["barcode"]}#{goodsInfo["goodscode"]}#{goodsInfo["mudstoretype"]}#{goodsInfo["level"]}#{goodsInfo["zhineng"]}#{goodsInfo["gaoya"]}#{goodsInfo["lineno"]}";
+                //}
+                #endregion
+
+                #region 特定:光瓷库入前分流,只验证正品和副品,只支持一个条码=================
+                if (barCodes.Length == 1 && (procedure_no == "3_1_0" || (procedure_no == "3_1_1" && procedure_in == 0)))
+                {
+                    if (goodsInfo["goodsleveltypeid"].ToString() == "4" || goodsInfo["goodsleveltypeid"].ToString() == "5")
+                    {
+                        string msg = checkBarcode(Convert.ToInt32(smartDevicePoint.Rows[0]["PROCEDUREID"]), barCodes);
+                        if (msg != "")
+                            return $"NG:{msg}";
+                        else
+                            return returnMessage;
+                    }
+                    else
+                        return returnMessage;
+                }
+                #endregion
+
+                #region 特定:三车间 釉坯库(入)节点 验证防伪码 xuwei add 2021-08-30
+                if (procedure_no == "3_2_1")
+                {
+                    ServiceResultEntity result = PDAModuleLogic.CheckSecurityCodeByBarcode(barcode, securitycode, null);
+                    if (result.Status != Constant.ServiceResultStatus.Success) return $"NG:{result.Message}";
+                }
+                #endregion
+
+                #region 通用:procedure_in = 0 验证处理,支持多条码
+                if (procedure_in == 0)
+                {
+                    string msg = "";
+                    //标准验证是否可到达,支持多条码
+                    msg = checkBarcode(Convert.ToInt32(smartDevicePoint.Rows[0]["PROCEDUREID"]), barCodes);
+                    if (msg != "")
+                        return $"NG:{msg}";
+                    else
+                        return returnMessage;
+                }
+                #endregion
+
+                #region 通用:procedure_in = 1 计件处理,支持多条码
+                //二车间这个节点不计件处理
+                if (procedure_in == 1 && procedure_no != "2_1_1")
+                {
+                    DataTable addWorkPiece = doAddWorkPiece(barCodes, smartDevicePoint);
+                    string out_msg = addWorkPiece?.Rows[0]["out_errMsg"].ToString();
+                    if (!string.IsNullOrWhiteSpace(out_msg))
+                    {
+                        OutputLog.TraceLog(LogPriority.Warning,
+                                this.ToString(),
+                                System.Reflection.MethodBase.GetCurrentMethod().Name,
+                                inputCode + JsonHelper.ToJson(addWorkPiece),
+                                LocalPath.LogExePath + "SmartDevice\\");
+                        return "NG:" + out_msg;
+                    }
+                }
+                #endregion
+
+                //返回正常拼合串
+                return returnMessage;
+            }
+            catch (Exception ex)
+            {
+                OutputLog.TraceLog(LogPriority.Error,
+                        this.ToString(),
+                        System.Reflection.MethodBase.GetCurrentMethod().Name,
+                        inputCode + ex.ToString(),
+                        LocalPath.LogExePath);
+                return "NG:MES系统异常";
+            }
+        }
+
+
         #region 通用私有方法
 
         /// <summary>

+ 22 - 0
WCF.Service/WCF.Ex_HGS3_QRS/IEx_HGS3_QR.cs

@@ -38,6 +38,28 @@ namespace Dongke.IBOSS.PRD.WCF.ExHGS3QRS
             RequestFormat = WebMessageFormat.Json,
             ResponseFormat = WebMessageFormat.Json)]
         string AddWorkInfoHGS3_QR(string barcode, string procedure_no, string road_no, double weight, int procedure_in = 1);
+
+
+        /// <summary>
+        /// 恒洁三水三车间对接乾润扫码(增加防伪码参数用于釉坯库(入)节点进行验证)2021-08-26 xuwei add
+        /// </summary>
+        /// <param name="barcode"></param>
+        /// <param name="securitycode"></param>
+        /// <param name="procedure_no"></param>
+        /// <param name="road_no"></param>
+        /// <param name="weight"></param>
+        /// <param name="procedure_in"></param>
+        /// <returns></returns>
+        [OperationContract]
+        //[WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest
+        //    , ResponseFormat = WebMessageFormat.Json
+        //    , RequestFormat = WebMessageFormat.Json)]
+        [WebGet(
+            RequestFormat = WebMessageFormat.Json,
+            ResponseFormat = WebMessageFormat.Json)]
+        string AddWorkInfoHGS3_QR2(string barcode, string securitycode, string procedure_no, string road_no, double weight, int procedure_in = 1);
+
+
         #endregion
     }
 }

+ 8 - 0
WCF.Service/WCF.Ex_HGS3_QRS/WCF.ExHGS3QRS.csproj

@@ -68,6 +68,10 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\DK.Basics\BaseResources\BaseResources.csproj">
+      <Project>{61710211-9b80-45c1-b338-fdf984c9ae43}</Project>
+      <Name>BaseResources</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\DK.Basics\DataAccess\DataAccess.csproj">
       <Project>{D0492C0B-7B65-4D8F-8EA5-BC0570E19050}</Project>
       <Name>DataAccess</Name>
@@ -76,6 +80,10 @@
       <Project>{922D0F0F-01C2-4FA5-A4AD-00064232F455}</Project>
       <Name>Library</Name>
     </ProjectReference>
+    <ProjectReference Include="..\..\DK.Service\PDAModuleLogic\PDAModuleLogic.csproj">
+      <Project>{75a1a28d-7076-4dc7-a1d4-703b884ecdeb}</Project>
+      <Name>PDAModuleLogic</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\DK.Service\PMModuleLogic\PMModuleLogic.csproj">
       <Project>{0492B0D6-2908-4AFF-BE1E-0E4F7B07622D}</Project>
       <Name>PMModuleLogic</Name>