Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂基础数据
|
||||
/// </summary>
|
||||
public static class FactoryConfigConst
|
||||
{
|
||||
/// <summary>
|
||||
/// 报工是否允许超过工单计划数 是:1 否 :0
|
||||
/// </summary>
|
||||
public const string IS_SURPASS = "is_surpass";
|
||||
|
||||
/// <summary>
|
||||
/// 报工允许超过工单计划数百分比 例:填写10就是10%
|
||||
/// </summary>
|
||||
public const string IS_SURPASS_PERCENTAGE = "is_surpass_percentage";
|
||||
}
|
||||
}
|
||||
87
BasicData/Tnb.BasicData.Entities/Entity/BasFactoryConfig.cs
Normal file
87
BasicData/Tnb.BasicData.Entities/Entity/BasFactoryConfig.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.BasicData.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 工厂基础数据
|
||||
/// </summary>
|
||||
[SugarTable("bas_factory_config")]
|
||||
public partial class BasFactoryConfig : BaseEntity<string>
|
||||
{
|
||||
public BasFactoryConfig()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// key
|
||||
/// </summary>
|
||||
public string key { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public string value { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public int enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public long? ordinal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否系统
|
||||
/// </summary>
|
||||
public int? is_system { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程任务Id
|
||||
/// </summary>
|
||||
public string? f_flowtaskid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程引擎Id
|
||||
/// </summary>
|
||||
public string? f_flowid { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
public class PrdMoListOuput
|
||||
{
|
||||
public string id { get; set; }
|
||||
|
||||
public string mo_type { get; set; }
|
||||
|
||||
public string mo_source { get; set; }
|
||||
public string mo_code { get; set; }
|
||||
public string plan_start_date { get; set; }
|
||||
public string plan_end_date { get; set; }
|
||||
public string material_id { get; set; }
|
||||
public int? plan_qty { get; set; }
|
||||
public string unit_id { get; set; }
|
||||
public string mo_status { get; set; }
|
||||
public string? remark { get; set; }
|
||||
public string combine_mo_code { get; set; }
|
||||
public string material_id_id { get; set; }
|
||||
public List<PrdMoListOuput> children { get; set; } = new List<PrdMoListOuput>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
public class PrdMoTaskIssueListOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string mo_task_code { get; set; }
|
||||
public string material_id { get; set; }
|
||||
public string mold_id { get; set; }
|
||||
public string mo_task_status { get; set; }
|
||||
public int? plan_qty { get; set; }
|
||||
public int? scheduled_qty { get; set; }
|
||||
public string create_time { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,8 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// 工序名称
|
||||
/// </summary>
|
||||
public string process_name { get; set;}
|
||||
|
||||
public string create_time { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,5 +17,6 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
public string estimated_start_date { get; set; }
|
||||
public string estimated_end_date { get; set; }
|
||||
public string eqp_id { get; set; }
|
||||
public string create_time { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -53,5 +53,10 @@ public partial class PrdInstockD : BaseEntity<string>
|
||||
/// 生产提报id
|
||||
/// </summary>
|
||||
public string report_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 生产任务单号
|
||||
/// </summary>
|
||||
public string mo_task_code { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
@@ -227,5 +227,11 @@ public partial class PrdMo : BaseEntity<string>
|
||||
/// 物料单位
|
||||
/// </summary>
|
||||
public string? unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单来源
|
||||
/// </summary>
|
||||
public string? mo_source { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,28 +1,16 @@
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using Aop.Api.Domain;
|
||||
using DbModels;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extensitions.EventBus;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
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;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Org.BouncyCastle.Crypto.Generators;
|
||||
using Senparc.Weixin.Work.AdvancedAPIs.MailList;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -74,43 +62,103 @@ namespace Tnb.ProductionMgr
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
// private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
// {
|
||||
// var db = _repository.AsSugarClient();
|
||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
// var data = await _runService.GetListResult(templateEntity, input);
|
||||
// if (data?.list?.Count > 0)
|
||||
// {
|
||||
// foreach (var row in data.list)
|
||||
// {
|
||||
// var dic = row.ToDictionary(x => x.Key, x => x.Value);
|
||||
// var pkName = "material_id_id";
|
||||
// if (dic.ContainsKey(pkName))
|
||||
// {
|
||||
// var materialId = dic[pkName]?.ToString();
|
||||
// var material = await db.Queryable<BasMaterial>().FirstAsync(it => it.id == materialId);
|
||||
// if (material != null)
|
||||
// {
|
||||
// row.Add("material_name", material.name);
|
||||
// row.Add($"material_attribute", material.attribute);
|
||||
// if (dic.ContainsKey("material_id"))
|
||||
// {
|
||||
// row["material_id"] = material.code + "/" + material.name;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (dic.ContainsKey("unit_id"))
|
||||
// {
|
||||
// string unitId = dic["unit_id"]?.ToString() ?? "";
|
||||
// var unit = await db.Queryable<DictionaryDataEntity>().SingleAsync(x => x.Id == unitId);
|
||||
// row["unit_id"] = unit?.FullName ?? "";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return data!;
|
||||
// }
|
||||
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
var data = await _runService.GetListResult(templateEntity, input);
|
||||
if (data?.list?.Count > 0)
|
||||
{
|
||||
foreach (var row in data.list)
|
||||
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
|
||||
string moCode = queryJson.ContainsKey("mo_code") ? queryJson["mo_code"].ToString() : "";
|
||||
string moStatus = queryJson.ContainsKey("mo_status") ? queryJson["mo_status"].ToString() : "";
|
||||
string combineMoCode = queryJson.ContainsKey("combine_mo_code") ? queryJson["combine_mo_code"].ToString() : "";
|
||||
var result = await db.Queryable<PrdMo>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => c.EnCode == DictConst.MeasurementUnit)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d) => c.Id == d.DictionaryTypeId && a.unit_id == d.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => a.mo_status == e.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e,f) => a.mo_type==f.Id)
|
||||
.WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d, e) => a.mo_code.Contains(moCode))
|
||||
.WhereIF(!string.IsNullOrEmpty(combineMoCode),
|
||||
(a, b, c, d, e) => a.combine_mo_code.Contains(combineMoCode))
|
||||
.WhereIF(!string.IsNullOrEmpty(moStatus), (a, b, c, d, e) => a.mo_status == moStatus)
|
||||
.Where(a=>SqlFunc.IsNullOrEmpty(a.parent_id))
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.Select((a, b, c, d, e,f) => new PrdMoListOuput
|
||||
{
|
||||
var dic = row.ToDictionary(x => x.Key, x => x.Value);
|
||||
var pkName = "material_id_id";
|
||||
if (dic.ContainsKey(pkName))
|
||||
{
|
||||
var materialId = dic[pkName]?.ToString();
|
||||
var material = await db.Queryable<BasMaterial>().FirstAsync(it => it.id == materialId);
|
||||
if (material != null)
|
||||
id = a.id,
|
||||
mo_type = f.FullName,
|
||||
mo_source = a.mo_source=="1" ? "ERP同步" : "新建/导入",
|
||||
mo_code = a.mo_code,
|
||||
plan_start_date = a.plan_start_date==null ? "" : a.plan_start_date.Value.ToString("yyyy-MM-dd"),
|
||||
plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"),
|
||||
material_id = b.code+"/"+b.name,
|
||||
material_id_id = b.id,
|
||||
plan_qty = a.plan_qty,
|
||||
unit_id = d.FullName,
|
||||
mo_status = e.FullName,
|
||||
remark = a.remark,
|
||||
children = SqlFunc.Subqueryable<PrdMo>()
|
||||
.LeftJoin<BasMaterial>((aa, bb) => aa.material_id == bb.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((aa, bb, cc) => cc.EnCode == DictConst.MeasurementUnit)
|
||||
.LeftJoin<DictionaryDataEntity>((aa, bb, cc, dd) => cc.Id == dd.DictionaryTypeId && aa.unit_id == dd.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((aa, bb, cc, dd, ee) => aa.mo_status == ee.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((aa, bb, cc, dd, ee,ff) => aa.mo_type==ff.Id)
|
||||
.Where(aa=>aa.parent_id==a.id)
|
||||
.ToList((aa,bb,cc,dd,ee,ff)=>new PrdMoListOuput
|
||||
{
|
||||
row.Add("material_name", material.name);
|
||||
row.Add($"material_attribute", material.attribute);
|
||||
if (dic.ContainsKey("material_id"))
|
||||
{
|
||||
row["material_id"] = material.code + "/" + material.name;
|
||||
}
|
||||
}
|
||||
|
||||
if (dic.ContainsKey("unit_id"))
|
||||
{
|
||||
string unitId = dic["unit_id"]?.ToString() ?? "";
|
||||
var unit = await db.Queryable<DictionaryDataEntity>().SingleAsync(x => x.Id == unitId);
|
||||
row["unit_id"] = unit?.FullName ?? "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return data!;
|
||||
id = aa.id,
|
||||
mo_type = ff.FullName,
|
||||
mo_source = aa.mo_source=="1" ? "ERP同步" : "新建/导入",
|
||||
mo_code = aa.mo_code,
|
||||
plan_start_date = aa.plan_start_date==null ? "" : aa.plan_start_date.Value.ToString("yyyy-MM-dd"),
|
||||
plan_end_date = aa.plan_end_date==null ? "" : aa.plan_end_date.Value.ToString("yyyy-MM-dd"),
|
||||
material_id = bb.code+"/"+bb.name,
|
||||
material_id_id = bb.id,
|
||||
plan_qty = aa.plan_qty,
|
||||
unit_id = dd.FullName,
|
||||
mo_status = ee.FullName,
|
||||
remark = aa.remark,
|
||||
})
|
||||
}).ToPagedListAsync(input.currentPage, int.MaxValue);
|
||||
return PageResult<PrdMoListOuput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
|
||||
#region Get
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ using JNPF.Systems.Entitys.System;
|
||||
using Newtonsoft.Json;
|
||||
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -116,7 +117,8 @@ namespace Tnb.ProductionMgr
|
||||
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode))
|
||||
.WhereIF(!string.IsNullOrEmpty(moTaskStatus), (a, b, c, d) => a.mo_task_status == moTaskStatus)
|
||||
.Where((a,b,c,d,e,f)=>a.schedule_type==1)
|
||||
.Select((a, b, c, d,e,f) => new PrdMoTask
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.Select((a, b, c, d,e,f) => new PrdMoTaskIssueListOutput
|
||||
{
|
||||
id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
@@ -125,8 +127,9 @@ namespace Tnb.ProductionMgr
|
||||
mo_task_status = d.FullName,
|
||||
plan_qty = f.plan_qty,
|
||||
scheduled_qty = a.scheduled_qty,
|
||||
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<PrdMoTask>.SqlSugarPageResult(result);
|
||||
return PageResult<PrdMoTaskIssueListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,6 +303,7 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<ToolMolds>((a, b, c, d) => a.mold_id == d.id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d, e) => a.eqp_id == e.id)
|
||||
.Where((a, b, c, d, e) => a.mo_id == moId)
|
||||
.OrderByDescending((a,b,c,d,e)=>a.create_time)
|
||||
.Select((a, b, c, d, e) => new PrdMoTaskOutput
|
||||
{
|
||||
mo_task_code = a.mo_task_code,
|
||||
@@ -321,6 +322,7 @@ namespace Tnb.ProductionMgr
|
||||
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
|
||||
process_code = SqlFunc.Subqueryable<BasProcess>().Where(it => it.id == a.process_id).Select(it => it.process_code),
|
||||
process_name = SqlFunc.Subqueryable<BasProcess>().Where(it => it.id == a.process_id).Select(it => it.process_name),
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
})
|
||||
.Mapper(it =>
|
||||
{
|
||||
@@ -335,6 +337,7 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workline_id == d.Id)
|
||||
.LeftJoin<BasProcess>((a,b,c,d,e)=>a.process_id==e.id)
|
||||
.Where((a, b, c, d) => (b.id == moId || b.parent_id == moId) && SqlFunc.IsNullOrEmpty(a.parent_id))
|
||||
.OrderByDescending((a,b,c,d,e)=>a.create_time)
|
||||
.Select((a, b, c, d,e) => new PrdMoTaskOutput
|
||||
{
|
||||
mo_task_code = a.mo_task_code,
|
||||
@@ -350,6 +353,7 @@ namespace Tnb.ProductionMgr
|
||||
estimated_end_date = a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
plan_qty = a.scheduled_qty,
|
||||
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
})
|
||||
.Mapper(it =>
|
||||
{
|
||||
@@ -375,6 +379,7 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<BasMbom>((a, b, c, d) => a.bom_id == d.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), (a, b, c, d) => a.mo_task_code.Contains(input.mo_task_code))
|
||||
.Where((a, b, c, d) => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id))
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.Select((a, b, c, d) => new PackSechelToBeIssueListOutput
|
||||
{
|
||||
mo_task_id = a.id,
|
||||
@@ -1361,6 +1366,26 @@ namespace Tnb.ProductionMgr
|
||||
throw Oops.Bah("暂停的任务单无法提报");
|
||||
}
|
||||
|
||||
if ((prdMoTask.reported_work_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty)
|
||||
{
|
||||
var config1 = await db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.IS_SURPASS);
|
||||
if (config1?.value == "1")
|
||||
{
|
||||
var config2 = await db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.IS_SURPASS_PERCENTAGE);
|
||||
if (!string.IsNullOrEmpty(config2?.value))
|
||||
{
|
||||
if ((prdMoTask.reported_work_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty*(100+Convert.ToDecimal(config2?.value ?? "1"))/100)
|
||||
{
|
||||
throw Oops.Bah($"提报数量不能大于{100+Convert.ToDecimal(config2?.value ?? "0")}%排产数量");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Oops.Bah("提报数量不能大于排产数量");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// bool flag = (prdMoTask.reported_work_qty ?? 0) + (prdMoTask.scrap_qty ?? 0) + input.reported_qty == prdMoTask.scheduled_qty;
|
||||
// if ((prdMoTask.reported_work_qty ?? 0) + (prdMoTask.scrap_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty)
|
||||
@@ -1780,19 +1805,21 @@ namespace Tnb.ProductionMgr
|
||||
worklineIds = await db.Queryable<OrganizeEntity>().Where(x => x.ParentId == eqpId && x.Category==DictConst.RegionCategoryWorklineCode && x.DeleteMark==null).Select(x=>x.Id).ToListAsync();
|
||||
equipIds = await db.Queryable<EqpEquipment>().Where(x => x.equip_type_id == eqpId).Select(x => x.id).ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
var result = await db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => c.EnCode == DictConst.TaskStatus)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d) => c.Id == d.DictionaryTypeId && a.mo_task_status == d.EnCode)
|
||||
.LeftJoin<ToolMolds>((a,b,c,d,e)=>a.mold_id==e.id)
|
||||
.LeftJoin<PrdMo>((a,b,c,d,e,f)=>a.mo_id==f.id)
|
||||
.LeftJoin<OrganizeEntity>((a,b,c,d,e,f,g)=>a.workline_id==g.Id)
|
||||
.LeftJoin<EqpEquipment>((a,b,c,d,e,f,g,h)=>a.eqp_id==h.id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d) =>
|
||||
c.Id == d.DictionaryTypeId && a.mo_task_status == d.EnCode)
|
||||
.LeftJoin<ToolMolds>((a, b, c, d, e) => a.mold_id == e.id)
|
||||
.LeftJoin<PrdMo>((a, b, c, d, e, f) => a.mo_id == f.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f, g) => a.workline_id == g.Id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d, e, f, g, h) => a.eqp_id == h.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode))
|
||||
.WhereIF(!string.IsNullOrEmpty(eqpId) && equipIds.Count<=0 && worklineIds.Count<=0, (a, b, c, d) => a.workline_id==eqpId || a.eqp_id==eqpId)
|
||||
.WhereIF(worklineIds.Count>0,(a, b, c, d)=>worklineIds.Contains(a.workline_id))
|
||||
.WhereIF(equipIds.Count>0,(a, b, c, d)=>equipIds.Contains(a.eqp_id))
|
||||
.WhereIF(!string.IsNullOrEmpty(eqpId) && equipIds.Count <= 0 && worklineIds.Count <= 0,
|
||||
(a, b, c, d) => a.workline_id == eqpId || a.eqp_id == eqpId)
|
||||
.WhereIF(worklineIds.Count > 0, (a, b, c, d) => worklineIds.Contains(a.workline_id))
|
||||
.WhereIF(equipIds.Count > 0, (a, b, c, d) => equipIds.Contains(a.eqp_id))
|
||||
.Select((a, b, c, d,e,f,g,h) => new WorkOrderAdjustmentListOutput
|
||||
{
|
||||
id = a.id,
|
||||
@@ -1807,7 +1834,8 @@ namespace Tnb.ProductionMgr
|
||||
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
|
||||
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
|
||||
eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name,
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace Tnb.ProductionMgr
|
||||
// .WhereIF(end, a => a.estimated_end_date != null && endTimes[0] <= a.estimated_end_date && endTimes[1] >= a.estimated_end_date)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.workline), a => list.Where(p => p.EnCode.Contains(input.workline) || p.FullName.Contains(input.workline)).Select(p => p.Id).ToList().Contains(a.workline_id!))
|
||||
.Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled")
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.Select((a, b, c) => new PrdMoTask
|
||||
{
|
||||
id = a.id,
|
||||
@@ -187,7 +188,7 @@ namespace Tnb.ProductionMgr
|
||||
process_name = b.process_name,
|
||||
plan_start_date = a.estimated_start_date,
|
||||
plan_end_date = a.estimated_end_date,
|
||||
plan_qty = c.scheduled_qty,
|
||||
plan_qty = a.scheduled_qty,
|
||||
//complete_qty = SqlFunc.Subqueryable<PrdReport>().Where(it => it.mo_task_code == a.mo_task_code).Sum(it => it.reported_work_qty),
|
||||
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0),
|
||||
mo_task_status = a.mo_task_status,
|
||||
|
||||
@@ -155,8 +155,7 @@ namespace Tnb.ProductionMgr
|
||||
plan_qty = a.scheduled_qty,
|
||||
complete_qty = a.reported_work_qty,
|
||||
mo_task_status = a.mo_task_status,
|
||||
schedule_type = a.schedule_type.ToString()
|
||||
|
||||
schedule_type = a.schedule_type.ToString(),
|
||||
})
|
||||
.Mapper(x=>x.mo_task_status=dic[x.mo_task_status].ToString())
|
||||
.ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -70,13 +70,14 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
||||
if (carry.IsNull()) throw new AppFriendlyException($"编号{input.carry_code},对应载具不存在", 500);
|
||||
List<WmsCarryCode> carryCodes = new();
|
||||
var carryDsLst = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && carryDsLst?.Count > 0)
|
||||
{
|
||||
var mIds = carryDsLst.Select(it => it.membercarry_id).ToList();
|
||||
carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => mIds.Contains(it.carry_id)).ToListAsync();
|
||||
if (carryCodes.Count < mIds.Count) throw new AppFriendlyException("载具条码数据异常,有料箱为空",500);
|
||||
if (carryCodes.Count < mIds.Count) throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500);
|
||||
for (int i = 0, cnt = mIds.Count; i < cnt; i++)
|
||||
{
|
||||
carryCodes[i].member_carrycode = carryDsLst.Find(x => x.membercarry_id == mIds[i])?.membercarry_code ?? string.Empty;
|
||||
@@ -92,7 +93,7 @@ namespace Tnb.WarehouseMgr
|
||||
catch (Exception)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw ;
|
||||
throw;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -124,8 +124,8 @@ namespace Tnb.WarehouseMgr
|
||||
if (details.Count > 0 && carryCodes.Count > 0)
|
||||
{
|
||||
var locTypes = new[] { ((int)EnumLocationType.出库库位).ToString(), ((int)EnumLocationType.出入库位).ToString() };
|
||||
var endLocs = await _db.Queryable<BasLocation>().Where(it => it.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && locTypes.Contains(it.is_type)).ToListAsync();
|
||||
var randomIndex = new Random().Next(0, endLocs.Count - 1);
|
||||
var endLocs = await _db.Queryable<BasLocation>().Where(it => it.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && locTypes.Contains(it.is_type)).ToArrayAsync();
|
||||
var randomIndex = new Random().Next(0, endLocs.GetUpperBound(0));
|
||||
var carrys = await _db.Queryable<WmsCarryH>().Where(it => carryCodes.Select(x => x.carry_id).Distinct().Contains(it.id)).ToListAsync();
|
||||
var curDetails = details.DistinctBy(x => x.carry_id).ToList();
|
||||
var curCarryCodes = carryCodes.FindAll(x => curDetails.Select(d => d.carry_id).Contains(x.carry_id));
|
||||
|
||||
Reference in New Issue
Block a user