bug
This commit is contained in:
@@ -19,6 +19,10 @@ namespace Tnb.BasicData.Entities.Dto
|
||||
public string? unit_id { get; set; }
|
||||
public string? version { get; set; }
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int quantity { get; set; }
|
||||
/// <summary>
|
||||
/// 工艺路线名称
|
||||
/// </summary>
|
||||
public string? route_id { get; set; }
|
||||
|
||||
@@ -45,12 +45,11 @@ namespace Tnb.BasicData.Entities.Dto
|
||||
/// </summary>
|
||||
public string? loss_rate {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:数量
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? quantity {get;set;}
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:需要称量
|
||||
|
||||
@@ -37,7 +37,7 @@ public partial class BasEbomD : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public string? quantity { get; set; }
|
||||
public int quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 损耗率
|
||||
|
||||
@@ -32,7 +32,7 @@ public partial class BasEbomH : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public string? quantity { get; set; }
|
||||
public int quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位id
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace Tnb.BasicData
|
||||
material_id_id = b.id,
|
||||
status = SqlFunc.IIF(a.status == "0", "禁用", "启用"),
|
||||
descrip = a.descrip,
|
||||
quantity = a.quantity,
|
||||
version = a.version,
|
||||
route_id = c.name,
|
||||
route_id_id = c.id,
|
||||
|
||||
@@ -179,6 +179,56 @@ namespace Tnb.ProductionMgr
|
||||
.ExecuteCommandAsync();
|
||||
return (row > 0);
|
||||
}
|
||||
// /// <summary>
|
||||
// /// 关联同组工单
|
||||
// /// </summary>
|
||||
// /// <param name="input">关联同组工单输入参数</param>
|
||||
// /// <returns></returns>
|
||||
// [HttpPost]
|
||||
// public async Task<dynamic> RelevancySameGroupMo(MoCrInput input)
|
||||
// {
|
||||
// (bool executeRes, string errMsg) multi = (true, "");
|
||||
// var list = await _repository.AsSugarClient().Queryable<PrdMo>()
|
||||
// .InnerJoin<ToolMolds>((a, b) => a.material_id == b.material_id)
|
||||
// .Where((a, b) => input.WorkOrderIds.Contains(a.id))
|
||||
// .Select((a, b) => new
|
||||
// {
|
||||
// planDate = a.plan_start_date,
|
||||
// mold_code = b.mold_code,
|
||||
// }).ToListAsync();
|
||||
// var planDateAll = true;
|
||||
// var moldIdAll = true;
|
||||
// if (list?.Count > 0)
|
||||
// {
|
||||
// var planDate = list.FirstOrDefault()?.planDate;
|
||||
// var moldCode = list.FirstOrDefault()?.mold_code;
|
||||
//
|
||||
// planDateAll = list.Skip(1).All(x => x.planDate == planDate);
|
||||
// moldIdAll = list.Skip(1).All(x => x.mold_code == moldCode);
|
||||
// if (planDateAll && moldIdAll)
|
||||
// {
|
||||
// var groupId = SnowflakeIdHelper.NextId();
|
||||
// multi.executeRes = await _repository.AsSugarClient().Updateable<PrdMo>()
|
||||
// .SetColumns(c => new PrdMo { combine_mo_code = groupId })
|
||||
// .Where(it => input.WorkOrderIds.Contains(it.id))
|
||||
// .ExecuteCommandHasChangeAsync();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// multi.executeRes = false;
|
||||
// if (!planDateAll)
|
||||
// {
|
||||
// throw new AppFriendlyException("计划开始日期不一致", null);
|
||||
// }
|
||||
// if (!moldIdAll)
|
||||
// {
|
||||
// throw new AppFriendlyException("未关联到同一模具下", null);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return multi;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 关联同组工单
|
||||
/// </summary>
|
||||
@@ -189,12 +239,13 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
(bool executeRes, string errMsg) multi = (true, "");
|
||||
var list = await _repository.AsSugarClient().Queryable<PrdMo>()
|
||||
.InnerJoin<ToolMolds>((a, b) => a.material_id == b.material_id)
|
||||
.Where((a, b) => input.WorkOrderIds.Contains(a.id))
|
||||
.Select((a, b) => new
|
||||
.LeftJoin<ToolMoldsMaterial>((a, b) => a.material_id == b.material_id)
|
||||
.LeftJoin<ToolMolds>((a,b,c)=>b.mold_id==c.id)
|
||||
.Where((a, b,c) => input.WorkOrderIds.Contains(a.id))
|
||||
.Select((a, b,c) => new
|
||||
{
|
||||
planDate = a.plan_start_date,
|
||||
mold_code = b.mold_code,
|
||||
mold_code = c.mold_code,
|
||||
}).ToListAsync();
|
||||
var planDateAll = true;
|
||||
var moldIdAll = true;
|
||||
@@ -203,8 +254,8 @@ namespace Tnb.ProductionMgr
|
||||
var planDate = list.FirstOrDefault()?.planDate;
|
||||
var moldCode = list.FirstOrDefault()?.mold_code;
|
||||
|
||||
planDateAll = list.Skip(1).All(x => x.planDate == planDate);
|
||||
moldIdAll = list.Skip(1).All(x => x.mold_code == moldCode);
|
||||
planDateAll = list.All(x => x.planDate == planDate);
|
||||
moldIdAll = moldCode != null && list.All(x => x.mold_code == moldCode);
|
||||
if (planDateAll && moldIdAll)
|
||||
{
|
||||
var groupId = SnowflakeIdHelper.NextId();
|
||||
@@ -218,11 +269,11 @@ namespace Tnb.ProductionMgr
|
||||
multi.executeRes = false;
|
||||
if (!planDateAll)
|
||||
{
|
||||
throw new AppFriendlyException("计划开始日期不一致", null);
|
||||
throw Oops.Bah("计划开始日期不一致");
|
||||
}
|
||||
if (!moldIdAll)
|
||||
{
|
||||
throw new AppFriendlyException("未关联到同一模具下", null);
|
||||
throw Oops.Bah("未关联到同一模具下");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user