|
@@ -21,16 +21,14 @@ import com.fjhx.mes.service.production.ProduceOrderService;
|
|
|
import com.fjhx.sale.entity.contract.po.ContractProductBom;
|
|
|
import com.fjhx.sale.entity.contract.vo.ContractProductBomVo;
|
|
|
import com.fjhx.sale.service.contract.ContractProductBomService;
|
|
|
+import com.fjhx.sale.service.contract.ContractProductService;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -51,6 +49,8 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
|
|
|
@Autowired
|
|
|
private ProductionTaskProgressMapper productionTaskProgressMapper;
|
|
|
@Autowired
|
|
|
+ private ContractProductService contractProductService;
|
|
|
+ @Autowired
|
|
|
private ContractProductBomService contractProductBomService;
|
|
|
@Autowired
|
|
|
private ProduceOrderService produceOrderService;
|
|
@@ -162,63 +162,11 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
|
|
|
ProductionOrderDetailVo detail = BeanUtil.copyProperties(getById(dto.getId()), ProductionOrderDetailVo.class);
|
|
|
Assert.notEmpty(detail, "查询不到任务明细信息!");
|
|
|
|
|
|
- //赋值订单信息
|
|
|
- ProductionOrder productionOrder = produceOrderService.getById(detail.getProduceOrderId());
|
|
|
- if (ObjectUtil.isNotEmpty(productionOrder)) {
|
|
|
- detail.setOrderCode(productionOrder.getCode());
|
|
|
- detail.setDeliveryPeriod(productionOrder.getDeliveryPeriod());
|
|
|
- }
|
|
|
-
|
|
|
- //赋值产品信息
|
|
|
- ProductInfo product = productInfoService.getById(detail.getProductId());
|
|
|
- if (ObjectUtil.isNotEmpty(product)) {
|
|
|
- detail.setProductCode(product.getCustomCode());
|
|
|
- detail.setProductName(product.getName());
|
|
|
- detail.setProductUnit(product.getUnit());
|
|
|
- detail.setProductSpec(product.getSpec());
|
|
|
- detail.setProductLength(product.getLength());
|
|
|
- detail.setProductWidth(product.getWidth());
|
|
|
- detail.setProductHeight(product.getHeight());
|
|
|
- }
|
|
|
- //赋值原材料信息
|
|
|
- ContractProductBom rawMaterialBom = contractProductBomService.getOne(q -> q
|
|
|
- .eq(ContractProductBom::getContractProductId, detail.getContractDetailId())
|
|
|
- .eq(ContractProductBom::getType, 1)
|
|
|
- );
|
|
|
- if (ObjectUtil.isNotEmpty(rawMaterialBom)) {
|
|
|
- ProductInfo rawMaterial = productInfoService.getById(rawMaterialBom.getMaterialId());
|
|
|
- if (ObjectUtil.isNotEmpty(rawMaterial)) {
|
|
|
- detail.setRawMaterialCode(rawMaterial.getCustomCode());
|
|
|
- detail.setRawMaterialName(rawMaterial.getName());
|
|
|
- detail.setRawMaterialLength(rawMaterial.getLength());
|
|
|
- detail.setRawMaterialWidth(rawMaterial.getWidth());
|
|
|
- detail.setRawMaterialHeight(rawMaterial.getHeight());
|
|
|
- }
|
|
|
- }
|
|
|
- //赋值BOM信息
|
|
|
- List<ContractProductBom> bomList = contractProductBomService.list(q -> q
|
|
|
- .eq(ContractProductBom::getContractProductId, detail.getContractDetailId())
|
|
|
- .ne(ContractProductBom::getType, 1)
|
|
|
- );
|
|
|
- List<ContractProductBomVo> bomVoList = BeanUtil.copyToList(bomList, ContractProductBomVo.class);
|
|
|
- productInfoService.attributeAssign(bomVoList, ContractProductBomVo::getMaterialId, (item, product1) -> {
|
|
|
- item.setProductCode(product1.getCustomCode());
|
|
|
- item.setProductName(product1.getName());
|
|
|
- });
|
|
|
- detail.setContractProductBomList(bomVoList);
|
|
|
-
|
|
|
- //赋值生产进度列表
|
|
|
- List<ProductionTaskProgressVo> productionTaskProgressList = productionTaskProgressMapper.getList(IWrapper.<ProductionTaskProgress>getWrapper()
|
|
|
- .eq("ptp.task_id", detail.getId())
|
|
|
- );
|
|
|
- detail.setProductionTaskProgressList(productionTaskProgressList);
|
|
|
-
|
|
|
- return detail;
|
|
|
+ return detailByIds(Arrays.asList(detail.getId())).get(0);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ProductionOrderDetailVo> detailByIds(ProduceOrderDetailSelectDto dto) {
|
|
|
- List<Long> taskIds = dto.getTaskIds();
|
|
|
+ public List<ProductionOrderDetailVo> detailByIds(List<Long> taskIds) {
|
|
|
Assert.notEmpty(taskIds, "任务id列表不能为空");
|
|
|
|
|
|
List<ProductionOrderDetail> productionOrderDetailList = this.list(q -> q.in(ProductionOrderDetail::getId, taskIds));
|
|
@@ -240,6 +188,10 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
|
|
|
detail.setProductWidth(product.getWidth());
|
|
|
detail.setProductHeight(product.getHeight());
|
|
|
});
|
|
|
+ //赋值产品备注
|
|
|
+ contractProductService.attributeAssign(voList, ProductionOrderDetailVo::getContractDetailId, (detail, product) -> {
|
|
|
+ detail.setProductRemark(product.getRemark());
|
|
|
+ });
|
|
|
|
|
|
//获取bom信息
|
|
|
List<Long> cpIds = voList.stream().map(ProductionOrderDetailVo::getContractDetailId).collect(Collectors.toList());
|