| | |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductOrderService; |
| | | import com.ruoyi.productionPlan.mapper.ProductOrderPlanMapper; |
| | | import com.ruoyi.productionPlan.mapper.ProductionPlanMapper; |
| | | import com.ruoyi.productionPlan.pojo.ProductOrderPlan; |
| | | import com.ruoyi.productionPlan.pojo.ProductionPlan; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | |
| | | |
| | | @Autowired |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | | @Autowired |
| | | private ProductOrderPlanMapper productOrderPlanMapper; |
| | | |
| | | @Autowired |
| | | private ProductionPlanMapper productionPlanMapper; |
| | | |
| | | @Autowired |
| | | private ProductionProductOutputMapper productionProductOutputMapper; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean revoke(ProductOrder productOrder) { |
| | | // todo 判断是否产生报工信息 |
| | | |
| | | // 查询合并的生产计划 |
| | | List<ProductOrderPlan> productOrderPlans = productOrderPlanMapper.selectList(Wrappers.<ProductOrderPlan>lambdaQuery().in(ProductOrderPlan::getProductOrderId, productOrder.getId())); |
| | | if (productOrderPlans.isEmpty()) { |
| | | throw new RuntimeException("合并的生产计划不存在"); |
| | | } |
| | | for (ProductOrderPlan productOrderPlan : productOrderPlans) { |
| | | ProductionPlan productionPlan = productionPlanMapper.selectById(productOrderPlan.getProductionPlanId()); |
| | | productionPlan.setAssignedQuantity(productionPlan.getAssignedQuantity().subtract(productOrderPlan.getAssignedQuantity())); |
| | | productionPlanMapper.updateById(productionPlan); |
| | | } |
| | | // 删除关联关系 |
| | | productOrderPlanMapper.delete(Wrappers.<ProductOrderPlan>lambdaQuery().in(ProductOrderPlan::getProductOrderId, productOrder.getId())); |
| | | // 删除订单 |
| | | productOrderMapper.deleteById(productOrder.getId()); |
| | | // todo 删除订单下的工艺路线子表 |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProcessRoute> listProcessRoute(Long productModelId) { |
| | | return productOrderMapper.listProcessRoute(productModelId); |
| | | } |