schangxiang@126.com
2024-09-10 03de13b2a5357916a7b6ec2f3e8a9ff6ca2e3970
DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/SystemBussinessHelper.cs
@@ -3,8 +3,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace iWare_SCADA_BusinessLogical.Utils
{
@@ -13,6 +15,97 @@
    /// </summary>
    public class SystemBussinessHelper
    {
        /// <summary>
        /// 模拟时间(返回秒)
        /// </summary>
        /// <param name="workingProcedure"></param>
        /// <returns></returns>
        public static int MoNiTimeForWorkingProcedure(string workingProcedure)
        {
            switch (workingProcedure)
            {
                case "OP10":
                case "OP40":
                    return 4;
                case "OP20":
                    return 2 * 60;
                case "OP30":
                    return 2 * 60;
                case "OP35":
                    return 1 * 60;
                case "OP50":
                    return 3 * 60;
                case "OP60":
                    return 4 * 60;
                default:
                    return 1 * 60;
            }
        }
        /// <summary>
        /// 校验读取的二维码是否正确
        /// </summary>
        /// <param name="workPieceID"></param>
        /// <returns></returns>
        public static bool ValidateIsRightWorkPieceID(string workPieceID)
        {
            if (string.IsNullOrEmpty(workPieceID))
            {
                return false;
            }
            if (workPieceID.Length == 22)
            {
                var n_workPieceID = workPieceID.Trim();
                if (n_workPieceID.Length == 22)
                {
                    if (n_workPieceID.ToUpper().IndexOf("ERROR") > -1)
                    {
                        return false;
                    }
                    if (n_workPieceID.ToUpper().IndexOf("ERR") > -1)
                    {
                        return false;
                    }
                    if (n_workPieceID.ToUpper().IndexOf('\0') > -1)
                    {
                        return false;
                    }
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 设置 WorkPieceInfo 的DataCapturePointCname
        /// </summary>
        /// <param name="workPieceLog"></param>
        /// <param name="_DataCapturePointCode"></param>
        /// <param name="_DataCapturePointName"></param>
        public static void SetWorkPieceInfoMiddleForCreatedUserName(ref WorkPieceInfo workPiece, string _DataCapturePointName)
        {
            workPiece.DataCapturePointCname = _DataCapturePointName;
        }
        /// <summary>
        /// 设置 WorkPieceInfo 的UpdateDataCapturePointCname
        /// </summary>
        /// <param name="workPieceLog"></param>
        /// <param name="_DataCapturePointCode"></param>
        /// <param name="_DataCapturePointName"></param>
        public static void SetWorkPieceInfoMiddleForUpdateDataCapturePointCname(ref WorkPieceInfo workPiece, string _DataCapturePointName)
        {
            workPiece.UpdateDataCapturePointCname = _DataCapturePointName;
        }
        /// <summary>
        /// 设置WorkPieceLog 的创建人
        /// </summary>