Browse Source

更新版本

master
赵新宇 3 weeks ago
parent
commit
6cf6b4616f
  1. 2
      API/TaskManager.Entity/11-18/SUPPLIER_PRO_PROCESS_EQUIPMENT_LOGS.cs
  2. 113
      API/Wood.Service/Datas/SupplierEmployeeDtService.cs
  3. 97
      API/Wood.Service/Datas/SupplierInfoDtService.cs
  4. 119
      API/Wood.Service/Datas/SupplierProProcessEquipmentDtService.cs

2
API/TaskManager.Entity/11-18/SUPPLIER_PRO_PROCESS_EQUIPMENT_LOGS.cs

@ -156,7 +156,7 @@ namespace TaskManager.Entity.Entitys
/// </summary>
[ExporterHeader(DisplayName = "最近校准日期")]
[ImporterHeader(Name = "最近校准日期")]
public string CalibrationDate { get; set; }
public DateTime? CalibrationDate { get; set; }
/// <summary>
/// 校准到期天数
/// </summary>

113
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<SUPPLIER_INFO_DT, SUPPLIER_INFO>.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<SUPPLIER_EMPLOYEE_DT> { 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<SUPPLIER_EMPLOYEE_DT> { 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<SUPPLIER_EMPLOYEE_DT, SUPPLIER_EMPLOYEE>.Trans(entity);
//empObj.TaskId = taskSubObj.TaskId;
//await _supplierEmployeeRepository.AddAsync(empObj);
//var firstObj = _context.Set<SUPPLIER_EMPLOYEE_DT>().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<SUPPLIER_INFO_DT, SUPPLIER_INFO>.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<SUPPLIER_EMPLOYEE_DT> { entity }, options => {
await _context.AddAsync(empObj);
await _context.BulkMergeAsync(new List<SUPPLIER_EMPLOYEE_DT> { 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<SUPPLIER_EMPLOYEE_DT, SUPPLIER_EMPLOYEE>.Trans(entity);
//empObj.TaskId = taskSubObj.TaskId;
//await _supplierEmployeeRepository.AddAsync(empObj);
//var firstObj = _context.Set<SUPPLIER_EMPLOYEE_DT>().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();

97
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<SUPPLIER_INFO_DT, SUPPLIER_INFO>.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<SUPPLIER_INFO_DT> { entity }, options => { options.ColumnPrimaryKeyExpression = itm => new { itm.SupplierCode, itm.PlantId, itm.WorkshopId, itm.ProductionLineId, itm.StationId }; options.Transaction = tran; });
await _context.BulkMergeAsync(new List<SUPPLIER_INFO_DT> { 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<SUPPLIER_INFO_DT>().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<SUPPLIER_INFO_DT, SUPPLIER_INFO>.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<SUPPLIER_INFO_DT>().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();

119
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<SUPPLIER_PRO_PROCESS_EQUIPMENT_DT, SUPPLIER_PRO_PROCESS_EQUIPMENT>.Trans(entity);
empObj.TaskId = taskSubObj.TaskId;
await _context.AddAsync(empObj);
//await _supplierProProcessEquipmentRepository.AddAsync(empObj);
empObj.ReadState = true;
await _context.BulkMergeAsync(new List<SUPPLIER_PRO_PROCESS_EQUIPMENT_DT> { entity }, options => { options.ColumnPrimaryKeyExpression = itm =>
new { itm.SupplierCode, itm.CheryProductNo, itm.DeviceCode, itm.DeviceType}; options.Transaction = tran; }
);
await _context.BulkInsertAsync(new List<SUPPLIER_PRO_PROCESS_EQUIPMENT>() { empObj });
_context.SaveChanges();
//var firstObj = _context.Set<SUPPLIER_PRO_PROCESS_EQUIPMENT_DT>().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<SUPPLIER_PRO_PROCESS_EQUIPMENT>(){ empObj});
_context.SaveChanges();
//await _supplierProProcessEquipmentRepository.AddAsync(empObj);
await _context.BulkMergeAsync(new List<SUPPLIER_PRO_PROCESS_EQUIPMENT_DT> { entity }, options => {
await _context.BulkMergeAsync(new List<SUPPLIER_PRO_PROCESS_EQUIPMENT_DT> { entity }, options =>
{
options.ColumnPrimaryKeyExpression = itm =>
new { itm.SupplierCode, itm.CheryProductNo, itm.DeviceCode, itm.DeviceType }; options.Transaction = tran;
}
);
_context.SaveChanges();

Loading…
Cancel
Save