diff --git a/AMESCoreStudio.Web/Controllers/FQCController.cs b/AMESCoreStudio.Web/Controllers/FQCController.cs
index 01c09fe1..77b46498 100644
--- a/AMESCoreStudio.Web/Controllers/FQCController.cs
+++ b/AMESCoreStudio.Web/Controllers/FQCController.cs
@@ -1234,6 +1234,26 @@ namespace AMESCoreStudio.Web.Controllers
}
}
+ // 判斷有Fail但抽驗量不足 不可開立允收
+ if (fqcItem.FailQty > 0)
+ {
+ // 抽驗數量 大於 本批次送驗量
+ if (fqcItem.QcQty > fqcItem.InhouseQty)
+ {
+ if (fqcItem.PassQty + fqcItem.FailQty != fqcItem.InhouseQty && model.QaResult == "P")
+ {
+ ModelState.AddModelError("error", "抽樣數量不足,不可判定允收");
+ return View("FQC007B", model);
+ }
+ }
+ //當抽驗數量 小於 抽樣數量就離開
+ else if (fqcItem.QcQty > fqcItem.PassQty + fqcItem.FailQty && model.QaResult == "P")
+ {
+ ModelState.AddModelError("error", "抽樣數量不足,不可判定允收");
+ return View("FQC007B", model);
+ }
+ }
+
var fqcResultMaster = await _fqcApi.GetFqcResultMaster(model.FqcID);
var fqcInhouseMaster = await _fqcApi.GetFqcInhouseMaster(model.InhouseNo, model.SeqID);
diff --git a/AMESCoreStudio.WebApi/Controllers/QASRV/DocEsopViewController.cs b/AMESCoreStudio.WebApi/Controllers/QASRV/DocEsopViewController.cs
new file mode 100644
index 00000000..45a729ea
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Controllers/QASRV/DocEsopViewController.cs
@@ -0,0 +1,43 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using AMESCoreStudio.WebApi.Models.AMES;
+using Microsoft.EntityFrameworkCore;
+using AMESCoreStudio.CommonTools.Result;
+using AMESCoreStudio.WebApi.Models.QASRV;
+
+namespace AMESCoreStudio.WebApi.Controllers.QASRV
+{
+ ///
+ /// 標準SOP路徑
+ ///
+ [Route("api/[controller]")]
+ [ApiController]
+ public class DocEsopViewController : ControllerBase
+ {
+
+ private readonly QASRVContext _context;
+
+ ///
+ ///
+ ///
+ ///
+ public DocEsopViewController(QASRVContext context)
+ {
+ _context = context;
+ }
+
+ /////
+ ///// Get標準SOP路徑
+ /////
+ /////
+ //[HttpGet]
+ //public async Task>> GetDocEsopView()
+ //{
+ // IQueryable q = _context.DocEsopViews;
+ // return await q.Take(100).ToListAsync();
+ //}
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Controllers/QASRV/RuleController.cs b/AMESCoreStudio.WebApi/Controllers/QASRV/RuleController.cs
new file mode 100644
index 00000000..2d3a5fd7
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Controllers/QASRV/RuleController.cs
@@ -0,0 +1,43 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using AMESCoreStudio.WebApi.Models.AMES;
+using Microsoft.EntityFrameworkCore;
+using AMESCoreStudio.CommonTools.Result;
+using AMESCoreStudio.WebApi.Models.QASRV;
+
+namespace AMESCoreStudio.WebApi.Controllers.QASRV
+{
+ ///
+ /// 標準SOP路徑
+ ///
+ [Route("api/[controller]")]
+ [ApiController]
+ public class RuleController : ControllerBase
+ {
+
+ private readonly QASRVContext _context;
+
+ ///
+ ///
+ ///
+ ///
+ public RuleController(QASRVContext context)
+ {
+ _context = context;
+ }
+
+ ///
+ /// Get標準SOP路徑
+ ///
+ ///
+ [HttpGet]
+ public async Task>> GetRule()
+ {
+ IQueryable q = _context.Rules;
+ return await q.Take(100).ToListAsync();
+ }
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Models/QASRV/DocEsopView.cs b/AMESCoreStudio.WebApi/Models/QASRV/DocEsopView.cs
new file mode 100644
index 00000000..97e6f6fe
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Models/QASRV/DocEsopView.cs
@@ -0,0 +1,39 @@
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Runtime.Serialization;
+
+#nullable disable
+
+namespace AMESCoreStudio.WebApi.Models.QASRV
+{
+ ///
+ /// 安勤標準SOP路徑
+ ///
+ [Table("doc_esop_view")]
+ [Keyless]
+ public partial class DocEsopView
+ {
+ [DataMember]
+ [Column("document_name")]
+ public string document_name { get; set; }
+
+ [Column("document_no")]
+ [DataMember]
+ public string document_no { get; set; }
+
+ [Column("document_version")]
+ [DataMember]
+ public string document_version { get; set; }
+
+ [Column("file_path")]
+ [DataMember]
+ public string file_path { get; set; }
+
+ [Column("maintain_by")]
+ [DataMember]
+ public string maintain_by { get; set; }
+
+ [Column("issue_date")]
+ [DataMember]
+ public string issue_date { get; set; }
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Models/QASRV/Rule.cs b/AMESCoreStudio.WebApi/Models/QASRV/Rule.cs
new file mode 100644
index 00000000..42bc2788
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Models/QASRV/Rule.cs
@@ -0,0 +1,45 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Runtime.Serialization;
+
+#nullable disable
+
+namespace AMESCoreStudio.WebApi.Models.QASRV
+{
+ ///
+ /// 安勤標準SOP路徑
+ ///
+ [Table("ROLE")]
+ [Keyless]
+ public partial class Rule
+ {
+ [DataMember]
+ [Column("ROLE_NAME")]
+ public string ROLE_NAME { get; set; }
+
+ [Column("ROLE_DESC")]
+ [DataMember]
+ public string ROLE_DESC { get; set; }
+
+ [Column("CREATE_USERID")]
+ [DataMember]
+ public int CREATE_USERID { get; set; }
+
+ [Column("CREATE_DATE")]
+ [DataMember]
+ public DateTime CREATE_DATE { get; set; }
+
+ [Column("UPDATE_DATE")]
+ [DataMember]
+ public DateTime UPDATE_DATE { get; set; }
+
+ [Column("SYS_TYPE")]
+ [DataMember]
+ public string SYS_TYPE { get; set; }
+
+ [Column("ROLE_ID")]
+ [DataMember]
+ public int ROLE_ID { get; set; }
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Models/QASRVContext.cs b/AMESCoreStudio.WebApi/Models/QASRVContext.cs
new file mode 100644
index 00000000..3e6f2a3d
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Models/QASRVContext.cs
@@ -0,0 +1,41 @@
+using AMESCoreStudio.WebApi.Models.QASRV;
+using AMESCoreStudio.WebApi.Models.SYS;
+using Microsoft.EntityFrameworkCore;
+
+
+namespace AMESCoreStudio.WebApi
+{
+ ///
+ ///
+ ///
+ public class QASRVContext : DbContext
+ {
+
+ public QASRVContext(DbContextOptions options)
+ : base(options)
+ {
+ //Configuration.ProxyCreationEnabled = false;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+
+ }
+
+ ///
+ /// DocEsopView
+ ///
+ public DbSet DocEsopViews { get; set; }
+
+ ///
+ /// DocEsopView
+ ///
+ //public DbSet Rules { get; set; }
+
+ }
+
+}
diff --git a/AMESCoreStudio.WebApi/Startup.cs b/AMESCoreStudio.WebApi/Startup.cs
index dea27ec8..ff8c9102 100644
--- a/AMESCoreStudio.WebApi/Startup.cs
+++ b/AMESCoreStudio.WebApi/Startup.cs
@@ -53,6 +53,10 @@ namespace AMESCoreStudio.WebApi
opt => opt.UseLazyLoadingProxies().UseOracle(Configuration.GetConnectionString("AMESContext"), b => b.UseOracleSQLCompatibility("11"))
.UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole())));
+ services.AddDbContext(options =>
+ options.UseSqlServer(Configuration.GetConnectionString("QASRVConnection"))
+ );
+
services.AddControllers();
services.AddSwaggerGen(c =>