调整框架多组合代码,组合条件查询
This commit is contained in:
@@ -35,6 +35,10 @@ public static class DictConst
|
||||
/// 任务单状态-待开工编码
|
||||
/// </summary>
|
||||
public const string ToBeStartedEnCode = "ToBeStarted";
|
||||
/// <summary>
|
||||
/// 任务单状态-待排产
|
||||
/// </summary>
|
||||
public const string ToBeScheduledEncode = "ToBeScheduled";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -324,6 +324,10 @@ namespace Tnb.ProductionMgr.Entities
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string mo_task_no { get; set; }
|
||||
/// <summary>
|
||||
/// 生产任务状态
|
||||
/// </summary>
|
||||
public string icmo_status { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
@@ -22,13 +23,15 @@ namespace Tnb.ProductionMgr
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class PrdMoService : IPrdMoService, IDynamicApiController, ITransient
|
||||
public class PrdMoService : IOverideVisualDevService, IPrdMoService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<PrdMo> _repository;
|
||||
private readonly IDataBaseManager _dataBaseManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs => new OverideVisualDevFunc();
|
||||
|
||||
public PrdMoService(
|
||||
ISqlSugarRepository<PrdMo> repository,
|
||||
IDataBaseManager dataBaseManager,
|
||||
@@ -197,7 +200,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
|
||||
var row = await db.Updateable<PrdMo>()
|
||||
.SetColumns(it => new PrdMo { mo_status = DictConst.IssueId })
|
||||
.SetColumns(it => new PrdMo { mo_status = DictConst.IssueId, icmo_status = DictConst.ToBeScheduledEncode })
|
||||
.Where(it => input.WorkOrderIds.Contains(it.id))
|
||||
.ExecuteCommandAsync();
|
||||
return (row > 0);
|
||||
@@ -360,7 +363,7 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
if (row > 0)
|
||||
{
|
||||
if (combineMoCodes?.Count > 0)
|
||||
if (combineMoCodes?.Count > 0 && combineMoCodes?.FirstOrDefault() is not null)
|
||||
{
|
||||
var moList = await db.Queryable<PrdMo>().Where(it => combineMoCodes.Contains(it.combine_mo_code)).ToListAsync();
|
||||
var icmoList = moList.Adapt<List<PrdTask>>();
|
||||
@@ -401,20 +404,26 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
var obj = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id));
|
||||
obj.input_qty += entity.scheduled_qty;
|
||||
var moStatus = "";
|
||||
string moStatus = "",icmoStatus="";
|
||||
|
||||
//判断,已排产数量>=计划数量时将状态改为 已排产
|
||||
if (obj.input_qty >= obj.plan_qty)
|
||||
{
|
||||
moStatus = DictConst.AlreadyId;
|
||||
icmoStatus = DictConst.ToBeStartedEnCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
//修改工单状态为待排产,同事修改已排产数量
|
||||
moStatus = DictConst.WaitProductId;
|
||||
icmoStatus = DictConst.ToBeScheduledEncode;
|
||||
|
||||
|
||||
}
|
||||
row = await db.Updateable<PrdMo>().SetColumns(it => new PrdMo
|
||||
{
|
||||
mo_status = moStatus,
|
||||
icmo_status = icmoStatus,
|
||||
input_qty = obj.input_qty
|
||||
})
|
||||
.Where(it => it.id == entity.mo_id).ExecuteCommandAsync();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"Kestrel": {
|
||||
"Endpoints": {
|
||||
"Http": {
|
||||
"Url": "http://*:9231"
|
||||
"Url": "http://0.0.0.0:9231"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"CorsAccessorSettings": {
|
||||
"PolicyName": "JNPFCorsAccessor",
|
||||
"WithOrigins": [ "http://192.168.10.12:9230", "http://localhost:8080" ],
|
||||
"WithOrigins": [ "http://192.168.10.12:9230", "http://192.168.10.18:9230", "http://localhost:8080", "http://localhost:9230" ],
|
||||
"WithExposedHeaders": [ "access-token", "x-access-token", "Content-Disposition" ]
|
||||
}
|
||||
}
|
||||
@@ -176,12 +176,25 @@ public class RunService : IRunService, ITransient
|
||||
input.superQueryJson = GetSuperQueryJson(input.superQueryJson).ToJsonString();
|
||||
|
||||
//modified by ly on 20230426
|
||||
if (!input.station_code.IsNullOrWhiteSpace())
|
||||
var jArr = JArray.Parse(entity.Tables);
|
||||
if (!input.station_code.IsNullOrWhiteSpace())
|
||||
{
|
||||
sql += $" where station_code='{input.station_code}' or station_code=''";
|
||||
|
||||
if (jArr?.FirstOrDefault()?.Value<string>("table") == "eqp_equipment")
|
||||
{
|
||||
sql += $" where station_code='{input.station_code}' or station_code=''";
|
||||
}
|
||||
}
|
||||
if (!input.process_code.IsNullOrWhiteSpace())
|
||||
{
|
||||
if (jArr?.FirstOrDefault()?.Value<string>("table") == "bas_process")
|
||||
{
|
||||
//sql += $" where station_code='{input.station_code}' or station_code=''";
|
||||
}
|
||||
}
|
||||
realList = _databaseService.GetInterFaceData(link, sql, input, templateInfo.ColumnData.Adapt<MainBeltViceQueryModel>(), new List<IConditionalModel>(), tableFieldKeyValue);
|
||||
|
||||
realList = _databaseService.GetInterFaceData(link, sql, input, templateInfo.ColumnData.Adapt<MainBeltViceQueryModel>(), new List<IConditionalModel>(), tableFieldKeyValue);
|
||||
|
||||
|
||||
|
||||
// 显示列有子表字段
|
||||
@@ -1565,7 +1578,7 @@ public class RunService : IRunService, ITransient
|
||||
{
|
||||
List<FieldsModel> childFieldsModelList = model.__config__.children;
|
||||
object? objectData = allDataMap[strKey[i]];
|
||||
|
||||
|
||||
List<Dictionary<string, object>> childAllDataMapList = objectData.ToJsonString().ToObject<List<Dictionary<string, object>>>();
|
||||
if (childAllDataMapList != null && childAllDataMapList.Count > 0)
|
||||
{
|
||||
@@ -2889,27 +2902,17 @@ public class RunService : IRunService, ITransient
|
||||
{
|
||||
jarr = JArray.Parse(itemValue);
|
||||
}
|
||||
|
||||
|
||||
// 多选时为模糊查询
|
||||
if (model.multiple)
|
||||
{
|
||||
if (jarr?.Children() != null && jarr?.Children().ToList().Count > 1)
|
||||
{
|
||||
var values = jarr.ToList().Select(t => t.Value<string>()).ToList();
|
||||
var condition = new ConditionalCollections();
|
||||
condition.ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>(values.Count);
|
||||
values.ForEach(x =>
|
||||
{
|
||||
condition.ConditionalList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel
|
||||
{
|
||||
FieldName = item.Key,
|
||||
ConditionalType = ConditionalType.Like,
|
||||
FieldValue = x,
|
||||
}));
|
||||
});
|
||||
conModels.Add(condition);
|
||||
var values = string.Join(",", jarr.ToList().Select(t => t.Value<string>()));
|
||||
conModels.Add(new ConditionalModel { FieldName= item.Key, ConditionalType= ConditionalType.In, FieldValue=values });
|
||||
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
conModels.Add(new ConditionalCollections()
|
||||
{
|
||||
@@ -2924,34 +2927,24 @@ public class RunService : IRunService, ITransient
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//modified by ly on 20230407
|
||||
else if (jarr?.Children() != null && jarr?.Children().ToList().Count > 1)
|
||||
{
|
||||
var values = jarr.ToList().Select(t => t.Value<string>()).ToList();
|
||||
var condition = new ConditionalCollections();
|
||||
condition.ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>(values.Count);
|
||||
values.ForEach(x =>
|
||||
{
|
||||
condition.ConditionalList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel
|
||||
{
|
||||
FieldName = item.Key,
|
||||
ConditionalType = ConditionalType.Equal,
|
||||
FieldValue = x,
|
||||
}));
|
||||
});
|
||||
conModels.Add(condition);
|
||||
var values = string.Join(",", jarr.ToList().Select(t => t.Value<string>()));
|
||||
conModels.Add(new ConditionalModel { FieldName = item.Key, ConditionalType = ConditionalType.In, FieldValue = values });
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//modified by ly on 20230407
|
||||
if (itemValue.IsMatch(@"\[(.+)\]"))
|
||||
if (itemValue.IsMatch(@"\[(.+)\]"))
|
||||
{
|
||||
itemValue = Regex.Match(itemValue, @"\[(.+)\]").Groups[1].Value;
|
||||
itemValue = itemValue.Trim('"');
|
||||
}
|
||||
|
||||
|
||||
conModels.Add(new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
||||
|
||||
Reference in New Issue
Block a user