diff --git a/BasicData/Tnb.BasicData/BasStandardTimeService.cs b/BasicData/Tnb.BasicData/BasStandardTimeService.cs new file mode 100644 index 00000000..d366aca1 --- /dev/null +++ b/BasicData/Tnb.BasicData/BasStandardTimeService.cs @@ -0,0 +1,69 @@ +using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; +using JNPF.Common.Extension; +using JNPF.Common.Security; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.FriendlyException; +using JNPF.Systems.Interfaces.Permission; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using Tnb.BasicData.Entities; + +namespace Tnb.BasicData +{ + /// + /// 标准工时 + /// + [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + public class BasStandardTimeService : IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + private readonly IOrganizeService _organizeService; + + public BasStandardTimeService( + ISqlSugarRepository repository, + IOrganizeService organizeService, + IUserManager userManager + ) + { + _repository = repository; + _organizeService = organizeService; + _userManager = userManager; + } + + [HttpPost] + public async Task SaveDate(BasStandardTime input) + { + var db = _repository.AsSugarClient(); + DbResult result = await db.Ado.UseTranAsync(async () => + { + if (input.enabled != null && input.enabled == 1) + { + await db.Updateable() + .SetColumns(x => x.enabled == 0) + .Where(x => x.process_id == input.process_id) + .ExecuteCommandAsync(); + } + + if (input.id != null && !input.id.IsEmpty()) + { + input.modify_id = _userManager.UserId; + input.modify_time = DateTime.Now; + await _repository.UpdateAsync(input); + } + else + { + input.id = SnowflakeIdHelper.NextId(); + input.create_time = DateTime.Now; + input.create_id = _userManager.UserId; + await db.Insertable(input).ExecuteCommandAsync(); + } + }); + + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage); + } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs index fe96dc58..26bb1497 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs @@ -165,6 +165,16 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string warehouse_name { get; set; } + /// + /// 入库库位id + /// + public string? as_location_id { get; set; } + + /// + /// 入库库位编号 + /// + public string? as_location_code { get; set; } + } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskReleaseUpInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskReleaseUpInput.cs index 7c02ae35..68867e76 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskReleaseUpInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskReleaseUpInput.cs @@ -17,6 +17,10 @@ ///
Compled(任务完成) /// public string Behavior { get; set; } + /// + /// 暂停原因 + /// + public String PauseReeson { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs index 905d73a0..56af072f 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs @@ -202,5 +202,9 @@ public partial class PrdMoTask : BaseEntity /// 批号 /// public string? batch { get; set; } + /// + /// 暂停原因 + /// + public string? pause_reason { get; set; } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs index 80ace7e1..f266d8f2 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs @@ -558,6 +558,7 @@ namespace Tnb.ProductionMgr ISqlSugarClient db = _repository.AsSugarClient(); // string location_code = "ZCR01";//todo ̹ܼĿλ֮ + //todo ֿȷٸ string warehouse_id = "2"; PrdInstockH? prdInstockH = null; diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index f48cedc1..484b2e6b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -261,7 +261,12 @@ namespace Tnb.ProductionMgr { if (!await db.Queryable().AnyAsync(x => x.material_id == item.material_id && x.version == item.ebom_version)) { - throw Oops.Bah($"系统中无法找到{item.ebom_version}版本"); + throw Oops.Bah($"系统中无法找到物料清单{item.ebom_version}版本"); + } + + if (!await db.Queryable().LeftJoin((a, b) => a.ebom_id == b.id).Where((a, b) => a.material_id == item.material_id && b.version == item.ebom_version).AnyAsync()) + { + throw Oops.Bah($"系统中无法找到物料清单对应的生产bom{item.ebom_version}版本"); } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 04f3e604..dd5559b0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1151,6 +1151,8 @@ namespace Tnb.ProductionMgr { throw Oops.Bah("状态错误无法暂停"); } + + item.pause_reason = input.PauseReeson; break; case PrdTaskBehavior.Compled: if (item.mo_task_status == status) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs index 8f442b57..1fbee1b4 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs @@ -417,7 +417,7 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b, c, d, e, f) => a.eqp_id == f.id) .LeftJoin((a, b, c, d, e, f, g) => a.mold_id == g.id) .LeftJoin((a, b, c, d, e, f, g, h) => a.material_id == h.output_material_id && a.eqp_id == h.equip_id && a.mold_id == h.molds_id && h.enabled == 1) - .LeftJoin((a, b, c, d, e, f, g, h, i) => a.process_id == i.process_id && i.enabled == 1) + .LeftJoin((a, b, c, d, e, f, g, h, i) => a.process_id == i.process_id && i.enabled == 1 && a.schedule_type==1) .LeftJoin((a, b, c, d, e, f, g, h, i, j) => a.mo_id == j.id) .LeftJoin((a, b, c, d, e, f, g, h, i, j, k) => a.material_id == k.material_id && k.auxiliary_unit_id == "kg") .LeftJoin((a, b, c, d, e, f, g, h, i, j, k, l) => a.eqp_id == l.equip_id && l.enabled == 1 && l.label_point == "注塑空满箱请求") @@ -469,11 +469,32 @@ namespace Tnb.ProductionMgr deputy_num = k.number_of_auxiliary_unit, third_equip_code = l.equip_code, weight_name = l.label_name, - category_id = b.category_id + category_id = b.category_id, + as_location_id = f.as_location_id }) .MergeTable() .OrderBy($"{input.sidx} {input.sort}") .ToPagedListAsync(input.currentPage, input.pageSize); + if (!result.list.IsEmpty()) + { + foreach (var item in result.list) + { + if (item.as_location_id!=null && !item.as_location_id.IsEmpty()) + { + BasLocation basLocation = await _db.Queryable().SingleAsync(x => x.id == item.as_location_id); + item.as_location_code = basLocation.location_code; + } + + if (item.schedule_type == 2) + { + PerProcessStandardsH processStandardsH = await _db.Queryable() + .Where(x => x.equip_id == item.equip_id && x.molds_id == item.mold_id && + x.output_material_id == item.material_id && x.enabled == 1) + .OrderByDescending(x => x.create_time).FirstAsync(); + item.standard_time = processStandardsH?.moulding_cycle?.ToString(); + } + } + } return PageResult.SqlSugarPageResult(result);