|
@@ -1,15 +1,22 @@
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
+import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.sd.SdApplication;
|
|
|
+import com.sd.business.entity.order.po.OrderInfo;
|
|
|
import com.sd.business.entity.production.dto.StockPreparationDto;
|
|
|
import com.sd.business.entity.production.vo.UncompletedVo;
|
|
|
+import com.sd.business.service.order.OrderService;
|
|
|
import com.sd.business.service.production.StockPreparationService;
|
|
|
import com.sd.wln.service.WlnStatementOfAccount;
|
|
|
+import com.sd.wln.util.WlnUtil;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
@@ -22,6 +29,9 @@ public class TestList {
|
|
|
@Autowired
|
|
|
private WlnStatementOfAccount wlnStatementOfAccount;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OrderService orderService;
|
|
|
+
|
|
|
@DSTransactional
|
|
|
@Test
|
|
|
public void test2() {
|
|
@@ -57,5 +67,37 @@ public class TestList {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void a() {
|
|
|
+ String warehouseCode = "B014";
|
|
|
+
|
|
|
+ long endTime = new Date().getTime();
|
|
|
+ long startTime;
|
|
|
+
|
|
|
+ OrderInfo orderInfo = orderService.getOne(q -> q
|
|
|
+ .eq(OrderInfo::getWlnStorageCode, warehouseCode)
|
|
|
+ .orderByDesc(OrderInfo::getWlnModifyTimestamp));
|
|
|
+
|
|
|
+ List<JSONObject> list = new ArrayList<>();
|
|
|
+ startTime = endTime - 1000 * 60 * 60 * 24 * 7;
|
|
|
+ getOrderList(startTime, endTime, warehouseCode, list);
|
|
|
+
|
|
|
+ System.out.println(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getOrderList(Long startTime, Long endTime, String warehouseCode, List<JSONObject> list) {
|
|
|
+ int page = 0;
|
|
|
+ int size;
|
|
|
+ do {
|
|
|
+ try {
|
|
|
+ List<JSONObject> itemList = WlnUtil.getOrderList(page, 200, startTime, endTime, warehouseCode);
|
|
|
+ page++;
|
|
|
+ size = itemList.size();
|
|
|
+ list.addAll(itemList);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException("订单同步失败");
|
|
|
+ }
|
|
|
+ } while (size >= 200);
|
|
|
+ }
|
|
|
|
|
|
}
|