diff --git a/API/TaskManager.Entity/11-18/SUPPLIER_PRO_PROCESS_EQUIPMENT_LOGS.cs b/API/TaskManager.Entity/11-18/SUPPLIER_PRO_PROCESS_EQUIPMENT_LOGS.cs
index 97bee8e..a0e9fdc 100644
--- a/API/TaskManager.Entity/11-18/SUPPLIER_PRO_PROCESS_EQUIPMENT_LOGS.cs
+++ b/API/TaskManager.Entity/11-18/SUPPLIER_PRO_PROCESS_EQUIPMENT_LOGS.cs
@@ -156,7 +156,7 @@ namespace TaskManager.Entity.Entitys
///
[ExporterHeader(DisplayName = "最近校准日期")]
[ImporterHeader(Name = "最近校准日期")]
- public string CalibrationDate { get; set; }
+ public DateTime? CalibrationDate { get; set; }
///
/// 校准到期天数
///
diff --git a/API/Wood.Service/Datas/SupplierEmployeeDtService.cs b/API/Wood.Service/Datas/SupplierEmployeeDtService.cs
index 1b205c4..e6310d3 100644
--- a/API/Wood.Service/Datas/SupplierEmployeeDtService.cs
+++ b/API/Wood.Service/Datas/SupplierEmployeeDtService.cs
@@ -167,21 +167,45 @@ namespace Wood.Service.Datas
{
#region 数据库操作
//添加任务
-
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
await _context.TaskSub.AddAsync(taskSubObj);
+ entity.ReadState = true;
+ entity.WriteState = false;
+ entity.TaskId = taskSubObj.TaskId;
//添加任务明细
SUPPLIER_EMPLOYEE empObj = new SUPPLIER_EMPLOYEE();
- empObj.InjectFrom(entity);
- //EntityMapper.Trans(entity);
+
+ empObj.SupplierCode = entity.SupplierCode;
+ empObj.SupplierName = entity.SupplierName;
+ empObj.PlantId = entity.PlantId;
+ empObj.PlantName = entity.PlantName;
+ empObj.WorkshopId = entity.WorkshopId;
+ empObj.WorkshopName = entity.WorkshopName;
+ empObj.ProductionLineId = entity.ProductionLineId;
+ empObj.ProductionLineName = entity.ProductionLineName;
+ empObj.StationId = entity.StationId;
+ empObj.StationName = entity.StationName;
+ empObj.OperatorId = entity.OperatorId;
+ empObj.OperatorName = entity.OperatorName;
+ empObj.HaveQuantity = entity.HaveQuantity;
+ empObj.DataUpdateTime = entity.DataUpdateTime;
+ empObj.PositionId = entity.PositionId;
+ empObj.PositionName = entity.PositionName;
+ empObj.QualificationLevel = entity.QualificationLevel;
+ empObj.CheckInTime = entity.CheckInTime;
+ empObj.CheckOutTime = entity.CheckOutTime;
empObj.TaskId = taskSubObj.TaskId;
- await _context.AddAsync(empObj);
+ empObj.ReadState = true;
- 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; }
+ 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();
@@ -190,27 +214,6 @@ namespace Wood.Service.Datas
- ////添加任务明细
- //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();
@@ -236,16 +239,39 @@ namespace Wood.Service.Datas
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
await _context.TaskSub.AddAsync(taskSubObj);
+ entity.ReadState = true;
+ entity.WriteState = false;
+ entity.TaskId = taskSubObj.TaskId;
//添加任务明细
SUPPLIER_EMPLOYEE empObj = new SUPPLIER_EMPLOYEE();
- empObj.InjectFrom(entity);
- //EntityMapper.Trans(entity);
+
+ empObj.SupplierCode = entity.SupplierCode;
+ empObj.SupplierName = entity.SupplierName;
+ empObj.PlantId = entity.PlantId;
+ empObj.PlantName = entity.PlantName;
+ empObj.WorkshopId = entity.WorkshopId;
+ empObj.WorkshopName = entity.WorkshopName;
+ empObj.ProductionLineId = entity.ProductionLineId;
+ empObj.ProductionLineName = entity.ProductionLineName;
+ empObj.StationId = entity.StationId;
+ empObj.StationName = entity.StationName;
+ empObj.OperatorId = entity.OperatorId;
+ empObj.OperatorName = entity.OperatorName;
+ empObj.HaveQuantity = entity.HaveQuantity;
+ empObj.DataUpdateTime = entity.DataUpdateTime;
+ empObj.PositionId = entity.PositionId;
+ empObj.PositionName = entity.PositionName;
+ empObj.QualificationLevel = entity.QualificationLevel;
+ empObj.CheckInTime = entity.CheckInTime;
+ empObj.CheckOutTime = entity.CheckOutTime;
empObj.TaskId = taskSubObj.TaskId;
- await _context.AddAsync(empObj);
+ empObj.ReadState = true;
- await _context.BulkMergeAsync(new List { entity }, options => {
+ 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;
}
@@ -253,31 +279,6 @@ namespace Wood.Service.Datas
_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 ed1af9b..8de34f9 100644
--- a/API/Wood.Service/Datas/SupplierInfoDtService.cs
+++ b/API/Wood.Service/Datas/SupplierInfoDtService.cs
@@ -163,45 +163,42 @@ namespace Wood.Service.Datas
{
#region 数据库操作
//添加任务
- //TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
-
- //await _taskSubRepository.AddAsync(taskSubObj);
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
await _context.TaskSub.AddAsync(taskSubObj);
-
-
+ entity.ReadState = true;
+ entity.WriteState = false;
+ entity.TaskId = taskSubObj.TaskId;
//添加任务明细
+
SUPPLIER_INFO empObj = new SUPPLIER_INFO();
- empObj.InjectFrom(entity);
- //EntityMapper.Trans(entity);
+ empObj.SupplierCode = entity.SupplierCode;
+ empObj.SupplierName = entity.SupplierName;
+ empObj.PlantId = entity.PlantId;
+ empObj.PlantName = entity.PlantName;
+ empObj.WorkshopId = entity.WorkshopId;
+ empObj.WorkshopName = entity.WorkshopName;
+ empObj.ProductionLineId = entity.ProductionLineId;
+ empObj.ProductionLineName = entity.ProductionLineName;
+ empObj.StationId = entity.StationId;
+ empObj.StationName = entity.StationName;
+ empObj.KeyStation = entity.KeyStation;
+ empObj.DataUpdateTime = entity.DataUpdateTime;
+ empObj.ProductionLineOrder = entity.ProductionLineOrder;
+ empObj.StationOrder = entity.StationOrder;
+ empObj.VendorProductNo = entity.VendorProductNo;
+ empObj.VendorProductName = entity.VendorProductName;
+ empObj.CheryProductNo = entity.CheryProductNo;
+ empObj.CheryProductName = entity.CheryProductName;
empObj.TaskId = taskSubObj.TaskId;
+ empObj.ReadState = true;
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; });
- 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();
@@ -223,20 +220,36 @@ namespace Wood.Service.Datas
{
#region 数据库操作
//添加任务
- //TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
- //await _taskSubRepository.AddAsync(taskSubObj);
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
await _context.TaskSub.AddAsync(taskSubObj);
-
-
-
+ entity.ReadState = true;
+ entity.WriteState = false;
+ entity.TaskId = taskSubObj.TaskId;
//添加任务明细
- //SUPPLIER_INFO empObj = EntityMapper.Trans(entity);
+
SUPPLIER_INFO empObj = new SUPPLIER_INFO();
- empObj.InjectFrom(entity);
+ empObj.SupplierCode = entity.SupplierCode;
+ empObj.SupplierName = entity.SupplierName;
+ empObj.PlantId = entity.PlantId;
+ empObj.PlantName = entity.PlantName;
+ empObj.WorkshopId = entity.WorkshopId;
+ empObj.WorkshopName = entity.WorkshopName;
+ empObj.ProductionLineId = entity.ProductionLineId;
+ empObj.ProductionLineName = entity.ProductionLineName;
+ empObj.StationId = entity.StationId;
+ empObj.StationName = entity.StationName;
+ empObj.KeyStation = entity.KeyStation;
+ empObj.DataUpdateTime = entity.DataUpdateTime;
+ empObj.ProductionLineOrder = entity.ProductionLineOrder;
+ empObj.StationOrder = entity.StationOrder;
+ empObj.VendorProductNo = entity.VendorProductNo;
+ empObj.VendorProductName = entity.VendorProductName;
+ empObj.CheryProductNo = entity.CheryProductNo;
+ empObj.CheryProductName = entity.CheryProductName;
empObj.TaskId = taskSubObj.TaskId;
+ empObj.ReadState = true;
await _context.AddAsync(empObj);
@@ -246,21 +259,7 @@ namespace Wood.Service.Datas
_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 1413aac..bbb37c1 100644
--- a/API/Wood.Service/Datas/SupplierProProcessEquipmentDtService.cs
+++ b/API/Wood.Service/Datas/SupplierProProcessEquipmentDtService.cs
@@ -152,47 +152,58 @@ namespace Wood.Service.Datas
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);
+
+ entity.SupplierCode = VendCode;
+ entity.ReadState = true;
+ entity.WriteState = false;
+ entity.TaskId = taskSubObj.TaskId;
//添加任务明细
SUPPLIER_PRO_PROCESS_EQUIPMENT empObj = new SUPPLIER_PRO_PROCESS_EQUIPMENT();
- empObj.InjectFrom(entity);
+
+ empObj.SupplierCode = entity.SupplierCode;
+ empObj.SupplierName = entity.SupplierName;
+ empObj.CheryProductNo = entity.CheryProductNo;
+ empObj.CheryProductName = entity.CheryProductName;
+ empObj.VendorProductNo = entity.VendorProductNo;
+ empObj.VendorProductName = entity.VendorProductName;
+ empObj.DeviceType = entity.DeviceType;
+ empObj.DeviceCode = entity.DeviceCode;
+ empObj.DeviceName = entity.DeviceName;
+ empObj.Manufacturer = entity.Manufacturer;
+ empObj.ModelNumber = entity.ModelNumber;
+ empObj.SerialNumber = entity.SerialNumber;
+ empObj.ProductionDate = entity.ProductionDate;
+ empObj.Material = entity.Material;
+ empObj.CurrentLocation = entity.CurrentLocation;
+ empObj.DeviceStatus = entity.DeviceStatus;
+ empObj.CavityCount = entity.CavityCount;
+ empObj.MoldSize = entity.MoldSize;
+ empObj.DesignLifeUnits = entity.DesignLifeUnits;
+ empObj.DesignLifeValue = entity.DesignLifeValue;
+ empObj.CurrentUsageCount = entity.CurrentUsageCount;
+ empObj.OverhaulCount = entity.OverhaulCount;
+ empObj.CoolingChannelLayout = entity.CoolingChannelLayout;
+ empObj.DetectionAccuracy = entity.DetectionAccuracy;
+ empObj.CalibrationDate = entity.CalibrationDate;
+ empObj.CalibrationDueDays = entity.CalibrationDueDays;
+ empObj.ToleranceRange = entity.ToleranceRange;
+ empObj.WearThreshold = entity.WearThreshold;
+ empObj.DetectionRange = entity.DetectionRange;
+ empObj.UnitType = entity.UnitType;
empObj.SupplierCode = VendCode;
- //EntityMapper.Trans(entity);
empObj.TaskId = taskSubObj.TaskId;
- await _context.AddAsync(empObj);
-
- //await _supplierProProcessEquipmentRepository.AddAsync(empObj);
-
+ empObj.ReadState = true;
- await _context.BulkMergeAsync(new List { entity }, options => { options.ColumnPrimaryKeyExpression = itm =>
- new { itm.SupplierCode, itm.CheryProductNo, itm.DeviceCode, itm.DeviceType}; options.Transaction = tran; }
- );
+ await _context.BulkInsertAsync(new List() { empObj });
_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();
return Ok(true);
}
@@ -210,26 +221,68 @@ namespace Wood.Service.Datas
try
{
#region 数据库操作
+
//添加任务
TaskSub taskSubObj = _commonService.BuildTaskSub(1, _taskName);
await _taskSubRepository.AddAsync(taskSubObj);
+
+ entity.SupplierCode = VendCode;
+ entity.ReadState = true;
+ entity.WriteState = false;
+ entity.TaskId = taskSubObj.TaskId;
//添加任务明细
SUPPLIER_PRO_PROCESS_EQUIPMENT empObj = new SUPPLIER_PRO_PROCESS_EQUIPMENT();
- empObj.InjectFrom(entity);
+
+ empObj.SupplierCode = entity.SupplierCode;
+ empObj.SupplierName = entity.SupplierName;
+ empObj.CheryProductNo = entity.CheryProductNo;
+ empObj.CheryProductName = entity.CheryProductName;
+ empObj.VendorProductNo = entity.VendorProductNo;
+ empObj.VendorProductName = entity.VendorProductName;
+ empObj.DeviceType = entity.DeviceType;
+ empObj.DeviceCode = entity.DeviceCode;
+ empObj.DeviceName = entity.DeviceName;
+ empObj.Manufacturer = entity.Manufacturer;
+ empObj.ModelNumber = entity.ModelNumber;
+ empObj.SerialNumber = entity.SerialNumber;
+ empObj.ProductionDate = entity.ProductionDate;
+ empObj.Material = entity.Material;
+ empObj.CurrentLocation = entity.CurrentLocation;
+ empObj.DeviceStatus = entity.DeviceStatus;
+ empObj.CavityCount = entity.CavityCount;
+ empObj.MoldSize = entity.MoldSize;
+ empObj.DesignLifeUnits = entity.DesignLifeUnits;
+ empObj.DesignLifeValue = entity.DesignLifeValue;
+ empObj.CurrentUsageCount = entity.CurrentUsageCount;
+ empObj.OverhaulCount = entity.OverhaulCount;
+ empObj.CoolingChannelLayout = entity.CoolingChannelLayout;
+ empObj.DetectionAccuracy = entity.DetectionAccuracy;
+ empObj.CalibrationDate = entity.CalibrationDate;
+ empObj.CalibrationDueDays = entity.CalibrationDueDays;
+ empObj.ToleranceRange = entity.ToleranceRange;
+ empObj.WearThreshold = entity.WearThreshold;
+ empObj.DetectionRange = entity.DetectionRange;
+ empObj.UnitType = entity.UnitType;
+
empObj.SupplierCode = VendCode;
empObj.TaskId = taskSubObj.TaskId;
- await _context.AddAsync(empObj);
+ empObj.ReadState = true;
+
+
+ await _context.BulkInsertAsync(new List(){ empObj});
+ _context.SaveChanges();
//await _supplierProProcessEquipmentRepository.AddAsync(empObj);
- await _context.BulkMergeAsync(new List { entity }, options => {
+ await _context.BulkMergeAsync(new List { entity }, options =>
+ {
options.ColumnPrimaryKeyExpression = itm =>
new { itm.SupplierCode, itm.CheryProductNo, itm.DeviceCode, itm.DeviceType }; options.Transaction = tran;
}
);
- _context.SaveChanges();
+