parent
9206500097
commit
d3995a030b
3 changed files with 95 additions and 31 deletions
@ -1,20 +1,97 @@ |
|||||||
package org.jeecg.modules.demo.delivery.service.impl; |
package org.jeecg.modules.demo.delivery.service.impl; |
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
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.delivery.entity.Delivery; |
import org.jeecg.modules.demo.delivery.entity.Delivery; |
||||||
import org.jeecg.modules.demo.delivery.mapper.DeliveryMapper; |
import org.jeecg.modules.demo.delivery.mapper.DeliveryMapper; |
||||||
import org.jeecg.modules.demo.delivery.service.IDeliveryService; |
import org.jeecg.modules.demo.delivery.service.IDeliveryService; |
||||||
|
import org.jeecg.modules.demo.fabric.entity.ZyFabric; |
||||||
|
import org.jeecg.modules.demo.fabric.service.IZyFabricService; |
||||||
|
import org.jeecg.modules.productplan.entity.ZyPlanAccessories; |
||||||
|
import org.jeecg.modules.productplan.entity.ZyPlanFabric; |
||||||
|
import org.jeecg.modules.productplan.entity.ZyProductPlan; |
||||||
|
import org.jeecg.modules.productplan.service.IZyPlanAccessoriesService; |
||||||
|
import org.jeecg.modules.productplan.service.IZyPlanFabricService; |
||||||
|
import org.jeecg.modules.productplan.service.IZyProductPlanService; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.util.ObjectUtils; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
import java.util.LinkedList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Optional; |
||||||
|
|
||||||
/** |
/** |
||||||
* @Description: 出库表 |
* @Description: 出库表 |
||||||
* @Author: jeecg-boot |
* @Author: jeecg-boot |
||||||
* @Date: 2023-01-10 |
* @Date: 2023-01-10 |
||||||
* @Version: V1.0 |
* @Version: V1.0 |
||||||
*/ |
*/ |
||||||
@Service |
@Service |
||||||
public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> implements IDeliveryService { |
public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> implements IDeliveryService { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IZyProductPlanService iZyProductPlanService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IZyPlanFabricService iZyPlanFabricService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IZyPlanAccessoriesService iZyPlanAccessoriesService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
IZyFabricService iZyFabricService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IZyAccessoriesService iZyAccessoriesService; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void sendToRepository(String planId) { |
||||||
|
ZyProductPlan zyProductPlan = iZyProductPlanService.getById(planId); |
||||||
|
Optional.ofNullable(zyProductPlan).orElseThrow(() -> new JeecgBootException("生产计划不存在!")); |
||||||
|
|
||||||
|
List<ZyPlanFabric> fabricList = iZyPlanFabricService.list(new LambdaQueryWrapper<ZyPlanFabric>() |
||||||
|
.eq(ZyPlanFabric::getPlanId, planId)); |
||||||
|
List<Delivery> deliveryList4Fabric = new LinkedList<>(); |
||||||
|
Optional.ofNullable(fabricList).orElse(new LinkedList<>()).forEach(e -> { |
||||||
|
Delivery delivery = new Delivery(); |
||||||
|
delivery.setDeliveryReason("0"); |
||||||
|
delivery.setItemType("0"); |
||||||
|
delivery.setAmount(e.getAmount().doubleValue()); |
||||||
|
// delivery.setDeliveryTime(new Date());
|
||||||
|
// delivery.setCarrierId("TODO");
|
||||||
|
// delivery.setAdminId("TODO");
|
||||||
|
// delivery.setStorehouseId("TODO");
|
||||||
|
ZyFabric zyFabric = iZyFabricService.getById(e.getFabricId()); |
||||||
|
if (!ObjectUtils.isEmpty(zyFabric)) { |
||||||
|
delivery.setItemCode(zyFabric.getFabricNumber()); |
||||||
|
} |
||||||
|
deliveryList4Fabric.add(delivery); |
||||||
|
}); |
||||||
|
this.saveBatch(deliveryList4Fabric); |
||||||
|
|
||||||
|
List<ZyPlanAccessories> accessoriesList = iZyPlanAccessoriesService.list(new LambdaQueryWrapper<ZyPlanAccessories>() |
||||||
|
.eq(ZyPlanAccessories::getPlanId, planId)); |
||||||
|
List<Delivery> deliveryList4accessories = new LinkedList<>(); |
||||||
|
Optional.ofNullable(accessoriesList).orElse(new LinkedList<>()).forEach(e -> { |
||||||
|
Delivery delivery2 = new Delivery(); |
||||||
|
delivery2.setDeliveryReason("0"); |
||||||
|
delivery2.setItemType("1"); |
||||||
|
delivery2.setAmount(e.getAmount().doubleValue()); |
||||||
|
// delivery2.setDeliveryTime(new Date());
|
||||||
|
// delivery2.setCarrierId("TODO");
|
||||||
|
// delivery2.setAdminId("TODO");
|
||||||
|
// delivery2.setStorehouseId("TODO");
|
||||||
|
ZyAccessories zyAccessories = iZyAccessoriesService.getById(e.getAccessoriesId()); |
||||||
|
if (!ObjectUtils.isEmpty(zyAccessories)) { |
||||||
|
delivery2.setItemCode(zyAccessories.getNums()); |
||||||
|
} |
||||||
|
deliveryList4accessories.add(delivery2); |
||||||
|
}); |
||||||
|
this.saveBatch(deliveryList4accessories); |
||||||
|
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue