Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -53,6 +53,11 @@ public partial class PrdMo : BaseEntity<string>
|
|||||||
/// 已完工数量
|
/// 已完工数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? complete_qty { get; set; }
|
public int? complete_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已报工数量
|
||||||
|
/// </summary>
|
||||||
|
public int? reported_work_qty { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 报废数量
|
/// 报废数量
|
||||||
|
|||||||
@@ -1364,6 +1364,7 @@ namespace Tnb.ProductionMgr
|
|||||||
var row = -1;
|
var row = -1;
|
||||||
var report = await db.Queryable<PrdReport>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
var report = await db.Queryable<PrdReport>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
||||||
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||||
|
var prdMo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
||||||
var mbomProcess = await db.Queryable<BasMbomProcess>().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
|
var mbomProcess = await db.Queryable<BasMbomProcess>().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
|
||||||
|
|
||||||
if (prdMoTask.mo_task_status == DictConst.MoStatusPauseCode)
|
if (prdMoTask.mo_task_status == DictConst.MoStatusPauseCode)
|
||||||
@@ -1444,6 +1445,35 @@ namespace Tnb.ProductionMgr
|
|||||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prdMoTask.schedule_type==1)
|
||||||
|
{
|
||||||
|
if (prdMo.reported_work_qty == null)
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.reported_work_qty == input.reported_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prdMo.complete_qty == null)
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.complete_qty == input.reported_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id))
|
if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id))
|
||||||
{
|
{
|
||||||
if (mbomProcess.is_last==1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id))
|
if (mbomProcess.is_last==1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id))
|
||||||
@@ -1462,6 +1492,32 @@ namespace Tnb.ProductionMgr
|
|||||||
// .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
|
// .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
|
||||||
.Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync();
|
.Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prdMo.reported_work_qty == null)
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.reported_work_qty == input.reported_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prdMo.complete_qty == null)
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.complete_qty == input.reported_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1595,6 +1651,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
List<PrdMoTaskDefect> destDefects = new();
|
List<PrdMoTaskDefect> destDefects = new();
|
||||||
var batch = DateTime.Now.ToString("yyyyMMddHHmmss");
|
var batch = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||||
|
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||||
|
|
||||||
foreach (var categoryItem in input.categoryItems)
|
foreach (var categoryItem in input.categoryItems)
|
||||||
{
|
{
|
||||||
@@ -1619,7 +1676,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
#region 质检模块
|
#region 质检模块
|
||||||
//质检模块
|
//质检模块
|
||||||
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
|
||||||
TriggerPlanEntity entity = new TriggerPlanEntity();
|
TriggerPlanEntity entity = new TriggerPlanEntity();
|
||||||
entity.materialid = prdMoTask.material_id;
|
entity.materialid = prdMoTask.material_id;
|
||||||
entity.processid = prdMoTask.process_id;
|
entity.processid = prdMoTask.process_id;
|
||||||
@@ -1640,6 +1697,34 @@ namespace Tnb.ProductionMgr
|
|||||||
await db.Updateable(defectRecord).ExecuteCommandAsync();
|
await db.Updateable(defectRecord).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
var reportMaster = await db.Queryable<PrdReportRecord>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
var reportMaster = await db.Queryable<PrdReportRecord>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
||||||
|
var prdMo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
||||||
|
|
||||||
|
if (prdMo.reported_work_qty == null)
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.scrap_qty == input.scrap_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.scrap_qty == x.scrap_qty + input.scrap_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prdMo.complete_qty == null)
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.complete_qty == input.scrap_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await db.Updateable<PrdMo>()
|
||||||
|
.SetColumns(x => x.complete_qty == x.complete_qty + input.scrap_qty)
|
||||||
|
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
if (reportMaster != null)
|
if (reportMaster != null)
|
||||||
{
|
{
|
||||||
reportMaster.completed_qty += input.scrap_qty;
|
reportMaster.completed_qty += input.scrap_qty;
|
||||||
|
|||||||
@@ -499,11 +499,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Updateable(eles).ReSetValue(it => it.task_nums--).ExecuteCommandAsync();
|
await _db.Updateable(eles).ReSetValue(it => it.task_nums--).ExecuteCommandAsync();
|
||||||
|
|
||||||
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
|
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
|
||||||
var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id, it.endlocation_code)).ToList();
|
var multiList = disTasks.Select(it => (it.carry_id, it.carry_status, it.endlocation_id, it.endlocation_code)).ToList();
|
||||||
var locWhIdMap = await _db.Queryable<BasLocation>().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id);
|
var locWhIdMap = await _db.Queryable<BasLocation>().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id);
|
||||||
List<WmsCarryH> carryIts = new();
|
List<WmsCarryH> carryIts = new();
|
||||||
List<WmsCarryCode> carryCodeIts = new();
|
List<WmsCarryCode> carryCodeIts = new();
|
||||||
for (int i = 0; i < multiList.Count; i++)
|
List<BasLocation> locIts = new();
|
||||||
|
for (int i = 0, cnt = multiList.Count; i < cnt; i++)
|
||||||
{
|
{
|
||||||
WmsCarryH carry = new()
|
WmsCarryH carry = new()
|
||||||
{
|
{
|
||||||
@@ -521,29 +522,20 @@ namespace Tnb.WarehouseMgr
|
|||||||
carryIts.Add(carry);
|
carryIts.Add(carry);
|
||||||
carryCodeIts.Add(carryCode);
|
carryCodeIts.Add(carryCode);
|
||||||
|
|
||||||
//await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
BasLocation loc = new();
|
||||||
////更新条码的库位和仓库信息
|
loc.is_lock = 0;
|
||||||
//var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.id == multiList[i].carry_id).ToListAsync();
|
if (multiList[i].carry_status.ToEnum<EnumCarryStatus>() == EnumCarryStatus.空闲)
|
||||||
//if (carryCodes?.Count > 0)
|
{
|
||||||
//{
|
loc.is_use = ((int)EnumCarryStatus.占用).ToString();
|
||||||
// await _db.Updateable<WmsCarryCode>().SetColumns(it => new WmsCarryCode { warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(), location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
}
|
||||||
//}
|
locIts.Add(loc);
|
||||||
|
|
||||||
}
|
}
|
||||||
await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync();
|
await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync();
|
||||||
|
//更新条码的库位和仓库信息
|
||||||
await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync();
|
await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync();
|
||||||
//更新库位信息,使用状态为 使用,锁定状态为未锁定
|
//更新库位信息,使用状态为 使用,锁定状态为未锁定
|
||||||
var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList();
|
await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ExecuteCommandAsync();
|
||||||
for (int i = 0; i < multis.Count; i++)
|
|
||||||
{
|
|
||||||
var carryStatus = multis[i].carry_status;
|
|
||||||
if (multis[i].carry_status == ((int)EnumCarryStatus.空闲).ToString())
|
|
||||||
{
|
|
||||||
carryStatus = ((int)EnumCarryStatus.占用).ToString();
|
|
||||||
}
|
|
||||||
var cStatus = carryStatus.ParseToInt();
|
|
||||||
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = cStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
//更新业务主表的单据状态
|
//更新业务主表的单据状态
|
||||||
foreach (var dt in disTasks)
|
foreach (var dt in disTasks)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user