调整框架多组合代码,组合条件查询
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user