#
luxiaotao1123
2021-03-12 840a7447b720e95fcc979b8d0a10485e84e883eb
#
4个文件已修改
130 ■■■■■ 已修改文件
src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/zy/cloud/wms/common/service/erp/entity/GetBasisResult.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/zy/cloud/wms/manager/utils/NodeUtils.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/tag/tag.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java
@@ -4,20 +4,23 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.exception.CoolException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import zy.cloud.wms.common.service.erp.entity.GetBasisResult;
import zy.cloud.wms.common.service.erp.entity.GetOrderResult;
import zy.cloud.wms.manager.entity.Cstmr;
import zy.cloud.wms.manager.entity.CustOrder;
import zy.cloud.wms.manager.entity.Mat;
import zy.cloud.wms.manager.service.CstmrService;
import zy.cloud.wms.manager.service.CustOrderService;
import zy.cloud.wms.manager.service.LocDetlService;
import zy.cloud.wms.manager.service.MatService;
import zy.cloud.wms.manager.entity.Tag;
import zy.cloud.wms.manager.mapper.TagMapper;
import zy.cloud.wms.manager.service.*;
import zy.cloud.wms.manager.utils.HttpHandler;
import zy.cloud.wms.manager.utils.NodeUtils;
import java.io.IOException;
import java.util.Date;
@@ -32,6 +35,7 @@
 */
@Slf4j
@Component
@RestController
public class ErpScheduler {
    public static final String URI = "http://8.133.182.21:8080/api";
@@ -47,11 +51,16 @@
    private CstmrService cstmrService;
    @Autowired
    private LocDetlService locDetlService;
    @Autowired
    private TagService tagService;
    @Autowired
    private TagMapper tagMapper;
    /**
     * 商品下载
     */
    //    @Scheduled(cron = "0/5 * * * * ? ")
    @GetMapping("/test1")
//    @PostConstruct
    public void getBasis1Execute(){
        try {
@@ -72,6 +81,7 @@
                    return;
                }
                List<GetBasisResult> list = JSON.parseArray(result.getData(), GetBasisResult.class);
                Tag first = null;
                for (GetBasisResult data : list) {
                    Mat mat = matService.selectByMatnr(data.getUserCode());
                    String modifyDate = data.getModifyDate();
@@ -79,19 +89,87 @@
                    if (!Cools.isEmpty(modifyDate)) {
                        updateTime = DateUtils.convert(data.getModifyDate());
                    }
                    // 分类
                    Tag second = tagService.selectOne(new EntityWrapper<Tag>().eq("name", data.getYjfl()).eq("level", 2));
                    if (second == null) {
                        if (first == null) {
                            first = tagService.selectOne(new EntityWrapper<Tag>().eq("level", 1));
                            if (first == null) {
                                throw new CoolException("全部分类出错");
                            }
                        }
                        NodeUtils nodeUtils = new NodeUtils();
                        nodeUtils.executePath(first.getId());
                        second = new Tag(
                                    null,    // 编号
                                data.getYjfl(),    // 名称
                                first.getId(),    // 父级
                                first.getName(),    // 父级名称
                                nodeUtils.path.toString(),    // 关联路径
                                nodeUtils.pathName.toString(),    // 关联路径名
                                    0,    // 类型
                                    null,    // 负责人
                                    null,    // 图片
                                    null,    // 简要描述
                                    null,    // 数量
                                    2,    // 等级
                                    null,    // 排序
                                    1,    // 状态
                                    now,    // 添加时间
                                    null,    // 添加人员
                                now,    // 修改时间
                                    null,    // 修改人员
                                    null    // 备注
                            );
                        if (tagMapper.insert(second) == 0) {
                            throw new CoolException("插入分类失败");
                        }
                    }
                    Tag third = tagService.selectOne(new EntityWrapper<Tag>().eq("level", 3).eq("name", data.getEjfl()).eq("parent_name", data.getYjfl()));
                    if (third == null) {
                        NodeUtils nodeUtils = new NodeUtils();
                        nodeUtils.executePath(second.getId());
                        third = new Tag(
                                null,    // 编号
                                data.getEjfl(),    // 名称
                                second.getId(),    // 父级
                                second.getName(),    // 父级名称
                                nodeUtils.path.toString(),    // 关联路径
                                nodeUtils.pathName.toString(),    // 关联路径名
                                0,    // 类型
                                null,    // 负责人
                                null,    // 图片
                                null,    // 简要描述
                                null,    // 数量
                                3,    // 等级
                                null,    // 排序
                                1,    // 状态
                                now,    // 添加时间
                                null,    // 添加人员
                                now,    // 修改时间
                                null,    // 修改人员
                                null    // 备注
                        );
                        if (tagMapper.insert(third) == 0) {
                            throw new CoolException("插入分类失败");
                        }
                    }
                    if (null == mat) {
                        mat = new Mat(
                                String.valueOf(data.getRec()),    // 编号
                                null,    // 所属区域
                                null,    // 所属归类
                                third.getId(),    // 所属归类
                                data.getUserCode(),    // 商品编号
                                data.getFullName(),    // 商品名称
                                null,    // 名称
                                null,    // 规格
                                data.getStandard(),    // 规格
                                null,    // 型号
                                null,    // 批号
                                null,    // 单位
                                null,    // 条码
                                data.getUnit3(),    // 单位
                                data.getBarcode(),    // 条码
                                null,    // 单据类型
                                null,    // 单据编号
                                null,    // 客户名称
@@ -110,7 +188,10 @@
                        mat.setUuid(String.valueOf(data.getRec()));
                        mat.setMatnr(data.getUserCode());
                        mat.setMaktx(data.getFullName());
                        mat.setSpecs(data.getStandard());
                        mat.setUpdateTime(updateTime);
                        mat.setBarcode(data.getBarcode());
                        mat.setUnit(data.getUnit3());
                        matService.updateById(mat);
                    }
                    log.info("====>> 更新物料:{}", data.getUserCode());
src/main/java/zy/cloud/wms/common/service/erp/entity/GetBasisResult.java
@@ -8,6 +8,10 @@
@Data
public class GetBasisResult {
    private String Yjfl; // 一级分类
    private String Ejfl; // 二级分类
    private String UserCode;    // 商品/客户编号
    private String FullName;    // 商品/客户名称
@@ -16,4 +20,14 @@
    private String ModifyDate;  // 商品/客户修改时间
    private String Unit3;
    private String Barcode;
    private String Standard;
    private Double UnitRate1;
    private Double UnitRate2;
}
src/main/java/zy/cloud/wms/manager/utils/NodeUtils.java
@@ -45,4 +45,19 @@
        }
    }
    public void executePath(Long parentId) {
        TagService bean = SpringUtils.getBean(TagService.class);
        Tag parent = bean.selectById(parentId);
        if (null != parent) {
            path.insert(0, parent.getId()).insert(0,",");
            pathName.insert(0, parent.getName()).insert(0,",");
            if (parent.getParentId() != null) {
                executePath(parent);
            } else {
                path.deleteCharAt(0);
                pathName.deleteCharAt(0);
            }
        }
    }
}
src/main/webapp/views/tag/tag.html
@@ -13,6 +13,9 @@
        #detail {
            padding: 25px 30px 0 0;
        }
        .ew-tree-table-box {
            height: 100%;
        }
    </style>
</head>
<body>
@@ -163,6 +166,7 @@
                ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
            ]],
            done: function (data) {
                $('.ew-tree-table-box').css('height', '100%');
                insTb.expandAll();
                tbDataList = data;
            }