一次合格品仓库,抛光仓库,GP12质检报告,抛光操作,后道检验相关功能完善
This commit is contained in:
parent
8b9205cea3
commit
729f148731
@ -3,6 +3,7 @@ using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
using ZR.Service.mes.wms;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
|
||||
//创建时间:2024-08-08
|
||||
@ -11,8 +12,8 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// <summary>
|
||||
/// GP12质检记录表
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/WmGp12QualityStatistics")]
|
||||
//[Verify]
|
||||
[Route("/mes/wm/WmGp12QualityStatistics")]
|
||||
public class WmGp12QualityStatisticsController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
@ -33,7 +34,6 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "business:wmgp12qualitystatistics:list")]
|
||||
public IActionResult QueryWmGp12QualityStatistics(
|
||||
[FromQuery] WmGp12QualityStatisticsQueryDto parm
|
||||
)
|
||||
@ -48,7 +48,6 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "business:wmgp12qualitystatistics:query")]
|
||||
public IActionResult GetWmGp12QualityStatistics(string Id)
|
||||
{
|
||||
var response = _WmGp12QualityStatisticsService.GetInfo(Id);
|
||||
@ -62,15 +61,21 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "business:wmgp12qualitystatistics:add")]
|
||||
[Log(Title = "GP12质检记录表", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddWmGp12QualityStatistics([FromBody] WmGp12QualityStatisticsDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<WmGp12QualityStatistics>().ToCreate(HttpContext);
|
||||
try
|
||||
{
|
||||
var modal = parm.Adapt<WmGp12QualityStatistics>().ToCreate(HttpContext);
|
||||
|
||||
var response = _WmGp12QualityStatisticsService.AddWmGp12QualityStatistics(modal);
|
||||
var response = _WmGp12QualityStatisticsService.AddWmGp12QualityStatistics(modal);
|
||||
|
||||
return SUCCESS(response);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ToResponse(ApiResult.Error("添加记录失败:" + e.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -78,16 +83,22 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "business:wmgp12qualitystatistics:edit")]
|
||||
[Log(Title = "GP12质检记录表", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateWmGp12QualityStatistics(
|
||||
[FromBody] WmGp12QualityStatisticsDto parm
|
||||
)
|
||||
{
|
||||
var modal = parm.Adapt<WmGp12QualityStatistics>().ToUpdate(HttpContext);
|
||||
var response = _WmGp12QualityStatisticsService.UpdateWmGp12QualityStatistics(modal);
|
||||
try
|
||||
{
|
||||
var modal = parm.Adapt<WmGp12QualityStatistics>().ToUpdate(HttpContext);
|
||||
var response = _WmGp12QualityStatisticsService.UpdateWmGp12QualityStatistics(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
return ToResponse(response);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ToResponse(ApiResult.Error("修改记录失败:" + e.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -95,7 +106,6 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:wmgp12qualitystatistics:delete")]
|
||||
[Log(Title = "GP12质检记录表", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteWmGp12QualityStatistics(string ids)
|
||||
{
|
||||
|
||||
@ -25,19 +25,26 @@ namespace ZR.Model.MES.wms.Dto
|
||||
/// </summary>
|
||||
public class WmGp12QualityStatisticsDto
|
||||
{
|
||||
[Required(ErrorMessage = "id不能为空")]
|
||||
public string Id { get; set; }
|
||||
|
||||
public string WorkorderId { get; set; }
|
||||
|
||||
public string Partnumber { get; set; }
|
||||
|
||||
public string Color { get; set; }
|
||||
|
||||
public string Specification { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public int? RequireNumber { get; set; }
|
||||
|
||||
public string Team { get; set; }
|
||||
|
||||
public int? QualifiedNumber { get; set; }
|
||||
|
||||
public string QualifiedRateStr { get; set; }
|
||||
|
||||
public decimal QualifiedRate { get; set; }
|
||||
|
||||
public int? PaoguangTotal { get; set; }
|
||||
|
||||
@ -13,6 +13,12 @@ namespace ZR.Model.MES.wms
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单号
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string WorkOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 毛坯号
|
||||
/// </summary>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -27,12 +27,56 @@ namespace ZR.Service.mes.wms
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmGp12QualityStatisticsDto> GetList(WmGp12QualityStatisticsQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmGp12QualityStatistics>();
|
||||
var predicate = Expressionable
|
||||
.Create<WmGp12QualityStatistics>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.WorkorderId),
|
||||
it => it.WorkorderId.Contains(parm.WorkorderId)
|
||||
)
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Team), it => it.Team.Contains(parm.Team))
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.Partnumber),
|
||||
it => it.Partnumber.Contains(parm.Partnumber)
|
||||
)
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.CreatedBy),
|
||||
it => it.CreatedBy.Contains(parm.CreatedBy)
|
||||
)
|
||||
.AndIF(
|
||||
parm.StartTime != null,
|
||||
it => it.StartTime >= parm.StartTime.Value.ToLocalTime()
|
||||
)
|
||||
.AndIF(
|
||||
parm.EndTime != null,
|
||||
it => it.StartTime <= parm.EndTime.Value.ToLocalTime()
|
||||
);
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<WmGp12QualityStatistics, WmGp12QualityStatisticsDto>(parm);
|
||||
|
||||
if (response.Result.Count > 0)
|
||||
{
|
||||
foreach (WmGp12QualityStatisticsDto item in response.Result)
|
||||
{
|
||||
WmMaterial material = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber == item.Partnumber)
|
||||
.Where(it => it.Type == 1)
|
||||
.Where(it => it.Status == 1)
|
||||
.First();
|
||||
if (material == null)
|
||||
{
|
||||
item.Description = "此零件号不在物料清单内!";
|
||||
continue;
|
||||
}
|
||||
item.QualifiedRateStr = Math.Ceiling(item.QualifiedRate).ToString() + "%";
|
||||
item.Color = material.Color;
|
||||
item.Specification = material.Specification;
|
||||
item.Description = !string.IsNullOrEmpty(material.Description)
|
||||
? material.Description
|
||||
: material.ProductName;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -55,7 +99,114 @@ namespace ZR.Service.mes.wms
|
||||
/// <returns></returns>
|
||||
public WmGp12QualityStatistics AddWmGp12QualityStatistics(WmGp12QualityStatistics model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
try
|
||||
{
|
||||
Context.Ado.BeginTran();
|
||||
if (
|
||||
model.RequireNumber
|
||||
!= (
|
||||
model.QualifiedNumber
|
||||
+ model.PaoguangTotal
|
||||
+ model.DamoTotal
|
||||
+ model.BaofeiTotal
|
||||
)
|
||||
)
|
||||
{
|
||||
throw new Exception("投入数与合格数,抛光总数,打磨数,报废数不符合,请检查");
|
||||
}
|
||||
model.Id = SnowFlakeSingle.instance.NextId().ToString();
|
||||
model.Type = 0;
|
||||
decimal qualifiedRate = 0.0m;
|
||||
if (model.QualifiedNumber != 0)
|
||||
{
|
||||
qualifiedRate =
|
||||
(decimal)model.QualifiedNumber / model.RequireNumber * 100 ?? 0.0m;
|
||||
}
|
||||
model.QualifiedRate = qualifiedRate;
|
||||
WmGp12QualityStatistics res0 = Context.Insertable(model).ExecuteReturnEntity();
|
||||
if (res0 == null)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("插入GP12检测结果记录失败");
|
||||
}
|
||||
WmOneTimeInventoryService oneTimeService = new();
|
||||
WmPolishInventoryService inventoryService = new();
|
||||
//抛光品重新进入抛光仓库
|
||||
if (model.PaoguangTotal > 0)
|
||||
{
|
||||
WmPolishInventory wmPolishInventoryWarehousing =
|
||||
new()
|
||||
{
|
||||
Partnumber = model.Partnumber,
|
||||
WorkOrder = model.WorkorderId,
|
||||
Type = model.IsReturnWorkpiece ? 2 : 1,
|
||||
Quantity = model.PaoguangTotal,
|
||||
CreatedBy = model.CreatedBy,
|
||||
ActionTime = DateTime.Now.ToLocalTime(),
|
||||
Remark =
|
||||
"GP12检测抛光入库,抛光数:"
|
||||
+ model.PaoguangTotal
|
||||
+ "、工单号:"
|
||||
+ model.WorkorderId ?? "未填写工单号"
|
||||
+ "。记录时间:"
|
||||
+ model.CreatedTime.Value.ToLocalTime().ToString()
|
||||
+ "[来源记录识别编号:"
|
||||
+ res0.Id
|
||||
+ "]"
|
||||
};
|
||||
int res1 = inventoryService.DoWmPolishWarehousing(wmPolishInventoryWarehousing);
|
||||
if (res1 == 0)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("GP12检测结果抛光入库失败");
|
||||
}
|
||||
}
|
||||
//合格品,报废,打磨品,抛光品 扣除一次合格品仓库库存
|
||||
if ((model.BaofeiTotal + model.DamoTotal + model.QualifiedNumber + model.PaoguangTotal) > 0)
|
||||
{
|
||||
WmOneTimeInventory wmOneTimeInventoryRetrieval =
|
||||
new()
|
||||
{
|
||||
Partnumber = model.Partnumber,
|
||||
WorkOrder = model.WorkorderId,
|
||||
Type = model.IsReturnWorkpiece ? 2 : 1,
|
||||
Quantity = (
|
||||
model.BaofeiTotal + model.DamoTotal + model.QualifiedNumber + model.PaoguangTotal
|
||||
),
|
||||
CreatedBy = model.CreatedBy,
|
||||
ActionTime = DateTime.Now.ToLocalTime(),
|
||||
Remark =
|
||||
"GP12检测记录出库,合格数:"
|
||||
+ model.QualifiedNumber
|
||||
+ "、抛光数:"
|
||||
+ model.PaoguangTotal
|
||||
+ "、打磨数:"
|
||||
+ model.DamoTotal
|
||||
+ "、报废数:"
|
||||
+ model.BaofeiTotal
|
||||
+ "、工单号:"
|
||||
+ model.WorkorderId ?? "未填写工单号"
|
||||
+ "。记录时间:"
|
||||
+ model.CreatedTime.Value.ToLocalTime().ToString()
|
||||
+ "[来源记录识别编号:"
|
||||
+ res0.Id
|
||||
+ "]"
|
||||
};
|
||||
int res2 = oneTimeService.DoWmOneTimeRetrieval(wmOneTimeInventoryRetrieval);
|
||||
if (res2 == 0)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("GP12检测结果出库失败");
|
||||
}
|
||||
}
|
||||
Context.Ado.CommitTran();
|
||||
return res0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -65,7 +216,33 @@ namespace ZR.Service.mes.wms
|
||||
/// <returns></returns>
|
||||
public int UpdateWmGp12QualityStatistics(WmGp12QualityStatistics model)
|
||||
{
|
||||
return Update(model, true);
|
||||
try
|
||||
{
|
||||
if (
|
||||
model.RequireNumber
|
||||
!= (
|
||||
model.QualifiedNumber
|
||||
+ model.PaoguangTotal
|
||||
+ model.DamoTotal
|
||||
+ model.BaofeiTotal
|
||||
)
|
||||
)
|
||||
{
|
||||
throw new Exception("投入数与合格数,抛光数,打磨数,报废数不符合,请检查");
|
||||
}
|
||||
decimal qualifiedRate = 0.0m;
|
||||
if (model.QualifiedNumber != 0)
|
||||
{
|
||||
qualifiedRate =
|
||||
(decimal)model.QualifiedNumber / model.RequireNumber * 100 ?? 0.0m;
|
||||
}
|
||||
model.QualifiedRate = qualifiedRate;
|
||||
return Update(model, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,7 +251,9 @@ namespace ZR.Service.mes.wms
|
||||
WmPolishInventory addWmPolishInventory = Context
|
||||
.Insertable(newWmPolishInventory)
|
||||
.ExecuteReturnEntity();
|
||||
string code = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
string code = !string.IsNullOrEmpty(parm.WorkOrder)
|
||||
? parm.WorkOrder
|
||||
: SnowFlakeSingle.Instance.NextId().ToString();
|
||||
string remark = "初次创建仓库,新增入库数据 " + parm.Remark;
|
||||
int successNum = AddPolishRecord(
|
||||
addWmPolishInventory.Id,
|
||||
@ -355,7 +357,9 @@ namespace ZR.Service.mes.wms
|
||||
WmPolishInventory addWmPolishInventory = Context
|
||||
.Insertable(newWmPolishInventory)
|
||||
.ExecuteReturnEntity();
|
||||
string code = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
string code = !string.IsNullOrEmpty(parm.WorkOrder)
|
||||
? parm.WorkOrder
|
||||
: SnowFlakeSingle.Instance.NextId().ToString();
|
||||
string remark = "初次创建仓库,新增手动出库数据" + parm.Remark;
|
||||
int successNum = AddPolishRecord(
|
||||
addWmPolishInventory.Id,
|
||||
@ -432,7 +436,9 @@ namespace ZR.Service.mes.wms
|
||||
}
|
||||
Context.Updateable(parm).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||||
// 已有则新增记录
|
||||
string code = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
string code = !string.IsNullOrEmpty(parm.WorkOrder)
|
||||
? parm.WorkOrder
|
||||
: SnowFlakeSingle.Instance.NextId().ToString();
|
||||
int successNum = AddPolishRecord(
|
||||
parm.Id,
|
||||
code,
|
||||
@ -457,7 +463,5 @@ namespace ZR.Service.mes.wms
|
||||
throw new Exception(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ namespace ZR.Service.mes.wms
|
||||
)
|
||||
.AndIF(
|
||||
parm.EndTime != null,
|
||||
it => it.StartTime <= parm.StartTime.Value.ToLocalTime()
|
||||
it => it.StartTime <= parm.EndTime.Value.ToLocalTime()
|
||||
);
|
||||
|
||||
var response = Queryable()
|
||||
@ -127,8 +127,67 @@ namespace ZR.Service.mes.wms
|
||||
(decimal)model.QualifiedNumber / model.RequireNumber * 100 ?? 0.0m;
|
||||
}
|
||||
model.QualifiedRate = qualifiedRate;
|
||||
WmPolishQualityStatistics res0 = Context.Insertable(model).ExecuteReturnEntity();
|
||||
if (res0 == null)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("插入抛光质检记录失败");
|
||||
}
|
||||
WmPolishInventoryService inventoryService = new();
|
||||
//TODO 合格品检查是否是门把手,是进入成品库,不是进入一次合格品库
|
||||
WmOneTimeInventoryService oneTimeService = new();
|
||||
// 合格品检查是否是门把手,是进入成品库(仅出库),不是进入一次合格品库
|
||||
string[] checkStrArray =
|
||||
{
|
||||
"T22",
|
||||
"T26",
|
||||
"A58",
|
||||
"A60",
|
||||
"C01",
|
||||
"B02",
|
||||
"V71",
|
||||
"T1EJ "
|
||||
};
|
||||
var isDoorknobCheck = Expressionable
|
||||
.Create<WmMaterial>();
|
||||
foreach (string checkStr in checkStrArray)
|
||||
{
|
||||
isDoorknobCheck.Or(it => it.Description.Contains(checkStr));
|
||||
}
|
||||
;
|
||||
isDoorknobCheck.And(it => it.Partnumber == res0.Partnumber)
|
||||
.And(it => it.Type == 1)
|
||||
.And(it => it.Status == 1)
|
||||
.And(it => it.Description.Contains("门把手"));
|
||||
bool isDoorknob = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(isDoorknobCheck.ToExpression())
|
||||
.Any();
|
||||
if (!isDoorknob && model.QualifiedNumber > 0)
|
||||
{
|
||||
WmOneTimeInventory wmOneTimeInventoryWarehousing =
|
||||
new()
|
||||
{
|
||||
Partnumber = model.Partnumber,
|
||||
Type = model.IsReturnWorkpiece ? 2 : 1,
|
||||
Quantity = model.PaoguangTotal,
|
||||
CreatedBy = model.CreatedBy,
|
||||
ActionTime = DateTime.Now.ToLocalTime(),
|
||||
Remark =
|
||||
"抛光合格品入库,合格数:"
|
||||
+ model.QualifiedNumber
|
||||
+ "。记录时间:"
|
||||
+ model.CreatedTime.Value.ToLocalTime().ToString()
|
||||
+ "[来源记录识别编号:"
|
||||
+ res0.Id
|
||||
+ "]"
|
||||
};
|
||||
int res1 = oneTimeService.DoWmOneTimeWarehousing(wmOneTimeInventoryWarehousing);
|
||||
if (res1 == 0)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("抛光合格品入库失败");
|
||||
}
|
||||
}
|
||||
|
||||
//抛光品重新进入抛光仓库
|
||||
if (model.PaoguangTotal > 0)
|
||||
@ -140,12 +199,15 @@ namespace ZR.Service.mes.wms
|
||||
Type = model.IsReturnWorkpiece ? 2 : 1,
|
||||
Quantity = model.PaoguangTotal,
|
||||
CreatedBy = model.CreatedBy,
|
||||
ActionTime = DateTime.Now,
|
||||
ActionTime = DateTime.Now.ToLocalTime(),
|
||||
Remark =
|
||||
"抛光质检记录入库:抛光数"
|
||||
"抛光质检记录入库,抛光数:"
|
||||
+ model.PaoguangTotal
|
||||
+ "。记录时间"
|
||||
+ "。记录时间:"
|
||||
+ model.CreatedTime.Value.ToLocalTime().ToString()
|
||||
+ "[来源记录识别编号:"
|
||||
+ res0.Id
|
||||
+ "]"
|
||||
};
|
||||
int res1 = inventoryService.DoWmPolishWarehousing(wmPolishInventory);
|
||||
if (res1 == 0)
|
||||
@ -168,31 +230,27 @@ namespace ZR.Service.mes.wms
|
||||
CreatedBy = model.CreatedBy,
|
||||
ActionTime = DateTime.Now,
|
||||
Remark =
|
||||
"抛光质检记录出库:合格数"
|
||||
"抛光质检记录出库,合格数:"
|
||||
+ model.QualifiedNumber
|
||||
+ "、打磨数"
|
||||
+ "、打磨数:"
|
||||
+ model.DamoTotal
|
||||
+ "、报废数"
|
||||
+ "、报废数:"
|
||||
+ model.BaofeiTotal
|
||||
+ "。记录时间"
|
||||
+ "。记录时间:"
|
||||
+ model.CreatedTime.Value.ToLocalTime().ToString()
|
||||
+ "[来源记录识别编号:"
|
||||
+ res0.Id
|
||||
+ "]"
|
||||
};
|
||||
int res1 = inventoryService.DoWmPolishRetrieval(wmPolishInventory);
|
||||
if (res1 == 0)
|
||||
int res2 = inventoryService.DoWmPolishRetrieval(wmPolishInventory);
|
||||
if (res2 == 0)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("抛光质检记录出库失败");
|
||||
}
|
||||
}
|
||||
|
||||
WmPolishQualityStatistics res3 = Context.Insertable(model).ExecuteReturnEntity();
|
||||
if (res3 == null)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("插入抛光质检记录失败");
|
||||
}
|
||||
Context.Ado.CommitTran();
|
||||
return res3;
|
||||
return res0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -220,7 +278,7 @@ namespace ZR.Service.mes.wms
|
||||
)
|
||||
)
|
||||
{
|
||||
throw new Exception("投入数与合格数,抛光总数,打磨数,报废数不符合,请检查");
|
||||
throw new Exception("投入数与合格数,抛光数,打磨数,报废数不符合,请检查");
|
||||
}
|
||||
decimal qualifiedRate = 0.0m;
|
||||
if (model.QualifiedNumber != 0)
|
||||
|
||||
@ -50,7 +50,7 @@ namespace ZR.Service.mes.wms
|
||||
)
|
||||
.AndIF(
|
||||
parm.EndTime != null,
|
||||
it => it.StartTime <= parm.StartTime.Value.ToLocalTime()
|
||||
it => it.StartTime <= parm.EndTime.Value.ToLocalTime()
|
||||
);
|
||||
|
||||
var response = Queryable()
|
||||
@ -122,6 +122,14 @@ namespace ZR.Service.mes.wms
|
||||
(decimal)model.QualifiedNumber / model.RequireNumber * 100 ?? 0.0m;
|
||||
}
|
||||
model.QualifiedRate = qualifiedRate;
|
||||
WmPolishWorkQualityStatistics res0 = Context
|
||||
.Insertable(model)
|
||||
.ExecuteReturnEntity();
|
||||
if (res0 == null)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("插入抛光操作记录失败");
|
||||
}
|
||||
WmPolishInventoryService inventoryService = new();
|
||||
//合格品重新进入抛光仓库
|
||||
if (model.QualifiedNumber > 0)
|
||||
@ -133,12 +141,15 @@ namespace ZR.Service.mes.wms
|
||||
Type = model.IsReturnWorkpiece ? 2 : 1,
|
||||
Quantity = model.QualifiedNumber,
|
||||
CreatedBy = model.CreatedBy,
|
||||
ActionTime = DateTime.Now,
|
||||
ActionTime = DateTime.Now.ToLocalTime(),
|
||||
Remark =
|
||||
"抛光操作记录入库:合格数"
|
||||
"抛光操作记录入库,合格数:"
|
||||
+ model.QualifiedNumber
|
||||
+ "。记录时间"
|
||||
+ "。记录时间:"
|
||||
+ model.CreatedTime.Value.ToLocalTime().ToString()
|
||||
+ "[来源记录识别编号:"
|
||||
+ res0.Id
|
||||
+ "]"
|
||||
};
|
||||
int res1 = inventoryService.DoWmPolishWarehousing(wmPolishInventory);
|
||||
if (res1 == 0)
|
||||
@ -157,7 +168,7 @@ namespace ZR.Service.mes.wms
|
||||
Type = model.IsReturnWorkpiece ? 2 : 1,
|
||||
Quantity = (model.BaofeiTotal + model.DamoTotal),
|
||||
CreatedBy = model.CreatedBy,
|
||||
ActionTime = DateTime.Now,
|
||||
ActionTime = DateTime.Now.ToLocalTime(),
|
||||
Remark =
|
||||
"抛光操作记录出库:打磨数"
|
||||
+ model.DamoTotal
|
||||
@ -165,25 +176,19 @@ namespace ZR.Service.mes.wms
|
||||
+ model.BaofeiTotal
|
||||
+ "。记录时间"
|
||||
+ model.CreatedTime.Value.ToLocalTime().ToString()
|
||||
+ "[来源记录识别编号:"
|
||||
+ res0.Id
|
||||
+ "]"
|
||||
};
|
||||
int res1 = inventoryService.DoWmPolishRetrieval(wmPolishInventory);
|
||||
if (res1 == 0)
|
||||
int res2 = inventoryService.DoWmPolishRetrieval(wmPolishInventory);
|
||||
if (res2 == 0)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("抛光操作记录出库失败");
|
||||
}
|
||||
}
|
||||
|
||||
WmPolishWorkQualityStatistics res3 = Context
|
||||
.Insertable(model)
|
||||
.ExecuteReturnEntity();
|
||||
if (res3 == null)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("插入抛光操作记录失败");
|
||||
}
|
||||
Context.Ado.CommitTran();
|
||||
return res3;
|
||||
return res0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user