|
|
|
@ -7,6 +7,8 @@ import com.fasterxml.jackson.core.type.TypeReference; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.gaotao.common.exception.XJException; |
|
|
|
import com.gaotao.common.utils.*; |
|
|
|
import com.gaotao.modules.api.entity.issueAndReturnVo.InventoryPartVo; |
|
|
|
import com.gaotao.modules.api.service.IfsApiIssueAndReturnService; |
|
|
|
import com.gaotao.modules.factory.dao.AccessSiteMapper; |
|
|
|
import com.gaotao.modules.factory.dao.PartAttributeMapper; |
|
|
|
import com.gaotao.modules.factory.entity.PartAttribute; |
|
|
|
@ -82,6 +84,8 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
|
private LocationService locationService; |
|
|
|
@Autowired |
|
|
|
private PartAttributeMapper partAttributeMapper; |
|
|
|
@Autowired |
|
|
|
private IfsApiIssueAndReturnService ifsApiIssueAndReturnService; |
|
|
|
|
|
|
|
@Value("${custom.ifs-url}") |
|
|
|
private String ifsUrl; |
|
|
|
@ -167,19 +171,10 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
|
@Transactional |
|
|
|
public String saveTrans(TransDetailDto inData) { |
|
|
|
try { |
|
|
|
Map<String, Object> params = Map.of("ifsDBName", ifsDBName, "domainUserID", getCurrentDomainUserID(), |
|
|
|
"ifsSiteID", inData.getSite(), |
|
|
|
"ifsPartNo", inData.getPartNo() |
|
|
|
); |
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
String jsonBody = objectMapper.writeValueAsString(params); |
|
|
|
log.info("IFS请求接口名称:{},请求参数: {}","InventoryPart", jsonBody); |
|
|
|
String partResponse = HttpUtils.doGetWithBody(ifsUrl+"InventoryPart",jsonBody,null); |
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
List<Map<String, Object>> partData = mapper.readValue(partResponse, new TypeReference<>() {}); |
|
|
|
List<InventoryPartVo> parts = ifsApiIssueAndReturnService.getInventoryPart(inData.getPartNo(),inData.getSite()); |
|
|
|
Integer shelfLife = null; // 有效期 |
|
|
|
if (partData!=null && !partData.isEmpty()) { |
|
|
|
shelfLife = partData.getFirst().get("durabilityDays")!=null?(Integer) partData.getFirst().get("durabilityDays"):null; |
|
|
|
if (parts!=null && !parts.isEmpty()) { |
|
|
|
shelfLife = parts.getFirst().getDurabilityDays()!=0?parts.getFirst().getDurabilityDays():null; |
|
|
|
} |
|
|
|
// 根据库位获取仓库ID |
|
|
|
String warehouseId = null; |
|
|
|
|