diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java index 72bdce9..3391973 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java @@ -238,7 +238,7 @@ public class PadServiceImpl implements PadService { JSONArray result = WQL .getWO("QHAND_QUERY") - .addParam("flag", "6") + .addParam("flag", "7") .addParam("region", param.getString("region")) .process() .getResultJSONArray(0); @@ -258,7 +258,7 @@ public class PadServiceImpl implements PadService { WQLObject .getWQLObject("acs_device_extra") - .update(update_extra, "extra_name = 'agv_check_status' AND device_code = " + param.getString("device_code") + "'"); + .update(update_extra, "extra_name = 'agv_check_status' AND device_code = '" + param.getString("device_code") + "'"); resultJSON.put("code", "1"); resultJSON.put("desc", "操作成功"); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/hand/wql/QHAND_QUERY.wql b/acs/hd/nladmin-system/src/main/java/org/nl/hand/wql/QHAND_QUERY.wql index 7241822..b2480e4 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/hand/wql/QHAND_QUERY.wql +++ b/acs/hd/nladmin-system/src/main/java/org/nl/hand/wql/QHAND_QUERY.wql @@ -176,7 +176,7 @@ ENDQUERY ENDIF - IF 输入.flag = "5" + IF 输入.flag = "6" QUERY SELECT `value` AS 'region_id', @@ -190,7 +190,7 @@ ENDQUERY ENDIF - IF 输入.flag = "6" + IF 输入.flag = "7" QUERY SELECT device.device_id, diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/callmaterial/rest/CallMaterialController.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/callmaterial/rest/CallMaterialController.java index 2fed835..0216580 100644 --- a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/callmaterial/rest/CallMaterialController.java +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/callmaterial/rest/CallMaterialController.java @@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; + @RestController @RequiredArgsConstructor @Api(tags = "手持叫料") diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/login/rest/HandLoginController.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/login/rest/HandLoginController.java index 02e61c3..0a5eba2 100644 --- a/lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/login/rest/HandLoginController.java +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/login/rest/HandLoginController.java @@ -10,6 +10,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.annotation.Log; +import org.nl.annotation.rest.AnonymousPostMapping; import org.nl.config.RsaProperties; import org.nl.exception.BadRequestException; import org.nl.modules.security.config.bean.SecurityProperties; @@ -55,7 +56,7 @@ public class HandLoginController { private final TokenProvider tokenProvider; private final OnlineUserService onlineUserService; - @PostMapping("/handlogin") + @AnonymousPostMapping("/handlogin") @Log("手持登陆验证") @ApiOperation("手持登陆验证") public ResponseEntity handlogin(@RequestBody Map whereJson, HttpServletRequest request) { diff --git a/lms/hd/nladmin-system/src/main/resources/config/application-dev.yml b/lms/hd/nladmin-system/src/main/resources/config/application-dev.yml index 9015716..b8c3fa4 100644 --- a/lms/hd/nladmin-system/src/main/resources/config/application-dev.yml +++ b/lms/hd/nladmin-system/src/main/resources/config/application-dev.yml @@ -17,11 +17,12 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - #url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false - url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:yongyu_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false + url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:jianan_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false +# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:yongyu_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false username: ${DB_USER:root} #password: ${DB_PWD:P@ssw0rd} - password: ${DB_PWD:Root.123456} +# password: ${DB_PWD:Root.123456} + password: ${DB_PWD:123456} # 初始连接数 initial-size: 5 # 最小连接数 @@ -68,7 +69,7 @@ spring: redis: #数据库索引 database: ${REDIS_DB:1} - host: ${REDIS_HOST:47.111.78.178} + host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} #连接超时时间 @@ -165,5 +166,5 @@ jetcache: maxIdle: 200 maxTotal: 1000 uri: - - redis://47.111.78.178:6379 + - redis://127.0.0.1:6379 diff --git a/lms/hd/nladmin-system/src/test/java/org/nl/Test3.java b/lms/hd/nladmin-system/src/test/java/org/nl/Test3.java deleted file mode 100644 index 1b35e89..0000000 --- a/lms/hd/nladmin-system/src/test/java/org/nl/Test3.java +++ /dev/null @@ -1,1342 +0,0 @@ -package org.nl; - -import cn.hutool.core.date.DateTime; -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.NumberUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import org.junit.Test; -import org.nl.exception.BadRequestException; -import org.nl.modules.system.util.CodeUtil; -import org.nl.utils.SecurityUtils; -import org.nl.wql.WQL; -import org.nl.wql.core.bean.WQLObject; - -import java.math.BigDecimal; -import java.util.Calendar; -import java.util.Date; -import java.util.LinkedList; -import java.util.Queue; - -public class Test3 extends BaseTest { - @Test - public void test() { - Calendar calendar = Calendar.getInstance(); - JSONArray array = WQLObject.getWQLObject("acs_route_line").query("device_code='A11'").getResultJSONArray(0); - WQLObject tab = WQLObject.getWQLObject("acs_route_line"); - for (int i = 1; i < 5; i++) { - JSONObject json = array.getJSONObject(0); - - json.put("next_device_code", "B2" + i); - - json.put("line_uuid", IdUtil.simpleUUID()); - json.put("device_code", "D22"); - tab.insert(json); - json.put("line_uuid", IdUtil.simpleUUID()); - json.put("device_code", "E22"); - tab.insert(json); - json.put("line_uuid", IdUtil.simpleUUID()); - json.put("device_code", "F22"); - tab.insert(json); - json.put("line_uuid", IdUtil.simpleUUID()); - json.put("device_code", "G22"); - tab.insert(json); - json.put("line_uuid", IdUtil.simpleUUID()); - json.put("device_code", "H22"); - tab.insert(json); - } - - } - - @Test - public void test3() { - String stor_id = "1518109007364100096"; - String is_used = "1"; - String is_delete = "0"; - String create_id = "1"; - String create_time = "2022-04-24 14:12:26"; - int flag = 0; - String sect_id = "1518109805401739264";//满托货架库区 - for (int k = 1; k < 8; k++) { - for (int i = 1; i < 3; i++) { - if (k == 1) { - flag = 10 + 1; - sect_id = "1518109502010953728"; - } - if (k == 2) { - flag = 10 + 1; - sect_id = "1518109502010953728"; - } - if (k == 3) { - flag = 6 + 1; - sect_id = "1518109805401739264"; - } - if (k == 4) { - flag = 6 + 1; - sect_id = "1518109805401739264"; - } - if (k == 5) { - flag = 20 + 1; - sect_id = "1518109805401739264"; - } - if (k == 6) { - flag = 26 + 1; - sect_id = "1518121250239680512"; - } - if (k == 7) { - flag = 11 + 1; - sect_id = "1518121250239684212"; - } - if (k == 7 && i == 2) { - continue; - } - for (int j = 1; j < flag; j++) { - String struct_id = IdUtil.getSnowflake(1, 1).nextId() + ""; - String row_seq = String.valueOf(k);//排 - String col = String.valueOf(j);//列 - String layer = String.valueOf(i);//层 - String struct_code = "L" + row_seq + "-" + col + "-" + layer; - String struct_name = row_seq + "排" + col + "列" + layer + "层"; - String simple_name = struct_name; - JSONObject jo = new JSONObject(); - jo.put("struct_id", struct_id); - jo.put("struct_code", struct_code); - jo.put("struct_name", struct_name); - jo.put("simple_name", simple_name); - jo.put("sect_id", sect_id); - jo.put("stor_id", stor_id); - jo.put("row_seq", row_seq); - jo.put("col", col); - jo.put("layer", layer); - jo.put("is_used", is_used); - jo.put("is_delete", is_delete); - jo.put("create_id", create_id); - jo.put("create_name", "管理员"); - jo.put("create_time", create_time); - WQLObject.getWQLObject("st_ivt_structattr").insert(jo); - - - } - - } - } - - - } - - @Test - public void syncStruct() { - JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("is_delete='0'").getResultJSONArray(0); - WQLObject wo = WQLObject.getWQLObject("st_rule_iodisstruct"); - String now = DateUtil.now(); - for (int i = 0; i < structArray.size(); i++) { - JSONObject structObject = structArray.getJSONObject(i); - JSONObject iodObject = new JSONObject(); - iodObject.put("disrule_uuid", String.valueOf(IdUtil.getSnowflake(1, 1).nextId())); - iodObject.put("disrule_type", "00"); - iodObject.put("struct_uuid", structObject.getString("struct_id")); - iodObject.put("struct_code", structObject.getString("struct_code")); - iodObject.put("struct_name", structObject.getString("struct_name")); - iodObject.put("sect_uuid", structObject.getString("sect_id")); - iodObject.put("store_uuid", structObject.getString("stor_id")); - iodObject.put("row_num", structObject.getString("row_seq")); - iodObject.put("col_num", structObject.getString("col")); - iodObject.put("layer_num", structObject.getString("layer")); - iodObject.put("height", 10); - iodObject.put("out_seq_no", i); - iodObject.put("in_seq_no", i); - iodObject.put("load_series", 1); - iodObject.put("create_id", 1); - iodObject.put("create_name", "管理员"); - iodObject.put("create_time", now); - iodObject.put("update_optid", 1); - iodObject.put("update_optname", "管理员"); - iodObject.put("update_time", now); - wo.insert(iodObject); - } - } - - @Test - public void syncStruct1() { - JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("is_delete='0'").getResultJSONArray(0); - WQLObject wo = WQLObject.getWQLObject("ST_IVT_StructRelaMaterial"); - String now = DateUtil.now(); - for (int i = 0; i < structArray.size(); i++) { - String material_id = ""; - for (int j = 0; j < 4; j++) { - if (j == 0) { - material_id = "1515940603542769664"; - } - if (j == 1) { - material_id = "1515940976307343360"; - } - if (j == 2) { - material_id = "1515947921256878080"; - } - if (j == 3) { - material_id = "1516309702840029184"; - } - JSONObject jsonObject = structArray.getJSONObject(i); - JSONObject map = new JSONObject(); - map.put("relation_id", String.valueOf(IdUtil.getSnowflake(1, 1).nextId())); - map.put("struct_id", jsonObject.getString("struct_id")); - map.put("material_id", material_id); - map.put("create_id", 1); - map.put("create_name", "管理员"); - map.put("create_time", now); - map.put("update_optid", 1); - map.put("update_optname", "管理员"); - map.put("update_time", now); - wo.insert(map); - } - - } - } - - @Test - public void syncStruct2() { - JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("is_delete='0'").getResultJSONArray(0); - WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelavehicletype"); - String now = DateUtil.now(); - for (int i = 0; i < structArray.size(); i++) { - for (int j = 1; j <= 3; j++) { - JSONObject jsonObject = structArray.getJSONObject(i); - JSONObject map = new JSONObject(); - map.put("relation_id", String.valueOf(IdUtil.getSnowflake(1, 1).nextId())); - map.put("struct_id", jsonObject.getString("struct_id")); - map.put("vehicle_type", "0" + j); - map.put("create_id", 1); - map.put("create_name", "管理员"); - map.put("create_time", now); - map.put("update_optid", 1); - map.put("update_optname", "管理员"); - map.put("update_time", now); - wo.insert(map); - } - } - } - - //同步物料 - @Test - public void compare() { - System.out.println("开始测试!"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "1").process().getResultJSONArray(0); - WQLObject md_me_materialBase = WQLObject.getWQLObject("MD_ME_MaterialBase"); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = ja.getJSONObject(i); - String material_id = IdUtil.getSnowflake(1, 1).nextId() + ""; - String material_name = jo.getString("material_name"); - String material_code = jo.getString("material_code"); - String material_spec = jo.getString("material_spec"); - String material_mode = jo.getString("material_spec"); - String base_unit_uuid = jo.getString("base_unit_uuid"); - String base_unit_id = this.unit_tran(base_unit_uuid); - String assist_unit_uuid = jo.getString("asst_unit_uuid"); - String assist_unit_id = this.unit_tran(assist_unit_uuid); - - //先给code 后续分类出来填充id - String material_type_code = "09" + jo.getString("path_code"); - String material_type_id = this.getClassidBycode(material_type_code); - - - String len_unit_id = this.unit_tran(jo.getString("len_unit_uuid")); - String lenght = jo.getString("lenght"); - String width = jo.getString("width"); - String height = jo.getString("height"); - String gross_weight = jo.getString("gross_weight"); - String net_weight = jo.getString("net_weight"); - String cubage_unit_uuid = this.unit_tran(jo.getString("cubage_unit_uuid")); - String cubage = jo.getString("cubage"); - //系列取 物料属性 - String product_series = jo.getString("material_prop_scode"); - JSONObject jsonObj = new JSONObject(); - jsonObj.put("material_id", material_id); - jsonObj.put("material_name", material_name); - jsonObj.put("material_code", material_code); - jsonObj.put("material_spec", material_spec); - jsonObj.put("material_mode", material_mode); - jsonObj.put("base_unit_id", base_unit_id); - jsonObj.put("assist_unit_id", assist_unit_id); - jsonObj.put("material_type_id", material_type_id); - jsonObj.put("len_unit_id", len_unit_id); - jsonObj.put("lenght", lenght); - jsonObj.put("width", width); - jsonObj.put("height", height); - jsonObj.put("gross_weight", gross_weight); - jsonObj.put("net_weight", net_weight); - jsonObj.put("cubage_unit_id", cubage_unit_uuid); - jsonObj.put("cubage", cubage); - jsonObj.put("product_series", product_series); - jsonObj.put("create_id", "1"); - jsonObj.put("create_name", "覃炫"); - jsonObj.put("create_time", "2022-05-21 17:04:54"); - jsonObj.put("is_used", "1"); - try { - md_me_materialBase.insert(jsonObj); - } catch (Exception e) { - } - - } - System.out.println("测试完成!"); - } - - //同步物料分类 - @Test - public void compare111() { - System.out.println("开始测试!"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "2").process().getResultJSONArray(0); - WQLObject md_pb_classstandard = WQLObject.getWQLObject("md_pb_classstandard"); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = ja.getJSONObject(i); - String class_code = jo.getString("path_code"); - String new_class_code = "09" + class_code; - //分类编码的长度 - int length = class_code.length(); - String is_leaf = "1"; - String class_level = "2"; - if (length == 3) { - is_leaf = "0"; - class_level = "2"; - } - if (length == 6) { - is_leaf = "1"; - class_level = "3"; - } - JSONObject joObj = new JSONObject(); - String class_id = IdUtil.getSnowflake(1, 1).nextIdStr(); - joObj.put("class_id", class_id); - joObj.put("base_data_type", "03"); - joObj.put("class_code", new_class_code); - joObj.put("long_class_code", new_class_code); - joObj.put("class_name", jo.getString("class_name")); - joObj.put("parent_class_id", "1"); - joObj.put("sub_count", "1"); - joObj.put("is_leaf", is_leaf); - joObj.put("class_level", class_level); - joObj.put("is_modify", "1"); - joObj.put("ext_id", "1002A110000000227XUV"); - joObj.put("ext_parent_id", "1002A11000000020IXPE"); - joObj.put("is_modify", "1"); - joObj.put("create_id", "1"); - joObj.put("create_name", "管理员"); - joObj.put("create_time", DateUtil.now()); - md_pb_classstandard.insert(joObj); - } - System.out.println("测试完成!"); - } - - public String unit_tran(String base_unit_uuid) { - String after_unit = ""; - //箱 - if (StrUtil.equals(base_unit_uuid, "06D7486174B24534843CFD3A1D0C66D9")) { - after_unit = "32"; - } - //盒 - if (StrUtil.equals(base_unit_uuid, "2FE6EC94FF82441FADD6E78BA833CABC")) { - after_unit = "33"; - }//厘米 - if (StrUtil.equals(base_unit_uuid, "63B51AB6C06B4DD69D9F3C4F08850654")) { - after_unit = "8"; - }//毫米 - if (StrUtil.equals(base_unit_uuid, "8654BE2464224B7FB370C563456B248E")) { - after_unit = "10"; - }//千克 - if (StrUtil.equals(base_unit_uuid, "9F8D4F6046494CC0AC1EB17B09570A2C")) { - after_unit = "1"; - }//袋 - if (StrUtil.equals(base_unit_uuid, "A7930A26B9554A3EAC4359783BE99B52")) { - after_unit = "30"; - }//米 - if (StrUtil.equals(base_unit_uuid, "B1979AB73AE147C2A02D71B8C3D58A92")) { - after_unit = "6"; - }//pc - if (StrUtil.equals(base_unit_uuid, "B79AFB26497840C2BEAD73035B337C20")) { - after_unit = "16"; - }//吨 - if (StrUtil.equals(base_unit_uuid, "C1CD78534D1442E5BC111A016BF794AA")) { - after_unit = "3"; - }//克 - if (StrUtil.equals(base_unit_uuid, "D57151153A7B432E9B65DF0DD66C3363")) { - after_unit = "2"; - }//ROL - if (StrUtil.equals(base_unit_uuid, "229E23C9A1DB422580752F70C88C757C")) { - after_unit = "32"; - }//秒 - if (StrUtil.equals(base_unit_uuid, "5AAD75F52A764BCD8847B795882495A9")) { - after_unit = "46"; - }//分钟 - if (StrUtil.equals(base_unit_uuid, "245942641FE34FC6AAE130622A8BA176")) { - after_unit = "47"; - }//小时 - if (StrUtil.equals(base_unit_uuid, "0214383EF372472FB06370392FAFB3D6")) { - after_unit = "48"; - }//台 - if (StrUtil.equals(base_unit_uuid, "806FD4B4220247E6B261545C2B394BBB")) { - after_unit = "25"; - }//KG - if (StrUtil.equals(base_unit_uuid, "A61707EB1E6E4F6CB9EBB1EAD2193AB3")) { - after_unit = "1"; - }//盘 - if (StrUtil.equals(base_unit_uuid, "3B3D9DB128DB4AED9D884FDACB49E839")) { - after_unit = "38"; - }//捆 - if (StrUtil.equals(base_unit_uuid, "32E813B17B4F4DBFB1C3DC75668B600F")) { - after_unit = "40"; - } - return after_unit; - } - - public String getClassidBycode(String class_code) { - String class_id = ""; - JSONObject classObj = WQLObject.getWQLObject("md_pb_classstandard").query("class_code ='" + class_code + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(classObj)) { - class_id = classObj.getString("class_id"); - } - return class_id; - } - - //同步仓库 - @Test - public void stor() { - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "3").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject joObj = ja.getJSONObject(i); - joObj.put("stor_id", IdUtil.getSnowflake(1, 1).nextId()); - joObj.put("create_id", "1"); - joObj.put("create_name", "管理员"); - joObj.put("create_time", DateUtil.now()); - joObj.put("sysdeptid", "1"); - joObj.put("syscompanyid", "1"); - WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").insert(joObj); - } - } - - //同步仓库 - @Test - public void sect() { - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "4").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject joObj = ja.getJSONObject(i); - String stor_uuid = joObj.getString("stor_uuid"); - String storid = ""; - if (StrUtil.equals(stor_uuid, "16517DE29C0B4D7BBD2E289B1FBD2507")) { - storid = "1528627964823080960"; - } - if (StrUtil.equals(stor_uuid, "CDA7D44ABC3F45D3ADCF829256DB638E")) { - storid = "1528627995269533696"; - } - joObj.put("sect_id", IdUtil.getSnowflake(1, 1).nextId()); - joObj.put("stor_id", storid); - joObj.put("create_id", "1"); - joObj.put("create_name", "管理员"); - joObj.put("create_time", DateUtil.now()); - joObj.put("sysdeptid", "1"); - joObj.put("syscompanyid", "1"); - WQLObject.getWQLObject("ST_IVT_SectAttr").insert(joObj); - } - - } - - //同步仓位 - @Test - public void struct() { - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "5").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject joObj = ja.getJSONObject(i); - String stor_uuid = joObj.getString("stor_uuid"); - String sect_uuid = joObj.getString("sect_uuid"); - joObj.put("struct_id", IdUtil.getSnowflake(1, 1).nextId()); - String sect_code = joObj.getString("sect_code"); - String storid = ""; - if (StrUtil.equals(stor_uuid, "16517DE29C0B4D7BBD2E289B1FBD2507")) { - storid = "1528627964823080960"; - } - if (StrUtil.equals(stor_uuid, "CDA7D44ABC3F45D3ADCF829256DB638E")) { - storid = "1528627995269533696"; - } - JSONObject sectObj = WQLObject.getWQLObject("ST_IVT_SectAttr").query("sect_code='" + sect_code + "'").uniqueResult(0); - JSONObject storObj = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("stor_id='" + storid + "'").uniqueResult(0); - //数据库中的 半成品料箱区 的库区code 跟库区表的code 对应不上 - String sect_id = "9999999"; - if (ObjectUtil.isNotEmpty(sectObj)) { - sect_id = sectObj.getString("sect_id"); - } - joObj.put("stor_id", storid); - joObj.put("sect_id", sect_id); - joObj.put("create_id", "1"); - joObj.put("create_name", "管理员"); - joObj.put("create_time", DateUtil.now()); - joObj.put("sysdeptid", "1"); - joObj.put("syscompanyid", "1"); - joObj.put("material_height_type", "1"); - WQLObject.getWQLObject("st_ivt_structattr").insert(joObj); - } - - } - - //同步载具 - @Test - public void vehicle() { - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "6").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject joObj = ja.getJSONObject(i); - String storagevehicle_id = IdUtil.getSnowflake(1, 1).nextIdStr(); - joObj.put("create_id", "1"); - joObj.put("storagevehicle_id", storagevehicle_id); - joObj.put("create_name", "管理员"); - joObj.put("create_time", DateUtil.now()); - WQLObject.getWQLObject("MD_PB_StorageVehicleInfo").insert(joObj); - } - } - - //同步系统参数 - @Test - public void sysparam() { - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "7").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject joObj = ja.getJSONObject(i); - String id = IdUtil.getSnowflake(1, 1).nextIdStr(); - String pcode = joObj.getString("pcode"); - String pname = joObj.getString("pname"); - String pvalue = joObj.getString("pvalue"); - JSONObject jo = new JSONObject(); - jo.put("id", id); - jo.put("code", pcode); - jo.put("name", pname); - jo.put("value", pvalue); - jo.put("is_active", "1"); - jo.put("is_delete", "0"); - jo.put("create_by", "覃炫"); - jo.put("create_time", DateUtil.now()); - WQLObject.getWQLObject("sys_param").insert(jo); - } - - } - - //给缓存线插入值 - @Test - public void IF_cacheLine_Position() { - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "8").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject joObj = ja.getJSONObject(i); - joObj.put("position_uuid", IdUtil.getSnowflake(1, 1).nextId() + ""); - joObj.put("device_uuid", IdUtil.getSnowflake(1, 1).nextId() + ""); - WQLObject.getWQLObject("ST_cacheLine_Position").insert(joObj); - } - - } - - //给缓存线统一uuid - @Test - public void IF_cacheLine_PositionDevice_uuid() { - WQLObject caTable = WQLObject.getWQLObject("ST_cacheLine_Position"); - JSONArray ja = caTable.query("1=1").getResultJSONArray(0); - long device_uuid1 = IdUtil.getSnowflake(1, 1).nextId(); - long device_uuid2 = IdUtil.getSnowflake(1, 1).nextId(); - long device_uuid3 = IdUtil.getSnowflake(1, 1).nextId(); - - for (int i = 0; i < ja.size(); i++) { - JSONObject joObj = ja.getJSONObject(i); - String extdevice_code = joObj.getString("extdevice_code"); - if (StrUtil.equals("HCX01", extdevice_code)) { - joObj.put("device_uuid", device_uuid1); - } - if (StrUtil.equals("HCX02", extdevice_code)) { - joObj.put("device_uuid", device_uuid2); - } - if (StrUtil.equals("HCX03", extdevice_code)) { - joObj.put("device_uuid", device_uuid3); - } - caTable.update(joObj); - } - - } - - //初始化 半成品原材料对应表 - @Test - public void MD_ME_SemiRealRawMaterial() { - //半成品对应原材料关系表【MD_ME_SemiRealRawMaterial】 - WQLObject caTable = WQLObject.getWQLObject("MD_ME_SemiRealRawMaterial"); - String create_id = "1"; - String create_name = "覃炫"; - String create_time = DateUtil.now(); - JSONArray ja = WQL.getWO("QLK01").addParam("flag", "10").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = new JSONObject(); - String semi_material_id = ja.getJSONObject(i).getString("material_id"); - long relation_id = IdUtil.getSnowflake(1, 1).nextId(); - jo.put("relation_id", relation_id); - jo.put("semi_material_id", semi_material_id); - jo.put("create_id", create_id); - jo.put("create_name", create_name); - jo.put("create_time", create_time); - caTable.insert(jo); - } - - - } - - @Test - public void MD_ME_EndRealSemiMaterial() { - // 成品对应半成品关系表【MD_ME_EndRealSemiMaterial】 - WQLObject caTable = WQLObject.getWQLObject("MD_ME_EndRealSemiMaterial"); - String create_id = "1"; - String create_name = "覃炫"; - String create_time = DateUtil.now(); - JSONArray ja = WQL.getWO("QLK01").addParam("flag", "11").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = new JSONObject(); - String end_material_id = ja.getJSONObject(i).getString("material_id"); - long relation_id = IdUtil.getSnowflake(1, 1).nextId(); - jo.put("relation_id", relation_id); - jo.put("end_material_id", end_material_id); - jo.put("create_id", create_id); - jo.put("create_name", create_name); - jo.put("create_time", create_time); - caTable.insert(jo); - } - - - } - - //将半成品的物料加到MD_ME_EndRealSemiMaterial - @Test - public void MD_ME_EndRealSemiMaterial11() { - - // 成品对应半成品关系表【MD_ME_EndRealSemiMaterial】 - WQLObject caTable = WQLObject.getWQLObject("MD_ME_EndRealSemiMaterial"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "12").process().getResultJSONArray(0); - JSONObject endrealJo = new JSONObject(); - JSONObject endjo = new JSONObject(); - JSONObject semijo = new JSONObject(); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = ja.getJSONObject(i); - String material_code = jo.getString("material_code"); - String semimanufactures_code = jo.getString("semimanufactures_code"); - endjo = this.findMaterialByid(material_code); - semijo = this.findMaterialByid(semimanufactures_code); - if (ObjectUtil.isNotEmpty(endjo)) { - endrealJo.put("semi_material_id", semijo.getString("material_id")); - caTable.update(endrealJo, "end_material_id='" + endjo.getString("material_id") + "'"); - } - } - } - - //将原料的物料加到MD_ME_SemiRealRawMaterial - @Test - public void MD_ME_SemiRealRawMaterial11() { - //半成品对应原材料关系表【MD_ME_SemiRealRawMaterial】 - WQLObject caTable = WQLObject.getWQLObject("MD_ME_SemiRealRawMaterial"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "13").process().getResultJSONArray(0); - JSONObject SemirealJo = new JSONObject(); - JSONObject rowjo = new JSONObject(); - JSONObject semijo = new JSONObject(); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = ja.getJSONObject(i); - String rawmaterial_code = jo.getString("rawmaterial_code"); - String semimanufactures_code = jo.getString("semimanufactures_code"); - rowjo = this.findMaterialByid(rawmaterial_code); - semijo = this.findMaterialByid(semimanufactures_code); - if (ObjectUtil.isNotEmpty(rowjo)) { - SemirealJo.put("raw_material_id", rowjo.getString("material_id")); - caTable.update(SemirealJo, "semi_material_id='" + semijo.getString("material_id") + "'"); - } - } - } - - - public JSONObject findMaterialByid(String material_code) { - return WQLObject.getWQLObject("md_me_materialbase").query("material_code ='" + material_code + "'").uniqueResult(0); - } - - public JSONObject finduntiByid(String code) { - return WQLObject.getWQLObject("md_pb_measureunit").query("unit_name ='" + code + "'").uniqueResult(0); - } - - //设置物料系列 - @Test - public void set() { - WQLObject materiTable = WQLObject.getWQLObject("md_me_materialbase"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "14").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = ja.getJSONObject(i); - String sysdic_code = jo.getString("sysdic_code"); - String product_series = ""; - /* 070101 L15三通, 1501 1531471791086768128 - 07010101 5/8三通 1001 1531472482471645184 - 070102 L22三通 2201 1531471941439983616 - 07010201 7/8三通 1101 1531473034806956032 - 070103 L28三通 2801 1531472059186679808*/ - if (StrUtil.equals(sysdic_code, "1501")) { - product_series = "1531471791086768128"; - } - if (StrUtil.equals(sysdic_code, "1001")) { - product_series = "1531472482471645184"; - } - if (StrUtil.equals(sysdic_code, "2201")) { - product_series = "1531471941439983616"; - } - if (StrUtil.equals(sysdic_code, "1101")) { - product_series = "1531474370004914176"; - } - if (StrUtil.equals(sysdic_code, "2801")) { - product_series = "1531472059186679808"; - } - /*070201 15弯头 1502 1531473623896952832 - 07020101 5/8弯头 1002 1531474252040114176 - 070202 22弯头 2202 1531473752985047040 - 07020201 7/8弯头 1102 1531474370004914176 - 070203 28弯头 2802 1531474053183967232*/ - - - if (StrUtil.equals(sysdic_code, "1502")) { - product_series = "1531473623896952832"; - } - if (StrUtil.equals(sysdic_code, "1002")) { - product_series = "1531474252040114176"; - } - if (StrUtil.equals(sysdic_code, "2202")) { - product_series = "1531473752985047040"; - } - if (StrUtil.equals(sysdic_code, "1102")) { - product_series = "1531474370004914176"; - } - if (StrUtil.equals(sysdic_code, "2802")) { - product_series = "1531474053183967232"; - } - - /* 070301 15直接 1503 1531474539429629952 - 070302 22直接 2203 1531474641170862080 - 070303 28直接 2803 1531474734242467840*/ - if (StrUtil.equals(sysdic_code, "1503")) { - product_series = "1531474539429629952"; - } - if (StrUtil.equals(sysdic_code, "2203")) { - product_series = "1531474641170862080"; - } - if (StrUtil.equals(sysdic_code, "2803")) { - product_series = "1531474734242467840"; - } - /* 070401 22大小头 2204 1531474889091977216 - 070402 28大小头 2804 1531474992171192320 - 070403 35大小头 3504 1531475110849024000 - 070404 42大小头 4204 1531475240335577088 - 070405 54大小头 5404 1531475373823496192*/ - - if (StrUtil.equals(sysdic_code, "2204")) { - product_series = "1531474889091977216"; - } - if (StrUtil.equals(sysdic_code, "2804")) { - product_series = "1531474992171192320"; - } - if (StrUtil.equals(sysdic_code, "3504")) { - product_series = "1531475110849024000"; - } - if (StrUtil.equals(sysdic_code, "4204")) { - product_series = "1531475240335577088"; - } - if (StrUtil.equals(sysdic_code, "5404")) { - product_series = "1531475373823496192"; - } - String endmaterial_code = jo.getString("material_code"); - String rawmaterial_code = jo.getString("rawmaterial_code"); - String semimanufactures_code = jo.getString("semimanufactures_code"); - JSONObject endJo = this.findMaterialByid(endmaterial_code); - JSONObject rawjo = this.findMaterialByid(rawmaterial_code); - JSONObject semijo = this.findMaterialByid(semimanufactures_code); - endJo.put("product_series", product_series); - rawjo.put("product_series", product_series); - semijo.put("product_series", product_series); - materiTable.update(endJo); - materiTable.update(rawjo); - materiTable.update(semijo); - } - } - - //发货单 - @Test - public void SAP_OD_Delivery() { - //// 销售TDEL接口交货单【SAP_OD_Delivery】 - WQLObject caTable = WQLObject.getWQLObject("SAP_OD_Delivery"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "15").process().getResultJSONArray(0); - JSONObject pcsjo = new JSONObject(); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = ja.getJSONObject(i); - long sale_id = IdUtil.getSnowflake(1, 1).nextId(); - String sale_code = jo.getString("Vbeln"); - String seq_no = jo.getString("Posnr"); - String sale_type = jo.getString("VtextLf"); - //物料编码 - JSONObject matrOBj = findMaterialByid(jo.getString("Matnr")); - String material_id = matrOBj.getString("material_id"); - String status = "10"; - String sale_qty = jo.getString("Lfimg"); - String produce_seq = "1"; - String cust_code = jo.getString("Kunag"); - String cust_name = jo.getString("Name"); - //计量单位 - String Vrkme = jo.getString("Vrkme"); - JSONObject unitObj = finduntiByid(Vrkme); - String qty_unit_id = unitObj.getString("measure_unit_id"); - String plandeliver_date = jo.getString("WadatIst"); - String create_id = "1"; - String create_name = "qinx"; - String create_time = "2021-12-9 14:15"; - pcsjo.put("sale_id", sale_id); - pcsjo.put("sale_code", sale_code); - pcsjo.put("seq_no", seq_no); - pcsjo.put("sale_type", sale_type); - pcsjo.put("material_id", material_id); - pcsjo.put("status", status); - pcsjo.put("sale_qty", sale_qty); - pcsjo.put("produce_seq", produce_seq); - pcsjo.put("status", status); - pcsjo.put("cust_code", cust_code); - pcsjo.put("cust_name", cust_name); - pcsjo.put("qty_unit_id", qty_unit_id); - pcsjo.put("plandeliver_date", plandeliver_date); - pcsjo.put("create_id", create_id); - pcsjo.put("create_name", create_name); - pcsjo.put("create_time", create_time); - caTable.insert(pcsjo); - } - } - - //同步SAP销售订单表【PCS_sale_order】 - @Test - public void PCS_sale_order() { - //SAP销售订单表【PCS_sale_order】 - WQLObject caTable = WQLObject.getWQLObject("PCS_sale_order"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "16").process().getResultJSONArray(0); - JSONObject pcsjo = new JSONObject(); - for (int i = 0; i < 10; i++) { - JSONObject jo = ja.getJSONObject(i); - long sale_id = IdUtil.getSnowflake(1, 1).nextId(); - String sale_code = jo.getString("vbeln"); - String seq_no = jo.getString("posnr"); - String sale_type = jo.getString("bezeiau"); - //物料编码 - JSONObject matrOBj = findMaterialByid(jo.getString("matnr")); - String material_id = matrOBj.getString("material_id"); - String status = "10"; - String sale_qty = jo.getString("kwmeng"); - String produce_seq = "1"; - String cust_code = jo.getString("kunnr"); - String cust_name = jo.getString("name"); - //计量单位 - String qty_unit_id = "16"; - String Vrkme = jo.getString("vrkme"); - if (StrUtil.equals("KG", Vrkme)) { - qty_unit_id = "1"; - } - String plandeliver_date = jo.getString("edatu"); - String create_id = "1"; - String create_name = "qinx"; - String create_time = "2021-12-9 14:15"; - pcsjo.put("sale_id", sale_id); - pcsjo.put("sale_code", sale_code); - pcsjo.put("seq_no", seq_no); - pcsjo.put("sale_type", sale_type); - pcsjo.put("material_id", material_id); - pcsjo.put("status", status); - pcsjo.put("sale_qty", sale_qty); - pcsjo.put("produce_seq", produce_seq); - pcsjo.put("cust_code", cust_code); - pcsjo.put("cust_name", cust_name); - pcsjo.put("qty_unit_id", qty_unit_id); - pcsjo.put("plandeliver_date", plandeliver_date); - pcsjo.put("create_id", create_id); - pcsjo.put("create_name", create_name); - pcsjo.put("create_time", create_time); - caTable.insert(pcsjo); - } - System.out.println("测试完成"); - } - - // 初始化成品分配规则表 - @Test - public void ST_IVT_StructAttributeRules() { - WQLObject st_ivt_structAttributeRules = WQLObject.getWQLObject("ST_IVT_StructAttributeRules"); - WQLObject struct_arr = WQLObject.getWQLObject("st_ivt_structattr"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "17").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject ruleObj = ja.getJSONObject(i); - String structatt_id = IdUtil.getSnowflake(1, 1).nextIdStr(); - String struct_code = ruleObj.getString("struct_code"); - String struct_name = ruleObj.getString("struct_name"); - String row_code = ruleObj.getString("row_code"); - String column_code = ruleObj.getString("column_code"); - String layer_code = ruleObj.getString("layer_code"); - int in_seq_no = i * 10; - int out_seq_no = i * 10; - String load_series = "1"; - String sect_id = "1528631043496742912"; - String stor_id = "1528627995269533696"; - String struct_id = this.findStructIdByCode(struct_code); - String set_date = "2020-08-06"; - JSONObject jo = new JSONObject(); - jo.put("structatt_id", structatt_id); - jo.put("struct_code", struct_code); - jo.put("struct_name", struct_name); - jo.put("row_code", row_code); - jo.put("column_code", column_code); - jo.put("layer_code", layer_code); - jo.put("in_seq_no", in_seq_no); - jo.put("out_seq_no", out_seq_no); - jo.put("load_series", load_series); - jo.put("sect_id", sect_id); - jo.put("stor_id", stor_id); - jo.put("set_date", set_date); - jo.put("set_id", "1"); - jo.put("struct_id", struct_id); - st_ivt_structAttributeRules.insert(jo); - } - - } - - public String findStructIdByCode(String code) { - WQLObject struct_arr = WQLObject.getWQLObject("st_ivt_structattr"); - JSONObject jsonObject = struct_arr.query("struct_code ='" + code + "' and sect_code='KQ001'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonObject)) { - throw new BadRequestException("未找到编码未'" + code + "'的仓位!"); - } - return jsonObject.getString("struct_id"); - } - - - @Test - //初始化 仓位托盘表 - public void initStructVehicle() { - WQLObject ruleTable = WQLObject.getWQLObject("ST_IVT_StructRelaVehicleType"); - WQLObject struct_arr = WQLObject.getWQLObject("st_ivt_structattr"); - JSONArray ja = struct_arr.query("sect_code='KQ001'").getResultJSONArray(0); - String create_id = "1"; - String create_name = "qinx"; - String create_time = DateUtil.now(); - String is_delete = "0"; - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = ja.getJSONObject(i); - String struct_id = jo.getString("struct_id"); - for (int j = 0; j < 5; j++) { - JSONObject row = new JSONObject(); - String relation_id = IdUtil.getSnowflake(1, 1).nextIdStr(); - String vehicle_type = "0" + j; - row.put("relation_id", relation_id); - row.put("struct_id", struct_id); - row.put("vehicle_type", vehicle_type); - row.put("create_id", create_id); - row.put("create_name", create_name); - row.put("create_time", create_time); - row.put("is_delete", is_delete); - ruleTable.insert(row); - } - - } - - } - - //初始化仓位对应仓位表 - @Test - public void ST_IVT_StructRelaStruct() { - WQLObject relaTable = WQLObject.getWQLObject("ST_IVT_StructRelaStruct"); - WQLObject pointTable = WQLObject.getWQLObject("sch_base_point"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "18").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = ja.getJSONObject(i); - String struct_code = jo.getString("struct_code"); - String bindstruct_code = jo.getString("bindstruct_code"); - JSONObject struObj = pointTable.query("point_code ='" + struct_code + "'").uniqueResult(0); - JSONObject bindstruObj = pointTable.query("point_code ='" + bindstruct_code + "'").uniqueResult(0); - JSONObject relaObj = new JSONObject(); - relaObj.put("struct_id", struObj.getString("point_id")); - relaObj.put("bindstruct_id", bindstruObj.getString("point_id")); - relaObj.put("overstruct_mode", "02"); - relaObj.put("set_date", "2022-6-16"); - relaObj.put("set_id", "1"); - relaTable.insert(relaObj); - } - } - - //初始化仓位code KQ001 成品 KQ004 半成品 - @Test - public void StructCode() { - WQLObject pointTable = WQLObject.getWQLObject("sch_base_point"); - JSONArray resultArr = pointTable.query("(area_type='KQ001' or area_type='KQ004') and point_code not like'%CPRK%'").getResultJSONArray(0); - for (int i = 0; i < resultArr.size(); i++) { - JSONObject jo = resultArr.getJSONObject(i); - String point_code = jo.getString("point_code"); - String a = point_code.substring(0, 2); - String b = point_code.substring(2, 4); - String c = point_code.substring(4, 6); - String new_point_code = "L" + a + "-" + c + "-" + b; - String new_point_code_name = a + "排" + c + "列" + b + "层"; - jo.put("point_code", new_point_code); - jo.put("point_name", new_point_code_name); - pointTable.update(jo); - } - } - - //初始化成品出库位 - @Test - public void StructCKWCode() { - WQLObject pointTable = WQLObject.getWQLObject("sch_base_point"); - JSONArray resultArr = pointTable.query("(area_type='KQ006') and point_code not like'%CPRK%'").getResultJSONArray(0); - for (int i = 0; i < resultArr.size(); i++) { - JSONObject jo = resultArr.getJSONObject(i); - String point_code = jo.getString("point_code"); - String new_point_code = "CPCKW" + point_code; - jo.put("point_code", new_point_code); - pointTable.update(jo); - } - } - - @Test - public void StructCKWCode123() { - WQLObject pointTable = WQLObject.getWQLObject("sch_base_point"); - WQLObject structtable = WQLObject.getWQLObject("st_ivt_structattr"); - JSONArray resultArr = pointTable.query("1=1").getResultJSONArray(0); - for (int i = 0; i < resultArr.size(); i++) { - JSONObject jo = resultArr.getJSONObject(i); - JSONObject joo = new JSONObject(); - joo.put("struct_id", jo.getString("point_id")); - joo.put("struct_code", jo.getString("point_code")); - joo.put("struct_name", jo.getString("point_name")); - joo.put("simple_name", jo.getString("point_name")); - String area_type = jo.getString("area_type"); - String sect_id = ""; - String sect_name = ""; - if (area_type.equals("KQ001")) { - sect_id = "1528631043496742912"; - sect_name = "成品库区"; - } - if (area_type.equals("KQ002")) { - sect_id = "1528631044482404352"; - sect_name = "半成品库区"; - } - if (area_type.equals("KQ003")) { - sect_id = "1528631044243329024"; - sect_name = "半成品上料空框暂存区"; - } - if (area_type.equals("KQ004")) { - sect_id = "1528631042318143488"; - sect_name = "半成品上下料暂存区"; - } - if (area_type.equals("KQ005")) { - sect_id = "1528631044369158144"; - sect_name = "半成品空框应急区"; - } - if (area_type.equals("KQ006")) { - sect_id = "1528631043685486592"; - sect_name = "成品出库暂存区"; - } - if (area_type.equals("KQ007")) { - sect_id = "1528631044054585344"; - sect_name = "半成品料箱区"; - } - - - joo.put("sect_id", sect_id); - joo.put("sect_code", area_type); - joo.put("sect_name", sect_name); - - joo.put("stor_id", "1528627995269533696"); - joo.put("stor_code", "F102"); - joo.put("stor_name", "紫铜成品仓库"); - joo.put("stor_type", "01"); - joo.put("capacity", "100000.00"); - joo.put("width", "1"); - joo.put("height", "2"); - joo.put("zdepth", "1"); - joo.put("is_tempstruct", "1"); - joo.put("create_id", "1"); - joo.put("create_name", "管理员"); - joo.put("create_time", "2022-05-23 15:19:14"); - joo.put("is_delete", "0"); - joo.put("back_ground_color", "01"); - joo.put("front_ground_color", "01"); - joo.put("font_direction_scode", "01"); - joo.put("is_used", "1"); - joo.put("is_emptyvehicle", "0"); - joo.put("storagevehicle_qty", "0"); - joo.put("lock_type", "00"); - joo.put("material_height_type", "1"); - structtable.insert(joo); - } - } - - //同步产品工艺路线 - @Test - public void PDM_BI_ProductProcessRoute() { - WQLObject routeTable = WQLObject.getWQLObject("PDM_BI_ProductProcessRoute"); - WQLObject dtlTable = WQLObject.getWQLObject("PDM_BI_ProductProcessRouteDtl"); - WQLObject materialTable = WQLObject.getWQLObject("md_me_materialbase"); - JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "15").process().getResultJSONArray(0); - for (int i = 0; i < ja.size(); i++) { - JSONObject jo = ja.getJSONObject(i); - String processroute_uuid = jo.getString("processroute_uuid"); - JSONArray dtlja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("processroute_uuid", processroute_uuid).addParam("flag", "16").process().getResultJSONArray(0); - for (int j = 0; j < dtlja.size(); j++) { - JSONObject dtljo = dtlja.getJSONObject(i); - JSONObject routejoo = new JSONObject(); - JSONObject routeDtljoo = new JSONObject(); - long productprocess_id = IdUtil.getSnowflake(1, 1).nextId(); - String material_code = dtljo.getString("material_code"); - JSONObject material_jo = materialTable.query("material_code='" + material_code + "'").uniqueResult(0); - String material_id = material_jo.getString("material_id"); - - } - long sale_id = IdUtil.getSnowflake(1, 1).nextId(); - String sale_code = jo.getString("Vbeln"); - String seq_no = jo.getString("Posnr"); - String sale_type = jo.getString("VtextLf"); - //物料编码 - JSONObject matrOBj = findMaterialByid(jo.getString("Matnr")); - String material_id = matrOBj.getString("material_id"); - String status = "10"; - String sale_qty = jo.getString("Lfimg"); - String produce_seq = "1"; - String cust_code = jo.getString("Kunag"); - String cust_name = jo.getString("Name"); - //计量单位 - String Vrkme = jo.getString("Vrkme"); - JSONObject unitObj = finduntiByid(Vrkme); - String qty_unit_id = unitObj.getString("measure_unit_id"); - String plandeliver_date = jo.getString("WadatIst"); - String create_id = "1"; - String create_name = "qinx"; - String create_time = "2021-12-9 14:15"; - - // caTable.insert(pcsjo); - } - } - - public static void main1231(String[] args) { - String now = "2022-06-30"; - DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(now), 30); - System.out.println(dateTime.toString().substring(0, 10)); - JSONArray dataArr = new JSONArray(); - for (int i = 1; i < 9; i++) { - DateTime dateTime11 = DateUtil.offsetDay(DateUtil.parse(now), -i); - dataArr.add(dateTime11.toString().substring(0, 10)); - } - System.out.println("cesw"); - } - - public static void main123(String[] args) { - JSONObject jo = new JSONObject(); - JSONArray ja1 = new JSONArray(); - System.out.println("12313"); - } - - //初始化x,y坐标 - public static void main2343(JSONObject jo) { - //起点坐标 - BigDecimal start_x = NumberUtil.round(jo.getIntValue("start_x") / 100, 0); - BigDecimal start_y = NumberUtil.round(jo.getIntValue("start_y") / 100, 0); - int start_web_x = jo.getIntValue("start_web_x"); - int start_web_y = jo.getIntValue("start_web_y"); - //终点坐标 - BigDecimal end_x = NumberUtil.round(jo.getIntValue("end_x") / 100, 0); - BigDecimal end_y = NumberUtil.round(jo.getIntValue("end_y") / 100, 0); - int end_web_x = jo.getIntValue("end_web_x"); - int end_web_y = jo.getIntValue("end_web_y"); - //这个路线切割多少个线段,点数比线段多一个 - int n = jo.getIntValue("n"); - //单位x坐标的长度 (web长度 除以 实际长度) - BigDecimal x = new BigDecimal(0); - BigDecimal y = new BigDecimal(0); - //算出每个线段的x实际距离 - BigDecimal real_x= new BigDecimal(0); - //算出每个先段的y实际距离 - BigDecimal real_y = new BigDecimal(0); - if (!end_x.equals(start_x)) { - x = NumberUtil.div((end_web_x - start_web_x), NumberUtil.sub(end_x, start_x)); - real_x = NumberUtil.div((NumberUtil.sub(end_x, start_x)), n); - } - if (!end_y.equals(start_y)) { - y = NumberUtil.div((end_web_y - start_web_y), NumberUtil.sub(end_y, start_y)); - real_y = NumberUtil.div((NumberUtil.sub(end_y, start_y)), n); - } - for (int i = 0; i < n + 1; i++) { - //算出每个点对应的web坐标 - BigDecimal real_web_x = NumberUtil.add(start_web_x, NumberUtil.mul(x, real_x)); - BigDecimal real_web_y = NumberUtil.add(start_web_y, NumberUtil.mul(y, real_y)); - JSONObject Obj = new JSONObject(); - Obj.put("point_uuid",IdUtil.getSnowflake(1,1).nextId()); - Obj.put("point_code",IdUtil.getSnowflake(1,1).nextId()); - Obj.put("point_uuid",IdUtil.getSnowflake(1,1).nextId()); - } - } - - //工单造数据 - @Test - public void shiftorder() { - WQLObject shiftTable = WQLObject.getWQLObject("mps_bd_produceshiftorder"); - String date = "2022-07-01"; - JSONArray dataArr = new JSONArray(); - for (int i = 1; i < 29; i++) { - DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(date), i); - dataArr.add(dateTime.toString().substring(0, 10)); - } - for (int i = 0; i < dataArr.size(); i++) { - String newdate = (String) dataArr.get(i); - JSONArray orderArr = shiftTable.query("produce_date='2022-07-01'").getResultJSONArray(0); - for (int j = 0; j < orderArr.size(); j++) { - JSONObject orderjo = orderArr.getJSONObject(j); - JSONObject neworderjo = new JSONObject(); - neworderjo.put("produceorder_id", IdUtil.getSnowflake(1, 1).nextId()); - neworderjo.put("produceorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER")); - neworderjo.put("producedeviceorder_code", orderjo.getString("producedeviceorder_code")); - neworderjo.put("shift_type_scode", orderjo.getString("shift_type_scode")); - neworderjo.put("workprocedure_id", orderjo.getString("workprocedure_id")); - neworderjo.put("produce_date", newdate); - neworderjo.put("plan_qty", orderjo.getIntValue("plan_qty") + i * 100); - neworderjo.put("real_qty", orderjo.getIntValue("real_qty") + i * 100); - neworderjo.put("report_qty", orderjo.getIntValue("report_qty")); - neworderjo.put("material_id", orderjo.getString("material_id")); - neworderjo.put("material_weight", orderjo.getString("material_weight")); - neworderjo.put("planproducestart_date", newdate + " " + "00:00:00"); - neworderjo.put("planproduceend_date", newdate + " " + "22:00:00"); - neworderjo.put("device_id", orderjo.getString("device_id")); - neworderjo.put("is_canupdate_update", orderjo.getString("is_canupdate_update")); - neworderjo.put("order_status", orderjo.getString("order_status")); - neworderjo.put("is_needmove", orderjo.getString("is_needmove")); - neworderjo.put("sale_id", orderjo.getString("sale_id")); - neworderjo.put("create_id", orderjo.getString("create_id")); - neworderjo.put("create_name", orderjo.getString("create_name")); - neworderjo.put("create_time", orderjo.getString("create_time")); - neworderjo.put("is_delete", orderjo.getString("is_delete")); - shiftTable.insert(neworderjo); - } - } - } - - public static void main(String[] args) { - String date = "2022-07-28"; - date = date.substring(5,date.length()); - System.out.println(date); - } - - @Test - public void createPoint() { - // 1-2 46 ; 3-9 50 ; 10-11 35 ; 12-13 37 - WQLObject tab = WQLObject.getWQLObject("ST_IVT_StructAttr"); - - for (int i = 12; i <=13; i++) { - String code1 = ""; - if (i<10) { - code1 = "0"+ String.valueOf(i); - } else { - code1 = String.valueOf(i); - } - for (int j = 1; j <= 37; j++) { - String code = ""; - if (j<10) { - code = "0"+ String.valueOf(j); - } else { - code = String.valueOf(j); - } - JSONObject json = new JSONObject(); - json.put("struct_id", IdUtil.getSnowflake(1,1).nextId()); - json.put("struct_code", "YA"+code1+"-01-"+ code); - json.put("struct_name", String.valueOf(i) + "排" + "1 层" + String.valueOf(j) + "列"); - json.put("simple_name",json.getString("struct_name")); - json.put("region_id", "1557539288307077120"); - json.put("region_code","YSQA01"); - json.put("region_name","养生区A"); - json.put("stor_id","1528627964823080960"); - json.put("stor_code","F103"); - json.put("stor_name","永裕仓库"); - json.put("stor_type","01"); - json.put("create_id","1"); - json.put("create_name","管理员"); - json.put("create_time", DateUtil.now()); - json.put("material_height_type", "1"); - tab.insert(json); - } - } - System.out.println("创建成功"); - } - - @Test - public void createPoint2() { - WQLObject tab = WQLObject.getWQLObject("ST_IVT_StructAttr"); - - // 成品A 4排 5层 46列 成品B 4排 5层16列 - for (int i = 1; i <=4; i++) { - String code1 = ""; - if (i<10) { - code1 = "0"+ String.valueOf(i); - } else { - code1 = String.valueOf(i); - } - for (int j = 1; j <= 5; j++) { - String code = ""; - if (j<10) { - code = "0"+ String.valueOf(j); - } else { - code = String.valueOf(j); - } - for (int k = 1; k <= 16; k++) { - String code3 = ""; - if (j<10) { - code3 = "0"+ String.valueOf(k); - } else { - code3 = String.valueOf(k); - } - JSONObject json = new JSONObject(); - json.put("struct_id", IdUtil.getSnowflake(1,1).nextId()); - json.put("struct_code", "CA"+code1+"-"+code+"-"+ code3); - json.put("struct_name", String.valueOf(i) + "排" + String.valueOf(j)+"层" + String.valueOf(k) + "列"); - json.put("simple_name",json.getString("struct_name")); - json.put("region_id", "1564874102089584640"); - json.put("region_code","CPQYB01"); - json.put("region_name","成品区域B"); - json.put("stor_id","1528627964823080960"); - json.put("stor_code","F103"); - json.put("stor_name","永裕仓库"); - json.put("stor_type","01"); - json.put("create_id","1"); - json.put("create_name","管理员"); - json.put("create_time", DateUtil.now()); - json.put("material_height_type", "1"); - tab.insert(json); - } - } - } - System.out.println("创建成功"); - } - -} - - -class A implements Runnable { - static A a = new A(); // 创建类变量 - - @Override - public void run() { - this.method(); - } - - public synchronized void method() { - System.out.println("我是线程" + Thread.currentThread().getName()); - try { - Thread.sleep(3000); - } catch (Exception e) { - e.printStackTrace(); - } - System.out.println(Thread.currentThread().getName() + "结束"); - } -} - -class B { - public static void main(String[] args) { - Thread thread1 = new Thread(A.a); - Thread thread2 = new Thread(A.a); - thread1.start(); - thread2.start(); - } -}