订单功能逻辑修改

This commit is contained in:
2025-04-11 15:16:52 +08:00
parent 6c0087e871
commit 1e8987908e
4 changed files with 281 additions and 203 deletions

View File

@@ -19,6 +19,7 @@ public class ReportFlowController : BaseController
{
_reportFlowService = reportFlowService;
}
/// <summary>
/// 根据指定日期获取工单列表
/// </summary>
@@ -28,11 +29,11 @@ public class ReportFlowController : BaseController
/// <exception cref="CustomException"></exception>
[HttpGet("get_workorders_by_date")]
public IActionResult GetWorkOrdersByDate(DateTime startDate, DateTime endDate)
public IActionResult GetWorkOrdersByDate(DateTime startDate, DateTime endDate)
{
startDate = DOANConvertDate.ConvertLocalDate(startDate);
endDate = DOANConvertDate.ConvertLocalDate(endDate);
if(startDate == DateTime.MinValue||endDate==DateTime.MinValue)
if (startDate == DateTime.MinValue || endDate == DateTime.MinValue)
{
throw new CustomException("date is error");
}
@@ -40,8 +41,6 @@ public class ReportFlowController : BaseController
return SUCCESS(response);
}
//TODO 查询工单详情
/// <summary>
/// 查询工单详情
@@ -57,10 +56,11 @@ public class ReportFlowController : BaseController
var response = _reportFlowService.GetWorkOrderDetail(workOrder);
if (response == null)
{
return ToResponse(ResultCode.SUCCESS, "工单不存在");
return ToResponse(ResultCode.SUCCESS, "工单不存在");
}
return SUCCESS(response);
}
//TODO 查询工序报工详情
/// <summary>
/// 查询某个工序报工详情
@@ -76,23 +76,40 @@ public class ReportFlowController : BaseController
{
throw new CustomException("workorder is null");
}
return ToResponse(ResultCode.SUCCESS,_reportFlowService.GetProcessReportWorkDetail(workorder, processId));
return ToResponse(
ResultCode.SUCCESS,
_reportFlowService.GetProcessReportWorkDetail(workorder, processId)
);
}
//TODO 领料工序
[HttpGet("feed_process_reportwork")]
public IActionResult FeedProcessReportwork(string workorder, int processId, int finish_num,string stove_code,string feed_order,string process_operator)
public IActionResult FeedProcessReportwork(
string workorder,
int processId,
int finish_num,
string stove_code,
string feed_order,
string process_operator
)
{
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder or process is null");
}
return SUCCESS(_reportFlowService.FeedProcessReportwork(workorder, processId, finish_num, stove_code, feed_order, process_operator));
return SUCCESS(
_reportFlowService.FeedProcessReportwork(
workorder,
processId,
finish_num,
stove_code,
feed_order,
process_operator
)
);
}
//TODO 工序报工
/// <summary>
/// 工序报工
@@ -104,47 +121,65 @@ public class ReportFlowController : BaseController
/// <returns></returns>
/// <exception cref="CustomException"></exception>
[HttpGet("process_reportwork")]
public IActionResult ProcessReportWork([FromQuery]ProReportWorkDto proReportWorkDto)
public IActionResult ProcessReportWork([FromQuery] ProReportWorkDto proReportWorkDto)
{
if (string.IsNullOrEmpty(proReportWorkDto.workorder))
{
throw new CustomException("workorder or process is null");
}
return SUCCESS(_reportFlowService.ProcessReportWork(proReportWorkDto.workorder, proReportWorkDto. processId, proReportWorkDto.finish_num, proReportWorkDto.bad_num, proReportWorkDto.process_operator));
return SUCCESS(
_reportFlowService.ProcessReportWork(
proReportWorkDto.workorder,
proReportWorkDto.processId,
proReportWorkDto.finish_num,
proReportWorkDto.bad_num,
proReportWorkDto.process_operator
)
);
}
//TODO 出货工序
[HttpGet("shipment_process_reportwork")]
public IActionResult ShipmentProcessReportwork(string workorder, int processId, int finish_num, int bad_num, string customer_order, string process_operator)
public IActionResult ShipmentProcessReportwork(
string workorder,
int processId,
int finish_num,
int bad_num,
string customer_order,
string process_operator
)
{
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder or process is null");
}
int ret = _reportFlowService.ShipmentProcessReportwork(workorder, processId, finish_num, bad_num, customer_order, process_operator);
int ret = _reportFlowService.ShipmentProcessReportwork(
workorder,
processId,
finish_num,
bad_num,
customer_order,
process_operator
);
string data = "";
if (ret == 0)
{
data = "失败";
}
if (ret==1)
if (ret == 0)
{
data = "系统操作失败";
}
if (ret == 1)
{
data = "成功";
}
if (ret == 2)
{
data = "采购订单号和工单号不匹配";
}
if (ret == 3)
{
data = "出货数量超额";
}
return SUCCESS(data);
}
if (ret == 2)
{
data = "采购订单号和工单号不匹配";
}
if (ret == 3)
{
data = "出货数量超额";
}
return SUCCESS(data);
}
//TODO 获取工单下的报工列表
@@ -159,49 +194,35 @@ public class ReportFlowController : BaseController
return SUCCESS(_reportFlowService.GetWorkOrderReportWorkList(workorder));
}
//TODO 输入姓名拼音,查询此人今日报工记录
[HttpGet("get_report_info_by_name")]
public IActionResult GetReportInfoByName([FromQuery] ProReportWorkDto2 query )
public IActionResult GetReportInfoByName([FromQuery] ProReportWorkDto2 query)
{
if (string.IsNullOrEmpty(query.name))
if (string.IsNullOrEmpty(query.name))
{
throw new CustomException("name is null");
}
var response= _reportFlowService.GetReportInfoByName(query);
return SUCCESS(response);
var response = _reportFlowService.GetReportInfoByName(query);
return SUCCESS(response);
}
//TODO 根据工艺路线获取所有工序
[HttpGet("get_process_by_route")]
public IActionResult GetProcessByRoute(int route_id=32)
public IActionResult GetProcessByRoute(int route_id = 32)
{
var response = _reportFlowService.GetProcessByRoute(route_id);
return SUCCESS(response);
}
//TODO 输入工序id 查询今天报工记录
[HttpGet("get_report_by_processid")]
public IActionResult GetReportByProcessId([FromQuery] ProReportWorkDto3 query)
{
if (query.processId <= 0) {
if (query.processId <= 0)
{
throw new CustomException("processId is error");
}
var response = _reportFlowService.GetReportByProcessId(query);
return SUCCESS(response);
}
}
}