更新载具绑定和载具解绑

This commit is contained in:
FanLian
2023-06-20 19:07:02 +08:00
parent 0968abf3f0
commit 44e084cd2f
4 changed files with 80 additions and 34 deletions

View File

@@ -59,7 +59,7 @@ namespace Tnb.WarehouseMgr
{
await _db.Ado.BeginTranAsync();
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBIND_ID, true);
await _runService.Create(templateEntity, input);
if (input == null) throw new ArgumentNullException(nameof(input));
@@ -67,18 +67,21 @@ namespace Tnb.WarehouseMgr
var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
var subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == subCarryId);
WmsCarrybindH wmsCarrybindH = carry.Adapt<WmsCarrybindH>();
WmsCarryD wmsCarryD = new()
{
id = SnowflakeIdHelper.NextId(),
carry_id = carry.id,
org_id = carry?.org_id!,
membercarry_id = subCarry.id,
membercarry_code = subCarry.carry_code,
loc = input.data[nameof(WmsCarrybindH.loc)]?.ToString()!,
create_id = _userManager.UserId,
create_time = DateTime.Now
};
//WmsCarrybindH wmsCarrybindH = carry?.Adapt<WmsCarrybindH>()!;
if (carry != null && subCarry != null)
{
wmsCarrybindH.id = SnowflakeIdHelper.NextId();
wmsCarrybindH.org_id = carry.org_id;
wmsCarrybindH.carry_id = carry.id;
wmsCarrybindH.membercarry_id = subCarry.id;
wmsCarrybindH.membercarry_code = subCarry.carry_code;
wmsCarrybindH.loc = input.data[nameof(WmsCarrybindH.loc)].ParseToInt(1);
wmsCarrybindH.create_id = _userManager.UserId;
wmsCarrybindH.create_time = DateTime.Now;
var row = await _db.Insertable(wmsCarrybindH).ExecuteCommandAsync();
var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
carry.carry_status = "1";
row = await _db.Updateable(carry).ExecuteCommandAsync();
subCarry.carry_status = "1";
@@ -88,15 +91,15 @@ namespace Tnb.WarehouseMgr
{
WmsCarrybindCode wmsCarrybindCode = new();
wmsCarrybindCode.id = SnowflakeIdHelper.NextId();
wmsCarrybindCode.org_id = subCarry.id;
wmsCarrybindCode.carrybind_id = wmsCarrybindH.id;
wmsCarrybindCode.org_id = subCarry?.org_id!;
wmsCarrybindCode.carrybind_id = input.data["ReturnIdentity"]?.ToString()!;
wmsCarrybindCode.material_id = items[i].material_id;
wmsCarrybindCode.material_code = items[i].material_code;
wmsCarrybindCode.barcode = items[i].barcode;
wmsCarrybindCode.code_batch = items[i].code_batch;
wmsCarrybindCode.codeqty = items[i].codeqty;
wmsCarrybindCode.membercarry_id = subCarry.id;
wmsCarrybindCode.membercarry_code = subCarry.carry_code;
wmsCarrybindCode.membercarry_id = subCarry?.id;
wmsCarrybindCode.membercarry_code = subCarry?.carry_code;
wmsCarrybindCode.unit_id = items[i].unit_id;
wmsCarrybindCode.unit_code = items[i].unit_code;
wmsCarrybindCode.create_id = _userManager.UserId;

View File

@@ -58,7 +58,7 @@ namespace Tnb.WarehouseMgr
{
await _db.Ado.BeginTranAsync();
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBIND_ID, true);
await _runService.Create(templateEntity, input);
if (input == null) throw new ArgumentNullException(nameof(input));
@@ -69,7 +69,27 @@ namespace Tnb.WarehouseMgr
//WmsCarryunbindH wmsCarryUnbindH = carry.Adapt<WmsCarryunbindH>();
if (carry != null && subCarry != null)
{
var row = await _db.Deleteable<WmsCarryD>().Where(it => it.carry_id == subCarry.id).ExecuteCommandAsync();
var row = await _db.Deleteable<WmsCarryD>().Where(it => it.carry_id == carryId && it.membercarry_id == subCarryId).ExecuteCommandAsync();
var items = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
WmsCarryunbindCode wmsCarryUnbindCode = new();
for (int i = 0; i < items.Count; i++)
{
wmsCarryUnbindCode.id = SnowflakeIdHelper.NextId();
wmsCarryUnbindCode.org_id = subCarry?.org_id!;
wmsCarryUnbindCode.carryunbind_id = input.data["ReturnIdentity"]?.ToString()!;
wmsCarryUnbindCode.material_id = items[i].material_id;
wmsCarryUnbindCode.material_code = items[i].material_code;
wmsCarryUnbindCode.barcode = items[i].barcode;
wmsCarryUnbindCode.code_batch = items[i].code_batch;
wmsCarryUnbindCode.codeqty = items[i].codeqty;
wmsCarryUnbindCode.membercarry_id = subCarry?.id;
wmsCarryUnbindCode.membercarry_code = subCarry?.carry_code;
wmsCarryUnbindCode.unit_id = items[i].unit_id;
wmsCarryUnbindCode.unit_code = items[i].unit_code;
wmsCarryUnbindCode.create_id = _userManager.UserId;
wmsCarryUnbindCode.create_time = DateTime.Now;
row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync();
}
carry.carry_status = "0";
row = await _db.Updateable(carry).ExecuteCommandAsync();
subCarry.carry_status = "0";

View File

@@ -59,7 +59,7 @@ namespace Tnb.WarehouseMgr
{
await _db.Ado.BeginTranAsync();
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBINDPDA_ID, true);
await _runService.Create(templateEntity, input);
if (input == null) throw new ArgumentNullException(nameof(input));
@@ -67,18 +67,21 @@ namespace Tnb.WarehouseMgr
var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
var subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == subCarryId);
WmsCarrybindH wmsCarrybindH = carry.Adapt<WmsCarrybindH>();
WmsCarryD wmsCarryD = new()
{
id = SnowflakeIdHelper.NextId(),
carry_id = carry.id,
org_id = carry?.org_id!,
membercarry_id = subCarry.id,
membercarry_code = subCarry.carry_code,
loc = input.data[nameof(WmsCarrybindH.loc)]?.ToString()!,
create_id = _userManager.UserId,
create_time = DateTime.Now
};
//WmsCarrybindH wmsCarrybindH = carry?.Adapt<WmsCarrybindH>()!;
if (carry != null && subCarry != null)
{
wmsCarrybindH.id = SnowflakeIdHelper.NextId();
wmsCarrybindH.org_id = carry.org_id;
wmsCarrybindH.carry_id = carry.id;
wmsCarrybindH.membercarry_id = subCarry.id;
wmsCarrybindH.membercarry_code = subCarry.carry_code;
wmsCarrybindH.loc = input.data[nameof(WmsCarrybindH.loc)].ParseToInt(1);
wmsCarrybindH.create_id = _userManager.UserId;
wmsCarrybindH.create_time = DateTime.Now;
var row = await _db.Insertable(wmsCarrybindH).ExecuteCommandAsync();
var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
carry.carry_status = "1";
row = await _db.Updateable(carry).ExecuteCommandAsync();
subCarry.carry_status = "1";
@@ -88,15 +91,15 @@ namespace Tnb.WarehouseMgr
{
WmsCarrybindCode wmsCarrybindCode = new();
wmsCarrybindCode.id = SnowflakeIdHelper.NextId();
wmsCarrybindCode.org_id = subCarry.id;
wmsCarrybindCode.carrybind_id = wmsCarrybindH.id;
wmsCarrybindCode.org_id = subCarry?.org_id!;
wmsCarrybindCode.carrybind_id = input.data["ReturnIdentity"]?.ToString()!;
wmsCarrybindCode.material_id = items[i].material_id;
wmsCarrybindCode.material_code = items[i].material_code;
wmsCarrybindCode.barcode = items[i].barcode;
wmsCarrybindCode.code_batch = items[i].code_batch;
wmsCarrybindCode.codeqty = items[i].codeqty;
wmsCarrybindCode.membercarry_id = subCarry.id;
wmsCarrybindCode.membercarry_code = subCarry.carry_code;
wmsCarrybindCode.membercarry_id = subCarry?.id;
wmsCarrybindCode.membercarry_code = subCarry?.carry_code;
wmsCarrybindCode.unit_id = items[i].unit_id;
wmsCarrybindCode.unit_code = items[i].unit_code;
wmsCarrybindCode.create_id = _userManager.UserId;

View File

@@ -58,7 +58,7 @@ namespace Tnb.WarehouseMgr
{
await _db.Ado.BeginTranAsync();
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBINDPDA_ID, true);
await _runService.Create(templateEntity, input);
if (input == null) throw new ArgumentNullException(nameof(input));
@@ -69,7 +69,27 @@ namespace Tnb.WarehouseMgr
//WmsCarryunbindH wmsCarryUnbindH = carry.Adapt<WmsCarryunbindH>();
if (carry != null && subCarry != null)
{
var row = await _db.Deleteable<WmsCarryD>().Where(it => it.carry_id == subCarry.id).ExecuteCommandAsync();
var row = await _db.Deleteable<WmsCarryD>().Where(it => it.carry_id == carryId && it.membercarry_id == subCarryId).ExecuteCommandAsync();
var items = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
WmsCarryunbindCode wmsCarryUnbindCode = new();
for (int i = 0; i < items.Count; i++)
{
wmsCarryUnbindCode.id = SnowflakeIdHelper.NextId();
wmsCarryUnbindCode.org_id = subCarry?.org_id!;
wmsCarryUnbindCode.carryunbind_id = input.data["ReturnIdentity"]?.ToString()!;
wmsCarryUnbindCode.material_id = items[i].material_id;
wmsCarryUnbindCode.material_code = items[i].material_code;
wmsCarryUnbindCode.barcode = items[i].barcode;
wmsCarryUnbindCode.code_batch = items[i].code_batch;
wmsCarryUnbindCode.codeqty = items[i].codeqty;
wmsCarryUnbindCode.membercarry_id = subCarry?.id;
wmsCarryUnbindCode.membercarry_code = subCarry?.carry_code;
wmsCarryUnbindCode.unit_id = items[i].unit_id;
wmsCarryUnbindCode.unit_code = items[i].unit_code;
wmsCarryUnbindCode.create_id = _userManager.UserId;
wmsCarryUnbindCode.create_time = DateTime.Now;
row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync();
}
carry.carry_status = "0";
row = await _db.Updateable(carry).ExecuteCommandAsync();
subCarry.carry_status = "0";