排产代码逻辑调整
This commit is contained in:
@@ -35,6 +35,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.PrdManage
|
||||
/// 计划生产结束日期
|
||||
/// </summary>
|
||||
public DateTime? plan_end_date { get; set; }
|
||||
/// <summary>
|
||||
/// 任务ID
|
||||
/// </summary>
|
||||
public string task_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string mold_id { get; set; }
|
||||
/// <summary>
|
||||
/// 模具编号
|
||||
/// </summary>
|
||||
public string mold_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:模具名称
|
||||
@@ -93,6 +97,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string eqp_id { get; set; }
|
||||
/// <summary>
|
||||
/// 设备编号
|
||||
/// </summary>
|
||||
public string eqp_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:设备名称
|
||||
@@ -121,6 +129,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string item_id { get; set; }
|
||||
/// <summary>
|
||||
/// 产品编号
|
||||
/// </summary>
|
||||
public string item_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:产品名称
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Tnb.ProductionMgr.Entitys.Entity
|
||||
/// <summary>
|
||||
/// 产品ID
|
||||
/// </summary>
|
||||
public string item_id { get; set; }
|
||||
//public string item_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:产品代码, BAS_MATERIA.MATERIALCODE BAS_ITEM.ITEMCODE
|
||||
|
||||
@@ -137,29 +137,46 @@ namespace Tnb.ProductionPlanMgr
|
||||
try
|
||||
{
|
||||
await db.Ado.BeginTranAsync();
|
||||
|
||||
row = await db.Storageable(entity).ExecuteCommandAsync();
|
||||
var taskLogEntity = input.Adapt<PrdTaskLog>();
|
||||
taskLogEntity.id ??= SnowflakeIdHelper.NextId();
|
||||
taskLogEntity.task_id = input.id;
|
||||
taskLogEntity.status ??= "ToBeStarted";
|
||||
taskLogEntity.create_id = _userManager.UserId;
|
||||
taskLogEntity.create_time = DateTime.Now;
|
||||
taskLogEntity.operator_name = _userManager.RealName;
|
||||
|
||||
|
||||
//任务状态变更时插入操作记录
|
||||
if (!db.Queryable<PrdTaskLog>().Where(it => it.task_id == input.id && it.status == taskLogEntity.status).Any())
|
||||
{
|
||||
row = await db.Insertable(taskLogEntity).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
if (row > 0)
|
||||
{
|
||||
//修改工单状态为已排产,同事修改已排产数量
|
||||
var obj = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id));
|
||||
obj.input_qty += entity.scheduled_num;
|
||||
var moStatus = "";
|
||||
//判断,已排产数量>=计划数量时将状态改为 已完成
|
||||
if (obj.input_qty >= obj.plan_qty)
|
||||
{
|
||||
moStatus = "25019252113685";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//修改工单状态为已排产,同事修改已排产数量
|
||||
moStatus = "25019244276501";
|
||||
}
|
||||
row = await db.Updateable<PrdMo>().SetColumns(it => new PrdMo
|
||||
{
|
||||
mo_status = "25019252113685",
|
||||
input_qty = entity.scheduled_num
|
||||
mo_status = moStatus,
|
||||
input_qty = obj.input_qty
|
||||
})
|
||||
.Where(it => it.id == entity.mo_id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -231,19 +248,20 @@ namespace Tnb.ProductionPlanMgr
|
||||
/// <summary>
|
||||
/// 查看工单操作记录
|
||||
/// </summary>
|
||||
/// <param name="input">操作记录查询输入参数</param>
|
||||
/// <param name="taskId">任务ID</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("record/{moId}")]
|
||||
public async Task<dynamic> GetMoOperRecord(PrdTaskOperInput input)
|
||||
[HttpGet("record/{taskId}")]
|
||||
public async Task<dynamic> GetMoOperRecord(string taskId)
|
||||
{
|
||||
var list = await _repository.AsSugarClient().Queryable<PrdTask>().LeftJoin<PrdTaskLog>((a, b) => a.prd_task_id == b.id)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.mo_no), a => a.mo_id == input.mo_no)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.task_no), b => b.prd_task_id == input.task_no)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.item_code), a => a.item_code == input.item_code)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.eqp_code), a => a.eqp_type_code == input.eqp_code)
|
||||
.WhereIF(input.plan_start_date.HasValue, a => a.plan_start_date >= input.plan_start_date!.Value)
|
||||
.WhereIF(input.plan_end_date.HasValue, a => a.plan_end_date <= input.plan_end_date!.Value)
|
||||
.ToListAsync();
|
||||
//var list = await _repository.AsSugarClient().Queryable<PrdTask>().LeftJoin<PrdTaskLog>((a, b) => a.prd_task_id == b.id)
|
||||
// .WhereIF(!string.IsNullOrWhiteSpace(input.mo_no),b=>b.id == input.task_no)
|
||||
// .WhereIF(!string.IsNullOrWhiteSpace(input.task_no), b => b.prd_task_id == input.task_id)
|
||||
// .WhereIF(!string.IsNullOrWhiteSpace(input.item_code), a => a.item_code == input.item_code)
|
||||
// .WhereIF(!string.IsNullOrWhiteSpace(input.eqp_code), a => a.eqp_type_code == input.eqp_code)
|
||||
// .WhereIF(input.plan_start_date.HasValue, a => a.plan_start_date >= input.plan_start_date!.Value)
|
||||
// .WhereIF(input.plan_end_date.HasValue, a => a.plan_end_date <= input.plan_end_date!.Value)
|
||||
// .ToListAsync();
|
||||
var list = await _repository.AsSugarClient().Queryable<PrdTaskLog>().Where(it => it.id == taskId).ToListAsync();
|
||||
var data = list.Adapt<List<PrdTaskOperOutput>>();
|
||||
var dic = await _dictionaryDataService.GetDicByTypeId("25572555259157");
|
||||
_repository.AsSugarClient().ThenMapper(data, x => x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : "");
|
||||
|
||||
@@ -343,7 +343,7 @@ public class DictionaryDataService : IDictionaryDataService, IDynamicApiControll
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, object>> GetDicByTypeId(string typeId) =>
|
||||
await _repository.AsQueryable().Where(x => x.DictionaryTypeId == typeId).ToDictionaryAsync(x => x.EnCode, x => x.FullName);
|
||||
await _repository.AsQueryable().Where(x => x.DictionaryTypeId == typeId && x.DeleteMark == null).ToDictionaryAsync(x => x.EnCode, x => x.FullName);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2919,8 +2919,12 @@ public class RunService : IRunService, ITransient
|
||||
else
|
||||
{
|
||||
//modified by ly on 20230407
|
||||
itemValue = Regex.Match(itemValue, @"\[(.+)\]").Groups[1].Value;
|
||||
itemValue = itemValue.Trim('"');
|
||||
if (itemValue.IsMatch(@"\[(.+)\]"))
|
||||
{
|
||||
itemValue = Regex.Match(itemValue, @"\[(.+)\]").Groups[1].Value;
|
||||
itemValue = itemValue.Trim('"');
|
||||
}
|
||||
|
||||
conModels.Add(new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
||||
@@ -2939,6 +2943,7 @@ public class RunService : IRunService, ITransient
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (item.Value.IsNullOrEmpty()) continue;
|
||||
var itemValue = item.Value.ToString().Contains("[") ? item.Value.ToJsonString() : item.Value.ToString();
|
||||
|
||||
if (model.searchType == 1)
|
||||
|
||||
Reference in New Issue
Block a user