|
|
@ -65,6 +65,10 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
private static final String ORDER_TYPE_CABLE_COP = "CABLE_COP"; |
|
|
private static final String ORDER_TYPE_CABLE_COP = "CABLE_COP"; |
|
|
private static final String ORDER_TYPE_RENOVATION = "RENOVATION"; |
|
|
private static final String ORDER_TYPE_RENOVATION = "RENOVATION"; |
|
|
private static final String ORDER_TYPE_MACHINING = "MACHINING"; |
|
|
private static final String ORDER_TYPE_MACHINING = "MACHINING"; |
|
|
|
|
|
private static final String MACHINING_NODE_PRODUCTION = "machiningProduction"; |
|
|
|
|
|
private static final String MACHINING_NODE_INSPECTION = "machiningInspection"; |
|
|
|
|
|
private static final String MACHINING_NODE_PRODUCTION_NAME = "机加工生产"; |
|
|
|
|
|
private static final String MACHINING_NODE_INSPECTION_NAME = "机加工检验"; |
|
|
|
|
|
|
|
|
private static final String STATUS_PLAN = "已排产"; |
|
|
private static final String STATUS_PLAN = "已排产"; |
|
|
private static final String STATUS_PROCESSING = "进行中"; |
|
|
private static final String STATUS_PROCESSING = "进行中"; |
|
|
@ -221,8 +225,8 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
throw new XJException("请先拍照或录制视频"); |
|
|
throw new XJException("请先拍照或录制视频"); |
|
|
} |
|
|
} |
|
|
String orderType = normalizeOrderType(data.getOrderType()); |
|
|
String orderType = normalizeOrderType(data.getOrderType()); |
|
|
if (ORDER_TYPE_MACHINING.equals(orderType)) { |
|
|
|
|
|
throw new XJException("机加工报工无需上传影像"); |
|
|
|
|
|
|
|
|
if (ORDER_TYPE_MACHINING.equals(orderType) && !isMachiningInspectionNode(orderType, data.getNodeCode())) { |
|
|
|
|
|
throw new XJException("机加工仅检验节点支持上传影像"); |
|
|
} |
|
|
} |
|
|
boolean reportNode = !Boolean.FALSE.equals(data.getReportNode()); |
|
|
boolean reportNode = !Boolean.FALSE.equals(data.getReportNode()); |
|
|
String logNo = reportNode ? reportOrderNode(data, orderType) : validateMediaUploadOnly(data, orderType); |
|
|
String logNo = reportNode ? reportOrderNode(data, orderType) : validateMediaUploadOnly(data, orderType); |
|
|
@ -352,7 +356,9 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
productionPlanMapper.updateOrderStatus(reportLog.getOrderNo(), STATUS_PLAN, null, userId); |
|
|
productionPlanMapper.updateOrderStatus(reportLog.getOrderNo(), STATUS_PLAN, null, userId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (ORDER_TYPE_CABLE_COP.equals(normalizedOrderType) || ORDER_TYPE_MACHINING.equals(normalizedOrderType)) { |
|
|
|
|
|
|
|
|
boolean needRollbackQty = ORDER_TYPE_CABLE_COP.equals(normalizedOrderType) |
|
|
|
|
|
|| isMachiningProductionNode(normalizedOrderType, reportLog.getNodeCode()); |
|
|
|
|
|
if (needRollbackQty) { |
|
|
BigDecimal reportQty = reportLog.getReportQty() == null ? BigDecimal.ZERO : reportLog.getReportQty(); |
|
|
BigDecimal reportQty = reportLog.getReportQty() == null ? BigDecimal.ZERO : reportLog.getReportQty(); |
|
|
if (reportQty.compareTo(BigDecimal.ZERO) > 0) { |
|
|
if (reportQty.compareTo(BigDecimal.ZERO) > 0) { |
|
|
productionPlanMapper.decreaseOrderReportQty(reportLog.getOrderNo(), reportQty, userId); |
|
|
productionPlanMapper.decreaseOrderReportQty(reportLog.getOrderNo(), reportQty, userId); |
|
|
@ -858,7 +864,8 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
return nodeList; |
|
|
return nodeList; |
|
|
} |
|
|
} |
|
|
if (ORDER_TYPE_MACHINING.equals(orderType)) { |
|
|
if (ORDER_TYPE_MACHINING.equals(orderType)) { |
|
|
nodeList.add(buildNode("machiningProduction", "机加工生产", 1)); |
|
|
|
|
|
|
|
|
nodeList.add(buildNode(MACHINING_NODE_PRODUCTION, MACHINING_NODE_PRODUCTION_NAME, 1)); |
|
|
|
|
|
nodeList.add(buildNode(MACHINING_NODE_INSPECTION, MACHINING_NODE_INSPECTION_NAME, 2)); |
|
|
return nodeList; |
|
|
return nodeList; |
|
|
} |
|
|
} |
|
|
if (ORDER_TYPE_HOME_LIFT.equals(orderType)) { |
|
|
if (ORDER_TYPE_HOME_LIFT.equals(orderType)) { |
|
|
@ -1047,21 +1054,30 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
Long userId = getCurrentUserId(); |
|
|
Long userId = getCurrentUserId(); |
|
|
String userName = getCurrentUserName(); |
|
|
String userName = getCurrentUserName(); |
|
|
productionPlanMapper.updateOrderNodeToDone(data.getOrderNo(), data.getNodeCode(), data.getRemark(), userId); |
|
|
productionPlanMapper.updateOrderNodeToDone(data.getOrderNo(), data.getNodeCode(), data.getRemark(), userId); |
|
|
if (ORDER_TYPE_CABLE_COP.equals(orderType) || ORDER_TYPE_MACHINING.equals(orderType)) { |
|
|
|
|
|
BigDecimal reportQty = data.getReportQty() == null ? BigDecimal.ZERO : data.getReportQty(); |
|
|
|
|
|
|
|
|
BigDecimal reportQty = data.getReportQty(); |
|
|
|
|
|
boolean qtyRequired = ORDER_TYPE_CABLE_COP.equals(orderType) |
|
|
|
|
|
|| isMachiningProductionNode(orderType, data.getNodeCode()); |
|
|
|
|
|
if (qtyRequired) { |
|
|
|
|
|
reportQty = reportQty == null ? BigDecimal.ZERO : reportQty; |
|
|
if (reportQty.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
if (reportQty.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
throw new I18nException("lc.production.report.qty.gt.zero"); |
|
|
throw new I18nException("lc.production.report.qty.gt.zero"); |
|
|
} |
|
|
} |
|
|
if (ORDER_TYPE_MACHINING.equals(orderType)) { |
|
|
|
|
|
productionPlanMapper.increaseOrderReportQty(data.getOrderNo(), reportQty, userId); |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
} else if (isMachiningInspectionNode(orderType, data.getNodeCode()) |
|
|
|
|
|
&& (reportQty == null || reportQty.compareTo(BigDecimal.ZERO) <= 0)) { |
|
|
|
|
|
reportQty = BigDecimal.ONE; |
|
|
|
|
|
} |
|
|
|
|
|
if (reportQty != null) { |
|
|
|
|
|
data.setReportQty(reportQty); |
|
|
|
|
|
} |
|
|
|
|
|
if (ORDER_TYPE_CABLE_COP.equals(orderType)) { |
|
|
productionPlanMapper.updateCableCopReportQty( |
|
|
productionPlanMapper.updateCableCopReportQty( |
|
|
data.getOrderNo(), |
|
|
data.getOrderNo(), |
|
|
reportQty, |
|
|
reportQty, |
|
|
order.getTaskQty() == null ? BigDecimal.ZERO : order.getTaskQty(), |
|
|
order.getTaskQty() == null ? BigDecimal.ZERO : order.getTaskQty(), |
|
|
userId |
|
|
userId |
|
|
); |
|
|
); |
|
|
} |
|
|
|
|
|
|
|
|
} else if (isMachiningProductionNode(orderType, data.getNodeCode())) { |
|
|
|
|
|
productionPlanMapper.increaseOrderReportQty(data.getOrderNo(), reportQty, userId); |
|
|
} |
|
|
} |
|
|
int unDoneCount = productionPlanMapper.countUnDoneOrderNode(data.getOrderNo()); |
|
|
int unDoneCount = productionPlanMapper.countUnDoneOrderNode(data.getOrderNo()); |
|
|
if (unDoneCount > 0) { |
|
|
if (unDoneCount > 0) { |
|
|
@ -1075,7 +1091,9 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
data.setReportUserName(userName); |
|
|
data.setReportUserName(userName); |
|
|
String logNo = generateLogNo(orderType); |
|
|
String logNo = generateLogNo(orderType); |
|
|
data.setLogNo(logNo); |
|
|
data.setLogNo(logNo); |
|
|
data.setRemark(ORDER_TYPE_MACHINING.equals(orderType)&&data.getReportQty() != null ? "报工数量:"+data.getReportQty():""); |
|
|
|
|
|
|
|
|
if (isMachiningProductionNode(orderType, data.getNodeCode()) && data.getReportQty() != null) { |
|
|
|
|
|
data.setRemark("报工数量:" + data.getReportQty()); |
|
|
|
|
|
} |
|
|
productionPlanMapper.insertNodeReportLog(data); |
|
|
productionPlanMapper.insertNodeReportLog(data); |
|
|
return logNo; |
|
|
return logNo; |
|
|
} |
|
|
} |
|
|
@ -1448,14 +1466,25 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
if (ORDER_TYPE_MACHINING.equals(orderType)) { |
|
|
if (ORDER_TYPE_MACHINING.equals(orderType)) { |
|
|
if ("machiningProduction".equals(nodeCode)) { |
|
|
|
|
|
|
|
|
if (MACHINING_NODE_PRODUCTION.equals(nodeCode)) { |
|
|
return "LC_MACHINING_PRODUCTION"; |
|
|
return "LC_MACHINING_PRODUCTION"; |
|
|
} |
|
|
} |
|
|
|
|
|
if (MACHINING_NODE_INSPECTION.equals(nodeCode)) { |
|
|
|
|
|
return "LC_MACHINING_INSPECTION"; |
|
|
|
|
|
} |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isMachiningProductionNode(String orderType, String nodeCode) { |
|
|
|
|
|
return ORDER_TYPE_MACHINING.equals(orderType) && MACHINING_NODE_PRODUCTION.equals(nodeCode); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isMachiningInspectionNode(String orderType, String nodeCode) { |
|
|
|
|
|
return ORDER_TYPE_MACHINING.equals(orderType) && MACHINING_NODE_INSPECTION.equals(nodeCode); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void finishOrder(String orderNo, String orderType) { |
|
|
private void finishOrder(String orderNo, String orderType) { |
|
|
if (!StringUtils.hasText(orderNo)) { |
|
|
if (!StringUtils.hasText(orderNo)) { |
|
|
throw new I18nException("lc.production.finish.param.empty"); |
|
|
throw new I18nException("lc.production.finish.param.empty"); |
|
|
|