|
|
@ -1,7 +1,10 @@ |
|
|
|
package org.nl.ext; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.nl.common.utils.CodeUtil; |
|
|
|
import org.nl.wms.ext.acs.service.dto.to.wms.ApplyDeviceDto; |
|
|
|
import org.nl.wms.ext.mes.service.WmsToMesService; |
|
|
|
import org.nl.wms.ext.mes.service.dao.mapper.MesRequestMapper; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -10,6 +13,7 @@ import org.springframework.boot.test.context.SpringBootTest; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
|
|
|
/** |
|
|
@ -107,13 +111,28 @@ public class TestDemo { |
|
|
|
|
|
|
|
@Test |
|
|
|
void test03() throws InterruptedException { |
|
|
|
// for (int i = 0; i < 50; i++) {
|
|
|
|
// System.out.println("生成标识code: " + CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
|
|
|
// Thread.sleep(1000);
|
|
|
|
// }
|
|
|
|
// for (int i = 0; i < 5; i++) {
|
|
|
|
// new Thread(() -> System.out.println("生成标识code: " + CodeUtil.getNewCode("PDM_SHIFTORDER"))).start();
|
|
|
|
// }
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
JSONArray res = new JSONArray(); |
|
|
|
JSONObject r1 = new JSONObject(); |
|
|
|
r1.put("device_code", "FJ2CDDJW01"); |
|
|
|
r1.put("qty", "64887"); |
|
|
|
r1.put("vehicle_code", "1033"); |
|
|
|
JSONObject r2 = new JSONObject(); |
|
|
|
r2.put("device_code", "FJ2CDDJW02"); |
|
|
|
r2.put("qty", "64881"); |
|
|
|
r2.put("vehicle_code", "1031"); |
|
|
|
res.add(r1); |
|
|
|
res.add(r2); |
|
|
|
jsonObject.put("list", res); |
|
|
|
//[{device_code=FJ2CDDJW01, qty=64826, vehicle_code=1096}, {device_code=FJ2CDDJW02, qty=64431, vehicle_code=1152}]
|
|
|
|
//[{"device_code":"FJ2CDDJW01","qty":"64887","vehicle_code":"1033"},{"device_code":"FJ2CDDJW02","qty":"64881","vehicle_code":"1031"}]
|
|
|
|
List<ApplyDeviceDto> list = JSONArray.parseArray(jsonObject.getString("list"), ApplyDeviceDto.class); |
|
|
|
// 1 获取点位相应数量
|
|
|
|
int sum = 0; |
|
|
|
for (ApplyDeviceDto applyDeviceDto : list) { |
|
|
|
sum += Integer.parseInt(applyDeviceDto.getQty()); |
|
|
|
} |
|
|
|
System.out.println(sum); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|