|
|
|
@ -290,97 +290,97 @@ public class UdiTraceController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 客户端根据任务上传出入库单据
|
|
|
|
|
*
|
|
|
|
|
* @param traceOrderUploadRequest
|
|
|
|
|
* @param bindingResult
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Transactional
|
|
|
|
|
@ApiOperation(value = "客户端根据任务上传出入库单据", response = BaseResponse.class)
|
|
|
|
|
@AuthRuleAnnotation("udi/trace/order/upload")
|
|
|
|
|
@PostMapping("udi/trace/order/upload")
|
|
|
|
|
public BaseResponse uploadOrder(@RequestBody TraceOrderUploadRequest traceOrderUploadRequest, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.getById(traceOrderUploadRequest.getTaskId());
|
|
|
|
|
if (taskNoticeEntity == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "任务已过期,或任务不存在!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//清空历史数据
|
|
|
|
|
traceOrderService.deleteByCompanyId(taskNoticeEntity.getProdudctRecordIdFk(), taskNoticeEntity.getCompanyIdFk());
|
|
|
|
|
|
|
|
|
|
TraceOrderEntity traceOrderEntity = new TraceOrderEntity();
|
|
|
|
|
BeanUtils.copyProperties(traceOrderUploadRequest, traceOrderEntity);
|
|
|
|
|
traceOrderEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
traceOrderEntity.setUpdateTime(new Date());
|
|
|
|
|
traceOrderService.save(traceOrderEntity);
|
|
|
|
|
|
|
|
|
|
//设置任务已完成
|
|
|
|
|
taskNoticeEntity.setStatus(3);
|
|
|
|
|
traceTaskNoticeService.updateById(taskNoticeEntity);
|
|
|
|
|
udiTraceService.pushDelayRemoveTask(taskNoticeEntity);
|
|
|
|
|
return ResultVOUtils.success("上传成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 客户端根据任务上传生产关联关系信息
|
|
|
|
|
*
|
|
|
|
|
* @param traceManuOrderUploadRequest
|
|
|
|
|
* @param bindingResult
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Transactional
|
|
|
|
|
@ApiOperation(value = "客户端根据任务上传生产关联关系信息", response = BaseResponse.class)
|
|
|
|
|
@AuthRuleAnnotation("udi/trace/manuOrder/upload")
|
|
|
|
|
@PostMapping("udi/trace/manuOrder/upload")
|
|
|
|
|
public BaseResponse uploadManuOrder(@RequestBody TraceManuOrderUploadRequest traceManuOrderUploadRequest, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.getById(traceManuOrderUploadRequest.getTaskId());
|
|
|
|
|
if (taskNoticeEntity == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "任务已过期,或任务不存在!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//清除历史数据
|
|
|
|
|
TraceManuOrderEntity originOrder = traceManuOrderService.findByBillNo(traceManuOrderUploadRequest.getBillNo(), taskNoticeEntity.getProdudctRecordIdFk(), taskNoticeEntity.getCompanyIdFk());
|
|
|
|
|
if (originOrder != null) {
|
|
|
|
|
traceManuOrderService.removeById(originOrder.getId());
|
|
|
|
|
traceManuCodeRelService.remove(new QueryWrapper<TraceManuCodeRelEntity>().eq("manuOrderIdFk", originOrder.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//新增生产订单
|
|
|
|
|
TraceManuOrderEntity traceManuOrderEntity = new TraceManuOrderEntity();
|
|
|
|
|
BeanUtils.copyProperties(traceManuOrderUploadRequest, traceManuOrderEntity);
|
|
|
|
|
traceManuOrderEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
traceManuOrderService.save(traceManuOrderEntity);
|
|
|
|
|
|
|
|
|
|
//新增订单关联明细
|
|
|
|
|
List<TraceManuDetailRequest> traceManuDetailRequests = traceManuOrderUploadRequest.getDetails();
|
|
|
|
|
if (CollUtil.isNotEmpty(traceManuDetailRequests)) {
|
|
|
|
|
for (TraceManuDetailRequest traceManuDetailRequest : traceManuDetailRequests) {
|
|
|
|
|
TraceManuCodeRelEntity traceManuCodeRelEntity = new TraceManuCodeRelEntity();
|
|
|
|
|
BeanUtils.copyProperties(traceManuDetailRequest, traceManuCodeRelEntity);
|
|
|
|
|
traceManuCodeRelEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
traceManuCodeRelEntity.setManuOrderIdFk(traceManuOrderEntity.getId());
|
|
|
|
|
traceManuOrderService.save(traceManuOrderEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//设置任务已完成
|
|
|
|
|
taskNoticeEntity.setStatus(3);
|
|
|
|
|
traceTaskNoticeService.updateById(taskNoticeEntity);
|
|
|
|
|
udiTraceService.pushDelayRemoveTask(taskNoticeEntity);
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("上传成功");
|
|
|
|
|
}
|
|
|
|
|
// /**
|
|
|
|
|
// * 客户端根据任务上传出入库单据
|
|
|
|
|
// *
|
|
|
|
|
// * @param traceOrderUploadRequest
|
|
|
|
|
// * @param bindingResult
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @Transactional
|
|
|
|
|
// @ApiOperation(value = "客户端根据任务上传出入库单据", response = BaseResponse.class)
|
|
|
|
|
// @AuthRuleAnnotation("udi/trace/order/upload")
|
|
|
|
|
// @PostMapping("udi/trace/order/upload")
|
|
|
|
|
// public BaseResponse uploadOrder(@RequestBody TraceOrderUploadRequest traceOrderUploadRequest, BindingResult bindingResult) {
|
|
|
|
|
// if (bindingResult.hasErrors()) {
|
|
|
|
|
// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.getById(traceOrderUploadRequest.getTaskId());
|
|
|
|
|
// if (taskNoticeEntity == null) {
|
|
|
|
|
// return ResultVOUtils.error(500, "任务已过期,或任务不存在!");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //清空历史数据
|
|
|
|
|
// traceOrderService.deleteByCompanyId(taskNoticeEntity.getProdudctRecordIdFk(), taskNoticeEntity.getCompanyIdFk());
|
|
|
|
|
//
|
|
|
|
|
// TraceOrderEntity traceOrderEntity = new TraceOrderEntity();
|
|
|
|
|
// BeanUtils.copyProperties(traceOrderUploadRequest, traceOrderEntity);
|
|
|
|
|
// traceOrderEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
// traceOrderEntity.setUpdateTime(new Date());
|
|
|
|
|
// traceOrderService.save(traceOrderEntity);
|
|
|
|
|
//
|
|
|
|
|
// //设置任务已完成
|
|
|
|
|
// taskNoticeEntity.setStatus(3);
|
|
|
|
|
// traceTaskNoticeService.updateById(taskNoticeEntity);
|
|
|
|
|
// udiTraceService.pushDelayRemoveTask(taskNoticeEntity);
|
|
|
|
|
// return ResultVOUtils.success("上传成功");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 客户端根据任务上传生产关联关系信息
|
|
|
|
|
// *
|
|
|
|
|
// * @param traceManuOrderUploadRequest
|
|
|
|
|
// * @param bindingResult
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @Transactional
|
|
|
|
|
// @ApiOperation(value = "客户端根据任务上传生产关联关系信息", response = BaseResponse.class)
|
|
|
|
|
// @AuthRuleAnnotation("udi/trace/manuOrder/upload")
|
|
|
|
|
// @PostMapping("udi/trace/manuOrder/upload")
|
|
|
|
|
// public BaseResponse uploadManuOrder(@RequestBody TraceManuOrderUploadRequest traceManuOrderUploadRequest, BindingResult bindingResult) {
|
|
|
|
|
// if (bindingResult.hasErrors()) {
|
|
|
|
|
// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.getById(traceManuOrderUploadRequest.getTaskId());
|
|
|
|
|
// if (taskNoticeEntity == null) {
|
|
|
|
|
// return ResultVOUtils.error(500, "任务已过期,或任务不存在!");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //清除历史数据
|
|
|
|
|
// TraceManuOrderEntity originOrder = traceManuOrderService.findByBillNo(traceManuOrderUploadRequest.getBillNo(), taskNoticeEntity.getProdudctRecordIdFk(), taskNoticeEntity.getCompanyIdFk());
|
|
|
|
|
// if (originOrder != null) {
|
|
|
|
|
// traceManuOrderService.removeById(originOrder.getId());
|
|
|
|
|
// traceManuCodeRelService.remove(new QueryWrapper<TraceManuCodeRelEntity>().eq("manuOrderIdFk", originOrder.getId()));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //新增生产订单
|
|
|
|
|
// TraceManuOrderEntity traceManuOrderEntity = new TraceManuOrderEntity();
|
|
|
|
|
// BeanUtils.copyProperties(traceManuOrderUploadRequest, traceManuOrderEntity);
|
|
|
|
|
// traceManuOrderEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
// traceManuOrderService.save(traceManuOrderEntity);
|
|
|
|
|
//
|
|
|
|
|
// //新增订单关联明细
|
|
|
|
|
// List<TraceManuDetailRequest> traceManuDetailRequests = traceManuOrderUploadRequest.getDetails();
|
|
|
|
|
// if (CollUtil.isNotEmpty(traceManuDetailRequests)) {
|
|
|
|
|
// for (TraceManuDetailRequest traceManuDetailRequest : traceManuDetailRequests) {
|
|
|
|
|
// TraceManuCodeRelEntity traceManuCodeRelEntity = new TraceManuCodeRelEntity();
|
|
|
|
|
// BeanUtils.copyProperties(traceManuDetailRequest, traceManuCodeRelEntity);
|
|
|
|
|
// traceManuCodeRelEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
// traceManuCodeRelEntity.setManuOrderIdFk(traceManuOrderEntity.getId());
|
|
|
|
|
// traceManuOrderService.save(traceManuOrderEntity);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //设置任务已完成
|
|
|
|
|
// taskNoticeEntity.setStatus(3);
|
|
|
|
|
// traceTaskNoticeService.updateById(taskNoticeEntity);
|
|
|
|
|
// udiTraceService.pushDelayRemoveTask(taskNoticeEntity);
|
|
|
|
|
//
|
|
|
|
|
// return ResultVOUtils.success("上传成功");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|