Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -47,7 +47,7 @@ public partial class WmsFeedbox : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 理论数量
|
||||
/// </summary>
|
||||
public int qty { get; set; }
|
||||
public decimal qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前批次
|
||||
|
||||
@@ -47,7 +47,7 @@ public partial class WmsFeedingrecordCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 条码数量
|
||||
/// </summary>
|
||||
public int codeqty { get; set; }
|
||||
public decimal codeqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
|
||||
@@ -27,14 +27,14 @@ namespace Tnb.WarehouseMgr
|
||||
/// PDA载具更换
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACEPDA_ID)]
|
||||
public class WmsPDACarryService : WmsCarryService ,IPdaStroage
|
||||
public class WmsPDACarryReplaceService : WmsCarryService ,IPdaStroage
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
public WmsPDACarryService(
|
||||
public WmsPDACarryReplaceService(
|
||||
ISqlSugarRepository<WmsCarryH> repository,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRullService,
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Tnb.WarehouseMgr
|
||||
_billRullService = billRullService;
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
OverideFuncs.CreateAsync = WmsPDABind;
|
||||
OverideFuncs.CreateAsync = WmsPDAFeedingRecord;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -61,7 +61,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
private async Task<dynamic> WmsPDABind(VisualDevModelDataCrInput input)
|
||||
private async Task<dynamic> WmsPDAFeedingRecord(VisualDevModelDataCrInput input)
|
||||
{
|
||||
|
||||
|
||||
@@ -73,43 +73,50 @@ namespace Tnb.WarehouseMgr
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSFEEDINGRECORDPDA_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
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)
|
||||
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||
var feedBoxCode = input.data.ContainsKey("feedbox_code") ? input.data["feedbox_code"]?.ToString() : "";
|
||||
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == carryId);
|
||||
var feedBox = await _db.Queryable<WmsFeedbox>().FirstAsync(it => it.id == feedBoxCode);
|
||||
var carryMaterial = await _db.Queryable<WmsCarryMat>().FirstAsync(it => it.carry_id == carryId);
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it=>it.carry_id == carryId).ToListAsync();
|
||||
if (carry != null && feedBox != 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();
|
||||
row = await UpdateNullCarry(oldCarry);
|
||||
feedBox.material_id = carryMaterial.material_id;
|
||||
feedBox.material_code = carryMaterial.material_code;
|
||||
feedBox.qty = carryMaterial.qty;
|
||||
feedBox.batch = carryMaterial?.code_batch!;
|
||||
feedBox.status = carry.status;
|
||||
feedBox.create_id = _userManager.UserId;
|
||||
feedBox.create_time = DateTime.Now;
|
||||
var row = await _db.Updateable(feedBox).ExecuteCommandAsync();
|
||||
foreach(var carryCode in carryCodes)
|
||||
{
|
||||
WmsFeedingrecordCode wmsFeedingrecordCode = new();
|
||||
wmsFeedingrecordCode.id = SnowflakeIdHelper.NextId();
|
||||
wmsFeedingrecordCode.org_id = _userManager.User.OrganizeId;
|
||||
wmsFeedingrecordCode.record_id = input.data["ReturnIdentity"]?.ToString()!;
|
||||
wmsFeedingrecordCode.material_id = carryCode.material_id;
|
||||
wmsFeedingrecordCode.material_code = carryCode.material_code;
|
||||
wmsFeedingrecordCode.barcode = carryCode.barcode;
|
||||
wmsFeedingrecordCode.code_batch = carryCode.code_batch;
|
||||
wmsFeedingrecordCode.codeqty = carryCode.codeqty;
|
||||
wmsFeedingrecordCode.unit_id = carryCode.unit_id;
|
||||
wmsFeedingrecordCode.unit_code = carryCode.unit_code;
|
||||
wmsFeedingrecordCode.create_id = _userManager.UserId;
|
||||
wmsFeedingrecordCode.create_time = DateTime.Now;
|
||||
row = await _db.Insertable(wmsFeedingrecordCode).ExecuteCommandAsync();
|
||||
}
|
||||
row = await UpdateNullCarry(carry);
|
||||
isOk = (row > 0);
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldCarry == null)
|
||||
if (carry == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的旧载具", 500);
|
||||
}
|
||||
if (newCarry == null)
|
||||
if (feedBox == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用的新载具", 500);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user