diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs index 39844def..78e5b2ec 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using SqlSugar.DbConvert; namespace Tnb.BasicData.Entities; @@ -42,7 +43,8 @@ public partial class BasLocation : BaseEntity /// /// 是否使用 /// - public string is_use { get; set; } = string.Empty; + [SugarColumn(ColumnDataType = "varchar(1)", SqlParameterDbType = typeof(CommonPropertyConvert))] + public int is_use { get; set; } /// /// 是否最小 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipRepairRefuseInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipRepairRefuseInput.cs new file mode 100644 index 00000000..3c30a548 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipRepairRefuseInput.cs @@ -0,0 +1,9 @@ +namespace Tnb.EquipMgr.Entities.Dto +{ + public class EquipRepairRefuseInput + { + public string id { get; set; } + public string reason { get; set; } + + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairRefuse.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairRefuse.cs new file mode 100644 index 00000000..098edb22 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairRefuse.cs @@ -0,0 +1,52 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.EquipMgr.Entities; + +/// +/// 设备维修拒绝表 +/// +[SugarTable("eqp_repair_refuse")] +public partial class EqpRepairRefuse : BaseEntity +{ + public EqpRepairRefuse() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 拒绝理由 + /// + public string reason { get; set; } = string.Empty; + + /// + /// 报修id + /// + public string repair_apply_id { get; set; } = string.Empty; + + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + + /// + /// 流程任务Id + /// + public string? f_flowtaskid { get; set; } + + /// + /// 流程引擎Id + /// + public string? f_flowid { get; set; } + +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairRefuseService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairRefuseService.cs new file mode 100644 index 00000000..b1417e66 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairRefuseService.cs @@ -0,0 +1,15 @@ +namespace Tnb.EquipMgr.Interfaces +{ + /// + /// 维修拒绝服务 + /// + public interface IEqpRepairRefuseService + { + /// + /// 根据维修id获取拒绝列表 + /// + /// + /// + public Task GetRepairRefuseByRepairApplyId(Dictionary dic); + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs index c16efefb..5b7dd85d 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs @@ -82,10 +82,25 @@ namespace Tnb.EquipMgr public async Task Refuse(Dictionary dic) { string id = dic["id"]; - await _repository.UpdateAsync(x => new EqpRepairApply() + string reason = dic["reason"]; + var db = _repository.AsSugarClient(); + DbResult result = await db.Ado.UseTranAsync(async () => { - status = RepairApplyStatus.REFUSE, - }, x => x.id == id); + await _repository.UpdateAsync(x => new EqpRepairApply() + { + status = RepairApplyStatus.REFUSE, + }, x => x.id == id); + EqpRepairRefuse eqpRepairRefuse = new EqpRepairRefuse() + { + repair_apply_id = id, + reason = reason, + create_id = _userManager.UserId, + create_time = DateTime.Now, + org_id = _userManager.GetUserInfo().Result.organizeId + }; + await db.Insertable(eqpRepairRefuse).ExecuteCommandAsync(); + }); + if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return "拒绝成功"; } diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairRefuseService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairRefuseService.cs new file mode 100644 index 00000000..ffa74714 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairRefuseService.cs @@ -0,0 +1,36 @@ +using JNPF.Common.Core.Manager; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using Tnb.EquipMgr.Entities; +using Tnb.EquipMgr.Entities.Dto; +using Tnb.EquipMgr.Interfaces; + +namespace Tnb.EquipMgr +{ + /// + /// 设备维修拒绝 + /// + [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + public class EqpRepairRefuseService : IEqpRepairRefuseService, IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + + public EqpRepairRefuseService(ISqlSugarRepository repository, + IUserManager userManager) + { + _repository = repository; + _userManager = userManager; + } + + [HttpPost] + public async Task GetRepairRefuseByRepairApplyId(Dictionary dic) + { + string repairApplyId = dic["repairApplyId"]; + return await _repository.GetListAsync(x => x.repair_apply_id == repairApplyId); + } + } +} \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs new file mode 100644 index 00000000..3d0338a9 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +{ + /// + /// 机器人回调操作输入参数s + /// + public class RobotCallBackInput + { + /// + /// 主载具Id + /// + public string carry_id { get; set; } + /// + /// 主载具编号 + /// + public string carry_code { get; set; } + /// + /// 子载具ID + /// + public string membercarry_id { get; set; } + /// + /// 子载具编号 + /// + public string membercarry_code { get; set; } + /// + /// 方向 + /// + public int direction { get; set; } + /// + /// 是否最后一个 + /// + public bool isLast { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index c8390c52..34a673f8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -210,7 +210,7 @@ namespace Tnb.WarehouseMgr [HttpGet] public async Task> InStockStrategy([FromQuery] InStockStrategyQuery input) { - var items = await _db.Queryable().Where(it => it.wh_id == input.warehouse_id && it.is_lock == 0 && it.is_use == "0" && it.is_type == "0").OrderBy(it => new { it.layers, it.loc_line, it.loc_column }, OrderByType.Asc).ToListAsync(); + var items = await _db.Queryable().Where(it => it.wh_id == input.warehouse_id && it.is_lock == 0 && it.is_use == (int)EnumCarryStatus.空闲 && it.is_type == "0").OrderBy(it => new { it.layers, it.loc_line, it.loc_column }, OrderByType.Asc).ToListAsync(); return items.Take(input.Size).ToList(); } /// @@ -399,7 +399,7 @@ namespace Tnb.WarehouseMgr //更新起始库位,状态改为空闲、锁定状态,未锁定 if (startLocationIds?.Count > 0) { - await _db.Updateable().SetColumns(it => new BasLocation { is_use = "0", is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new BasLocation { is_use = (int)EnumCarryStatus.空闲, is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); @@ -450,7 +450,7 @@ namespace Tnb.WarehouseMgr { carryStatus = (int)EnumCarryStatus.空闲; } - await _db.Updateable().SetColumns(it => new BasLocation { is_use = carryStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new BasLocation { is_use = carryStatus, is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); } //更新业务主表的单据状态 if (disTasks?.Count > 0) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index 006c31e9..85a9ccd0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -52,7 +52,7 @@ namespace Tnb.WarehouseMgr _billRullService = billRullService; OverideFuncs.CreateAsync = CarryBind; } - + private async Task CarryBind(VisualDevModelDataCrInput input) { var isOk = false; @@ -127,6 +127,19 @@ namespace Tnb.WarehouseMgr } return Task.FromResult(true); } + + /// + /// 机器人回调操作 + /// + /// + [HttpPost] + public async Task RobotCallBack() + { + + + } + + /* public override async Task ModifyAsync(WareHouseUpInput input) { if (input == null) throw new ArgumentNullException(nameof(input)); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs index df1727ef..e1c65cae 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs @@ -50,7 +50,7 @@ namespace Tnb.WarehouseMgr }) .Mapper(it => it.material_name = dicMaterial.ContainsKey(it.material_id) ? dicMaterial[it.material_id].ToString()! : "") .ToListAsync(); - return items; + return items ?? Enumerable.Empty(); } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs index ba1ace87..c3733ac8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs @@ -31,10 +31,10 @@ namespace Tnb.WarehouseMgr /// 空载具出库 /// [OverideVisualDev(ModuleConsts.MODULE_WMSEMPTYOUTSTKPDA_ID)] - + [ServiceModule(BizTypeId)] public class WmsPDAEmptyOutstockService : BaseWareHouseService, IPdaStroage { - private const string BizTypeId = "26121986416677"; + private const string BizTypeId = "26475845405733"; private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index f091e3fe..3d9003e6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -240,7 +240,7 @@ namespace Tnb.WarehouseMgr await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, - it => new BasLocation { is_lock = 1, is_use = "1" }); + it => new BasLocation { is_lock = 1, is_use = (int)EnumCarryStatus.占用 }); if (instockCOdes?.Count > 0) { await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index 7bc941a4..93a0caed 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.FriendlyException; @@ -14,6 +15,7 @@ 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.Entities.Enums; @@ -24,12 +26,14 @@ namespace Tnb.WarehouseMgr /// /// 齐套分拣服务类 /// + [ServiceModule(BizTypeId)] public class WmsSetSortingService : BaseWareHouseService { private readonly ISqlSugarClient _db; private readonly IWareHouseService _wareHouseService; private readonly IBillRullService _billRullService; private readonly IUserManager _userManager; + private const string BizTypeId = "26172520979237"; public WmsSetSortingService(ISqlSugarRepository repository, IWareHouseService wareHouseService, IUserManager userManager, IBillRullService billRullService) { @@ -124,7 +128,7 @@ namespace Tnb.WarehouseMgr GenPreTaskUpInput genPreTaskAfterUpInput = new(); genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList(); - await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套分拣 }, it => new BasLocation { is_use = ((int)EnumCarryStatus.齐套分拣).ToString() }); + await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套分拣 }, it => new BasLocation { is_use = (int)EnumCarryStatus.齐套分拣 }); } } @@ -186,10 +190,25 @@ namespace Tnb.WarehouseMgr } - public override Task ModifyAsync(WareHouseUpInput input) + public override async Task ModifyAsync(WareHouseUpInput input) { - return Task.CompletedTask; + if (input == null) throw new ArgumentNullException(nameof(input)); + //根据载具更新明细表状态 + try + { + await _db.Ado.BeginTranAsync(); + await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.齐套, location_id = "", location_code = "" }).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new BasLocation { is_use = (int)EnumCarryStatus.空闲 }).ExecuteCommandAsync(); + + await _db.Ado.CommitTranAsync(); + } + catch (Exception) + { + await _db.Ado.RollbackTranAsync(); + throw; + + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs index 43d8af9d..adc56ba8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs @@ -17,6 +17,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -80,10 +81,12 @@ namespace Tnb.WarehouseMgr break; } } + var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); + loc.is_use = (int)EnumCarryStatus.空闲; + await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); + WareHouseUpInput upInput = new() { bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List { input.carryId } }; + await DoUpdate(upInput); //回更业务 } - var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); - loc.is_use = "0"; - await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 3c2e978e..99436256 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -128,7 +128,7 @@ namespace Tnb.WarehouseMgr var grpList = kittingOuts.GroupBy(g => g.location_id).ToList(); foreach (var koGrp in grpList) { - var locs = await _db.Queryable().Where(it => it.id == koGrp.Key && it.is_use == "0" && it.is_lock == 0).ToListAsync(); + var locs = await _db.Queryable().Where(it => it.id == koGrp.Key && it.is_use == (int)EnumCarryStatus.空闲 && it.is_lock == 0).ToListAsync(); if (locs?.Count > 0) {