This commit is contained in:
2024-06-29 12:26:12 +08:00
parent cf241dcd56
commit 3c52ad0d27
2 changed files with 70 additions and 59 deletions

View File

@@ -20,6 +20,7 @@ using Tnb.WarehouseMgr;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Interfaces;
using Tnb.WarehouseMgr.Entities.Enums;
namespace Tnb.ProductionMgr
{
@@ -496,35 +497,6 @@ namespace Tnb.ProductionMgr
}
if (prdMaterialReceiptH.first_feed)
{
List<PrdMaterialReceiptD> dList = await db.Queryable<PrdMaterialReceiptD>()
.Where(x => x.material_receipt_id == prdMaterialReceiptH.id).ToListAsync();
// foreach (var item in dList)
// {
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result2 = await _wmsCarryUnbindService.CarryUnbind(new CarryBindInput()
{
org = prdFeedingH.org_id,
create_id = prdFeedingH.create_id,
carry_id = prdMaterialReceiptH.carry_id,
carry_code = prdMaterialReceiptH.carry_code,
carrystd_id = carry.carrystd_id,
membercarry_code = "",
membercarry_id = "",
});
if (result2.code != JNPF.Common.Enums.HttpStatusCode.OK)
{
throw Oops.Bah(result2.msg);
}
// }
await db.Updateable<PrdMaterialReceiptH>()
.SetColumns(x => x.first_feed == true)
.Where(x => x.id == prdMaterialReceiptH.id)
.ExecuteCommandAsync();
}
}
else
{
@@ -535,6 +507,44 @@ namespace Tnb.ProductionMgr
_ = await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
_ = await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
if (prdMaterialReceiptH.first_feed)
{
await db.Updateable<PrdMaterialReceiptH>()
.SetColumns(x => x.first_feed == true)
.Where(x => x.id == prdMaterialReceiptH.id)
.ExecuteCommandAsync();
List<PrdMaterialReceiptD> dList = await db.Queryable<PrdMaterialReceiptD>()
.Where(x => x.material_receipt_id == prdMaterialReceiptH.id).ToListAsync();
List<String> carryIds = dList.Select(x => x.member_carry_id).ToList();
carryIds.Add(prdMaterialReceiptH.carry_id);
// foreach (var item in dList)
// {
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result2 = await _wmsCarryUnbindService.CarryUnbind(new CarryBindInput()
{
org = prdFeedingH.org_id,
create_id = prdFeedingH.create_id,
carry_id = prdMaterialReceiptH.carry_id,
carry_code = prdMaterialReceiptH.carry_code,
carrystd_id = carry.carrystd_id,
membercarry_code = "",
membercarry_id = "",
});
await db.Updateable<WmsCarryH>()
.SetColumns(x => x.carry_status == ((int)EnumCarryStatus.).ToString())
.Where(x => carryIds.Contains(x.id))
.ExecuteCommandAsync();
if (result2.code != JNPF.Common.Enums.HttpStatusCode.OK)
{
throw Oops.Bah(result2.msg);
}
// }
}
await db.Ado.CommitTranAsync();
}