新增工资/仓储/生产日报等模块,移除旧考勤模块
- 新增 PayRoll(工资)、Wms(仓储)、Prod(车速/缫丝/考勤/丝片检测/丝片台账/纤检日报/质量日报) 模块 - 新增对应 Domain 实体、Application DTO/Service、Api Controller 与前端页面 - 移除旧 Attendance 考勤模块(Controller/Service/Entity/DTO 及 5 个前端页面),由 Prod/Kaoqin 取代 - 调整路由、仪表盘、Lsjl 流丝记录实体与服务 - 更新业务种子数据与 DbSeeder - 补充工作进度文档 14-27
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using F9WebAiTest.Application.Common;
|
||||
using F9WebAiTest.Application.Dtos.Prod;
|
||||
using F9WebAiTest.Application.Services.Prod;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace F9WebAiTest.Api.Controllers.Prod;
|
||||
|
||||
/// <summary>秤大丝(生产-后缫):以落丝记录为主表,按车台录入丝量</summary>
|
||||
[ApiController]
|
||||
[Route("api/prod/cds")]
|
||||
[Authorize]
|
||||
public class CdsController : ControllerBase
|
||||
{
|
||||
private readonly ICdsService _svc;
|
||||
public CdsController(ICdsService svc) => _svc = svc;
|
||||
|
||||
/// <summary>秤大丝列表(落丝记录 + 秤丝汇总)</summary>
|
||||
[HttpGet("list")]
|
||||
public async Task<IActionResult> GetPaged([FromQuery] int pageIndex = 1, [FromQuery] int pageSize = 20,
|
||||
[FromQuery] DateTime? date = null, [FromQuery] long? deptId = null)
|
||||
=> Ok(ApiResult<PageResult<CdsListItemDto>>.Ok(await _svc.GetPagedAsync(pageIndex, pageSize, date, deptId)));
|
||||
|
||||
/// <summary>称重弹窗数据(车台明细;首次称重按车台范围初始化)</summary>
|
||||
[HttpGet("{lsjlId}")]
|
||||
public async Task<IActionResult> GetEdit(long lsjlId)
|
||||
{
|
||||
try { return Ok(ApiResult<CdsEditDto>.Ok(await _svc.GetEditAsync(lsjlId))); }
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
/// <summary>保存秤大丝(车台明细先删后建 + 汇总指标)</summary>
|
||||
[HttpPost("save")]
|
||||
public async Task<IActionResult> Save([FromBody] CdsSaveDto dto)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.SaveAsync(dto);
|
||||
return Ok(ApiResult<object>.Ok(null, "保存成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
/// <summary>清除称重数据(汇总 + 车台明细)</summary>
|
||||
[HttpDelete("{lsjlId}")]
|
||||
public async Task<IActionResult> Delete(long lsjlId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.DeleteAsync(lsjlId);
|
||||
return Ok(ApiResult<object>.Ok(null, "删除成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using F9WebAiTest.Application.Common;
|
||||
using F9WebAiTest.Application.Dtos.Prod;
|
||||
using F9WebAiTest.Application.Services.Prod;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace F9WebAiTest.Api.Controllers.Prod;
|
||||
|
||||
/// <summary>公量纤度(生产-后缫):按「日期 + 车间」整日批量录入</summary>
|
||||
[ApiController]
|
||||
[Route("api/prod/glxd")]
|
||||
[Authorize]
|
||||
public class GlxdController : ControllerBase
|
||||
{
|
||||
private readonly IGlxdService _svc;
|
||||
public GlxdController(IGlxdService svc) => _svc = svc;
|
||||
|
||||
/// <summary>公量纤度列表(落丝记录 + 纤度检验平均纤度 + 公量纤度)</summary>
|
||||
[HttpGet("list")]
|
||||
public async Task<IActionResult> GetList([FromQuery] DateTime? date = null, [FromQuery] long? deptId = null)
|
||||
=> Ok(ApiResult<List<GlxdListItemDto>>.Ok(await _svc.GetListAsync(date, deptId)));
|
||||
|
||||
/// <summary>批量保存公量纤度</summary>
|
||||
[HttpPost("save")]
|
||||
public async Task<IActionResult> Save([FromBody] GlxdSaveDto dto)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.SaveAsync(dto);
|
||||
return Ok(ApiResult<object>.Ok(null, "保存成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using F9WebAiTest.Application.Common;
|
||||
using F9WebAiTest.Application.Dtos.Prod;
|
||||
using F9WebAiTest.Application.Services.Prod;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace F9WebAiTest.Api.Controllers.Prod;
|
||||
|
||||
/// <summary>
|
||||
/// 生产-考勤:考勤登记(CQDJ)。
|
||||
/// 对应 F9 WinClient\F9.Business.Prod\KQ\CQDJ。
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/prod/kaoqin")]
|
||||
[Authorize]
|
||||
public class KaoqinController : ControllerBase
|
||||
{
|
||||
private readonly IKaoqinService _svc;
|
||||
public KaoqinController(IKaoqinService svc) => _svc = svc;
|
||||
|
||||
private IActionResult Fail(ServiceException ex) => StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code));
|
||||
|
||||
/// <summary>整组登记查询(日期 + 部门 + 工种 + 班次)</summary>
|
||||
[HttpGet("cqdj")]
|
||||
public async Task<IActionResult> GetRegister([FromQuery] DateTime date, [FromQuery] long depId,
|
||||
[FromQuery] long worktypeId = 0, [FromQuery] int banci = 1, [FromQuery] string keyword = "")
|
||||
{
|
||||
try { return Ok(ApiResult<CqdjViewDto>.Ok(await _svc.GetRegisterAsync(date, depId, worktypeId, banci, keyword ?? ""))); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
/// <summary>整组覆盖保存</summary>
|
||||
[HttpPost("cqdj")]
|
||||
public async Task<IActionResult> SaveRegister([FromBody] CqdjSaveDto dto)
|
||||
{
|
||||
try { return Ok(ApiResult<object>.Ok(new { count = await _svc.SaveRegisterAsync(dto) }, "保存成功")); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
/// <summary>删除整组登记</summary>
|
||||
[HttpDelete("cqdj")]
|
||||
public async Task<IActionResult> DeleteRegister([FromQuery] DateTime date, [FromQuery] long depId,
|
||||
[FromQuery] long worktypeId = 0, [FromQuery] int banci = 1)
|
||||
{
|
||||
try { return Ok(ApiResult<object>.Ok(new { count = await _svc.DeleteRegisterAsync(date, depId, worktypeId, banci) }, "删除成功")); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
/// <summary>「添加职工」可选职工</summary>
|
||||
[HttpGet("cqdj/employees")]
|
||||
public async Task<IActionResult> Employees([FromQuery] long depId, [FromQuery] long worktypeId = 0, [FromQuery] int banci = 1)
|
||||
=> Ok(ApiResult<List<CqdjEmpOptionDto>>.Ok(await _svc.GetEmployeesAsync(depId, worktypeId, banci)));
|
||||
|
||||
// ==================== 考勤统计(CQTJ) ====================
|
||||
|
||||
/// <summary>统计分页(库中的月快照)</summary>
|
||||
[HttpGet("cqtj")]
|
||||
public async Task<IActionResult> CqtjList([FromQuery] int year, [FromQuery] int month, [FromQuery] long depId = 0,
|
||||
[FromQuery] long worktypeId = 0, [FromQuery] string like = "", [FromQuery] int pageIndex = 1, [FromQuery] int pageSize = 20)
|
||||
=> Ok(ApiResult<PageResult<CqtjRowDto>>.Ok(
|
||||
await _svc.GetCqtjPagedAsync(year, month, depId, worktypeId, like ?? "", pageIndex, pageSize)));
|
||||
|
||||
/// <summary>录入:已有快照取库,否则按账期实时汇总</summary>
|
||||
[HttpGet("cqtj/edit")]
|
||||
public async Task<IActionResult> CqtjEdit([FromQuery] int year, [FromQuery] int month, [FromQuery] long depId)
|
||||
{
|
||||
try { return Ok(ApiResult<CqtjViewDto>.Ok(await _svc.GetCqtjForEditAsync(year, month, depId))); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
/// <summary>保存(整组覆盖)</summary>
|
||||
[HttpPost("cqtj")]
|
||||
public async Task<IActionResult> CqtjSave([FromBody] CqtjSaveDto dto)
|
||||
{
|
||||
try { return Ok(ApiResult<object>.Ok(new { count = await _svc.SaveCqtjAsync(dto) }, "保存成功")); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
/// <summary>删除该年月的统计快照(depId=0 表示全部部门)</summary>
|
||||
[HttpDelete("cqtj")]
|
||||
public async Task<IActionResult> CqtjDelete([FromQuery] int year, [FromQuery] int month, [FromQuery] long depId = 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
var count = depId > 0
|
||||
? await _svc.DeleteCqtjAsync(year, month, depId)
|
||||
: await _svc.DeleteCqtjAllAsync(year, month);
|
||||
return Ok(ApiResult<object>.Ok(new { count }, "删除成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
/// <summary>一键生成:遍历全部车间,缺的才生成</summary>
|
||||
[HttpPost("cqtj/generate")]
|
||||
public async Task<IActionResult> CqtjGenerate([FromBody] CqtjGenerateDto dto)
|
||||
{
|
||||
try { return Ok(ApiResult<object>.Ok(new { count = await _svc.GenerateCqtjAllAsync(dto.Year, dto.Month) }, "生成完成")); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using F9WebAiTest.Application.Common;
|
||||
using F9WebAiTest.Application.Dtos.Prod;
|
||||
using F9WebAiTest.Application.Services.Prod;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace F9WebAiTest.Api.Controllers.Prod;
|
||||
|
||||
/// <summary>丝片检查(生产-后缫):按「日期 + 车间 + 工艺庄口 + 规格」录入疵点片数</summary>
|
||||
[ApiController]
|
||||
[Route("api/prod/spjc")]
|
||||
[Authorize]
|
||||
public class SpjcController : ControllerBase
|
||||
{
|
||||
private readonly ISpjcService _svc;
|
||||
public SpjcController(ISpjcService svc) => _svc = svc;
|
||||
|
||||
/// <summary>丝片检查列表(日期 + 车间 + 关键字)</summary>
|
||||
[HttpGet("list")]
|
||||
public async Task<IActionResult> GetPaged([FromQuery] int pageIndex = 1, [FromQuery] int pageSize = 20,
|
||||
[FromQuery] DateTime? date = null, [FromQuery] long? deptId = null, [FromQuery] string like = "")
|
||||
=> Ok(ApiResult<PageResult<SpjcListItemDto>>.Ok(
|
||||
await _svc.GetPagedAsync(pageIndex, pageSize, date, deptId, like ?? string.Empty)));
|
||||
|
||||
/// <summary>修改回填</summary>
|
||||
[HttpGet("{id}")]
|
||||
public async Task<IActionResult> GetForEdit(long id)
|
||||
{
|
||||
try { return Ok(ApiResult<SpjcSaveDto>.Ok(await _svc.GetForEditAsync(id))); }
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
[HttpPost("save")]
|
||||
public async Task<IActionResult> Save([FromBody] SpjcSaveDto dto)
|
||||
{
|
||||
try
|
||||
{
|
||||
var id = await _svc.SaveAsync(dto);
|
||||
return Ok(ApiResult<object>.Ok(new { id }, "保存成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> Delete(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.DeleteAsync(id);
|
||||
return Ok(ApiResult<object>.Ok(null, "删除成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using F9WebAiTest.Application.Common;
|
||||
using F9WebAiTest.Application.Dtos.Prod;
|
||||
using F9WebAiTest.Application.Services.Prod;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace F9WebAiTest.Api.Controllers.Prod;
|
||||
|
||||
/// <summary>丝片台帐(生产-后缫):每日一条,按账期区间查询</summary>
|
||||
[ApiController]
|
||||
[Route("api/prod/sptz")]
|
||||
[Authorize]
|
||||
public class SptzController : ControllerBase
|
||||
{
|
||||
private readonly ISptzService _svc;
|
||||
public SptzController(ISptzService svc) => _svc = svc;
|
||||
|
||||
/// <summary>丝片台帐列表(账期起止)</summary>
|
||||
[HttpGet("list")]
|
||||
public async Task<IActionResult> GetPaged([FromQuery] DateTime dateFrom, [FromQuery] DateTime dateTo,
|
||||
[FromQuery] int pageIndex = 1, [FromQuery] int pageSize = 31)
|
||||
=> Ok(ApiResult<PageResult<SptzListItemDto>>.Ok(await _svc.GetPagedAsync(pageIndex, pageSize, dateFrom, dateTo)));
|
||||
|
||||
/// <summary>修改回填</summary>
|
||||
[HttpGet("{id}")]
|
||||
public async Task<IActionResult> GetForEdit(long id)
|
||||
{
|
||||
try { return Ok(ApiResult<SptzSaveDto>.Ok(await _svc.GetForEditAsync(id))); }
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
/// <summary>新增默认值:上一本台账 + 上存,并按当日「丝片检查」带出整理片数</summary>
|
||||
[HttpGet("defaults")]
|
||||
public async Task<IActionResult> GetDefaults([FromQuery] DateTime date)
|
||||
=> Ok(ApiResult<SptzDefaultsDto>.Ok(await _svc.GetDefaultsAsync(date)));
|
||||
|
||||
[HttpPost("save")]
|
||||
public async Task<IActionResult> Save([FromBody] SptzSaveDto dto)
|
||||
{
|
||||
try
|
||||
{
|
||||
var id = await _svc.SaveAsync(dto);
|
||||
return Ok(ApiResult<object>.Ok(new { id }, "保存成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> Delete(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.DeleteAsync(id);
|
||||
return Ok(ApiResult<object>.Ok(null, "删除成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
using F9WebAiTest.Application.Common;
|
||||
using F9WebAiTest.Application.Dtos.Prod;
|
||||
using F9WebAiTest.Application.Services.Prod;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace F9WebAiTest.Api.Controllers.Prod;
|
||||
|
||||
/// <summary>
|
||||
/// 生产-选剥茧(对应 F9 WinClient\F9.Business.Prod\XBJ):
|
||||
/// 选茧日报(含盈亏 / 联统率)、选茧计划及其明细、选茧班组与班组职工。
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/prod/xjrb")]
|
||||
[Authorize]
|
||||
public class XjrbController : ControllerBase
|
||||
{
|
||||
private readonly IXjrbService _svc;
|
||||
public XjrbController(IXjrbService svc) => _svc = svc;
|
||||
|
||||
private IActionResult Fail(ServiceException ex) => StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code));
|
||||
|
||||
// ==================== 选茧日报 ====================
|
||||
|
||||
[HttpGet("")]
|
||||
public async Task<IActionResult> List([FromQuery] DateTime? start = null, [FromQuery] DateTime? end = null,
|
||||
[FromQuery] string like = "", [FromQuery] int pageIndex = 1, [FromQuery] int pageSize = 20)
|
||||
=> Ok(ApiResult<PageResult<XjrbListDto>>.Ok(await _svc.GetPagedAsync(start, end, like ?? "", pageIndex, pageSize)));
|
||||
|
||||
[HttpGet("{id:long}")]
|
||||
public async Task<IActionResult> Get(long id)
|
||||
=> Ok(ApiResult<XjrbSaveDto>.Ok(await _svc.GetByIdAsync(id)));
|
||||
|
||||
[HttpPost("")]
|
||||
public async Task<IActionResult> Save([FromBody] XjrbSaveDto dto)
|
||||
{
|
||||
try { return Ok(ApiResult<object>.Ok(new { id = await _svc.SaveAsync(dto) }, "保存成功")); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
[HttpDelete("{id:long}")]
|
||||
public async Task<IActionResult> Delete(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.DeleteAsync(id);
|
||||
return Ok(ApiResult<object>.Ok(null, "删除成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
/// <summary>计算盈亏 / 联统率(前端保存前调用,把结果写入表单)</summary>
|
||||
[HttpPost("count-yingkui")]
|
||||
public async Task<IActionResult> CountYingkui([FromBody] XjrbSaveDto dto)
|
||||
{
|
||||
try { return Ok(ApiResult<XjrbYingkuiDto>.Ok(await _svc.CountYingkuiAsync(dto))); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
// ==================== 选茧计划 ====================
|
||||
|
||||
[HttpGet("plan")]
|
||||
public async Task<IActionResult> PlanList([FromQuery] DateTime? start = null, [FromQuery] DateTime? end = null,
|
||||
[FromQuery] string like = "", [FromQuery] int pageIndex = 1, [FromQuery] int pageSize = 20)
|
||||
=> Ok(ApiResult<PageResult<XjrbPlanListDto>>.Ok(await _svc.GetPlanPagedAsync(start, end, like ?? "", pageIndex, pageSize)));
|
||||
|
||||
[HttpGet("plan/{id:long}")]
|
||||
public async Task<IActionResult> PlanGet(long id)
|
||||
=> Ok(ApiResult<XjrbPlanSaveDto>.Ok(await _svc.GetPlanByIdAsync(id)));
|
||||
|
||||
[HttpPost("plan")]
|
||||
public async Task<IActionResult> PlanSave([FromBody] XjrbPlanSaveDto dto)
|
||||
{
|
||||
try { return Ok(ApiResult<object>.Ok(new { id = await _svc.SavePlanAsync(dto) }, "保存成功")); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
[HttpDelete("plan/{id:long}")]
|
||||
public async Task<IActionResult> PlanDelete(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.DeletePlanAsync(id);
|
||||
return Ok(ApiResult<object>.Ok(null, "删除成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
// ==================== 选茧计划明细 ====================
|
||||
|
||||
[HttpGet("plan/{planId:long}/items")]
|
||||
public async Task<IActionResult> PlanItems(long planId)
|
||||
=> Ok(ApiResult<List<XjrbItemDto>>.Ok(await _svc.GetPlanItemsAsync(planId)));
|
||||
|
||||
[HttpPost("plan/item")]
|
||||
public async Task<IActionResult> PlanItemSave([FromBody] XjrbItemSaveDto dto)
|
||||
{
|
||||
try { return Ok(ApiResult<object>.Ok(new { id = await _svc.SavePlanItemAsync(dto) }, "保存成功")); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
[HttpDelete("plan/item/{id:long}")]
|
||||
public async Task<IActionResult> PlanItemDelete(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.DeletePlanItemAsync(id);
|
||||
return Ok(ApiResult<object>.Ok(null, "删除成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
/// <summary>计划维度盈亏(联统率按包数口径)</summary>
|
||||
[HttpPost("plan/count-yingkui")]
|
||||
public async Task<IActionResult> PlanCountYingkui([FromBody] XjrbItemSaveDto dto)
|
||||
{
|
||||
try { return Ok(ApiResult<XjrbYingkuiDto>.Ok(await _svc.CountPlanYingkuiAsync(dto))); }
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
|
||||
// ==================== 选茧班组 ====================
|
||||
|
||||
[HttpGet("banzu")]
|
||||
public async Task<IActionResult> BanzuList([FromQuery] string banci = "", [FromQuery] int? zu = null,
|
||||
[FromQuery] int pageIndex = 1, [FromQuery] int pageSize = 20)
|
||||
=> Ok(ApiResult<PageResult<XjpbBanzuDto>>.Ok(await _svc.GetBanzuPagedAsync(banci ?? "", zu, pageIndex, pageSize)));
|
||||
|
||||
[HttpGet("banzu/{id:long}/zhigong")]
|
||||
public async Task<IActionResult> BanzuZhigong(long id)
|
||||
=> Ok(ApiResult<List<XjpbBanzuZhigongDto>>.Ok(await _svc.GetBanzuZhigongAsync(id)));
|
||||
|
||||
/// <summary>班组「编辑录入」:按班次整体覆盖保存职工与组别</summary>
|
||||
[HttpPost("banzu/zhigong")]
|
||||
public async Task<IActionResult> BanzuZhigongSave([FromBody] List<XjpbBanzuZhigongSaveDto> dtos)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.SaveBanzuZhigongAsync(dtos ?? new List<XjpbBanzuZhigongSaveDto>());
|
||||
return Ok(ApiResult<object>.Ok(null, "保存成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return Fail(ex); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
using F9WebAiTest.Application.Common;
|
||||
using F9WebAiTest.Application.Dtos.Prod;
|
||||
using F9WebAiTest.Application.Services.Prod;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace F9WebAiTest.Api.Controllers.Prod;
|
||||
|
||||
/// <summary>煮茧日报(生产-前缫):主表 + 机组 / 班次 / 机组班次</summary>
|
||||
[ApiController]
|
||||
[Route("api/prod/zjrb")]
|
||||
[Authorize]
|
||||
public class ZjrbController : ControllerBase
|
||||
{
|
||||
private readonly IZjrbService _svc;
|
||||
public ZjrbController(IZjrbService svc) => _svc = svc;
|
||||
|
||||
// ---------- 查询 ----------
|
||||
|
||||
/// <summary>日报列表(账期起止 + 车间 + 庄口/规格关键字)</summary>
|
||||
[HttpGet("list")]
|
||||
public async Task<IActionResult> GetPaged([FromQuery] DateTime dateFrom, [FromQuery] DateTime dateTo,
|
||||
[FromQuery] long depId = 0, [FromQuery] string like = "", [FromQuery] int pageIndex = 1,
|
||||
[FromQuery] int pageSize = 20)
|
||||
=> Ok(ApiResult<PageResult<ZjrbReadDto_View>>.Ok(
|
||||
await _svc.GetPagedAsync(dateFrom, dateTo, depId, like ?? string.Empty, pageIndex, pageSize)));
|
||||
|
||||
/// <summary>某条日报的机组明细</summary>
|
||||
[HttpGet("{id}/jizus")]
|
||||
public async Task<IActionResult> GetJizus(long id)
|
||||
{
|
||||
try { return Ok(ApiResult<List<ZjrbJizuDto>>.Ok(await _svc.GetJizuListAsync(id))); }
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
/// <summary>修改回填(主表 + 班次 + 机组 + 机组班次)</summary>
|
||||
[HttpGet("{id}")]
|
||||
public async Task<IActionResult> GetForEdit(long id)
|
||||
{
|
||||
try { return Ok(ApiResult<ZjrbSaveDto>.Ok(await _svc.GetForEditAsync(id))); }
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
/// <summary>新增默认值:按上一日结存带出上存、每桶茧量、工艺落丝桶数,并按机组车台生成机组行</summary>
|
||||
[HttpGet("defaults")]
|
||||
public async Task<IActionResult> GetDefaults([FromQuery] DateTime date, [FromQuery] long depId,
|
||||
[FromQuery] long gyzkId, [FromQuery] string guige = "")
|
||||
{
|
||||
try { return Ok(ApiResult<ZjrbSaveDto>.Ok(await _svc.BuildDefaultsAsync(date, depId, gyzkId, guige))); }
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
// ---------- 保存 / 删除 ----------
|
||||
|
||||
[HttpPost("save")]
|
||||
public async Task<IActionResult> Save([FromBody] ZjrbSaveDto dto)
|
||||
{
|
||||
try
|
||||
{
|
||||
var id = await _svc.SaveAsync(dto);
|
||||
return Ok(ApiResult<object>.Ok(new { id }, "保存成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> Delete(long id)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _svc.DeleteAsync(id);
|
||||
return Ok(ApiResult<object>.Ok(null, "删除成功"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
// ---------- 计算缫丝时长 ----------
|
||||
|
||||
/// <summary>按「日期 + 车间」整日重算机组缫丝时长(单班 9 小时 / 双班 18 小时,按茧量比例分配)</summary>
|
||||
[HttpPost("calculate-saosi-hours")]
|
||||
public async Task<IActionResult> CalculateSaosiHours([FromQuery] DateTime date, [FromQuery] long depId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var changed = await _svc.CalculateJizuSaosiHoursAsync(date, depId);
|
||||
return Ok(ApiResult<object>.Ok(changed, changed > 0 ? $"已更新 {changed} 条机组缫丝时长" : "缫丝时长无变化"));
|
||||
}
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user