diff --git a/API/TaskManager.Entity/Data/SUPPLIER_EMPLOYEE_DT.cs b/API/TaskManager.Entity/Data/SUPPLIER_EMPLOYEE_DT.cs
index fa147d9..38e951c 100644
--- a/API/TaskManager.Entity/Data/SUPPLIER_EMPLOYEE_DT.cs
+++ b/API/TaskManager.Entity/Data/SUPPLIER_EMPLOYEE_DT.cs
@@ -1,134 +1,162 @@
using Magicodes.ExporterAndImporter.Core;
+using Magicodes.ExporterAndImporter.Excel;
using System;
-using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using TaskManager.Entity;
-namespace TaskManager.Entity
+public class SUPPLIER_EMPLOYEE_DT : BaseEntity_NoTask
{
///
- /// 人员资质信息
- ///
- public class SUPPLIER_EMPLOYEE_DT : BaseEntity_NoTask
- {
- ///
- /// 供应商代码
- ///
- [ExporterHeader(DisplayName = "供应商代码")]
- [ImporterHeader(Name = "供应商代码")]
- public string SupplierCode { get; set; }
- ///
- /// 供应商名称
- ///
- [ExporterHeader(DisplayName = "供应商名称")]
- [ImporterHeader(Name = "供应商名称")]
- public string SupplierName { get; set; }
- ///
- /// 工厂代码
- ///
- [ExporterHeader(DisplayName = "工厂代码")]
- [ImporterHeader(Name = "工厂代码")]
- public string PlantId { get; set; }
- ///
- /// 工厂名称
- ///
- [ExporterHeader(DisplayName = "工厂名称")]
- [ImporterHeader(Name = "工厂名称")]
- public string PlantName { get; set; }
- ///
- /// 车间代码
- ///
- [ExporterHeader(DisplayName = "车间代码")]
- [ImporterHeader(Name = "车间代码")]
- public string WorkshopId { get; set; }
- ///
- /// 车间名称
- ///
- [ExporterHeader(DisplayName = "车间名称")]
- [ImporterHeader(Name = "车间名称")]
- public string WorkshopName { get; set; }
- ///
- /// 产线代码
- ///
- [ExporterHeader(DisplayName = "产线代码")]
- [ImporterHeader(Name = "产线代码")]
- public string ProductionLineId { get; set; }
- ///
- /// 产线名称
- ///
- [ExporterHeader(DisplayName = "产线名称")]
- [ImporterHeader(Name = "产线名称")]
- public string ProductionLineName { get; set; }
- ///
- /// 工位代码
- ///
- [ExporterHeader(DisplayName = "工位代码")]
- [ImporterHeader(Name = "工位代码")]
- public string StationId { get; set; }
- ///
- /// 工位名称
- ///
- [ExporterHeader(DisplayName = "工位名称")]
- [ImporterHeader(Name = "工位名称")]
- public string StationName { get; set; }
- ///
- /// 工位人员账号
- ///
- [ExporterHeader(DisplayName = "工位人员账号")]
- [ImporterHeader(Name = "工位人员账号")]
- public string OperatorId { get; set; }
- ///
- /// 工位人员姓名
- ///
- [ExporterHeader(DisplayName = "工位人员姓名")]
- [ImporterHeader(Name = "工位人员姓名")]
- public string OperatorName { get; set; }
- ///
- /// 是否有资质(Y,N)
- ///
- [ExporterHeader(DisplayName = "是否有资质(Y,N)")]
- [ImporterHeader(Name = "是否有资质(Y,N)")]
- [RegularExpression("^[YN]$", ErrorMessage = "是否有资质 只能填写 Y 或 N")]
- public string HaveQuantity { get; set; }
- ///
- /// 供应商修改时间,格式(yyyy-MM-ddHH:mm:ss)
- ///
- [ExporterHeader(DisplayName = "供应商修改时间")]
- [ImporterHeader(Name = "供应商修改时间", Format ="yyyy-MM-dd HH:mm:ss")]
- public DateTime? DataUpdateTime { get; set; }
- ///
- /// 岗位代码
- ///
- [ExporterHeader(DisplayName = "岗位代码")]
- [ImporterHeader(Name = "岗位代码")]
- public string PositionId { get; set; }
- ///
- /// 岗位名称
- ///
- [ExporterHeader(DisplayName = "岗位名称")]
- [ImporterHeader(Name = "岗位名称")]
- public string PositionName { get; set; }
- ///
- /// 资质等级(Level_4,Level_3,Level_2,Level_1)
- ///
- [ExporterHeader(DisplayName = "资质等级")]
- [ImporterHeader(Name = "资质等级")]
- [RegularExpression("^(Level_4|Level_3|Level_2|Level_1)$", ErrorMessage = "资质等级 只能填写 Level_4,Level_3,Level_2, Level_1 其中之一")]
-
- public string QualificationLevel { get; set; }
- ///
- /// 资质获取时间
- ///
- [ExporterHeader(DisplayName = "资质获取时间")]
- [ImporterHeader(Name = "资质获取时间", Format = "yyyy-MM-dd HH:mm:ss")]
- public DateTime? CheckInTime { get; set; }
- ///
- /// 资质失去时间
- ///
- [ExporterHeader(DisplayName = "资质失去时间")]
- [ImporterHeader(Name = "资质失去时间", Format = "yyyy-MM-dd HH:mm:ss")]
- public DateTime? CheckOutTime { get; set; }
- }
-}
+ /// 供应商代码
+ ///
+ [Required(ErrorMessage = "供应商代码为必填项")]
+ [ExporterHeader(DisplayName = "供应商代码")]
+ [ImporterHeader(Name = "供应商代码")]
+ public string SupplierCode { get; set; }
+
+ ///
+ /// 供应商名称
+ ///
+ [Required(ErrorMessage = "供应商名称为必填项")]
+ [ExporterHeader(DisplayName = "供应商名称")]
+ [ImporterHeader(Name = "供应商名称")]
+ public string SupplierName { get; set; }
+
+ ///
+ /// 工厂代码
+ ///
+ [Required(ErrorMessage = "工厂代码为必填项")]
+ [ExporterHeader(DisplayName = "工厂代码")]
+ [ImporterHeader(Name = "工厂代码")]
+ public string PlantId { get; set; }
+
+ ///
+ /// 工厂名称
+ ///
+ [Required(ErrorMessage = "工厂名称为必填项")]
+ [ExporterHeader(DisplayName = "工厂名称")]
+ [ImporterHeader(Name = "工厂名称")]
+ public string PlantName { get; set; }
+
+ ///
+ /// 车间代码
+ ///
+ [Required(ErrorMessage = "车间代码为必填项")]
+ [ExporterHeader(DisplayName = "车间代码")]
+ [ImporterHeader(Name = "车间代码")]
+ public string WorkshopId { get; set; }
+
+ ///
+ /// 车间名称
+ ///
+ [Required(ErrorMessage = "车间名称为必填项")]
+ [ExporterHeader(DisplayName = "车间名称")]
+ [ImporterHeader(Name = "车间名称")]
+ public string WorkshopName { get; set; }
+
+ ///
+ /// 产线代码
+ ///
+ [Required(ErrorMessage = "产线代码为必填项")]
+ [ExporterHeader(DisplayName = "产线代码")]
+ [ImporterHeader(Name = "产线代码")]
+ public string ProductionLineId { get; set; }
+
+ ///
+ /// 产线名称
+ ///
+ [Required(ErrorMessage = "产线名称为必填项")]
+ [ExporterHeader(DisplayName = "产线名称")]
+ [ImporterHeader(Name = "产线名称")]
+ public string ProductionLineName { get; set; }
+
+ ///
+ /// 工位代码
+ ///
+ [Required(ErrorMessage = "工位代码为必填项")]
+ [ExporterHeader(DisplayName = "工位代码")]
+ [ImporterHeader(Name = "工位代码")]
+ public string StationId { get; set; }
+
+ ///
+ /// 工位名称
+ ///
+ [Required(ErrorMessage = "工位名称为必填项")]
+ [ExporterHeader(DisplayName = "工位名称")]
+ [ImporterHeader(Name = "工位名称")]
+ public string StationName { get; set; }
+
+ ///
+ /// 工位人员账号
+ ///
+ [Required(ErrorMessage = "工位人员账号为必填项")]
+ [ExporterHeader(DisplayName = "工位人员账号")]
+ [ImporterHeader(Name = "工位人员账号")]
+ public string OperatorId { get; set; }
+
+ ///
+ /// 工位人员姓名
+ ///
+ [Required(ErrorMessage = "工位人员姓名为必填项")]
+ [ExporterHeader(DisplayName = "工位人员姓名")]
+ [ImporterHeader(Name = "工位人员姓名")]
+ public string OperatorName { get; set; }
+
+ ///
+ /// 是否有资质(Y,N)
+ ///
+ [Required(ErrorMessage = "是否有资质为必填项")]
+ [ExporterHeader(DisplayName = "是否有资质(Y,N)")]
+ [ImporterHeader(Name = "是否有资质(Y,N)")]
+ [RegularExpression("^[YN]$", ErrorMessage = "是否有资质 只能填写 Y 或 N")]
+ public string HaveQuantity { get; set; }
+
+ ///
+ /// 供应商修改时间,格式(yyyy-MM-ddHH:mm:ss)
+ ///
+ [Required(ErrorMessage = "供应商修改时间为必填项")]
+ [ExporterHeader(DisplayName = "供应商修改时间")]
+ [ImporterHeader(Name = "供应商修改时间", Format = "yyyy-MM-dd HH:mm:ss")]
+ public DateTime DataUpdateTime { get; set; }
+
+ ///
+ /// 岗位代码
+ ///
+ [Required(ErrorMessage = "岗位代码为必填项")]
+ [ExporterHeader(DisplayName = "岗位代码")]
+ [ImporterHeader(Name = "岗位代码")]
+ public string PositionId { get; set; }
+
+ ///
+ /// 岗位名称
+ ///
+ [Required(ErrorMessage = "岗位名称为必填项")]
+ [ExporterHeader(DisplayName = "岗位名称")]
+ [ImporterHeader(Name = "岗位名称")]
+ public string PositionName { get; set; }
+
+ ///
+ /// 资质等级(Level_4,Level_3,Level_2,Level_1)
+ ///
+ [Required(ErrorMessage = "资质等级为必填项")]
+ [ExporterHeader(DisplayName = "资质等级")]
+ [ImporterHeader(Name = "资质等级")]
+ [RegularExpression("^(Level_4|Level_3|Level_2|Level_1)$", ErrorMessage = "资质等级 只能填写 Level_4,Level_3,Level_2, Level_1 其中之一")]
+ public string QualificationLevel { get; set; }
+
+ ///
+ /// 资质获取时间
+ ///
+ [Required(ErrorMessage = "资质获取时间为必填项")]
+ [ExporterHeader(DisplayName = "资质获取时间")]
+ [ImporterHeader(Name = "资质获取时间", Format = "yyyy-MM-dd HH:mm:ss")]
+ public DateTime CheckInTime { get; set; }
+
+ ///
+ /// 资质失去时间
+ ///
+ [Required(ErrorMessage = "资质失去时间为必填项")]
+ [ExporterHeader(DisplayName = "资质失去时间")]
+ [ImporterHeader(Name = "资质失去时间", Format = "yyyy-MM-dd HH:mm:ss")]
+ public DateTime CheckOutTime { get; set; }
+}
\ No newline at end of file
diff --git a/API/TaskManager.Entity/Data/SUPPLIER_INFO_DT.cs b/API/TaskManager.Entity/Data/SUPPLIER_INFO_DT.cs
index 7cfa585..76e76c2 100644
--- a/API/TaskManager.Entity/Data/SUPPLIER_INFO_DT.cs
+++ b/API/TaskManager.Entity/Data/SUPPLIER_INFO_DT.cs
@@ -16,112 +16,146 @@ namespace TaskManager.Entity
///
/// 供应商代码
///
+ [Required(ErrorMessage = "供应商代码为必填项")]
[ExporterHeader(DisplayName = "供应商代码")]
[ImporterHeader(Name = "供应商代码")]
public string SupplierCode { get; set; }
+
///
/// 供应商名称
///
+ [Required(ErrorMessage = "供应商名称为必填项")]
[ExporterHeader(DisplayName = "供应商名称")]
[ImporterHeader(Name = "供应商名称")]
public string SupplierName { get; set; }
+
///
/// 工厂代码
///
+ [Required(ErrorMessage = "工厂代码为必填项")]
[ExporterHeader(DisplayName = "工厂代码")]
[ImporterHeader(Name = "工厂代码")]
public string PlantId { get; set; }
+
///
/// 工厂名称
///
+ [Required(ErrorMessage = "工厂名称为必填项")]
[ExporterHeader(DisplayName = "工厂名称")]
[ImporterHeader(Name = "工厂名称")]
public string PlantName { get; set; }
+
///
/// 车间代码
///
+ [Required(ErrorMessage = "车间代码为必填项")]
[ExporterHeader(DisplayName = "车间代码")]
[ImporterHeader(Name = "车间代码")]
public string WorkshopId { get; set; }
+
///
/// 车间名称
///
+ [Required(ErrorMessage = "车间名称为必填项")]
[ExporterHeader(DisplayName = "车间名称")]
[ImporterHeader(Name = "车间名称")]
public string WorkshopName { get; set; }
+
///
/// 产线代码
///
+ [Required(ErrorMessage = "产线代码为必填项")]
[ExporterHeader(DisplayName = "产线代码")]
[ImporterHeader(Name = "产线代码")]
public string ProductionLineId { get; set; }
+
///
/// 产线名称
///
+ [Required(ErrorMessage = "产线名称为必填项")]
[ExporterHeader(DisplayName = "产线名称")]
[ImporterHeader(Name = "产线名称")]
public string ProductionLineName { get; set; }
+
///
/// 工位代码
///
+ [Required(ErrorMessage = "工位代码为必填项")]
[ExporterHeader(DisplayName = "工位代码")]
[ImporterHeader(Name = "工位代码")]
public string StationId { get; set; }
+
///
/// 工位名称
///
+ [Required(ErrorMessage = "工位名称为必填项")]
[ExporterHeader(DisplayName = "工位名称")]
[ImporterHeader(Name = "工位名称")]
public string StationName { get; set; }
+
///
/// 是否关键工位(Y/N)
///
+ [Required(ErrorMessage = "是否关键工位为必填项")]
[ExporterHeader(DisplayName = "是否关键工位(Y/N)")]
[ImporterHeader(Name = "是否关键工位(Y/N)")]
[RegularExpression("^[YN]$", ErrorMessage = "是否关键工位 只能填写 Y 或 N")]
public string KeyStation { get; set; }
+
///
/// 供应商修改时间,格式(yyyy-MM-ddHH:mm:ss)
///
+ [Required(ErrorMessage = "供应商修改时间为必填项")]
[ExporterHeader(DisplayName = "供应商修改时间")]
[ImporterHeader(Name = "供应商修改时间", Format = "yyyy-MM-dd HH:mm:ss")]
- public DateTime? DataUpdateTime { get; set; }
+ public DateTime DataUpdateTime { get; set; }
+
///
/// 产线顺序
///
+ [Required(ErrorMessage = "产线顺序为必填项")]
[ExporterHeader(DisplayName = "产线顺序")]
[ImporterHeader(Name = "产线顺序")]
public decimal ProductionLineOrder { get; set; }
+
///
/// 工位顺序
///
+ [Required(ErrorMessage = "工位顺序为必填项")]
[ExporterHeader(DisplayName = "工位顺序")]
[ImporterHeader(Name = "工位顺序")]
public decimal StationOrder { get; set; }
+
///
/// 供应商总成零件号
///
+ [Required(ErrorMessage = "供应商总成零件号为必填项")]
[ExporterHeader(DisplayName = "供应商总成零件号")]
[ImporterHeader(Name = "供应商总成零件号")]
public string VendorProductNo { get; set; }
+
///
/// 供应商总成零件名称
///
+ [Required(ErrorMessage = "供应商总成零件名称为必填项")]
[ExporterHeader(DisplayName = "供应商总成零件名称")]
[ImporterHeader(Name = "供应商总成零件名称")]
public string VendorProductName { get; set; }
+
///
/// 奇瑞零件号
///
+ [Required(ErrorMessage = "奇瑞零件号为必填项")]
[ExporterHeader(DisplayName = "奇瑞零件号")]
[ImporterHeader(Name = "奇瑞零件号")]
public string CheryProductNo { get; set; }
+
///
/// 奇瑞零件名称
///
+ [Required(ErrorMessage = "奇瑞零件名称为必填项")]
[ExporterHeader(DisplayName = "奇瑞零件名称")]
[ImporterHeader(Name = "奇瑞零件名称")]
public string CheryProductName { get; set; }
}
-
-}
+}
\ No newline at end of file
diff --git a/API/TaskManager.Entity/Data/SUPPLIER_PRO_PROCESS_EQUIPMENT_DT.cs b/API/TaskManager.Entity/Data/SUPPLIER_PRO_PROCESS_EQUIPMENT_DT.cs
index 8522252..f2b6c9f 100644
--- a/API/TaskManager.Entity/Data/SUPPLIER_PRO_PROCESS_EQUIPMENT_DT.cs
+++ b/API/TaskManager.Entity/Data/SUPPLIER_PRO_PROCESS_EQUIPMENT_DT.cs
@@ -1,4 +1,5 @@
using Magicodes.ExporterAndImporter.Core;
+using System.ComponentModel.DataAnnotations;
namespace TaskManager.Entity.Entitys
{
@@ -10,184 +11,241 @@ namespace TaskManager.Entity.Entitys
///
/// 供应商代码
///
+ [Required(ErrorMessage = "供应商代码为必填项")]
[ExporterHeader(DisplayName = "供应商代码")]
[ImporterHeader(Name = "供应商代码")]
public string SupplierCode { get; set; }
+
///
/// 供应商名称
///
+ [Required(ErrorMessage = "供应商名称为必填项")]
[ExporterHeader(DisplayName = "供应商名称")]
[ImporterHeader(Name = "供应商名称")]
public string SupplierName { get; set; }
+
///
/// 奇瑞零件号
///
+ [Required(ErrorMessage = "奇瑞零件号为必填项")]
[ExporterHeader(DisplayName = "奇瑞零件号")]
[ImporterHeader(Name = "奇瑞零件号")]
public string CheryProductNo { get; set; }
+
///
/// 奇瑞零件名称
///
+ [Required(ErrorMessage = "奇瑞零件名称为必填项")]
[ExporterHeader(DisplayName = "奇瑞零件名称")]
[ImporterHeader(Name = "奇瑞零件名称")]
public string CheryProductName { get; set; }
+
///
/// 供应商总成零件号
///
+ [Required(ErrorMessage = "供应商总成零件号为必填项")]
[ExporterHeader(DisplayName = "供应商总成零件号")]
[ImporterHeader(Name = "供应商总成零件号")]
public string VendorProductNo { get; set; }
+
///
/// 供应商总成零件名称
///
+ [Required(ErrorMessage = "供应商总成零件名称为必填项")]
[ExporterHeader(DisplayName = "供应商总成零件名称")]
[ImporterHeader(Name = "供应商总成零件名称")]
public string VendorProductName { get; set; }
+
///
/// 工艺装备类型分类(1模具;2检具;3夹具)
///
+ [Required(ErrorMessage = "工艺装备类型分类为必填项")]
[ExporterHeader(DisplayName = "工艺装备类型分类")]
[ImporterHeader(Name = "工艺装备类型分类")]
public decimal DeviceType { get; set; }
+
///
/// 工艺装备编码
///
+ [Required(ErrorMessage = "工艺装备编码为必填项")]
[ExporterHeader(DisplayName = "工艺装备编码")]
[ImporterHeader(Name = "工艺装备编码")]
public string DeviceCode { get; set; }
+
///
/// 工艺装备名称
///
+ [Required(ErrorMessage = "工艺装备名称为必填项")]
[ExporterHeader(DisplayName = "工艺装备名称")]
[ImporterHeader(Name = "工艺装备名称")]
public string DeviceName { get; set; }
+
///
/// 生产厂家
///
+ [Required(ErrorMessage = "生产厂家为必填项")]
[ExporterHeader(DisplayName = "生产厂家")]
[ImporterHeader(Name = "生产厂家")]
public string Manufacturer { get; set; }
+
///
/// 工艺装备型号
///
+ [Required(ErrorMessage = "工艺装备型号为必填项")]
[ExporterHeader(DisplayName = "工艺装备型号")]
[ImporterHeader(Name = "工艺装备型号")]
public string ModelNumber { get; set; }
+
///
/// 工艺装备序列号
///
+ [Required(ErrorMessage = "工艺装备序列号为必填项")]
[ExporterHeader(DisplayName = "工艺装备序列号")]
[ImporterHeader(Name = "工艺装备序列号")]
public string SerialNumber { get; set; }
+
///
/// 工艺装备制造日期,格式(yyyy-MM-dd)
///
+ [Required(ErrorMessage = "工艺装备制造日期为必填项")]
[ExporterHeader(DisplayName = "工艺装备制造日期")]
[ImporterHeader(Name = "工艺装备制造日期", Format = "yyyy-MM-dd HH:mm:ss")]
public DateTime? ProductionDate { get; set; }
+
///
/// 主要材质
///
+ [Required(ErrorMessage = "主要材质为必填项")]
[ExporterHeader(DisplayName = "主要材质")]
[ImporterHeader(Name = "主要材质")]
public string Material { get; set; }
+
///
/// 当前存放地点
///
+ [Required(ErrorMessage = "当前存放地点为必填项")]
[ExporterHeader(DisplayName = "当前存放地点")]
[ImporterHeader(Name = "当前存放地点")]
public string CurrentLocation { get; set; }
+
///
/// 工艺装备状态
///
+ [Required(ErrorMessage = "工艺装备状态为必填项")]
[ExporterHeader(DisplayName = "工艺装备状态")]
[ImporterHeader(Name = "工艺装备状态")]
public string DeviceStatus { get; set; }
+
///
/// 穴腔数量
///
+ [Required(ErrorMessage = "穴腔数量为必填项")]
[ExporterHeader(DisplayName = "穴腔数量")]
[ImporterHeader(Name = "穴腔数量")]
public decimal CavityCount { get; set; }
+
///
/// 模具尺寸规格
///
+ [Required(ErrorMessage = "模具尺寸规格为必填项")]
[ExporterHeader(DisplayName = "模具尺寸规格")]
[ImporterHeader(Name = "模具尺寸规格")]
public string MoldSize { get; set; }
+
///
/// 设计寿命单位
///
+ [Required(ErrorMessage = "设计寿命单位为必填项")]
[ExporterHeader(DisplayName = "设计寿命单位")]
[ImporterHeader(Name = "设计寿命单位")]
public string DesignLifeUnits { get; set; }
+
///
/// 设计寿命
///
+ [Required(ErrorMessage = "设计寿命为必填项")]
[ExporterHeader(DisplayName = "设计寿命")]
[ImporterHeader(Name = "设计寿命")]
public string DesignLifeValue { get; set; }
+
///
- /// 当前剩余寿命,
+ /// 当前剩余寿命
///
+ [Required(ErrorMessage = "当前剩余寿命为必填项")]
[ExporterHeader(DisplayName = "当前剩余寿命")]
[ImporterHeader(Name = "当前剩余寿命")]
public string CurrentUsageCount { get; set; }
+
///
/// 模具大修次数
///
+ [Required(ErrorMessage = "模具大修次数为必填项")]
[ExporterHeader(DisplayName = "模具大修次数")]
[ImporterHeader(Name = "模具大修次数")]
public decimal OverhaulCount { get; set; }
+
///
/// 图纸编号描述
///
+ [Required(ErrorMessage = "图纸编号描述为必填项")]
[ExporterHeader(DisplayName = "图纸编号描述")]
[ImporterHeader(Name = "图纸编号描述")]
public string CoolingChannelLayout { get; set; }
+
///
/// 检测精度
///
+ [Required(ErrorMessage = "检测精度为必填项")]
[ExporterHeader(DisplayName = "检测精度")]
[ImporterHeader(Name = "检测精度")]
public string DetectionAccuracy { get; set; }
+
///
/// 最近校准日期,格式(yyyy-MM-ddHH:mm:ss)
///
+ [Required(ErrorMessage = "最近校准日期为必填项")]
[ExporterHeader(DisplayName = "最近校准日期")]
[ImporterHeader(Name = "最近校准日期", Format = "yyyy-MM-dd HH:mm:ss")]
-
public DateTime? CalibrationDate { get; set; }
+
///
/// 校准到期天数
///
+ [Required(ErrorMessage = "校准到期天数为必填项")]
[ExporterHeader(DisplayName = "校准到期天数")]
[ImporterHeader(Name = "校准到期天数")]
public string CalibrationDueDays { get; set; }
+
///
/// 允许误差范围
///
+ [Required(ErrorMessage = "允许误差范围为必填项")]
[ExporterHeader(DisplayName = "允许误差范围")]
[ImporterHeader(Name = "允许误差范围")]
public string ToleranceRange { get; set; }
+
///
/// 磨损阈值
///
+ [Required(ErrorMessage = "磨损阈值为必填项")]
[ExporterHeader(DisplayName = "磨损阈值")]
[ImporterHeader(Name = "磨损阈值")]
public string WearThreshold { get; set; }
+
///
/// 检测范围
///
+ [Required(ErrorMessage = "检测范围为必填项")]
[ExporterHeader(DisplayName = "检测范围")]
[ImporterHeader(Name = "检测范围")]
public string DetectionRange { get; set; }
+
///
/// 检测单位
///
+ [Required(ErrorMessage = "检测单位为必填项")]
[ExporterHeader(DisplayName = "检测单位")]
[ImporterHeader(Name = "检测单位")]
public string UnitType { get; set; }
}
-
-}
+}
\ No newline at end of file
diff --git a/API/Wood.Service/Datas/SupplierEmployeeDtService.cs b/API/Wood.Service/Datas/SupplierEmployeeDtService.cs
index 9a83deb..dc6eb12 100644
--- a/API/Wood.Service/Datas/SupplierEmployeeDtService.cs
+++ b/API/Wood.Service/Datas/SupplierEmployeeDtService.cs
@@ -1,23 +1,25 @@
-using Magicodes.ExporterAndImporter.Excel;
+using Magicodes.ExporterAndImporter.Core.Models;
+using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.Configuration;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using Omu.ValueInjecter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
+using System.Transactions;
using TaskManager.Entity;
-using TaskManager.EntityFramework.Repository;
using TaskManager.EntityFramework;
+using TaskManager.EntityFramework.Repository;
using Wood.Service.Controllers;
-using Magicodes.ExporterAndImporter.Core.Models;
using Wood.Util;
using static Dapper.SqlMapper;
-using System.Transactions;
-using Omu.ValueInjecter;
namespace Wood.Service.Datas
{
@@ -81,13 +83,17 @@ namespace Wood.Service.Datas
}
using var transaction = _context.Database.BeginTransaction();
+
+ var tran = transaction.GetDbTransaction();
try
{
#region 数据库操作
//添加任务
TaskSub taskSubObj = _commonService.BuildTaskSub(entityLst.Count, _taskName);
- await _taskSubRepository.AddAsync(taskSubObj);
+ await _context.TaskSub.AddAsync(taskSubObj);
//添加任务明细
+
+ List emps = new List();
foreach (var empDtObj in entityLst)
{
empDtObj.SupplierCode = VendCode;
@@ -95,35 +101,49 @@ namespace Wood.Service.Datas
empObj.InjectFrom(empDtObj);
//SUPPLIER_EMPLOYEE empObj = EntityMapper.Trans(empDtObj);
-
-
+
empObj.TaskId = taskSubObj.TaskId;
- await _supplierEmployeeRepository.AddAsync(empObj);
- }
+ //await _supplierEmployeeRepository.AddAsync(empObj);
+ emps.Add(empObj);
- foreach (var empDtObj in entityLst)
+ }
+ _context.BulkInsert(emps);
+ _context.BulkMerge(entityLst, options => {
+ options.ColumnPrimaryKeyExpression = itm =>
+ new
{
- empDtObj.SupplierCode = VendCode;
- //以“供应商代码+工厂代码+车间代码+产线代码+工位代码+操作人员账号”为唯一标识,做新增或者更新存储
- var firstObj = _context.Set().FirstOrDefault(
- itm => itm.SupplierCode == empDtObj.SupplierCode
- && itm.PlantId == empDtObj.PlantId
- && itm.WorkshopId == empDtObj.WorkshopId
- && itm.ProductionLineId == empDtObj.ProductionLineId
- && itm.StationId == empDtObj.StationId
- && itm.OperatorId == empDtObj.OperatorId
- );
- if (firstObj == null)
- {
- var ret = await base.Create(empDtObj);
- }
- else
- {
- empDtObj.UId = firstObj.UId;
- empDtObj.CreationTime = CommonHelper.CurrentTime;
- var ret = await base.Update(empDtObj);
- }
+ itm.SupplierCode,
+ itm.PlantId,
+ itm.WorkshopId,
+ itm.ProductionLineId,
+ itm.StationId
+ }; options.Transaction = tran;
}
+ );
+
+ //foreach (var empDtObj in entityLst)
+ //{
+ // empDtObj.SupplierCode = VendCode;
+ // //以“供应商代码+工厂代码+车间代码+产线代码+工位代码+操作人员账号”为唯一标识,做新增或者更新存储
+ // var firstObj = _context.Set().FirstOrDefault(
+ // itm => itm.SupplierCode == empDtObj.SupplierCode
+ // && itm.PlantId == empDtObj.PlantId
+ // && itm.WorkshopId == empDtObj.WorkshopId
+ // && itm.ProductionLineId == empDtObj.ProductionLineId
+ // && itm.StationId == empDtObj.StationId
+ // && itm.OperatorId == empDtObj.OperatorId
+ // );
+ // if (firstObj == null)
+ // {
+ // var ret = await base.Create(empDtObj);
+ // }
+ // else
+ // {
+ // empDtObj.UId = firstObj.UId;
+ // empDtObj.CreationTime = CommonHelper.CurrentTime;
+ // var ret = await base.Update(empDtObj);
+ // }
+ //}
#endregion
transaction.Commit();
@@ -139,33 +159,56 @@ namespace Wood.Service.Datas
public override async Task> Create(SUPPLIER_EMPLOYEE_DT entity)
{
using var transaction = _context.Database.BeginTransaction();
+
+ var tran = transaction.GetDbTransaction();
try
{
#region 数据库操作
//添加任务
+
+
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
- await _taskSubRepository.AddAsync(taskSubObj);
+ await _context.TaskSub.AddAsync(taskSubObj);
+
+
//添加任务明细
- SUPPLIER_EMPLOYEE empObj = EntityMapper.Trans(entity);
+ SUPPLIER_EMPLOYEE empObj = new SUPPLIER_EMPLOYEE();
+ empObj.InjectFrom(entity);
+ //EntityMapper.Trans(entity);
empObj.TaskId = taskSubObj.TaskId;
- await _supplierEmployeeRepository.AddAsync(empObj);
-
- var firstObj = _context.Set().FirstOrDefault(
- itm => itm.SupplierCode == entity.SupplierCode
- && itm.PlantId == entity.PlantId
- && itm.WorkshopId == entity.WorkshopId
- && itm.ProductionLineId == entity.ProductionLineId
- && itm.StationId == entity.StationId
- && itm.OperatorId == entity.OperatorId
- );
- if (firstObj == null)
- {
- var ret = await base.Create(entity);
- }
- else
- {
- throw new Exception("数据库已经存在,不能重复插入");
- }
+ await _context.AddAsync(empObj);
+
+ await _context.BulkMergeAsync(new List { entity }, options => { options.ColumnPrimaryKeyExpression = itm =>
+ new { itm.SupplierCode, itm.PlantId, itm.WorkshopId, itm.ProductionLineId, itm.StationId,itm.OperatorId }; options.Transaction = tran; }
+ );
+
+ _context.SaveChanges();
+
+
+
+
+
+ ////添加任务明细
+ //SUPPLIER_EMPLOYEE empObj = EntityMapper.Trans(entity);
+ //empObj.TaskId = taskSubObj.TaskId;
+ //await _supplierEmployeeRepository.AddAsync(empObj);
+
+ //var firstObj = _context.Set().FirstOrDefault(
+ // itm => itm.SupplierCode == entity.SupplierCode
+ // && itm.PlantId == entity.PlantId
+ // && itm.WorkshopId == entity.WorkshopId
+ // && itm.ProductionLineId == entity.ProductionLineId
+ // && itm.StationId == entity.StationId
+ // && itm.OperatorId == entity.OperatorId
+ // );
+ //if (firstObj == null)
+ //{
+ // var ret = await base.Create(entity);
+ //}
+ //else
+ //{
+ // throw new Exception("数据库已经存在,不能重复插入");
+ //}
#endregion
transaction.Commit();
@@ -181,33 +224,58 @@ namespace Wood.Service.Datas
public override async Task Update(SUPPLIER_EMPLOYEE_DT entity)
{
using var transaction = _context.Database.BeginTransaction();
+ var tran = transaction.GetDbTransaction();
+
+
try
{
#region 数据库操作
//添加任务
+
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
- await _taskSubRepository.AddAsync(taskSubObj);
+ await _context.TaskSub.AddAsync(taskSubObj);
+
+
//添加任务明细
- SUPPLIER_EMPLOYEE empObj = EntityMapper.Trans(entity);
+ SUPPLIER_EMPLOYEE empObj = new SUPPLIER_EMPLOYEE();
+ empObj.InjectFrom(entity);
+ //EntityMapper.Trans(entity);
empObj.TaskId = taskSubObj.TaskId;
- await _supplierEmployeeRepository.AddAsync(empObj);
-
- var firstObj = _context.Set().FirstOrDefault(
- itm => itm.SupplierCode == entity.SupplierCode
- && itm.PlantId == entity.PlantId
- && itm.WorkshopId == entity.WorkshopId
- && itm.ProductionLineId == entity.ProductionLineId
- && itm.StationId == entity.StationId
- && itm.OperatorId == entity.OperatorId
- );
- if (firstObj == null)
- {
- throw new Exception("数据库不存在,不能更新");
- }
- else
- {
- var ret = await base.Update(entity);
+ await _context.AddAsync(empObj);
+
+ await _context.BulkMergeAsync(new List { entity }, options => {
+ options.ColumnPrimaryKeyExpression = itm =>
+ new { itm.SupplierCode, itm.PlantId, itm.WorkshopId, itm.ProductionLineId, itm.StationId, itm.OperatorId }; options.Transaction = tran;
}
+ );
+
+ _context.SaveChanges();
+
+
+
+ //TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
+ //await _taskSubRepository.AddAsync(taskSubObj);
+ ////添加任务明细
+ //SUPPLIER_EMPLOYEE empObj = EntityMapper.Trans(entity);
+ //empObj.TaskId = taskSubObj.TaskId;
+ //await _supplierEmployeeRepository.AddAsync(empObj);
+
+ //var firstObj = _context.Set().FirstOrDefault(
+ // itm => itm.SupplierCode == entity.SupplierCode
+ // && itm.PlantId == entity.PlantId
+ // && itm.WorkshopId == entity.WorkshopId
+ // && itm.ProductionLineId == entity.ProductionLineId
+ // && itm.StationId == entity.StationId
+ // && itm.OperatorId == entity.OperatorId
+ // );
+ //if (firstObj == null)
+ //{
+ // throw new Exception("数据库不存在,不能更新");
+ //}
+ //else
+ //{
+ // var ret = await base.Update(entity);
+ //}
#endregion
transaction.Commit();
diff --git a/API/Wood.Service/Datas/SupplierInfoDtService.cs b/API/Wood.Service/Datas/SupplierInfoDtService.cs
index 1baedda..beb3a3f 100644
--- a/API/Wood.Service/Datas/SupplierInfoDtService.cs
+++ b/API/Wood.Service/Datas/SupplierInfoDtService.cs
@@ -1,22 +1,25 @@
-using Magicodes.ExporterAndImporter.Excel;
+using Magicodes.ExporterAndImporter.Core.Models;
+using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.Configuration;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Database;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using Omu.ValueInjecter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
+using System.Transactions;
using TaskManager.Entity;
-using TaskManager.EntityFramework.Repository;
using TaskManager.EntityFramework;
+using TaskManager.EntityFramework.Repository;
using Wood.Service.Controllers;
-using Magicodes.ExporterAndImporter.Core.Models;
-using System.Transactions;
using Wood.Util;
-using Omu.ValueInjecter;
namespace Wood.Service.Datas
{
@@ -80,12 +83,16 @@ namespace Wood.Service.Datas
}
using var transaction = _context.Database.BeginTransaction();
+ var tran = transaction.GetDbTransaction();
try
{
#region 数据库操作
//添加任务
TaskSub taskSubObj = _commonService.BuildTaskSub(entityLst.Count, _taskName);
- await _taskSubRepository.AddAsync(taskSubObj);
+ await _context.TaskSub.AddAsync(taskSubObj);
+
+
+ List< SUPPLIER_INFO> infos = new List< SUPPLIER_INFO>();
//添加任务明细
foreach (var empDtObj in entityLst)
{
@@ -93,31 +100,45 @@ namespace Wood.Service.Datas
SUPPLIER_INFO empObj = new SUPPLIER_INFO();
empObj.InjectFrom(empDtObj);
empObj.TaskId = taskSubObj.TaskId;
- await _supplierInfoRepository.AddAsync(empObj);
+ infos.Add(empObj);
+ //await _supplierInfoRepository.AddAsync(empObj);
}
-
- foreach (var empDtObj in entityLst)
+ _context.BulkInsert(infos);
+ _context.BulkMerge(entityLst, options => {
+ options.ColumnPrimaryKeyExpression = itm =>
+ new
{
- empDtObj.SupplierCode = VendCode;
- //以“供应商代码+工厂代码+车间代码+产线代码+工位代码”为唯一标识,做新增或更新存储
- var firstObj = _context.Set().FirstOrDefault(
- itm => itm.SupplierCode == empDtObj.SupplierCode
- && itm.PlantId == empDtObj.PlantId
- && itm.WorkshopId == empDtObj.WorkshopId
- && itm.ProductionLineId == empDtObj.ProductionLineId
- && itm.StationId == empDtObj.StationId
- );
- if (firstObj == null)
- {
- var ret = await base.Create(empDtObj);
- }
- else
- {
- empDtObj.UId = firstObj.UId;
- empDtObj.CreationTime = CommonHelper.CurrentTime;
- var ret = await base.Update(empDtObj);
- }
+ itm.SupplierCode,
+ itm.PlantId,
+ itm.WorkshopId,
+ itm.ProductionLineId,
+ itm.StationId
+ };options.Transaction = tran;
}
+ );
+
+ //foreach (var empDtObj in entityLst)
+ //{
+ // empDtObj.SupplierCode = VendCode;
+ // //以“供应商代码+工厂代码+车间代码+产线代码+工位代码”为唯一标识,做新增或更新存储
+ // var firstObj = _context.Set().FirstOrDefault(
+ // itm => itm.SupplierCode == empDtObj.SupplierCode
+ // && itm.PlantId == empDtObj.PlantId
+ // && itm.WorkshopId == empDtObj.WorkshopId
+ // && itm.ProductionLineId == empDtObj.ProductionLineId
+ // && itm.StationId == empDtObj.StationId
+ // );
+ // if (firstObj == null)
+ // {
+ // var ret = await base.Create(empDtObj);
+ // }
+ // else
+ // {
+ // empDtObj.UId = firstObj.UId;
+ // empDtObj.CreationTime = CommonHelper.CurrentTime;
+ // var ret = await base.Update(empDtObj);
+ // }
+ //}
#endregion
transaction.Commit();
@@ -133,36 +154,51 @@ namespace Wood.Service.Datas
public override async Task> Create(SUPPLIER_INFO_DT entity)
{
using var transaction = _context.Database.BeginTransaction();
+ var tran = transaction.GetDbTransaction();
+
try
{
#region 数据库操作
//添加任务
+ //TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
+
+ //await _taskSubRepository.AddAsync(taskSubObj);
+
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
+ await _context.TaskSub.AddAsync(taskSubObj);
- await _taskSubRepository.AddAsync(taskSubObj);
//添加任务明细
SUPPLIER_INFO empObj = new SUPPLIER_INFO();
empObj.InjectFrom(entity);
//EntityMapper.Trans(entity);
empObj.TaskId = taskSubObj.TaskId;
- await _supplierInfoRepository.AddAsync(empObj);
-
- var firstObj = _context.Set().FirstOrDefault(
- itm => itm.SupplierCode == entity.SupplierCode
- && itm.PlantId == entity.PlantId
- && itm.WorkshopId == entity.WorkshopId
- && itm.ProductionLineId == entity.ProductionLineId
- && itm.StationId == entity.StationId
- );
- if (firstObj == null)
- {
- var ret = await base.Create(entity);
- }
- else
- {
- throw new Exception("数据库已经存在,不能重复插入");
- }
+ await _context.AddAsync(empObj);
+
+
+
+
+ await _context.BulkMergeAsync(new List { entity }, options => { options.ColumnPrimaryKeyExpression = itm => new { itm.SupplierCode, itm.PlantId, itm.WorkshopId, itm.ProductionLineId, itm.StationId }; options.Transaction = tran; }
+ );
+
+ _context.SaveChanges();
+
+
+ //var firstObj = _context.Set().FirstOrDefault(
+ // itm => itm.SupplierCode == entity.SupplierCode
+ // && itm.PlantId == entity.PlantId
+ // && itm.WorkshopId == entity.WorkshopId
+ // && itm.ProductionLineId == entity.ProductionLineId
+ // && itm.StationId == entity.StationId
+ // );
+ //if (firstObj == null)
+ //{
+ // var ret = await base.Create(entity);
+ //}
+ //else
+ //{
+ // throw new Exception("数据库已经存在,不能重复插入");
+ //}
#endregion
transaction.Commit();
@@ -178,34 +214,50 @@ namespace Wood.Service.Datas
public override async Task Update(SUPPLIER_INFO_DT entity)
{
using var transaction = _context.Database.BeginTransaction();
+ var tran = transaction.GetDbTransaction();
+
try
{
#region 数据库操作
//添加任务
+ //TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
+ //await _taskSubRepository.AddAsync(taskSubObj);
+
+
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
- await _taskSubRepository.AddAsync(taskSubObj);
+ await _context.TaskSub.AddAsync(taskSubObj);
+
+
+
//添加任务明细
//SUPPLIER_INFO empObj = EntityMapper.Trans(entity);
SUPPLIER_INFO empObj = new SUPPLIER_INFO();
empObj.InjectFrom(entity);
empObj.TaskId = taskSubObj.TaskId;
- await _supplierInfoRepository.AddAsync(empObj);
-
- var firstObj = _context.Set().FirstOrDefault(
- itm => itm.SupplierCode == entity.SupplierCode
- && itm.PlantId == entity.PlantId
- && itm.WorkshopId == entity.WorkshopId
- && itm.ProductionLineId == entity.ProductionLineId
- && itm.StationId == entity.StationId
- );
- if (firstObj == null)
- {
- throw new Exception("数据库不存在,不能更新");
- }
- else
- {
- var ret = await base.Update(entity);
- }
+ await _context.AddAsync(empObj);
+
+
+ await _context.BulkMergeAsync(new List { entity }, options => { options.ColumnPrimaryKeyExpression = itm => new { itm.SupplierCode, itm.PlantId, itm.WorkshopId, itm.ProductionLineId, itm.StationId }; options.Transaction = tran; });
+
+
+ _context.SaveChanges();
+
+
+ //var firstObj = _context.Set().FirstOrDefault(
+ // itm => itm.SupplierCode == entity.SupplierCode
+ // && itm.PlantId == entity.PlantId
+ // && itm.WorkshopId == entity.WorkshopId
+ // && itm.ProductionLineId == entity.ProductionLineId
+ // && itm.StationId == entity.StationId
+ // );
+ //if (firstObj == null)
+ //{
+ // throw new Exception("数据库不存在,不能更新");
+ //}
+ //else
+ //{
+ // var ret = await base.Update(entity);
+ //}
#endregion
transaction.Commit();
diff --git a/API/Wood.Service/Datas/SupplierProProcessEquipmentDtService.cs b/API/Wood.Service/Datas/SupplierProProcessEquipmentDtService.cs
index ae57137..9739b94 100644
--- a/API/Wood.Service/Datas/SupplierProProcessEquipmentDtService.cs
+++ b/API/Wood.Service/Datas/SupplierProProcessEquipmentDtService.cs
@@ -1,23 +1,25 @@
-using Magicodes.ExporterAndImporter.Excel;
+using Magicodes.ExporterAndImporter.Core.Models;
+using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.Configuration;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using Omu.ValueInjecter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
+using System.Transactions;
using TaskManager.Entity;
-using TaskManager.EntityFramework.Repository;
+using TaskManager.Entity.Entitys;
using TaskManager.EntityFramework;
+using TaskManager.EntityFramework.Repository;
using Wood.Service.Controllers;
-using Magicodes.ExporterAndImporter.Core.Models;
-using TaskManager.Entity.Entitys;
-using System.Transactions;
using Wood.Util;
-using Omu.ValueInjecter;
namespace Wood.Service.Datas
{
@@ -81,6 +83,8 @@ namespace Wood.Service.Datas
}
using var transaction = _context.Database.BeginTransaction();
+ var tran = transaction.GetDbTransaction();
+
try
{
#region 数据库操作
@@ -88,36 +92,44 @@ namespace Wood.Service.Datas
TaskSub taskSubObj = _commonService.BuildTaskSub(entityLst.Count, _taskName);
await _taskSubRepository.AddAsync(taskSubObj);
//添加任务明细
+
+ List eqs = new List();
+
foreach (var empDtObj in entityLst)
{
SUPPLIER_PRO_PROCESS_EQUIPMENT empObj = new SUPPLIER_PRO_PROCESS_EQUIPMENT();
empObj.InjectFrom(empDtObj);
empObj.TaskId = taskSubObj.TaskId;
empObj.SupplierCode = VendCode;
- await _supplierProProcessEquipmentRepository.AddAsync(empObj);
- }
+ eqs.Add(empObj);
- foreach (var empDtObj in entityLst)
- {
- empDtObj.SupplierCode = VendCode;
- //以供应商代码+奇瑞零件号+工艺编码+工艺版本为唯一数据,做新增或者更新存储
- var firstObj = _context.Set().FirstOrDefault(
- itm => itm.SupplierCode == empDtObj.SupplierCode
- && itm.CheryProductNo == empDtObj.CheryProductNo
- && itm.DeviceCode == empDtObj.DeviceCode
- && itm.DeviceType == empDtObj.DeviceType
- );
- if (firstObj == null)
- {
- var ret = await base.Create(empDtObj);
- }
- else
- {
- empDtObj.UId = firstObj.UId;
- empDtObj.CreationTime = CommonHelper.CurrentTime;
- var ret = await base.Update(empDtObj);
- }
+ // await _supplierProProcessEquipmentRepository.AddAsync(empObj);
}
+
+ _context.BulkInsert(eqs);
+ _context.BulkMerge(eqs, options => { options.ColumnPrimaryKeyExpression = itm => new { itm.SupplierCode, itm.CheryProductNo, itm.DeviceCode, itm.DeviceType }; options.Transaction = tran; });
+
+ //foreach (var empDtObj in entityLst)
+ //{
+ // empDtObj.SupplierCode = VendCode;
+ // //以供应商代码+奇瑞零件号+工艺编码+工艺版本为唯一数据,做新增或者更新存储
+ // var firstObj = _context.Set().FirstOrDefault(
+ // itm => itm.SupplierCode == empDtObj.SupplierCode
+ // && itm.CheryProductNo == empDtObj.CheryProductNo
+ // && itm.DeviceCode == empDtObj.DeviceCode
+ // && itm.DeviceType == empDtObj.DeviceType
+ // );
+ // if (firstObj == null)
+ // {
+ // var ret = await base.Create(empDtObj);
+ // }
+ // else
+ // {
+ // empDtObj.UId = firstObj.UId;
+ // empDtObj.CreationTime = CommonHelper.CurrentTime;
+ // var ret = await base.Update(empDtObj);
+ // }
+ //}
#endregion
transaction.Commit();
@@ -133,34 +145,48 @@ namespace Wood.Service.Datas
public override async Task> Create(SUPPLIER_PRO_PROCESS_EQUIPMENT_DT entity)
{
using var transaction = _context.Database.BeginTransaction();
+ var tran = transaction.GetDbTransaction();
try
{
#region 数据库操作
//添加任务
+ //TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
+ //await _taskSubRepository.AddAsync(taskSubObj);
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
- await _taskSubRepository.AddAsync(taskSubObj);
+ await _context.TaskSub.AddAsync(taskSubObj);
//添加任务明细
SUPPLIER_PRO_PROCESS_EQUIPMENT empObj = new SUPPLIER_PRO_PROCESS_EQUIPMENT();
empObj.InjectFrom(entity);
empObj.SupplierCode = VendCode;
//EntityMapper.Trans(entity);
empObj.TaskId = taskSubObj.TaskId;
- await _supplierProProcessEquipmentRepository.AddAsync(empObj);
-
- var firstObj = _context.Set().FirstOrDefault(
- itm => itm.SupplierCode == entity.SupplierCode
- && itm.CheryProductNo == entity.CheryProductNo
- && itm.DeviceCode == entity.DeviceCode
- && itm.DeviceType == entity.DeviceType
- );
- if (firstObj == null)
- {
- var ret = await base.Create(entity);
- }
- else
- {
- throw new Exception("数据库已经存在,不能重复插入");
- }
+ await _context.AddAsync(empObj);
+
+ //await _supplierProProcessEquipmentRepository.AddAsync(empObj);
+
+
+ await _context.BulkMergeAsync(new List { entity }, options => { options.ColumnPrimaryKeyExpression = itm =>
+ new { itm.SupplierCode, itm.CheryProductNo, itm.DeviceCode, itm.DeviceType}; options.Transaction = tran; }
+ );
+
+ _context.SaveChanges();
+
+
+
+ //var firstObj = _context.Set().FirstOrDefault(
+ // itm => itm.SupplierCode == entity.SupplierCode
+ // && itm.CheryProductNo == entity.CheryProductNo
+ // && itm.DeviceCode == entity.DeviceCode
+ // && itm.DeviceType == entity.DeviceType
+ // );
+ //if (firstObj == null)
+ //{
+ // var ret = await base.Create(entity);
+ //}
+ //else
+ //{
+ // throw new Exception("数据库已经存在,不能重复插入");
+ //}
#endregion
transaction.Commit();
@@ -176,6 +202,7 @@ namespace Wood.Service.Datas
public override async Task Update(SUPPLIER_PRO_PROCESS_EQUIPMENT_DT entity)
{
using var transaction = _context.Database.BeginTransaction();
+ var tran = transaction.GetDbTransaction();
try
{
#region 数据库操作
@@ -187,24 +214,39 @@ namespace Wood.Service.Datas
empObj.InjectFrom(entity);
empObj.SupplierCode = VendCode;
empObj.TaskId = taskSubObj.TaskId;
+ await _context.AddAsync(empObj);
+
+ //await _supplierProProcessEquipmentRepository.AddAsync(empObj);
+
+
+ await _context.BulkMergeAsync(new List { entity }, options => {
+ options.ColumnPrimaryKeyExpression = itm =>
+ new { itm.SupplierCode, itm.CheryProductNo, itm.DeviceCode, itm.DeviceType }; options.Transaction = tran;
+ }
+ );
+
+ _context.SaveChanges();
+
+
+
//SUPPLIER_PRO_PROCESS_EQUIPMENT empObj = EntityMapper.Trans(entity);
//empObj.TaskId = taskSubObj.TaskId;
- await _supplierProProcessEquipmentRepository.AddAsync(empObj);
-
- var firstObj = _context.Set().FirstOrDefault(
- itm => itm.SupplierCode == entity.SupplierCode
- && itm.CheryProductNo == entity.CheryProductNo
- && itm.DeviceCode == entity.DeviceCode
- && itm.DeviceType == entity.DeviceType
- );
- if (firstObj == null)
- {
- throw new Exception("数据库不存在,不能更新");
- }
- else
- {
- var ret = await base.Update(entity);
- }
+ //await _supplierProProcessEquipmentRepository.AddAsync(empObj);
+
+ //var firstObj = _context.Set().FirstOrDefault(
+ // itm => itm.SupplierCode == entity.SupplierCode
+ // && itm.CheryProductNo == entity.CheryProductNo
+ // && itm.DeviceCode == entity.DeviceCode
+ // && itm.DeviceType == entity.DeviceType
+ // );
+ //if (firstObj == null)
+ //{
+ // throw new Exception("数据库不存在,不能更新");
+ //}
+ //else
+ //{
+ // var ret = await base.Update(entity);
+ //}
#endregion
transaction.Commit();