|
|
@ -5,20 +5,36 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.jeecg.common.exception.JeecgBootException; |
|
|
|
import org.jeecg.common.exception.JeecgBootException; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.accessories.entity.ZyAccessories; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.accessories.service.IZyAccessoriesService; |
|
|
|
import org.jeecg.modules.demo.base.entity.ZyProcess; |
|
|
|
import org.jeecg.modules.demo.base.entity.ZyProcess; |
|
|
|
import org.jeecg.modules.demo.base.service.IZyProcessService; |
|
|
|
import org.jeecg.modules.demo.base.service.IZyProcessService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.fabric.entity.ZyFabric; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.fabric.service.IZyFabricService; |
|
|
|
import org.jeecg.modules.demo.ordergoods.entity.OrderGoods; |
|
|
|
import org.jeecg.modules.demo.ordergoods.entity.OrderGoods; |
|
|
|
import org.jeecg.modules.demo.ordergoods.service.IOrderGoodsService; |
|
|
|
import org.jeecg.modules.demo.ordergoods.service.IOrderGoodsService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.pro.entity.ZyProcessAccessories; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.pro.entity.ZyProcessFabric; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.pro.service.IZyProcessAccessoriesService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.pro.service.IZyProcessFabricService; |
|
|
|
import org.jeecg.modules.demo.zyorders.entity.ZyOrders; |
|
|
|
import org.jeecg.modules.demo.zyorders.entity.ZyOrders; |
|
|
|
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; |
|
|
|
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; |
|
|
|
|
|
|
|
import org.jeecg.modules.product.pdaccessories.entity.ProductAccessories; |
|
|
|
|
|
|
|
import org.jeecg.modules.product.pdaccessories.service.IProductAccessoriesService; |
|
|
|
|
|
|
|
import org.jeecg.modules.product.pdfabric.entity.ProductFabric; |
|
|
|
|
|
|
|
import org.jeecg.modules.product.pdfabric.service.IProductFabricService; |
|
|
|
import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess; |
|
|
|
import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess; |
|
|
|
import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService; |
|
|
|
import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService; |
|
|
|
import org.jeecg.modules.productplan.entity.ZyPlanProcess; |
|
|
|
import org.jeecg.modules.productplan.entity.ZyPlanProcess; |
|
|
|
|
|
|
|
import org.jeecg.modules.productplan.entity.ZyPlanProcessAccessories; |
|
|
|
|
|
|
|
import org.jeecg.modules.productplan.entity.ZyPlanProcessFabric; |
|
|
|
import org.jeecg.modules.productplan.entity.ZyProductPlan; |
|
|
|
import org.jeecg.modules.productplan.entity.ZyProductPlan; |
|
|
|
import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo; |
|
|
|
import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo; |
|
|
|
import org.jeecg.modules.productplan.entity.vo.ProcessDataVo; |
|
|
|
import org.jeecg.modules.productplan.entity.vo.ProcessDataVo; |
|
|
|
import org.jeecg.modules.productplan.enums.ProductPlanStatusEnum; |
|
|
|
import org.jeecg.modules.productplan.enums.ProductPlanStatusEnum; |
|
|
|
import org.jeecg.modules.productplan.mapper.ZyPlanProcessMapper; |
|
|
|
import org.jeecg.modules.productplan.mapper.ZyPlanProcessMapper; |
|
|
|
|
|
|
|
import org.jeecg.modules.productplan.service.IZyPlanProcessAccessoriesService; |
|
|
|
|
|
|
|
import org.jeecg.modules.productplan.service.IZyPlanProcessFabricService; |
|
|
|
import org.jeecg.modules.productplan.service.IZyPlanProcessService; |
|
|
|
import org.jeecg.modules.productplan.service.IZyPlanProcessService; |
|
|
|
import org.jeecg.modules.productplan.service.IZyProductPlanService; |
|
|
|
import org.jeecg.modules.productplan.service.IZyProductPlanService; |
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
@ -43,10 +59,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.*; |
|
|
|
import java.util.LinkedList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -97,6 +110,24 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z |
|
|
|
private IZyProductService iZyProductService; |
|
|
|
private IZyProductService iZyProductService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IZyPlanProcessFabricService iZyPlanProcessFabricService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IZyPlanProcessAccessoriesService iZyPlanProcessAccessoriesService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IZyProcessFabricService iZyProcessFabricService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
IZyFabricService iZyFabricService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IZyProcessAccessoriesService iZyProcessAccessoriesService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IZyAccessoriesService iZyAccessoriesService; |
|
|
|
|
|
|
|
|
|
|
|
public List<ZyPlanProcess> getProcessDatalist(ZyPlanProcess zyPlanProcess) { |
|
|
|
public List<ZyPlanProcess> getProcessDatalist(ZyPlanProcess zyPlanProcess) { |
|
|
|
//生产计划id
|
|
|
|
//生产计划id
|
|
|
|
String planId = zyPlanProcess.getPlanId(); |
|
|
|
String planId = zyPlanProcess.getPlanId(); |
|
|
@ -137,10 +168,9 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<ZyPlanProcess> syncProductBaseProcess(ZyPlanProcess zyPlanProcess) { |
|
|
|
public List<ZyPlanProcess> syncProductBaseProcess(ZyPlanProcess zyPlanProcess) { |
|
|
|
List<ZyPlanProcess> planProcessList = this.list(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId())); |
|
|
|
int count = this.count(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId())); |
|
|
|
//生产计划工序表没有对应工序时,说明没有制定过该产品的生产工序计划,先把该产品对应的基本工序数据插入到生产计划工序表
|
|
|
|
//生产计划工序表没有对应工序时,说明没有制定过该产品的生产工序计划,先把该产品对应的基本工序数据插入到生产计划工序表
|
|
|
|
if (ObjectUtils.isEmpty(planProcessList)) { |
|
|
|
if (count == 0) { |
|
|
|
|
|
|
|
|
|
|
|
ZyProductPlan zyProductPlan = iZyProductPlanService.getById(zyPlanProcess.getPlanId()); |
|
|
|
ZyProductPlan zyProductPlan = iZyProductPlanService.getById(zyPlanProcess.getPlanId()); |
|
|
|
if (ObjectUtils.isEmpty(zyProductPlan)) { |
|
|
|
if (ObjectUtils.isEmpty(zyProductPlan)) { |
|
|
|
throw new JeecgBootException(zyProductPlan.getId() + "生产计划不存在"); |
|
|
|
throw new JeecgBootException(zyProductPlan.getId() + "生产计划不存在"); |
|
|
@ -152,6 +182,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z |
|
|
|
throw new JeecgBootException(zyProductPlan.getProductNo() + "产品不存在"); |
|
|
|
throw new JeecgBootException(zyProductPlan.getProductNo() + "产品不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//产品基本工序
|
|
|
|
List<ZyProductProcess> productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper<ZyProductProcess>() |
|
|
|
List<ZyProductProcess> productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper<ZyProductProcess>() |
|
|
|
.eq(ZyProductProcess::getProductId, zyProduct.getId())); |
|
|
|
.eq(ZyProductProcess::getProductId, zyProduct.getId())); |
|
|
|
|
|
|
|
|
|
|
@ -160,17 +191,65 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z |
|
|
|
productProcessesList.forEach(o -> { |
|
|
|
productProcessesList.forEach(o -> { |
|
|
|
ZyPlanProcess en = new ZyPlanProcess(); |
|
|
|
ZyPlanProcess en = new ZyPlanProcess(); |
|
|
|
en.setProcessId(o.getProcessId()); |
|
|
|
en.setProcessId(o.getProcessId()); |
|
|
|
ZyProcess zyProcess = iZyProcessService.getById(o.getProcessId()); |
|
|
|
ZyProcess zyProcess = iZyProcessService.getById(o.getId()); |
|
|
|
en.setProcessName(zyProcess.getProcessName()); |
|
|
|
en.setProcessName(zyProcess.getProcessName()); |
|
|
|
en.setPlanId(zyPlanProcess.getPlanId()); |
|
|
|
en.setPlanId(zyPlanProcess.getPlanId()); |
|
|
|
|
|
|
|
en.setTotalMachine(zyProcess.getTotalMachine()); |
|
|
|
|
|
|
|
en.setTotalMaunal(zyProcess.getTotalMaunal()); |
|
|
|
saveList.add(en); |
|
|
|
saveList.add(en); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.saveBatch(saveList); |
|
|
|
this.saveBatch(saveList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//重新查询计划工序
|
|
|
|
|
|
|
|
List<ZyPlanProcess> planProcessList = this.list(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//工序面料同步到计划工序面料表
|
|
|
|
|
|
|
|
this.saveBatchFabricByProcessIdList(planProcessList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//工序辅料同步到计划工序辅料表
|
|
|
|
|
|
|
|
this.saveBatchAccessoriesByProcessIdList(planProcessList); |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void saveBatchAccessoriesByProcessIdList(List<ZyPlanProcess> planProcessList) { |
|
|
|
|
|
|
|
Optional.ofNullable(planProcessList).orElse(new ArrayList<>()).forEach(e -> { |
|
|
|
|
|
|
|
List<ZyProcessAccessories> accessoriesList = this.iZyProcessAccessoriesService.list(new LambdaQueryWrapper<ZyProcessAccessories>() |
|
|
|
|
|
|
|
.eq(ZyProcessAccessories::getProcessId, e.getProcessId())); |
|
|
|
|
|
|
|
List<ZyPlanProcessAccessories> list = new LinkedList<>(); |
|
|
|
|
|
|
|
Optional.ofNullable(accessoriesList).orElse(new ArrayList<>()).forEach(obj -> { |
|
|
|
|
|
|
|
ZyPlanProcessAccessories en = new ZyPlanProcessAccessories(); |
|
|
|
|
|
|
|
en.setPlanProcessId(e.getProcessId()); |
|
|
|
|
|
|
|
en.setPlanId(e.getPlanId()); |
|
|
|
|
|
|
|
en.setAccessoriesId(obj.getAccessoriesId()); |
|
|
|
|
|
|
|
ZyAccessories zyAccessories = iZyAccessoriesService.getById(obj.getAccessoriesId()); |
|
|
|
|
|
|
|
en.setAccessoriesName(zyAccessories.getContents()); |
|
|
|
|
|
|
|
list.add(en); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
iZyPlanProcessAccessoriesService.saveBatch(list); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void saveBatchFabricByProcessIdList(List<ZyPlanProcess> planProcessList) { |
|
|
|
|
|
|
|
Optional.ofNullable(planProcessList).orElse(new ArrayList<>()).forEach(e -> { |
|
|
|
|
|
|
|
List<ZyProcessFabric> fabricList = this.iZyProcessFabricService.list(new LambdaQueryWrapper<ZyProcessFabric>() |
|
|
|
|
|
|
|
.eq(ZyProcessFabric::getProcessId, e.getProcessId())); |
|
|
|
|
|
|
|
List<ZyPlanProcessFabric> list = new LinkedList<>(); |
|
|
|
|
|
|
|
Optional.ofNullable(fabricList).orElse(new ArrayList<>()).forEach(obj -> { |
|
|
|
|
|
|
|
ZyPlanProcessFabric en = new ZyPlanProcessFabric(); |
|
|
|
|
|
|
|
en.setPlanProcessId(e.getProcessId()); |
|
|
|
|
|
|
|
en.setPlanId(e.getPlanId()); |
|
|
|
|
|
|
|
en.setFabricId(obj.getFabricId()); |
|
|
|
|
|
|
|
ZyFabric zyFabric = iZyFabricService.getById(obj.getFabricId()); |
|
|
|
|
|
|
|
en.setFabricName(zyFabric.getName()); |
|
|
|
|
|
|
|
list.add(en); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
iZyPlanProcessFabricService.saveBatch(list); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Map<String, Object> getPlanInfo(ZyPlanProcess planProcess) { |
|
|
|
public Map<String, Object> getPlanInfo(ZyPlanProcess planProcess) { |
|
|
|
//生产计划id
|
|
|
|
//生产计划id
|
|
|
|