home 2 vuotta sitten
vanhempi
commit
0ecc2bea75

+ 7 - 5
hx-service/storage/src/main/java/com/fjhx/stock/service/impl/StockDetailServiceImpl.java

@@ -132,16 +132,18 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
         listMapByMaterialCode.forEach((k, v) -> {
             List<Map<String, Object>> itemList = baseMapper.selectRecommendMaterial(k, (BigDecimal) v.get(0).get("availableQuantity"));
             int size = Math.min(v.size(), itemList.size());
+
             for (int i = 0; i < size; i++) {
                 BigDecimal availableQuantity = (BigDecimal) v.get(i).get("availableQuantity");
+
                 for (int j = 0; j < itemList.size(); j++) {
-                    BigDecimal bigDecimal = (BigDecimal) itemList.get(j).get("quantity");
-                    if (bigDecimal.compareTo(availableQuantity) >= 0) {
-                        v.get(i).putAll(itemList.get(i));
-                        itemList.remove(itemList.get(i));
+                    Map<String, Object> itemMap = itemList.get(j);
+                    if (((BigDecimal) itemMap.get("quantity")).compareTo(availableQuantity) >= 0) {
+                        v.get(i).putAll(itemMap);
+                        itemList.remove(itemMap);
                         break;
                     }
-                    itemList.remove(itemList.get(i));
+                    itemList.remove(itemMap);
                     j--;
                 }
             }

+ 6 - 5
hx-service/storage/src/main/java/com/fjhx/task/service/impl/ScheduleTaskServiceImpl.java

@@ -44,12 +44,12 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
         if (BladeApplication.isLocalDev()) {
             GET_ACCESS_TOKEN_ACTION_URL = "http://106.14.146.72:8087/portal/getAccessTokenAction.do?AppId=1&AppSecret=a2b1c2d3";
             STOCK_ACCEPT_ACTION = "http://106.14.146.72:8087/SrmWeb/stockAcceptAction.do?action=custom&access_token=";
-            SELECT_PUBLISHED_SQL = "select Id,Content from `cap.published_copy1` where handle is null";
+            SELECT_PUBLISHED_SQL = "select Id id,Content content from `cap.published_copy1` where handle is null";
             UPDATE_PUBLISHED_SQL = "UPDATE `cap.published_copy1` SET handle=1 WHERE id=";
         } else {
             GET_ACCESS_TOKEN_ACTION_URL = "http://mes.cfmfactory.com:8087/portal/getAccessTokenAction.do?AppId=1&AppSecret=a2b1c2d3";
             STOCK_ACCEPT_ACTION = "http://mes.cfmfactory.com:8087/SrmWeb/stockAcceptAction.do?action=custom&access_token=";
-            SELECT_PUBLISHED_SQL = "select Id,Content from `cap.published` where handle is null";
+            SELECT_PUBLISHED_SQL = "select Id id,Content content from `cap.published` where handle is null";
             UPDATE_PUBLISHED_SQL = "UPDATE `cap.published` SET handle=1 WHERE id=";
         }
     }
@@ -63,7 +63,8 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
         String token = getToken(GET_ACCESS_TOKEN_ACTION_URL);
 
         for (Map<String, Object> stringStringMap : selectPublishedList) {
-            String content = stringStringMap.get("Content").toString();
+
+            String content = stringStringMap.get("content").toString();
             // 内容
             JSONObject contentMap = JSONObject.parseObject(content);
             JSONObject value = contentMap.getJSONObject("Value");
@@ -72,7 +73,7 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
             Map<String, String> userIdAndJobNo = scheduleTaskMapper.selectUserIdAndJobNo(userId);
 
             if (userIdAndJobNo.get("ID").equals(userIdAndJobNo.get("JobNo"))) {
-                scheduleTaskMapper.updatePublished(UPDATE_PUBLISHED_SQL + stringStringMap.get("Id"));
+                scheduleTaskMapper.updatePublished(UPDATE_PUBLISHED_SQL + stringStringMap.get("id"));
                 continue;
             }
 
@@ -92,7 +93,7 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
                 String stockAcceptActionBody = stockAcceptActionResult.getBody();
 
                 if (JSONObject.parseObject(stockAcceptActionBody).getBoolean("success")) {
-                    scheduleTaskMapper.updatePublished(UPDATE_PUBLISHED_SQL + stringStringMap.get("Id"));
+                    scheduleTaskMapper.updatePublished(UPDATE_PUBLISHED_SQL + stringStringMap.get("id"));
                 }
 
             } catch (Exception e) {