生产管理,新增修改任务单接口
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.BasicData.Entitys.Entity
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///设备登记
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Consts
|
||||
namespace Tnb.ProductionMgr.Entities.Consts
|
||||
{
|
||||
/// <summary>
|
||||
/// 工单状态
|
||||
|
||||
@@ -3,9 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.BasicData.Entitys.Entity;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备列表输出参数
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产任务单更新输入参数
|
||||
/// </summary>
|
||||
public class IcmoUpInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 类别 1、模具 2、设备
|
||||
/// </summary>
|
||||
public int category { get; set; }
|
||||
/// <summary>
|
||||
/// 生产任务单Id
|
||||
/// </summary>
|
||||
public string icmo_id { get; set; }
|
||||
/// <summary>
|
||||
/// 工单Id
|
||||
/// </summary>
|
||||
public string mo_id { get; set; }
|
||||
/// <summary>
|
||||
/// 模具Id
|
||||
/// </summary>
|
||||
public string mold_id { get; set; }
|
||||
/// <summary>
|
||||
/// 设备Id
|
||||
/// </summary>
|
||||
public string eqp_id { get; set; }
|
||||
/// <summary>
|
||||
/// 生产任务单数量
|
||||
/// </summary>
|
||||
public int scheduled_qty { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产工单下发输入参数
|
||||
|
||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.ProductionMgr.Entitys.Entity;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 模具列表输出参数
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产操作记录查询参数
|
||||
|
||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.ProductionMgr.Entitys.Entity;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产操作记录输出类
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产任务单下发输入参数
|
||||
|
||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.ProductionMgr.Entitys.Entity;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产任务重新排序输出参数
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产工单排产输入参数
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
{
|
||||
/// <summary>
|
||||
/// 模具更换输入参数
|
||||
/// </summary>
|
||||
public class SwapMoldUpInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 模具Id
|
||||
/// </summary>
|
||||
public string mold_id { get; set; }
|
||||
/// <summary>
|
||||
/// 生产任务单Id
|
||||
/// </summary>
|
||||
public string icmo_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.ProductionMgr.Entitys.Entity;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
public class TaskOperRecordOutput
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Dto
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 转移机台输入参数
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Entity
|
||||
namespace Tnb.ProductionMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///模具信息表
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Contracts;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Entity
|
||||
namespace Tnb.ProductionMgr.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 模具信息表
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Entity
|
||||
namespace Tnb.ProductionMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///MES生产工单
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Entity
|
||||
namespace Tnb.ProductionMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///生产任务信息
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Entity
|
||||
namespace Tnb.ProductionMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///生产任务操作记录
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Mapster;
|
||||
using Tnb.ProductionMgr.Entitys.Dto;
|
||||
using Tnb.ProductionMgr.Entitys.Entity;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entitys.Mapper
|
||||
namespace Tnb.ProductionMgr.Entities.Mapper
|
||||
{
|
||||
public class Mapper : IRegister
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Tnb.ProductionMgr.Entitys.Dto;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.ProductionMgr.Interfaces
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Tnb.ProductionMgr.Entitys\Tnb.ProductionMgr.Entitys.csproj" />
|
||||
<ProjectReference Include="..\Tnb.ProductionMgr.Entitys\Tnb.ProductionMgr.Entities.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -8,10 +8,12 @@ using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entitys;
|
||||
using Tnb.BasicData.Entitys.Entity;
|
||||
using Tnb.ProductionMgr.Entitys.Dto;
|
||||
using Tnb.ProductionMgr.Entitys.Entity;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
@@ -90,16 +92,27 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<dynamic> GetEquipmentListByMoldId(string moldId)
|
||||
{
|
||||
var items = await _repository.AsSugarClient().Queryable<EqpEquipment>()
|
||||
.InnerJoin<PrdTask>((a, b) => a.id == b.eqp_id)
|
||||
.Where((a, b) => a.mold_id == moldId)
|
||||
.Select((a, b) => new
|
||||
{
|
||||
eqp_code = a.eqp_code,
|
||||
eqp_type_code = a.eqp_type_code,
|
||||
tonnage = b.tonnage,
|
||||
task_list_qty = SqlFunc.Subqueryable<PrdTask>().Where(it => it.eqp_id == a.id).Count(),
|
||||
first_date = SqlFunc.Subqueryable<PrdTask>().Where(it => it.eqp_id == a.id).OrderByDesc(o => o.estimated_end_date).Select(it => it.estimated_end_date)
|
||||
}).ToListAsync();
|
||||
.Where(it => it.mold_id == moldId)
|
||||
.Select(it => new
|
||||
{
|
||||
eqp_code = it.eqp_code,
|
||||
eqp_type_code = it.eqp_type_code,
|
||||
tonnage = it.tonnage,
|
||||
task_list_qty = SqlFunc.Subqueryable<PrdTask>().Where(x => x.eqp_id == it.id).Count(),
|
||||
first_date = SqlFunc.Subqueryable<PrdTask>().Where(x => x.eqp_id == it.id).OrderByDesc(o => o.estimated_end_date).Select(x => x.estimated_end_date)
|
||||
})
|
||||
.ToListAsync();
|
||||
//var items = await _repository.AsSugarClient().Queryable<EqpEquipment>()
|
||||
// .InnerJoin<PrdTask>((a, b) => a.id == b.eqp_id)
|
||||
// .Where((a, b) => a.mold_id == moldId)
|
||||
// .Select((a, b) => new
|
||||
// {
|
||||
// eqp_code = a.eqp_code,
|
||||
// eqp_type_code = a.eqp_type_code,
|
||||
// tonnage = b.tonnage,
|
||||
// task_list_qty = SqlFunc.Subqueryable<PrdTask>().Where(it => it.eqp_id == a.id).Count(),
|
||||
// first_date = SqlFunc.Subqueryable<PrdTask>().Where(it => it.eqp_id == a.id).OrderByDesc(o => o.estimated_end_date).Select(it => it.estimated_end_date)
|
||||
// }).ToListAsync();
|
||||
return items;
|
||||
|
||||
}
|
||||
@@ -441,25 +454,37 @@ namespace Tnb.ProductionMgr
|
||||
/// <summary>
|
||||
/// 生产任务单修改
|
||||
/// </summary>
|
||||
/// <param name="input">生产任务单修改输入参数</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ICMOModify()
|
||||
public async Task<dynamic> IcmoModify(IcmoUpInput input)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工单调整-转移机台
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic?> TransferPlatform(TransferPlatformUpInput input)
|
||||
{
|
||||
return await _repository.AsSugarClient().Updateable<PrdTask>()
|
||||
.SetColumns(it => new PrdTask { eqp_id = input.eqp_id })
|
||||
.Where(it => it.id == input.icmo_id)
|
||||
.ExecuteCommandHasChangeAsync();
|
||||
var row = -1;
|
||||
var db = _repository.AsSugarClient();
|
||||
var icmoItem = await db.Queryable<PrdTask>().FirstAsync(it => it.id == input.icmo_id);
|
||||
switch (input.category)
|
||||
{
|
||||
case 1: //设备
|
||||
var eqpItem = await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.eqp_id);
|
||||
icmoItem.eqp_id = eqpItem.id;
|
||||
icmoItem.eqp_type_code = eqpItem.eqp_type_code;
|
||||
if (input.scheduled_qty > icmoItem.plan_qty)
|
||||
{
|
||||
throw new AppFriendlyException("任务单数量不能大于计划数量", 500);
|
||||
}
|
||||
row = await db.Updateable<PrdMo>().SetColumns(it => new PrdMo { input_qty = input.scheduled_qty }).Where(it => it.id == input.mo_id).ExecuteCommandAsync();
|
||||
break;
|
||||
case 2: //模具
|
||||
var moldItem = await db.Queryable<Molds>().FirstAsync(it => it.id == input.mold_id);
|
||||
icmoItem.mold_id = moldItem.id;
|
||||
icmoItem.mold_code = moldItem.mold_code;
|
||||
icmoItem.mold_name = moldItem.mold_name;
|
||||
icmoItem.mold_cavity_qty = moldItem.cavity_qty;
|
||||
break;
|
||||
}
|
||||
row = await db.Updateable(icmoItem).WhereColumns(it => new { input.icmo_id }).ExecuteCommandAsync();
|
||||
return (row > 0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -13,7 +13,7 @@ using JNPF.Systems.Entitys.System;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.ProductionMgr.Entitys.Entity;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.BasicData.Interfaces",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.ProductionMgr", "ProductionMgr\Tnb.ProductionMgr\Tnb.ProductionMgr.csproj", "{C9001973-83C5-48B8-8905-69BCC8132928}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.ProductionMgr.Entitys", "ProductionMgr\Tnb.ProductionMgr.Entitys\Tnb.ProductionMgr.Entitys.csproj", "{4F4EDC3F-4167-4061-AD07-4B0254977F26}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.ProductionMgr.Entities", "ProductionMgr\Tnb.ProductionMgr.Entitys\Tnb.ProductionMgr.Entities.csproj", "{4F4EDC3F-4167-4061-AD07-4B0254977F26}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.ProductionMgr.Interfaces", "ProductionMgr\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj", "{CE039C17-0037-457C-A202-486701DB7F17}"
|
||||
EndProject
|
||||
|
||||
Reference in New Issue
Block a user