diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index d1b69b7c..ea87929d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -34,6 +34,10 @@ namespace Tnb.WarehouseMgr.Entities.Consts /// 预任务单据状态-已完成Id /// public const string PRETASK_BILL_STATUS_COMPLE_ID = "26126860808229"; + /// + /// 预任务单据状态-已完成Id + /// + public const string PRETASK_BILL_STATUS_CANCEL_ID = "26126842129701"; // /// /// 任务单据状态-已下达Id diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs new file mode 100644 index 00000000..f5f38e38 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs @@ -0,0 +1,86 @@ +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 Microsoft.CodeAnalysis; +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 +{ + + /// + /// 异常取消 + /// + [OverideVisualDev(ModuleConsts.MODULE_WMSEXCEPTIONCANCELPDA_ID)] + public class WmsPDAExceptionCancelService : BaseWareHouseService + { + private readonly ISqlSugarClient _db; + private readonly IRunService _runService; + private readonly IVisualDevService _visualDevService; + private readonly IWareHouseService _wareHouseService; + private readonly IBillRullService _billRullService; + private readonly IUserManager _userManager; + public WmsPDAExceptionCancelService( + ISqlSugarRepository repository, + IRunService runService, + IVisualDevService visualDevService, + IWareHouseService wareHouseService, + IUserManager userManager, + IBillRullService billRullService) + { + _db = repository.AsSugarClient(); + _runService = runService; + _visualDevService = visualDevService; + _wareHouseService = wareHouseService; + _userManager = userManager; + _billRullService = billRullService; + OverideFuncs.CreateAsync = ExceptionCancel; + } + + private async Task ExceptionCancel(VisualDevModelDataCrInput input) + { + + try + { + await _db.Ado.BeginTranAsync(); + //更新任务执行状态 已取消 + await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID}).Where(it => it.bill_code == input.data[nameof(WmsDistaskH.bill_code)].ToString()).ExecuteCommandAsync(); + //预任务取消 + await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID }).Where(it => it.id == input.data[nameof(WmsDistaskH.pretask_id)].ToString()).ExecuteCommandAsync(); + //载具解锁 + // await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync(); + //库位解锁 + //根据所有库位更新库位的锁定状态为“锁定” + // await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync(); + + + await _db.Ado.CommitTranAsync(); + } + catch (Exception ex) + { + await _db.Ado.RollbackTranAsync(); + throw; + } + return Task.FromResult(true); + } + } + +}