diff --git a/AMESCoreStudio.Web/Views/PCS/PCS004C.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS004C.cshtml index c4900ce8..476ea4b2 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS004C.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS004C.cshtml @@ -69,45 +69,46 @@ + -
-
- -
- -
- -
- -
+
+
+ +
+ +
+ +
+
+
-
-
- -
- -
- -
- -
+
+
+ +
+ +
+ +
+
+
-
-
- -
- -
+
+
+ +
+
-
+ +
@@ -175,7 +176,7 @@ layui.use(['form'], function () { var form = layui.form; }); - + $(document).ready(function () { diff --git a/AMESCoreStudio.WebApi/Attribute/BarCodeAttribute.cs b/AMESCoreStudio.WebApi/Attribute/BarCodeAttribute.cs new file mode 100644 index 00000000..4bfb4271 --- /dev/null +++ b/AMESCoreStudio.WebApi/Attribute/BarCodeAttribute.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.ComponentModel.DataAnnotations; +using AMESCoreStudio.WebApi.Models.AMES; + +namespace AMESCoreStudio.WebApi.Attribute +{ + public class BarCodeAttribute : ValidationAttribute + { + + + + protected override ValidationResult IsValid(object value, ValidationContext validationContext) + { + var WipBarcode = (WipBarcode)validationContext.ObjectInstance; + var aa = WipBarcode.StartNO; + var bb = WipBarcode.EndNO; + //string[] strBaseError = m_BaseText.Where(x => strValue.Contains(x)).ToArray(); + //string[] strCustomError = m_Text.Where(x => strValue.Contains(x)).ToArray(); + + //if (strBaseError.Count() == 0 && strCustomError.Count() == 0) + //{ + // return ValidationResult.Success; + //} + //else + //{ + // List temp = new List(); + // temp.AddRange(m_BaseText.ToList()); + // temp.AddRange(m_Text.ToList()); + // string errorMsg = $"禁止輸入 [{string.Join(", ", temp.ToArray())}] !!"; + // return new ValidationResult(errorMsg); + //} + return ValidationResult.Success; + } + + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipBarcode.cs b/AMESCoreStudio.WebApi/Models/AMES/WipBarcode.cs index 58419621..9e258c5b 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipBarcode.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipBarcode.cs @@ -2,6 +2,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; +using AMESCoreStudio.WebApi.Attribute; namespace AMESCoreStudio.WebApi.Models.AMES { @@ -39,6 +40,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [DataMember] [Required(ErrorMessage = "{0},不能空白")] [Display(Name = "結束條碼")] + [BarCode] public string EndNO { get; set; } ///