|
@@ -7,12 +7,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.base.BaseEntity;
|
|
|
+import com.fjhx.entity.product.ProductEx;
|
|
|
import com.fjhx.entity.working.WorkingProcedure;
|
|
|
import com.fjhx.entity.working.WorkingRoute;
|
|
|
import com.fjhx.entity.working.WorkingRouteProcedure;
|
|
|
import com.fjhx.mapper.working.WorkingRouteMapper;
|
|
|
import com.fjhx.params.working.WorkingRouteEx;
|
|
|
import com.fjhx.params.working.WorkingRouteVo;
|
|
|
+import com.fjhx.service.product.ProductExService;
|
|
|
import com.fjhx.service.working.WorkingProcedureService;
|
|
|
import com.fjhx.service.working.WorkingRouteProcedureService;
|
|
|
import com.fjhx.service.working.WorkingRouteService;
|
|
@@ -44,6 +46,9 @@ public class WorkingRouteServiceImpl extends ServiceImpl<WorkingRouteMapper, Wor
|
|
|
@Autowired
|
|
|
private WorkingProcedureService workingProcedureService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProductExService productExService;
|
|
|
+
|
|
|
@Override
|
|
|
public Page<WorkingRouteEx> getPage(Map<String, String> condition) {
|
|
|
|
|
@@ -84,10 +89,10 @@ public class WorkingRouteServiceImpl extends ServiceImpl<WorkingRouteMapper, Wor
|
|
|
}
|
|
|
|
|
|
// 工艺路线适用产品
|
|
|
- // List<Long> productIdList = workingRouteVo.getProductIdList();
|
|
|
- // if (productIdList.size() > 0) {
|
|
|
- // workingRouteProduct(productIdList, id);
|
|
|
- // }
|
|
|
+ List<Long> productIdList = workingRouteVo.getProductIdList();
|
|
|
+ if (productIdList.size() > 0) {
|
|
|
+ workingRouteProduct(productIdList, id);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -118,15 +123,15 @@ public class WorkingRouteServiceImpl extends ServiceImpl<WorkingRouteMapper, Wor
|
|
|
|
|
|
// 工艺路线适用产品
|
|
|
List<Long> productIdList = workingRouteVo.getProductIdList();
|
|
|
- // if (productIdList.size() > 0) {
|
|
|
- // workingRouteProduct(productIdList, id);
|
|
|
- //
|
|
|
- // // 去除这个工艺路线已关联的其他产品
|
|
|
- // productExService.update(Wrappers.<ProductEx>lambdaUpdate()
|
|
|
- // .eq(ProductEx::getWorkingRouteId, id)
|
|
|
- // .notIn(productIdList.size() > 0, ProductEx::getId, productIdList)
|
|
|
- // .set(ProductEx::getWorkingRouteId, null));
|
|
|
- // }
|
|
|
+ if (productIdList.size() > 0) {
|
|
|
+ workingRouteProduct(productIdList, id);
|
|
|
+
|
|
|
+ // 去除这个工艺路线已关联的其他产品
|
|
|
+ productExService.update(Wrappers.<ProductEx>lambdaUpdate()
|
|
|
+ .eq(ProductEx::getWorkingRouteId, id)
|
|
|
+ .notIn(productIdList.size() > 0, ProductEx::getId, productIdList)
|
|
|
+ .set(ProductEx::getWorkingRouteId, null));
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -137,10 +142,10 @@ public class WorkingRouteServiceImpl extends ServiceImpl<WorkingRouteMapper, Wor
|
|
|
|
|
|
removeById(id);
|
|
|
|
|
|
- // // 去除这个工艺路线已关联的产品
|
|
|
- // productExService.update(Wrappers.<ProductEx>lambdaUpdate()
|
|
|
- // .eq(ProductEx::getWorkingRouteId, id)
|
|
|
- // .set(ProductEx::getWorkingRouteId, null));
|
|
|
+ // 去除这个工艺路线已关联的产品
|
|
|
+ productExService.update(Wrappers.<ProductEx>lambdaUpdate()
|
|
|
+ .eq(ProductEx::getWorkingRouteId, id)
|
|
|
+ .set(ProductEx::getWorkingRouteId, null));
|
|
|
|
|
|
// 去除工艺路线关联工序
|
|
|
workingRouteProcedureService.remove(WorkingRouteProcedure::getWorkingRouteId, id);
|
|
@@ -179,20 +184,20 @@ public class WorkingRouteServiceImpl extends ServiceImpl<WorkingRouteMapper, Wor
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- // /**
|
|
|
- // * 产品关联工艺路线
|
|
|
- // *
|
|
|
- // * @param productIdList 产品id
|
|
|
- // * @param workingRouteId 工艺路线id
|
|
|
- // */
|
|
|
- // private void workingRouteProduct(List<Long> productIdList, Long workingRouteId) {
|
|
|
- // List<ProductEx> productExList = productIdList.stream().map(item -> {
|
|
|
- // ProductEx productEx = new ProductEx();
|
|
|
- // productEx.setId(item);
|
|
|
- // productEx.setWorkingRouteId(workingRouteId);
|
|
|
- // return productEx;
|
|
|
- // }).collect(Collectors.toList());
|
|
|
- // productExService.updateBatchById(productExList);
|
|
|
- // }
|
|
|
+ /**
|
|
|
+ * 产品关联工艺路线
|
|
|
+ *
|
|
|
+ * @param productIdList 产品id
|
|
|
+ * @param workingRouteId 工艺路线id
|
|
|
+ */
|
|
|
+ private void workingRouteProduct(List<Long> productIdList, Long workingRouteId) {
|
|
|
+ List<ProductEx> productExList = productIdList.stream().map(item -> {
|
|
|
+ ProductEx productEx = new ProductEx();
|
|
|
+ productEx.setId(item);
|
|
|
+ productEx.setWorkingRouteId(workingRouteId);
|
|
|
+ return productEx;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ productExService.updateBatchById(productExList);
|
|
|
+ }
|
|
|
|
|
|
}
|