Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -31,7 +31,6 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsBindService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -52,7 +51,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public async Task<dynamic> WmsBind(VisualDevModelDataCrInput input)
|
||||
private async Task<dynamic> WmsBind(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 载具绑定
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACE_ID)]
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYBIND_ID)]
|
||||
public class WmsCarryBindService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具服务
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class WmsCarryReplaceService : BaseWareHouseService, IWmsCarryService
|
||||
{
|
||||
private const string ModuleId = "26188532491557";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsCarryReplaceService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
OverideFuncs.CreateAsync = CarryReplace;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更换载具
|
||||
/// </summary>
|
||||
/// <param name="input">
|
||||
/// 输入参数:
|
||||
/// <br/>{
|
||||
/// <br/> old_carry_id:老载具id
|
||||
/// <br/> new_carry_id:新载具ID
|
||||
/// <br/>}
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> CarryReplace(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
var oldCarryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||
var newCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
||||
var oldCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == oldCarryId);
|
||||
var newCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == newCarryId);
|
||||
if (oldCarry != null && newCarry != null)
|
||||
{
|
||||
ExChangeCarryInput carryInput = new() { old_carry_id = oldCarry.id, new_carry_id = newCarry.id };
|
||||
isOk = await _updateSubCarry<WmsCarryD>(carryInput);
|
||||
isOk = await _updateSubCarry<WmsCarryMat>(carryInput);
|
||||
isOk = await _updateSubCarry<WmsCarryCode>(carryInput);
|
||||
|
||||
newCarry.status = oldCarry.status;
|
||||
newCarry.carry_status = oldCarry.carry_status;
|
||||
newCarry.location_id = oldCarry.location_id;
|
||||
newCarry.location_code = oldCarry.location_code;
|
||||
newCarry.is_lock = oldCarry.is_lock;
|
||||
newCarry.out_status = oldCarry.out_status;
|
||||
newCarry.is_check = oldCarry.is_check;
|
||||
newCarry.bale_num = oldCarry.bale_num;
|
||||
newCarry.collocation_scheme_id = oldCarry.collocation_scheme_id;
|
||||
newCarry.collocation_scheme_code = oldCarry.collocation_scheme_code;
|
||||
newCarry.source_id = oldCarry.source_id;
|
||||
newCarry.source_code = oldCarry.source_code;
|
||||
newCarry.create_id = _userManager.UserId;
|
||||
newCarry.create_time = DateTime.Now;
|
||||
var row = await _db.Updateable(newCarry).ExecuteCommandAsync();
|
||||
WmsCarryReplaceH wmsCarryReplaceH = oldCarry.Adapt<WmsCarryReplaceH>();
|
||||
wmsCarryReplaceH.id = SnowflakeIdHelper.NextId();
|
||||
wmsCarryReplaceH.org_id = oldCarry.org_id;
|
||||
wmsCarryReplaceH.bill_code = await _billRullService.GetBillNumber(WmsCarryConst.WMS_CARRY_REPLACE_ENCODE);
|
||||
wmsCarryReplaceH.carry_id = oldCarry.id;
|
||||
wmsCarryReplaceH.carry_code = oldCarry.carry_code;
|
||||
wmsCarryReplaceH.newcarry_id = newCarry.id;
|
||||
wmsCarryReplaceH.newcarry_code = newCarry.carry_code;
|
||||
row = await _db.Insertable(wmsCarryReplaceH).ExecuteCommandAsync();
|
||||
row = await UpdateNullCarry(oldCarry);
|
||||
isOk = (row > 0);
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldCarry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的旧载具", 500);
|
||||
}
|
||||
if (newCarry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的新载具", 500);
|
||||
}
|
||||
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("载具更换失败", ex);
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateNullCarry(WmsCarryH carryObj)
|
||||
{
|
||||
var row = -1;
|
||||
try
|
||||
{
|
||||
carryObj.status = 0;
|
||||
carryObj.carry_status = "0";
|
||||
carryObj.location_id = null;
|
||||
carryObj.location_code = null;
|
||||
carryObj.out_status = "0";
|
||||
carryObj.is_check = 0;
|
||||
carryObj.status = 1;
|
||||
carryObj.bale_num = null;
|
||||
carryObj.collocation_scheme_id = null;
|
||||
carryObj.collocation_scheme_code = null;
|
||||
carryObj.source_id = null;
|
||||
carryObj.source_code = null;
|
||||
row = await _db.Updateable(carryObj).ExecuteCommandAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
private async Task<bool> _updateSubCarry<T>(ExChangeCarryInput input) where T : BaseEntity<string>, IWmsCarryEntity, new()
|
||||
{
|
||||
var row = -1;
|
||||
var items = await _db.Queryable<T>().Where(it => it.carry_id == input.old_carry_id).ToListAsync();
|
||||
if (items?.Count > 0)
|
||||
{
|
||||
List<T> newItems = DeepCopyHelper<T>.DeepCopyList(items);
|
||||
if (newItems?.Count > 0)
|
||||
{
|
||||
newItems.ForEach(x =>
|
||||
{
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.carry_id = input.new_carry_id;
|
||||
|
||||
});
|
||||
row = await _db.Insertable(newItems).ExecuteCommandAsync();
|
||||
}
|
||||
if (row > 0)
|
||||
{
|
||||
row = await _db.Deleteable(items).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
return (row > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,14 +24,12 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 载具服务
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleId)]
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACE_ID)]
|
||||
public class WmsCarryService : BaseWareHouseService, IWmsCarryService
|
||||
{
|
||||
private const string ModuleId = "26188532491557";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsCarryService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -52,8 +50,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ExchangeCarry(VisualDevModelDataCrInput input)
|
||||
private async Task<dynamic> ExchangeCarry(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 载具解绑
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACE_ID)]
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYUNBIND_ID)]
|
||||
public class WmsCarryUnbindService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
|
||||
132
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
Normal file
132
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具绑定
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYBINDPDA_ID)]
|
||||
public class WmsPDACarryBindService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public WmsPDACarryBindService(
|
||||
ISqlSugarRepository<WmsCarryH> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
OverideFuncs.CreateAsync = PDACarryBind;
|
||||
}
|
||||
|
||||
private async Task<dynamic> PDACarryBind(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||
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>();
|
||||
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();
|
||||
carry.carry_status = "1";
|
||||
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||
subCarry.carry_status = "1";
|
||||
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||
var items = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
WmsCarrybindCode wmsCarrybindCode = new();
|
||||
wmsCarrybindCode.id = SnowflakeIdHelper.NextId();
|
||||
wmsCarrybindCode.org_id = subCarry.id;
|
||||
wmsCarrybindCode.carrybind_id = wmsCarrybindH.id;
|
||||
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.unit_id = items[i].unit_id;
|
||||
wmsCarrybindCode.unit_code = items[i].unit_code;
|
||||
wmsCarrybindCode.create_id = _userManager.UserId;
|
||||
wmsCarrybindCode.create_time = DateTime.Now;
|
||||
row = await _db.Insertable(wmsCarrybindCode).ExecuteCommandAsync();
|
||||
}
|
||||
isOk = (row > 0);
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (carry == null || subCarry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的主载具", 500);
|
||||
}
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
/* public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var isOk = await _db.Updateable<WmsCarryReplaceH>().SetColumns(it => new WmsCarryReplaceH { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -28,11 +28,9 @@ namespace Tnb.WarehouseMgr
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACEPDA_ID)]
|
||||
public class WmsPDACarryReplaceService : BaseWareHouseService, IWmsCarryService, IPdaStroage
|
||||
{
|
||||
//private const string ModuleId = "26188532491557";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsPDACarryReplaceService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -53,8 +51,8 @@ namespace Tnb.WarehouseMgr
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PDACarryReplace(VisualDevModelDataCrInput input)
|
||||
|
||||
private async Task<dynamic> PDACarryReplace(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
|
||||
108
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs
Normal file
108
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具解绑
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYUNBINDPDA_ID)]
|
||||
public class WmsPDACarryUnbindService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
public WmsPDACarryUnbindService(
|
||||
ISqlSugarRepository<WmsCarryH> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IWareHouseService wareHouseService,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_userManager = userManager;
|
||||
_wareHouseService = wareHouseService;
|
||||
OverideFuncs.CreateAsync = PDACarryUnbind;
|
||||
}
|
||||
private async Task<dynamic> PDACarryUnbind(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var isOk = false;
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||
var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
||||
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == carryId);
|
||||
var subCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == subCarryId);
|
||||
//WmsCarryunbindH wmsCarryUnbindH = carry.Adapt<WmsCarryunbindH>();
|
||||
if (carry != null && subCarry != null)
|
||||
{
|
||||
var row = await _db.Deleteable<WmsCarryD>().Where(it => it.carry_id == subCarry.id).ExecuteCommandAsync();
|
||||
carry.carry_status = "0";
|
||||
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||
subCarry.carry_status = "0";
|
||||
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||
isOk = (row > 0);
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (carry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的主载具", 500);
|
||||
}
|
||||
if (subCarry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的子载具", 500);
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
/* public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var isOk = await _db.Updateable<WmsCarryReplaceH>().SetColumns(it => new WmsCarryReplaceH { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -28,13 +28,12 @@ namespace Tnb.WarehouseMgr
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class WmsPDAFeedingService : BaseWareHouseService, IWmsCarryService, IWmsFeedingService
|
||||
{
|
||||
private const string ModuleId = "26188532491557";
|
||||
private const string ModuleId = "26496913096981";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly WmsCarryService _wmsCarryService;
|
||||
private static Dictionary<string, object> dicMaterial = new Dictionary<string, object>();
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public WmsPDAFeedingService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService,WmsCarryService wmsCarryService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
|
||||
Reference in New Issue
Block a user