重写在线开发,获取工序列表功能
This commit is contained in:
@@ -7,6 +7,10 @@ public static class DictConst
|
||||
/// 计量单位
|
||||
/// </summary>
|
||||
public const string MeasurementUnit = "MeasurementUnit";
|
||||
/// <summary>
|
||||
/// 区域类型-工位Code
|
||||
/// </summary>
|
||||
public const string RegionCategoryStationCode = "workstation";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.BasicData.Entitys.Dto.BasProcess
|
||||
{
|
||||
/// <summary>
|
||||
/// 工序列表输出类
|
||||
/// </summary>
|
||||
public class ProcessListOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string process_code { get; set; }
|
||||
public string process_name { get; set; }
|
||||
public string process_collection { get; set;}
|
||||
public string status { get; set; }
|
||||
public string station { get; set; }
|
||||
public string must_pass { get; set; }
|
||||
public string defective_products_put_into_production { get; set; }
|
||||
public string single_scan_type { get; set; }
|
||||
public string only_scan_type { get; set; }
|
||||
public string material_traced_back_relationship { get; set; }
|
||||
public string report_template { get; set; }
|
||||
public string descrip { get; set; }
|
||||
public string org_id { get; set; }
|
||||
public string create_id { get; set; }
|
||||
public string modify_id { get; set; }
|
||||
public DateTime? modify_time { get; set;}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace Tnb.BasicData.Entitys.Entity
|
||||
///<summary>
|
||||
///产品信息
|
||||
///</summary>
|
||||
[SugarTable("bas_item")]
|
||||
[SugarTable("bas_product")]
|
||||
public partial class BasItem
|
||||
{
|
||||
public BasItem(){
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -14,6 +17,7 @@ using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.BasicData.Entitys.Dto.BasProcess;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
@@ -33,7 +37,7 @@ namespace Tnb.BasicData
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
|
||||
public BasProcessService(
|
||||
ISqlSugarRepository<BasProcess> repository,
|
||||
IUserManager userManager,
|
||||
@@ -47,6 +51,48 @@ namespace Tnb.BasicData
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在线开发-获取工序列表
|
||||
/// added by ly on 20230428
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var result = new List<ProcessListOutput>();
|
||||
var db = _repository.AsSugarClient();
|
||||
var organize = await db.Queryable<OrganizeEntity>().FirstAsync(it => it.EnCode == input.station_code && it.Category == DictConst.RegionCategoryStationCode);
|
||||
if (organize != null)
|
||||
{
|
||||
var processIds = await db.Queryable<BasProcessStation>().Where(it => it.station_id == organize.Id).Select(it => it.process_id).ToListAsync();
|
||||
if (processIds?.Count > 0)
|
||||
{
|
||||
result = await db.Queryable<BasProcess>().Where(it => processIds.Contains(it.id)).Select(it => new ProcessListOutput
|
||||
{
|
||||
id = it.id,
|
||||
process_code = it.process_code,
|
||||
process_name = it.process_name,
|
||||
process_collection = it.process_collection,
|
||||
status = it.status,
|
||||
station = it.station,
|
||||
must_pass = it.must_pass,
|
||||
defective_products_put_into_production = it.defective_products_put_into_production,
|
||||
single_scan_type = it.single_scan_type,
|
||||
only_scan_type = it.only_scan_type,
|
||||
material_traced_back_relationship = it.material_traced_back_relationship,
|
||||
report_template = it.report_template,
|
||||
descrip = it.descrip,
|
||||
org_id = it.org_id,
|
||||
create_id = it.create_id,
|
||||
modify_id = it.modify_id,
|
||||
modify_time = it.modify_time,
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,17 +104,17 @@ namespace Tnb.BasicData
|
||||
[HttpPost]
|
||||
public async Task<dynamic> Create(VisualDevModelDataCrInput visualDevModelDataCrInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModelId, true);
|
||||
await _runService.Create(templateEntity, visualDevModelDataCrInput);
|
||||
await _runService.Create(templateEntity, visualDevModelDataCrInput);
|
||||
|
||||
string processId = visualDevModelDataCrInput.data["ReturnIdentity"].ToString();
|
||||
|
||||
|
||||
List<BasProcessStation> list = new List<BasProcessStation>();
|
||||
foreach (var item in (JArray)visualDevModelDataCrInput.data["station"])
|
||||
{
|
||||
|
||||
|
||||
string processStationId = SnowflakeIdHelper.NextId();
|
||||
list.Add(new BasProcessStation()
|
||||
{
|
||||
@@ -83,8 +129,10 @@ namespace Tnb.BasicData
|
||||
|
||||
await _repository.AsSugarClient().Insertable<BasProcessStation>(list).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
|
||||
return result.IsSuccess ? "保存成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using System.Reflection.Emit;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
@@ -33,7 +36,7 @@ namespace Tnb.ProductionMgr
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs => new OverideVisualDevFunc();
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public PrdMoService(
|
||||
ISqlSugarRepository<PrdMo> repository,
|
||||
@@ -511,10 +514,25 @@ namespace Tnb.ProductionMgr
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
private Task Delete(string id)
|
||||
private async Task Delete(string id)
|
||||
{
|
||||
string str = "";
|
||||
return Task.CompletedTask;
|
||||
var db = _repository.AsSugarClient();
|
||||
var result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var row = -1;
|
||||
var prdTask = await db.Queryable<PrdTask>().FirstAsync(it => it.id == id);
|
||||
row = await db.Deleteable<PrdTask>().Where(it => it.id == id).ExecuteCommandAsync();
|
||||
if (row > 0)
|
||||
{
|
||||
var prdMo = await db.Queryable<PrdMo>().FirstAsync(it => it.id == prdTask.mo_id);
|
||||
prdMo.input_qty += prdTask.scheduled_qty;
|
||||
prdMo.icmo_status = DictConst.ToBeScheduledEncode;
|
||||
row = await db.Updateable(prdMo).ExecuteCommandAsync();
|
||||
}
|
||||
return row > 0;
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1002);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -459,8 +459,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
|
||||
isOK = await _repository.AsSugarClient().Updateable<EqpEquipment>().SetColumns(it => new EqpEquipment { station_code = "" }).Where(it => unbindEqpIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
//绑定工序
|
||||
var procList = input.propertyJson.Value<JArray>("rowprocess");
|
||||
|
||||
|
||||
if (!(isOK > 0)) throw Oops.Oh(ErrorCode.COM1001);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
namespace JNPF.VisualDev
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] //modified by ly on 20230428 允许特性在一个类上多重定义
|
||||
public class OverideVisualDevAttribute : Attribute
|
||||
{
|
||||
public string ModelId { get; set; }
|
||||
|
||||
@@ -106,7 +106,6 @@ namespace JNPF.VisualDev
|
||||
/// </summary>
|
||||
private readonly ITenant _db;
|
||||
|
||||
private readonly IPrdMoService _prdMoService;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化一个<see cref="VisualDevModelDataService"/>类型的新实例.
|
||||
@@ -123,8 +122,7 @@ namespace JNPF.VisualDev
|
||||
ICacheManager cacheManager,
|
||||
IFlowTaskService flowTaskService,
|
||||
IFileManager fileManager,
|
||||
ISqlSugarClient context,
|
||||
IPrdMoService prdMoService)
|
||||
ISqlSugarClient context)
|
||||
{
|
||||
_visualDevRepository = visualDevRepository;
|
||||
_visualDevService = visualDevService;
|
||||
@@ -138,7 +136,6 @@ namespace JNPF.VisualDev
|
||||
_fileManager = fileManager;
|
||||
_dataInterfaceService = dataInterfaceService;
|
||||
_db = context.AsTenant();
|
||||
_prdMoService = prdMoService;
|
||||
}
|
||||
|
||||
#region Get
|
||||
|
||||
Reference in New Issue
Block a user