| | |
| | | package com.yuanchu.mom; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.yuanchu.mom.Task.SyncOrder; |
| | | import com.yuanchu.mom.pojo.RawInspect; |
| | | import com.yuanchu.mom.pojo.Sale; |
| | | import com.yuanchu.mom.pojo.SaleMaterial; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import javafx.scene.input.DataFormat; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | return sale; |
| | | }).collect(Collectors.toList()); |
| | | //System.out.println(list); |
| | | |
| | | for (Sale sale : list) { |
| | | List<Map<String, Object>> innerOrder = SyncOrder.getInnerOrder("2023-08-01 10:00:00", sale.getOrderNumber()); |
| | | List<SaleMaterial> saleMaterials = innerOrder.stream().map(inorder -> { |
| | |
| | | saleMaterial.setName(inorder.get("productName").toString()); //产品名称 |
| | | saleMaterial.setSpecifications(inorder.get("specificationModel").toString()); //产品规格型号 |
| | | saleMaterial.setUnit(inorder.get("unit").toString()); //单位 |
| | | saleMaterial.setNumber((int)Double.parseDouble(inorder.get("quantity").toString())); //数量 |
| | | saleMaterial.setNumber((int) Double.parseDouble(inorder.get("quantity").toString())); //数量 |
| | | saleMaterial.setPrice(inorder.get("unitPriceInclTax").toString()); //单价 |
| | | saleMaterial.setSaleId(sale.getId()); //关联 销售单id |
| | | saleMaterial.setAdress(String.valueOf(inorder.get("shippingAddress"))); //收货地址 |
| | |
| | | |
| | | @Test |
| | | void aaa() { |
| | | String pattern = "yyyy-MM-dd HH:mm:ss"; |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); |
| | | System.out.println(LocalDateTime.now().minusDays(1).with(LocalTime.of(0,0,0)).format(formatter)); |
| | | System.out.println(LocalDateTime.now().with(LocalTime.of(4, 0, 0)).format(formatter)); |
| | | int orderId = 773699; |
| | | List<Map<String, Object>> attachment = SyncOrder.getAttachmentByOrderId(orderId); |
| | | List<String> list = new ArrayList<>(); |
| | | for (Map<String, Object> attch : attachment) { |
| | | String path = attch.get("path").toString(); |
| | | list.add(path); |
| | | } |
| | | System.out.println(list); |
| | | } |
| | | |
| | | @Test |
| | | void bb() { |
| | | List<Map<String, Object>> mapList = SyncOrder.ifsInterfaces(); |
| | | List<RawInspect> rawInspectList = mapList.stream().map(map -> { |
| | | RawInspect rawInspect = new RawInspect(); |
| | | if (map.get("PART_NO").toString().equals("A0410008010700")) { |
| | | rawInspect.setCode(map.get("PART_NO").toString()); //原材料编码 |
| | | String[] split = map.get("PART_DESC").toString().split(","); |
| | | rawInspect.setName(split[0]); //原材料名称 |
| | | rawInspect.setSpecifications(split[1]); //型号规格 |
| | | rawInspect.setUnit(map.get("BUY_UNIT_MEAS").toString()); //单位 |
| | | rawInspect.setNumber(Integer.parseInt(String.valueOf(map.get("QTY_TO_INSPECT")))); //数量 |
| | | rawInspect.setInsState(0); //未检验 |
| | | rawInspect.setFormTime(DateUtil.parse(map.get("APPROVED_DATE").toString())); //来料日期 |
| | | rawInspect.setSupplier(map.get("SUPPLIER_NAME").toString()); //供应商 |
| | | } |
| | | return rawInspect; |
| | | }).collect(Collectors.toList()); |
| | | System.out.println(rawInspectList); |
| | | } |
| | | |
| | | } |