|
@@ -20,6 +20,7 @@ import com.fjhx.item.service.product.ProductInfoService;
|
|
import com.fjhx.mes.entity.bom.dto.BomInfoDto;
|
|
import com.fjhx.mes.entity.bom.dto.BomInfoDto;
|
|
import com.fjhx.mes.entity.bom.po.BomDetail;
|
|
import com.fjhx.mes.entity.bom.po.BomDetail;
|
|
import com.fjhx.mes.entity.bom.po.BomInfo;
|
|
import com.fjhx.mes.entity.bom.po.BomInfo;
|
|
|
|
+import com.fjhx.mes.entity.bom.vo.BomInfoVo;
|
|
import com.fjhx.mes.entity.production.po.ProductionPlan;
|
|
import com.fjhx.mes.entity.production.po.ProductionPlan;
|
|
import com.fjhx.mes.entity.production.po.ProductionProcesses;
|
|
import com.fjhx.mes.entity.production.po.ProductionProcesses;
|
|
import com.fjhx.mes.entity.production.po.ProductionTask;
|
|
import com.fjhx.mes.entity.production.po.ProductionTask;
|
|
@@ -218,6 +219,15 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
workOrderDto.setCode(codingRuleService.createCode(CodingRuleEnum.JXST_WORK_ORDER.getKey(), null));
|
|
workOrderDto.setCode(codingRuleService.createCode(CodingRuleEnum.JXST_WORK_ORDER.getKey(), null));
|
|
workOrderDto.setStatus(0);
|
|
workOrderDto.setStatus(0);
|
|
this.save(workOrderDto);
|
|
this.save(workOrderDto);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ BomInfoVo productBom = bomInfoService.getProductBom(workOrderDto.getProductId());
|
|
|
|
+ if(ObjectUtil.isNotEmpty(productBom)) {
|
|
|
|
+ List<WorkOrderBom> workOrderBomList = BeanUtil.copyToList(productBom.getBomDetailVoList(), WorkOrderBom.class);
|
|
|
|
+ if (ObjectUtil.isNotEmpty(workOrderBomList)) {
|
|
|
|
+ workOrderBomService.saveBatch(workOrderBomList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -369,34 +379,34 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @Override
|
|
+
|
|
- public List<BomDetail> getBomInfo(WorkOrder workOrder) {
|
|
+
|
|
-
|
|
+
|
|
- ProductInfo productInfo = productInfoService.getById(workOrder.getProductId());
|
|
+
|
|
- if (ObjectUtil.isEmpty(productInfo)) {
|
|
+
|
|
- throw new ServiceException("查询不到产品信息 产品id->" + workOrder.getProductId());
|
|
+
|
|
- }
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- List<BomDetail> bomDetailList = new ArrayList<>();
|
|
+
|
|
-
|
|
+
|
|
- BomInfo bomInfo = bomInfoService.getOne(q -> q.eq(BomInfo::getProductId, workOrder.getProductId()).eq(BomInfo::getCurrentVersion, 1));
|
|
+
|
|
- if (ObjectUtil.isEmpty(bomInfo)) {
|
|
+
|
|
- throw new ServiceException("查询不到产品的BOM信息 产品名称->" + productInfo.getName());
|
|
+
|
|
- }
|
|
+
|
|
- bomDetailList = bomDetailService.list(q -> q.eq(BomDetail::getBomInfoId, bomInfo.getId()));
|
|
+
|
|
- if (ObjectUtil.isEmpty(bomDetailList)) {
|
|
+
|
|
- throw new ServiceException("查询不到产品BOM明细 产品名称->" + productInfo.getName());
|
|
+
|
|
- }
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- if ("1".equals(workOrder.getIsCustomized())) {
|
|
+
|
|
-
|
|
+
|
|
- List<WorkOrderBom> workOrderBoms = workOrderBomService.list(q -> q.eq(WorkOrderBom::getWorkOrderId, workOrder.getId()));
|
|
+
|
|
- bomDetailList = BeanUtil.copyToList(workOrderBoms, BomDetail.class);
|
|
+
|
|
- }
|
|
+
|
|
- return bomDetailList;
|
|
+
|
|
- }
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -513,31 +523,34 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
.set(WorkOrder::getUpdateUser, SecurityUtils.getUserId())
|
|
.set(WorkOrder::getUpdateUser, SecurityUtils.getUserId())
|
|
);
|
|
);
|
|
|
|
|
|
-
|
|
+
|
|
- if (Objects.equals(workOrder.getIsCustomized(), "1")) {
|
|
+ workOrderBomService.edit(workOrderBomDto);
|
|
-
|
|
+
|
|
- workOrderBomService.edit(workOrderBomDto);
|
|
+
|
|
- } else {
|
|
+
|
|
-
|
|
+
|
|
- List<WorkOrderBom> workOrderBomList = workOrderBomDto.getWorkOrderBomList();
|
|
+
|
|
-
|
|
+
|
|
- BomInfoDto bomInfoDto = new BomInfoDto();
|
|
+
|
|
- List<BomDetail> bomDetailList = BeanUtil.copyToList(workOrderBomList, BomDetail.class);
|
|
+
|
|
- bomInfoDto.setBomDetailList(bomDetailList);
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- BomInfo bomInfo = bomInfoService.getOne(q -> q.eq(BomInfo::getProductId, workOrder.getProductId()).eq(BomInfo::getCurrentVersion, 1));
|
|
+
|
|
- if (ObjectUtil.isNotEmpty(bomInfo)) {
|
|
+
|
|
-
|
|
+
|
|
- bomInfoDto.setId(bomInfo.getId());
|
|
+
|
|
- bomInfoService.editByJxst(bomInfoDto);
|
|
+
|
|
- } else {
|
|
+
|
|
-
|
|
+
|
|
- bomInfoDto.setAddType(1);
|
|
+
|
|
- bomInfoDto.setProductId(workOrder.getProductId());
|
|
+
|
|
- bomInfoService.addByJxst(bomInfoDto);
|
|
+
|
|
- }
|
|
+
|
|
- }
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
checkWorkOrderStatus(workOrderId);
|
|
checkWorkOrderStatus(workOrderId);
|