mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
+5
-1
@@ -33,7 +33,11 @@ public interface ApiOrderService {
|
||||
@RequestMapping(value = "/Api-erpOrders-getModuleTypeList",method = RequestMethod.POST)
|
||||
JSONObject getApiModuleTypeDataMessage(@RequestParam("token") String token, @RequestBody JSONObject json);
|
||||
|
||||
// 板件数据
|
||||
// 板材明细
|
||||
@RequestMapping(value = "/Api-erpOrders-blocksList",method = RequestMethod.POST)
|
||||
JSONObject getApiBlocksDataMessage(@RequestParam("token") String token, @RequestBody JSONObject json);
|
||||
|
||||
// 板件数据
|
||||
@RequestMapping(value = "/Api-erpOrders-getBlocks",method = RequestMethod.POST)
|
||||
JSONObject getApiBlocksMessage(@RequestParam("token") String token, @RequestBody JSONObject json);
|
||||
}
|
||||
|
||||
+34
-12
@@ -324,7 +324,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
JSONObject dataBody = new JSONObject();
|
||||
for (int i = 1; i <= body.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
jsonParts.put("curr_page", i);
|
||||
jsonBody.put("curr_page", i);
|
||||
JSONObject value = apiOrderService.getApiOrderBodyMessage(token, jsonBody);
|
||||
dataBody = mergeJSONObjects(dataBody, value);
|
||||
}
|
||||
@@ -339,11 +339,11 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
JSONObject dataGoods = new JSONObject();
|
||||
for (int i = 1; i <= goods.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
jsonParts.put("curr_page", i);
|
||||
jsonGoods.put("curr_page", i);
|
||||
JSONObject value = apiOrderService.getApiOrderGoodsMessage(token, jsonGoods);
|
||||
dataGoods = mergeJSONObjects(dataGoods, value);
|
||||
}
|
||||
// 板材信息转换
|
||||
// 板材明细信息转换
|
||||
JSONObject jsonPlates = new JSONObject();
|
||||
jsonPlates.put("curr_page", 1);
|
||||
jsonPlates.put("page_count", PARTS_PAGE_MAX);
|
||||
@@ -362,20 +362,40 @@ public class OrderServiceImpl implements OrderService {
|
||||
JSONObject jsonModule = new JSONObject();
|
||||
jsonModule.put("order_no", orderNo);
|
||||
JSONObject dataModule = apiOrderService.getApiModuleTypeDataMessage(token, jsonGoods);
|
||||
|
||||
// 板材数据信息转换
|
||||
JSONObject jsonBlocks = new JSONObject();
|
||||
jsonBlocks.put("curr_page", 1);
|
||||
jsonBlocks.put("page_count", PARTS_PAGE_MAX);
|
||||
jsonBlocks.put("order_no", orderNo);
|
||||
JSONObject blocks = apiOrderService.getApiBlocksMessage(token, jsonBlocks);
|
||||
if (!blocks.getString("err_code").equals("0")) {
|
||||
throw exception(PLATE_DATA_ERROR);
|
||||
}
|
||||
JSONObject block = new JSONObject();
|
||||
for (int i = 1; i <= blocks.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
jsonBlocks.put("curr_page", i);
|
||||
JSONObject value = apiOrderService.getApiBlocksMessage(token, jsonBlocks);
|
||||
block = mergeJSONObjects(block, value);
|
||||
}
|
||||
System.err.println(block);
|
||||
// 转换
|
||||
System.out.println(" jsonPlatesData " + dataPlates.getJSONObject("value")+ "\n"
|
||||
System.out.println(" "
|
||||
+ " jsonPlatesData " + dataPlates.getJSONObject("value")+ "\n"
|
||||
+ " dataParts " + dataParts+ "\n"
|
||||
+ " dataBody " + dataBody+ "\n"
|
||||
+ " dataGoods " + dataGoods+ "\n"
|
||||
+ " plate " + plate+ "\n"
|
||||
+ " dataModule " + dataModule);
|
||||
+ " dataModule " + dataModule + "\n"
|
||||
+ " block " + block);
|
||||
Map<String, List<?>> listMap = apiTypeRealize.apiPlateDataChange(
|
||||
dataPlates.getJSONObject("value"),//板件生产信息
|
||||
dataParts,// 配件信息
|
||||
dataBody, // 柜体信息
|
||||
dataGoods, // 商品信息
|
||||
plate, // 板件信息
|
||||
dataModule); // 加工组信息
|
||||
dataModule,// 加工组信息
|
||||
block); // 板材数据
|
||||
List<OrderDO> order = (List<OrderDO>) listMap.get("orderDO");
|
||||
List<GoodsDO> goodsDO = (List<GoodsDO>) listMap.get("goodsDO");
|
||||
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) listMap.get("rawGoodsDO");
|
||||
@@ -396,7 +416,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
// System.out.println("plateDO = " + plateDO+ " BeanUtils.toBean(plateDetail, OrderModelDO.class) = " + orderModelDOs);
|
||||
return order.get(0).getId();
|
||||
// return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -460,6 +479,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
|
||||
mergedObj.put("List", mergedList);
|
||||
System.out.println(mergedObj);
|
||||
return mergedObj;
|
||||
|
||||
|
||||
@@ -494,11 +514,13 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
// 验证自定义单号是否存在
|
||||
private void validateCustomOrderNoExists(String customOrderNo) {
|
||||
if (orderMapper.selectCount(new LambdaQueryWrapper<OrderDO>()
|
||||
.eq(OrderDO::getCustomOrderNo, customOrderNo)
|
||||
.eq(OrderDO::getDeleted, false)
|
||||
.eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||
throw exception(CUSTOM_ORDER_EXISTS);
|
||||
if (!customOrderNo.isEmpty()) {
|
||||
if (orderMapper.selectCount(new LambdaQueryWrapper<OrderDO>()
|
||||
.eq(OrderDO::getCustomOrderNo, customOrderNo)
|
||||
.eq(OrderDO::getDeleted, false)
|
||||
.eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
|
||||
throw exception(CUSTOM_ORDER_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+37
-10
@@ -53,7 +53,8 @@ public class ApiTypeRealize {
|
||||
*/
|
||||
public Map<String, List<?>> apiPlateDataChange(JSONObject dataPlates, JSONObject dataParts
|
||||
, JSONObject dataBody, JSONObject dataGoods
|
||||
, JSONObject plates, JSONObject dataModule) {
|
||||
, JSONObject plates, JSONObject dataModule
|
||||
, JSONObject dataBlocks) {
|
||||
|
||||
Map<String, List<?>> map = new HashMap<>();
|
||||
|
||||
@@ -93,7 +94,7 @@ public class ApiTypeRealize {
|
||||
itemsList.addAll(partsItems.values());
|
||||
// 板材 写库
|
||||
Map<String, Map<Integer, ?>> platesDO = platesInfoChange(dataPlates, plates, orderId,
|
||||
(Map<Integer, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange);
|
||||
(Map<Integer, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange, dataBlocks);
|
||||
Map<Integer, PlateDO> orderPlatesDO = (Map<Integer, PlateDO>) platesDO.get("platesInfos");
|
||||
map.put("platesDO", orderPlatesDO.values().stream().collect(Collectors.toList()));
|
||||
map.put("plateDetail", platesDO.get("plateDetail").values().stream().collect(Collectors.toList()));
|
||||
@@ -322,7 +323,7 @@ public class ApiTypeRealize {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(" bodyInfos " + bodyInfos);
|
||||
return bodyInfos;
|
||||
}
|
||||
|
||||
@@ -339,7 +340,7 @@ public class ApiTypeRealize {
|
||||
}
|
||||
|
||||
/**
|
||||
* 配件信息转存 还没有存备注!!!!!!!!!!!!!!!!!!!!
|
||||
* 配件信息转存
|
||||
*
|
||||
* @param value: JSON数据
|
||||
* @param orderId:
|
||||
@@ -403,10 +404,15 @@ public class ApiTypeRealize {
|
||||
/**
|
||||
* 板材信息转换 写表 Integer指板材的ItemID板id 还没有存备注!!!!!!!!!!!!!!!!!!!! 加一个板材自定义编号
|
||||
*/
|
||||
private Map<String, Map<Integer, ?>> platesInfoChange(JSONObject value, JSONObject dataPlates, Long orderId, Map<Integer, GoodsDO> goodsDOMap, Map<Integer, OrderBodyDO> bodyInfos) {
|
||||
private Map<String, Map<Integer, ?>> platesInfoChange(JSONObject value, JSONObject dataPlates, Long orderId,
|
||||
Map<Integer, GoodsDO> goodsDOMap, Map<Integer, OrderBodyDO> bodyInfos,
|
||||
JSONObject dataBlocks) {
|
||||
// 板材 写ES
|
||||
Map<Integer, PlateDetail> plateDetail = platesDetailChange(value);
|
||||
|
||||
// 板材数据
|
||||
Map<String,JSONObject> plateMap = getBlocksData(dataBlocks);
|
||||
|
||||
Map<String, Map<Integer, ?>> map = new HashMap<>();
|
||||
Map<Integer, PlateDO> platesInfos = new HashMap<>();
|
||||
Map<Integer, OrderItemDO> platesItem = new HashMap<>();
|
||||
@@ -428,10 +434,10 @@ public class ApiTypeRealize {
|
||||
.type(type)
|
||||
.goodsId(goodsDOMap.get(plate.getInteger("GoodsID")) != null
|
||||
? goodsDOMap.get(plate.getInteger("GoodsID")).getId() : plate.getInteger("GoodsID"))
|
||||
.width(BigDecimal.valueOf(plate.getDouble("CutWidth")))
|
||||
.height(BigDecimal.valueOf(plate.getDouble("CutWidth")))
|
||||
.thickness(goodsDOMap.get(plate.getInteger("GoodsID")) != null
|
||||
? goodsDOMap.get(plate.getInteger("GoodsID")).getThickness() : BigDecimal.valueOf(0L))
|
||||
// .width(BigDecimal.valueOf(plate.getDouble("CutWidth")))
|
||||
// .height(BigDecimal.valueOf(plate.getDouble("CutWidth")))
|
||||
// .thickness(goodsDOMap.get(plate.getInteger("GoodsID")) != null
|
||||
// ? goodsDOMap.get(plate.getInteger("GoodsID")).getThickness() : BigDecimal.valueOf(0L))
|
||||
.splitHeight(BigDecimal.valueOf(plate.getDouble("SpliteHeight")))
|
||||
.splitThickness(BigDecimal.valueOf(plate.getDouble("SpliteThickness")))
|
||||
.splitWidth(BigDecimal.valueOf(plate.getDouble("SpliteWidth")))
|
||||
@@ -479,6 +485,13 @@ public class ApiTypeRealize {
|
||||
if (plateDetail.get(plate.getInteger("BlockNo")) != null) {
|
||||
plateDetail.get(plate.getInteger("BlockNo")).setPlateId(plateId);
|
||||
}
|
||||
if (plateMap.get(plate.getInteger("BlockNo")) != null) {
|
||||
JSONObject jsonObject = plateMap.get(plate.getInteger("BlockNo"));
|
||||
plateInfo.setHeight(BigDecimal.valueOf(jsonObject.getDouble("Height")))
|
||||
.setWidth(BigDecimal.valueOf(jsonObject.getDouble("Width")))
|
||||
.setThickness(BigDecimal.valueOf(jsonObject.getDouble("Thickness")))
|
||||
.setArea(BigDecimal.valueOf(jsonObject.getDouble("Area")));
|
||||
}
|
||||
platesInfos.put(plate.getInteger("ItemID"), plateInfo);
|
||||
platesItem.put(plate.getInteger("ItemID"), itemPlate);
|
||||
|
||||
@@ -511,7 +524,21 @@ public class ApiTypeRealize {
|
||||
}
|
||||
|
||||
/**
|
||||
* 板材数据转换成PlateDetail Integer指BlockID板id
|
||||
* 板材数据转换成 Map<String, Object>
|
||||
*/
|
||||
public Map<String, JSONObject> getBlocksData(JSONObject dataBlocks) {
|
||||
Map<String, JSONObject> map = new HashMap<>();
|
||||
JSONArray ordersArray = dataBlocks.getJSONArray("List");
|
||||
if (ordersArray != null && !ordersArray.isEmpty()) {
|
||||
for (int i = 0; i < ordersArray.size(); i++) {
|
||||
JSONObject block = ordersArray.getJSONObject(i);
|
||||
map.put(block.getString("BlockNo"), block);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 板材设计数据转换成PlateDetail Integer指BlockID板id
|
||||
*/
|
||||
public Map<Integer, PlateDetail> platesDetailChange(JSONObject dataPlates) {
|
||||
Map<Integer, PlateDetail> plateDetails = new HashMap<>();
|
||||
|
||||
+2
-1
@@ -175,7 +175,8 @@ public class ExcelTypeRealize {
|
||||
PlateDO plateDO = PlateDO.builder()
|
||||
.id(plateId).orderId(orderId).name(combination.getName()).plateNo(combination.getPlateNo())
|
||||
.goodsId(combination.getGoodId()).width(BigDecimal.valueOf(Double.parseDouble(combination.getWidth())))
|
||||
.height(BigDecimal.valueOf(Double.parseDouble(combination.getHeight()))).thickness(BigDecimal.valueOf(Double.parseDouble(combination.getThickness())))
|
||||
.height(BigDecimal.valueOf(Double.parseDouble(combination.getHeight())))
|
||||
.thickness(BigDecimal.valueOf(Double.parseDouble(combination.getThickness())))
|
||||
.splitWidth(BigDecimal.valueOf(Double.parseDouble(combination.getSplitWidth())))
|
||||
.splitHeight(BigDecimal.valueOf(Double.parseDouble(combination.getSplitHeight())))
|
||||
.splitThickness(BigDecimal.valueOf(Double.parseDouble(combination.getThickness())))
|
||||
|
||||
Reference in New Issue
Block a user