调整框架多组合代码,组合条件查询
This commit is contained in:
@@ -35,6 +35,10 @@ public static class DictConst
|
|||||||
/// 任务单状态-待开工编码
|
/// 任务单状态-待开工编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ToBeStartedEnCode = "ToBeStarted";
|
public const string ToBeStartedEnCode = "ToBeStarted";
|
||||||
|
/// <summary>
|
||||||
|
/// 任务单状态-待排产
|
||||||
|
/// </summary>
|
||||||
|
public const string ToBeScheduledEncode = "ToBeScheduled";
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -324,6 +324,10 @@ namespace Tnb.ProductionMgr.Entities
|
|||||||
/// Nullable:True
|
/// Nullable:True
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string mo_task_no { get; set; }
|
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.FriendlyException;
|
||||||
using JNPF.Logging;
|
using JNPF.Logging;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
@@ -22,13 +23,15 @@ namespace Tnb.ProductionMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[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 ISqlSugarRepository<PrdMo> _repository;
|
||||||
private readonly IDataBaseManager _dataBaseManager;
|
private readonly IDataBaseManager _dataBaseManager;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly IDictionaryDataService _dictionaryDataService;
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
|
|
||||||
|
public OverideVisualDevFunc OverideFuncs => new OverideVisualDevFunc();
|
||||||
|
|
||||||
public PrdMoService(
|
public PrdMoService(
|
||||||
ISqlSugarRepository<PrdMo> repository,
|
ISqlSugarRepository<PrdMo> repository,
|
||||||
IDataBaseManager dataBaseManager,
|
IDataBaseManager dataBaseManager,
|
||||||
@@ -197,7 +200,7 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
var row = await db.Updateable<PrdMo>()
|
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))
|
.Where(it => input.WorkOrderIds.Contains(it.id))
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
return (row > 0);
|
return (row > 0);
|
||||||
@@ -360,7 +363,7 @@ namespace Tnb.ProductionMgr
|
|||||||
|
|
||||||
if (row > 0)
|
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 moList = await db.Queryable<PrdMo>().Where(it => combineMoCodes.Contains(it.combine_mo_code)).ToListAsync();
|
||||||
var icmoList = moList.Adapt<List<PrdTask>>();
|
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));
|
var obj = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id));
|
||||||
obj.input_qty += entity.scheduled_qty;
|
obj.input_qty += entity.scheduled_qty;
|
||||||
var moStatus = "";
|
string moStatus = "",icmoStatus="";
|
||||||
|
|
||||||
//判断,已排产数量>=计划数量时将状态改为 已排产
|
//判断,已排产数量>=计划数量时将状态改为 已排产
|
||||||
if (obj.input_qty >= obj.plan_qty)
|
if (obj.input_qty >= obj.plan_qty)
|
||||||
{
|
{
|
||||||
moStatus = DictConst.AlreadyId;
|
moStatus = DictConst.AlreadyId;
|
||||||
|
icmoStatus = DictConst.ToBeStartedEnCode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//修改工单状态为待排产,同事修改已排产数量
|
//修改工单状态为待排产,同事修改已排产数量
|
||||||
moStatus = DictConst.WaitProductId;
|
moStatus = DictConst.WaitProductId;
|
||||||
|
icmoStatus = DictConst.ToBeScheduledEncode;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
row = await db.Updateable<PrdMo>().SetColumns(it => new PrdMo
|
row = await db.Updateable<PrdMo>().SetColumns(it => new PrdMo
|
||||||
{
|
{
|
||||||
mo_status = moStatus,
|
mo_status = moStatus,
|
||||||
|
icmo_status = icmoStatus,
|
||||||
input_qty = obj.input_qty
|
input_qty = obj.input_qty
|
||||||
})
|
})
|
||||||
.Where(it => it.id == entity.mo_id).ExecuteCommandAsync();
|
.Where(it => it.id == entity.mo_id).ExecuteCommandAsync();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://*:9231"
|
"Url": "http://0.0.0.0:9231"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"CorsAccessorSettings": {
|
"CorsAccessorSettings": {
|
||||||
"PolicyName": "JNPFCorsAccessor",
|
"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" ]
|
"WithExposedHeaders": [ "access-token", "x-access-token", "Content-Disposition" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,10 +176,23 @@ public class RunService : IRunService, ITransient
|
|||||||
input.superQueryJson = GetSuperQueryJson(input.superQueryJson).ToJsonString();
|
input.superQueryJson = GetSuperQueryJson(input.superQueryJson).ToJsonString();
|
||||||
|
|
||||||
//modified by ly on 20230426
|
//modified by ly on 20230426
|
||||||
|
var jArr = JArray.Parse(entity.Tables);
|
||||||
if (!input.station_code.IsNullOrWhiteSpace())
|
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);
|
||||||
|
|
||||||
|
|
||||||
@@ -2895,19 +2908,9 @@ public class RunService : IRunService, ITransient
|
|||||||
{
|
{
|
||||||
if (jarr?.Children() != null && jarr?.Children().ToList().Count > 1)
|
if (jarr?.Children() != null && jarr?.Children().ToList().Count > 1)
|
||||||
{
|
{
|
||||||
var values = jarr.ToList().Select(t => t.Value<string>()).ToList();
|
var values = string.Join(",", jarr.ToList().Select(t => t.Value<string>()));
|
||||||
var condition = new ConditionalCollections();
|
conModels.Add(new ConditionalModel { FieldName= item.Key, ConditionalType= ConditionalType.In, FieldValue=values });
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2929,19 +2932,9 @@ public class RunService : IRunService, ITransient
|
|||||||
//modified by ly on 20230407
|
//modified by ly on 20230407
|
||||||
else if (jarr?.Children() != null && jarr?.Children().ToList().Count > 1)
|
else if (jarr?.Children() != null && jarr?.Children().ToList().Count > 1)
|
||||||
{
|
{
|
||||||
var values = jarr.ToList().Select(t => t.Value<string>()).ToList();
|
var values = string.Join(",", jarr.ToList().Select(t => t.Value<string>()));
|
||||||
var condition = new ConditionalCollections();
|
conModels.Add(new ConditionalModel { FieldName = item.Key, ConditionalType = ConditionalType.In, FieldValue = values });
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user