diff --git a/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/baiduUtils/BeanUtil.java b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/baiduUtils/BeanUtil.java new file mode 100644 index 00000000..c344ba04 --- /dev/null +++ b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/baiduUtils/BeanUtil.java @@ -0,0 +1,32 @@ +package baiduUtils; + +import cn.hutool.core.util.ObjectUtil; +import com.github.pagehelper.util.StringUtil; + +import java.beans.BeanInfo; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; + +public class BeanUtil { + /** + * BeanMerge,对象属性合并(比beanCopy好用) + * @Author zhengkai.blog.csdn.net + */ + public static void merge(M target, M destination) throws Exception { + //获取目标bean + BeanInfo beanInfo = Introspector.getBeanInfo(target.getClass()); + // 遍历所有属性 + for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) { + // 如果是可写属性 + if (descriptor.getWriteMethod() != null) { + Object defaultValue = descriptor.getReadMethod().invoke(destination); + //可以使用StringUtil.isNotEmpty(defaultValue)来判断 + if(ObjectUtil.isNotEmpty(defaultValue)){ + //用非空的defaultValue值覆盖到target去 + descriptor.getWriteMethod().invoke(target, defaultValue); + } + } + } + } + +} diff --git a/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/WarehousingStorageController.java b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/WarehousingStorageController.java index c3064e5d..e141d0fe 100644 --- a/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/WarehousingStorageController.java +++ b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/WarehousingStorageController.java @@ -1,6 +1,8 @@ package jnpf.controller; +import baiduUtils.BeanUtil; import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -11,11 +13,13 @@ import jnpf.engine.service.FlowTaskNodeService; import jnpf.engine.service.FlowTaskService; import jnpf.exception.DataException; import jnpf.model.yunguan.YunguanPurchaseInBoundModel; +import jnpf.model.yunguan.YunguanPurchaseOrderProductModel; import jnpf.permission.entity.UserEntity; import jnpf.service.*; import jnpf.entity.*; import jnpf.util.*; import jnpf.model.warehousingstorage.*; +import jnpf.util.wxutil.HttpUtil; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.jdbc.Null; import org.springframework.beans.factory.annotation.Autowired; @@ -731,9 +735,16 @@ public class WarehousingStorageController { } if (entity.getWarehousingStorageType().equals("1")){ YunguanPurchaseInBoundModel yunguanPurchaseInBoundModel = warehousingStorageService.purchaseInBoundByYunGuan(id); - List yunguanPurchaseProductInBoundModel = warehousingStorageService.purchaseInBoundProductByYunGuanInfo(id); - for (YunguanPurchaseInBoundModel model : yunguanPurchaseProductInBoundModel){ - + List yunguanPurchaseProductInBoundModelList = warehousingStorageService.purchaseInBoundProductByYunGuanInfo(id); + for (YunguanPurchaseInBoundModel model : yunguanPurchaseProductInBoundModelList){ + BeanUtil.merge(model,yunguanPurchaseInBoundModel); + } + if (yunguanPurchaseProductInBoundModelList != null && yunguanPurchaseProductInBoundModelList.size()>0) { + JSONObject purchaseCode = HttpUtil.httpRequest("http://172.16.1.50:8020/fggj/pur/stoIn", "POST", JsonUtil.getObjectToString(yunguanPurchaseProductInBoundModelList)); + if (ObjectUtil.isNotEmpty(purchaseCode)){ + if (purchaseCode.get("code").equals("200")) { + } + } } } } diff --git a/jnpf-java-boot/jnpf-web/src/views/scm/warehousing/warehousingstorage/form.vue b/jnpf-java-boot/jnpf-web/src/views/scm/warehousing/warehousingstorage/form.vue index 2f3ca566..a8becd9f 100644 --- a/jnpf-java-boot/jnpf-web/src/views/scm/warehousing/warehousingstorage/form.vue +++ b/jnpf-java-boot/jnpf-web/src/views/scm/warehousing/warehousingstorage/form.vue @@ -823,9 +823,8 @@ export default { inventoryUnitId: e.inventoryUnitId, storageUnit: e.inventoryUnitId, storageAreaId: e.storageAreaId, - storageNumber: e.storageNumber, + storageNumber: e.notificationStorageNumber, receivedQuantity: e.receivedQuantity, - dateManufacture: new Date().getTime() } this.dataForm.warehousingStorageProductList.push(item)