diff --git a/ant-design-vue-jeecg/src/views/productplan/ZyPlanWuLiaoDataDetail.vue b/ant-design-vue-jeecg/src/views/productplan/ZyPlanWuLiaoDataDetail.vue index 7fd1dc3b..f2345571 100644 --- a/ant-design-vue-jeecg/src/views/productplan/ZyPlanWuLiaoDataDetail.vue +++ b/ant-design-vue-jeecg/src/views/productplan/ZyPlanWuLiaoDataDetail.vue @@ -38,8 +38,8 @@

计划面料清单

- +

计划辅料清单

@@ -71,11 +71,11 @@ import {mixinDevice} from '@/utils/mixin' import {JeecgListMixin} from '@/mixins/JeecgListMixin' import {filterObj} from "@/utils/util"; const columns1 = [ - { - title: '计划ID', - align: "center", - dataIndex: 'planId' - }, + // { + // title: '计划ID', + // align: "center", + // dataIndex: 'planId' + // }, { title: '面料', align: "center", @@ -89,11 +89,11 @@ const columns1 = [ ]; const columns2 = [ - { - title: '计划ID', - align: "center", - dataIndex: 'planId' - }, + // { + // title: '计划ID', + // align: "center", + // dataIndex: 'planId' + // }, { title: '辅料', align: "center", @@ -244,23 +244,7 @@ export default { this.loadRouteType = true; } }, - // showModal(id) { - // this.visible = true; - // this.id = id - // this.getDetailData() - // }, - // getDetailData() { - // getAction(this.url.detail, {id: this.id}).then((res) => { - // if (res.success) { - // this.data = res.result.records || res.result.records; - // console.log("data------------:" + JSON.stringify(this.data)); - // } else { - // this.$message.warning(res.message) - // } - // }).finally(() => { - // this.confirmLoading = false - // }) - // }, + handleOk(e) { this.confirmLoading = true; setTimeout(() => { diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/IDeliveryService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/IDeliveryService.java index b2830be6..07941a6f 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/IDeliveryService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/IDeliveryService.java @@ -3,6 +3,7 @@ package org.jeecg.modules.demo.delivery.service; import org.jeecg.modules.demo.delivery.entity.Delivery; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.productplan.entity.ZyPlanProcess; /** * @Description: 出库表 @@ -12,4 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IDeliveryService extends IService { + void sendToRepository(String planId); + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java index f866ebc4..7aa4f2bd 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/delivery/service/impl/DeliveryServiceImpl.java @@ -1,20 +1,97 @@ 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.mapper.DeliveryMapper; 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.util.ObjectUtils; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; /** * @Description: 出库表 * @Author: jeecg-boot - * @Date: 2023-01-10 + * @Date: 2023-01-10 * @Version: V1.0 */ @Service public class DeliveryServiceImpl extends ServiceImpl 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 fabricList = iZyPlanFabricService.list(new LambdaQueryWrapper() + .eq(ZyPlanFabric::getPlanId, planId)); + List 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 accessoriesList = iZyPlanAccessoriesService.list(new LambdaQueryWrapper() + .eq(ZyPlanAccessories::getPlanId, planId)); + List 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); + } }