|
@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -44,22 +45,28 @@ public class C2_SyncInventoryTest {
|
|
|
@Test
|
|
|
public void test() {
|
|
|
|
|
|
- String a = "204010400192 2075 \n" +
|
|
|
- "204010400195 1851 \n" +
|
|
|
- "204010400198 213 \n" +
|
|
|
- "204010400193 396 \n" +
|
|
|
- "204010400196 3617 \n" +
|
|
|
- "204010400199 322 \n" +
|
|
|
- "204010400201 890 \n" +
|
|
|
- "204010400205 1731 \n" +
|
|
|
- "204010400209 448\n" +
|
|
|
- "204010400250 299 \n" +
|
|
|
- "204010400200 431 \n" +
|
|
|
- "204010400212 338 \n" +
|
|
|
- "204010400211 712";
|
|
|
+ String a = "204010400104\t19\n" +
|
|
|
+ "204010400089\t50\n" +
|
|
|
+ "204010400090\t129\n" +
|
|
|
+ "204010400121\t75\n" +
|
|
|
+ "204010400092\t237\n" +
|
|
|
+ "204010400032\t170\n" +
|
|
|
+ "204010400035\t137\n" +
|
|
|
+ "204010400127\t18\n" +
|
|
|
+ "204010400033\t151\n" +
|
|
|
+ "204010400125\t31\n" +
|
|
|
+ "204010100239\t45\n" +
|
|
|
+ "204010400126\t2\n" +
|
|
|
+ "204010400034\t35\n" +
|
|
|
+ "204010400124\t32\n" +
|
|
|
+ "204012300027\t285\n" +
|
|
|
+ "204012300023\t210\n" +
|
|
|
+ "204012300028\t52\n" +
|
|
|
+ "204012300024\t70\n" +
|
|
|
+ "204010400197\t2294";
|
|
|
|
|
|
List<List<String>> list = Arrays.stream(a.split("\n"))
|
|
|
- .map(item -> Arrays.stream(item.split(" ")).filter(StrUtil::isNotBlank).collect(Collectors.toList()))
|
|
|
+ .map(item -> Arrays.stream(item.split("\t")).filter(StrUtil::isNotBlank).collect(Collectors.toList()))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
Map<String, Long> bomSpecMap = bomSpecService.mapKV(BomSpec::getCode, BaseIdPo::getId, null);
|
|
@@ -82,6 +89,13 @@ public class C2_SyncInventoryTest {
|
|
|
.set(Inventory::getQuantity, quantity)
|
|
|
);
|
|
|
if (!update) {
|
|
|
+ Inventory inventory = new Inventory();
|
|
|
+ inventory.setBomSpecId(bomSpecId);
|
|
|
+ inventory.setWarehouseId(1684037244354052098L);
|
|
|
+ inventory.setDepartmentId(0L);
|
|
|
+ inventory.setQuantity(new BigDecimal(quantity));
|
|
|
+ inventory.setBalanceUnitPrice(BigDecimal.ZERO);
|
|
|
+ inventoryService.save(inventory);
|
|
|
System.err.println(code + " 0库存");
|
|
|
}
|
|
|
|
|
@@ -93,6 +107,13 @@ public class C2_SyncInventoryTest {
|
|
|
);
|
|
|
if (!update1) {
|
|
|
System.err.println(code + " 0结存");
|
|
|
+ InOutStorageDetails inOutStorageDetails = new InOutStorageDetails();
|
|
|
+ inOutStorageDetails.setBomSpecId(bomSpecId);
|
|
|
+ inOutStorageDetails.setWarehouseId(1684037244354052098L);
|
|
|
+ inOutStorageDetails.setDepartmentId(0L);
|
|
|
+ inOutStorageDetails.setQuantity(new BigDecimal(quantity));
|
|
|
+ inOutStorageDetails.setInUnitPrice(BigDecimal.ZERO);
|
|
|
+ inOutStorageDetailsService.save(inOutStorageDetails);
|
|
|
}
|
|
|
|
|
|
}
|