bug
This commit is contained in:
@@ -83,5 +83,10 @@ public partial class BasEbomH : BaseEntity<string>
|
||||
/// 仅用于关联表字段查询用不存储数据
|
||||
/// </summary>
|
||||
public string? query_info { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// erp修改时间
|
||||
/// </summary>
|
||||
public string erp_modify_time { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -34,5 +34,9 @@ namespace Tnb.ProductionMgr.Entities.Entity.ErpEntity
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public decimal BATCHAMOUNT { get; set; }
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public string MODIFIEDTIME { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -942,41 +942,45 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
BasEbomH basEbomH = await _db.Queryable<BasEbomH>().Where(x=>x.material_id==material.id && x.version==firstItemInList.HVERSION).FirstAsync();
|
||||
if (basEbomH == null) continue;
|
||||
|
||||
bool flag = false;
|
||||
List<BasEbomD> tempList = new List<BasEbomD>();
|
||||
foreach (var children in itemList)
|
||||
|
||||
if (basEbomH.erp_modify_time != firstItemInList.MODIFIEDTIME)
|
||||
{
|
||||
BasMaterial childrenMaterial = materials.Find(x => x.code==children.SUBPRODID);
|
||||
if (childrenMaterial == null)
|
||||
bool flag = false;
|
||||
List<BasEbomD> tempList = new List<BasEbomD>();
|
||||
foreach (var children in itemList)
|
||||
{
|
||||
flag = true;
|
||||
tempList = new List<BasEbomD>();
|
||||
break;
|
||||
BasMaterial childrenMaterial = materials.Find(x => x.code==children.SUBPRODID);
|
||||
if (childrenMaterial == null)
|
||||
{
|
||||
flag = true;
|
||||
tempList = new List<BasEbomD>();
|
||||
break;
|
||||
}
|
||||
|
||||
BasEbomD basEbomD = new BasEbomD()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
ebom_id = basEbomH.id,
|
||||
material_id = childrenMaterial.id,
|
||||
denominator = children.DISHU,
|
||||
molecule = children.BATCHAMOUNT,
|
||||
};
|
||||
tempList.Add(basEbomD);
|
||||
}
|
||||
|
||||
BasEbomD basEbomD = new BasEbomD()
|
||||
if (flag)
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
ebom_id = basEbomH.id,
|
||||
material_id = childrenMaterial.id,
|
||||
denominator = children.DISHU,
|
||||
molecule = children.BATCHAMOUNT,
|
||||
};
|
||||
tempList.Add(basEbomD);
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
insertBasEbomDs.AddRange(tempList);
|
||||
await _db.Updateable<BasEbomH>()
|
||||
.SetColumns(x => x.unit_id == unitId)
|
||||
.Where(x => x.id == basEbomH.id)
|
||||
.ExecuteCommandAsync();
|
||||
await _db.Deleteable<BasEbomD>().Where(x => x.ebom_id == basEbomH.id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
insertBasEbomDs.AddRange(tempList);
|
||||
await _db.Updateable<BasEbomH>()
|
||||
.SetColumns(x => x.unit_id == unitId)
|
||||
.Where(x => x.id == basEbomH.id)
|
||||
.ExecuteCommandAsync();
|
||||
await _db.Deleteable<BasEbomD>().Where(x => x.ebom_id == basEbomH.id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user