From 840a7447b720e95fcc979b8d0a10485e84e883eb Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 12 三月 2021 12:53:47 +0800
Subject: [PATCH] #
---
src/main/java/zy/cloud/wms/manager/utils/NodeUtils.java | 15 +++++
src/main/java/zy/cloud/wms/common/service/erp/entity/GetBasisResult.java | 14 ++++
src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java | 97 +++++++++++++++++++++++++++++--
src/main/webapp/views/tag/tag.html | 4 +
4 files changed, 122 insertions(+), 8 deletions(-)
diff --git a/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java b/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java
index 6706377..f883afc 100644
--- a/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java
+++ b/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());
diff --git a/src/main/java/zy/cloud/wms/common/service/erp/entity/GetBasisResult.java b/src/main/java/zy/cloud/wms/common/service/erp/entity/GetBasisResult.java
index 8089d48..efcff89 100644
--- a/src/main/java/zy/cloud/wms/common/service/erp/entity/GetBasisResult.java
+++ b/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;
+
}
diff --git a/src/main/java/zy/cloud/wms/manager/utils/NodeUtils.java b/src/main/java/zy/cloud/wms/manager/utils/NodeUtils.java
index e3ca189..711a9ff 100644
--- a/src/main/java/zy/cloud/wms/manager/utils/NodeUtils.java
+++ b/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);
+ }
+ }
+ }
+
}
diff --git a/src/main/webapp/views/tag/tag.html b/src/main/webapp/views/tag/tag.html
index 3786b17..8b59cf5 100644
--- a/src/main/webapp/views/tag/tag.html
+++ b/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;
}
--
Gitblit v1.9.1