Browse Source

默认库位

master
han\hanst 3 weeks ago
parent
commit
422ed8a3af
  1. 2
      src/main/java/com/gaotao/modules/api/service/IfsApiService.java
  2. 25
      src/main/java/com/gaotao/modules/api/service/impl/IfsApiServiceImpl.java
  3. 10
      src/main/java/com/gaotao/modules/factory/controller/PartAttributeController.java

2
src/main/java/com/gaotao/modules/api/service/IfsApiService.java

@ -13,6 +13,7 @@ import com.gaotao.modules.notify.entity.vo.ShopOrderMaterialVo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
public interface IfsApiService { public interface IfsApiService {
@ -74,4 +75,5 @@ public interface IfsApiService {
*/ */
String changeAvailabilityControlId(IfsChangeAvailabilityControlIdDto data); String changeAvailabilityControlId(IfsChangeAvailabilityControlIdDto data);
List<Map<String, Object>> InventoryPartDefLoc(String site, String partNo);
} }

25
src/main/java/com/gaotao/modules/api/service/impl/IfsApiServiceImpl.java

@ -353,4 +353,29 @@ public class IfsApiServiceImpl implements IfsApiService {
} }
} }
@Override
public List<Map<String, Object>> InventoryPartDefLoc(String site, String partNo) {
try {
Map<String, Object> params = Map.of(
"ifsDBName", ifsDBName,
"domainUserID", getCurrentDomainUserID(),
"ifsSiteID", site,
"ifsPartNo", partNo
);
ObjectMapper objectMapper = new ObjectMapper();
String jsonBody = objectMapper.writeValueAsString(params);
log.info("IFS请求接口名称:{},请求参数: {}","InventoryPartDefLoc", jsonBody);
String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "InventoryPartDefLoc", jsonBody, null);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<Map<String, Object>> result = mapper.readValue(ifsResponse,
new TypeReference<List<Map<String, Object>>>() {});
log.info("获取IFS默认库存信息成功,站点: {}, 返回记录: {}", site, result);
return result;
} catch (Exception e) {
log.error("调用IFS InventoryPartDefLoc接口异常:{}", e.getMessage());
throw new XJException(e.getMessage());
}
}
} }

10
src/main/java/com/gaotao/modules/factory/controller/PartAttributeController.java

@ -1,7 +1,9 @@
package com.gaotao.modules.factory.controller; package com.gaotao.modules.factory.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.gaotao.common.utils.PageUtils; import com.gaotao.common.utils.PageUtils;
import com.gaotao.common.utils.R; import com.gaotao.common.utils.R;
import com.gaotao.modules.api.service.IfsApiService;
import com.gaotao.modules.factory.entity.PartAttribute; import com.gaotao.modules.factory.entity.PartAttribute;
import com.gaotao.modules.factory.entity.dto.NoOrderPartAttributeDto; import com.gaotao.modules.factory.entity.dto.NoOrderPartAttributeDto;
import com.gaotao.modules.factory.entity.dto.PartAttributeQueryDto; import com.gaotao.modules.factory.entity.dto.PartAttributeQueryDto;
@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 料件属性控制器 * 料件属性控制器
@ -22,6 +25,9 @@ public class PartAttributeController extends AbstractController {
@Autowired @Autowired
private PartAttributeService partAttributeService; private PartAttributeService partAttributeService;
@Autowired
private IfsApiService ifsApiService;
/** /**
* 分页查询料件属性列表 * 分页查询料件属性列表
*/ */
@ -42,7 +48,9 @@ public class PartAttributeController extends AbstractController {
@GetMapping("/info") @GetMapping("/info")
public R info(@RequestParam String site, @RequestParam String partNo) { public R info(@RequestParam String site, @RequestParam String partNo) {
PartAttribute partAttribute = partAttributeService.getPartAttributeByKey(site, partNo); PartAttribute partAttribute = partAttributeService.getPartAttributeByKey(site, partNo);
return R.ok().put("data", partAttribute);
List<Map<String, Object>> inventoryPartDefLoc;
inventoryPartDefLoc = ifsApiService.InventoryPartDefLoc(site, partNo);
return R.ok().put("data", partAttribute).put("partDefLoc", inventoryPartDefLoc);
} }
/** /**

Loading…
Cancel
Save