feat(工单管理): 添加工单审批通知和滞留库存查询功能
- 在工单服务中新增获取审批通知列表和滞留库存列表的接口 - 添加对应的DTO定义用于查询和响应 - 在控制器中暴露相关API端点 - 修改物料类型字段注释为快速识别标号 - 在工单查询结果中添加物料标号字段
This commit is contained in:
@@ -149,9 +149,9 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
return ToResponse(new ApiResult(500,ex.Message));
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
@@ -766,5 +766,45 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取审批通知列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("getApprovalList")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:query")]
|
||||
public IActionResult GetApprovalList([FromBody] ProWorkorderApprovalQueryDto parm)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = _ProWorkorderService.GetApprovalList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取滞留库存列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("getStockList")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proworkorder:query")]
|
||||
public IActionResult GetStockList([FromBody] ProWorkorderStockQueryDto parm)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = _ProWorkorderService.GetStockList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ namespace DOAN.Model.BZFM
|
||||
public string Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料类型(原材料/半成品/产成品/打包材料/辅料)
|
||||
/// 快速识别标号
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
|
||||
@@ -56,6 +56,11 @@ namespace DOAN.Model.MES.product.Dto
|
||||
|
||||
public string productionCode { get; set; }
|
||||
|
||||
// 成品物料标号
|
||||
public string Type { get; set; }
|
||||
// 原材料物料标号
|
||||
public string SubType { get; set; }
|
||||
|
||||
public string Unit { get; set; }
|
||||
|
||||
public int PlanNum { get; set; } = 0;
|
||||
@@ -345,4 +350,144 @@ namespace DOAN.Model.MES.product.Dto
|
||||
/// </summary>
|
||||
public int? ActualNum { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审批通知查询DTO
|
||||
/// </summary>
|
||||
public class ProWorkorderApprovalQueryDto : PagerInfo
|
||||
{
|
||||
// 可以根据需要添加查询参数
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审批通知响应DTO
|
||||
/// </summary>
|
||||
public class ProWorkorderApprovalDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 审批ID
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单号
|
||||
/// </summary>
|
||||
public string Workorder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标号
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主体编号
|
||||
/// </summary>
|
||||
public string ProductionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主体名称
|
||||
/// </summary>
|
||||
public string ProductionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批号
|
||||
/// </summary>
|
||||
public string BatchNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 炉号
|
||||
/// </summary>
|
||||
public string StoveCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审批内容
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作员
|
||||
/// </summary>
|
||||
public string Operator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 滞留库存查询DTO
|
||||
/// </summary>
|
||||
public class ProWorkorderStockQueryDto : PagerInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 主体编号
|
||||
/// </summary>
|
||||
public string ProductionCode { get; set; }
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
public string SupplierCode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 滞留库存响应DTO
|
||||
/// </summary>
|
||||
public class ProWorkorderStockDto
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单号
|
||||
/// </summary>
|
||||
public string Workorder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标号
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主体编号
|
||||
/// </summary>
|
||||
public string ProductionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主体名称
|
||||
/// </summary>
|
||||
public string ProductionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批号
|
||||
/// </summary>
|
||||
public string BatchNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 炉号
|
||||
/// </summary>
|
||||
public string StoveCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内容
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int StockQuantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作员
|
||||
/// </summary>
|
||||
public string Operator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -49,5 +49,19 @@ namespace DOAN.Service.MES.product.IService
|
||||
/// <param name="workorder">工单号</param>
|
||||
/// <returns></returns>
|
||||
int GetWorkorderWithProgress(string workorder);
|
||||
|
||||
/// <summary>
|
||||
/// 获取审批通知列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
PagedInfo<ProWorkorderApprovalDto> GetApprovalList(ProWorkorderApprovalQueryDto parm);
|
||||
|
||||
/// <summary>
|
||||
/// 获取滞留库存列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
PagedInfo<ProWorkorderStockDto> GetStockList(ProWorkorderStockQueryDto parm);
|
||||
}
|
||||
}
|
||||
@@ -75,5 +75,19 @@ namespace DOAN.Service.MES.product.IService
|
||||
/// <param name="workorder">工单号</param>
|
||||
/// <returns></returns>
|
||||
int GetWorkorderWithProgress(string workorder);
|
||||
|
||||
/// <summary>
|
||||
/// 获取审批通知列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
PagedInfo<ProWorkorderApprovalDto> GetApprovalList(ProWorkorderApprovalQueryDto parm);
|
||||
|
||||
/// <summary>
|
||||
/// 获取滞留库存列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
PagedInfo<ProWorkorderStockDto> GetStockList(ProWorkorderStockQueryDto parm);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,6 +145,14 @@ namespace DOAN.Service.MES.product
|
||||
.Where(sub => sub.Remarks != "已撤销" || sub.Remarks == null)
|
||||
.Select(sub => sub.Quantity)
|
||||
),
|
||||
Type = SqlFunc
|
||||
.Subqueryable<MmMaterial>()
|
||||
.Where(sub => sub.MaterialCode == it.productionCode)
|
||||
.Select(sub => sub.Type),
|
||||
SubType = SqlFunc
|
||||
.Subqueryable<MmMaterial>()
|
||||
.Where(sub => sub.MaterialCode == it.MaterialCode)
|
||||
.Select(sub => sub.Type),
|
||||
InInventoryNum = it.ProductNum - it.ShipmentNum,
|
||||
},
|
||||
true
|
||||
@@ -218,5 +226,68 @@ namespace DOAN.Service.MES.product
|
||||
}
|
||||
return reportInfo.ProcessId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取审批通知列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ProWorkorderApprovalDto> GetApprovalList(ProWorkorderApprovalQueryDto parm)
|
||||
{
|
||||
var result = Context
|
||||
.Queryable<QcScrapRecords>()
|
||||
.Where(it => it.Status == "待审批")
|
||||
.Select(it => new ProWorkorderApprovalDto
|
||||
{
|
||||
Id = it.Id,
|
||||
CreateTime = it.CreatedTime.Value,
|
||||
Workorder = it.Workorder,
|
||||
ProductionCode = it.ProductCode,
|
||||
ProductionName = it.ProductName,
|
||||
BatchNo = it.BatchNo,
|
||||
StoveCode = it.StoveCode,
|
||||
Operator = it.Operator,
|
||||
Type = SqlFunc
|
||||
.Subqueryable<MmMaterial>()
|
||||
.Where(sub => sub.MaterialCode == it.ProductCode)
|
||||
.Select(sub => sub.Type),
|
||||
Content = $"有不良品待审批:{it.ScrapQuantity}个",
|
||||
})
|
||||
.ToPage(parm);
|
||||
// 业务逻辑留空,暂时返回空列表
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取滞留库存列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ProWorkorderStockDto> GetStockList(ProWorkorderStockQueryDto parm)
|
||||
{
|
||||
var result = Context
|
||||
.Queryable<ProWorkorder>()
|
||||
.Where(it => (it.ProductNum - it.ShipmentNum) > 0)
|
||||
.Select(it => new ProWorkorderStockDto
|
||||
{
|
||||
Id = it.Id,
|
||||
Workorder = it.Workorder,
|
||||
ProductionCode = it.productionCode,
|
||||
ProductionName = it.productionName,
|
||||
Type = SqlFunc
|
||||
.Subqueryable<MmMaterial>()
|
||||
.Where(sub => sub.MaterialCode == it.productionCode)
|
||||
.Select(sub => sub.Type),
|
||||
BatchNo = it.FeedOrder,
|
||||
StoveCode = it.StoveCode,
|
||||
Operator = it.CreatedBy,
|
||||
Content = $"有成品待出库",
|
||||
StockQuantity = (it.ProductNum - it.ShipmentNum),
|
||||
CreateTime = it.WorkorderDate.Value,
|
||||
})
|
||||
.ToPage(parm);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,5 +278,25 @@ namespace DOAN.Service.MES.product
|
||||
{
|
||||
return _queryService.GetWorkorderWithProgress(workorder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取审批通知列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ProWorkorderApprovalDto> GetApprovalList(ProWorkorderApprovalQueryDto parm)
|
||||
{
|
||||
return _queryService.GetApprovalList(parm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取滞留库存列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ProWorkorderStockDto> GetStockList(ProWorkorderStockQueryDto parm)
|
||||
{
|
||||
return _queryService.GetStockList(parm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user