Browse Source

Merge remote-tracking branch 'origin/master'

master
常熟吴彦祖 6 months ago
parent
commit
6ce3d41feb
  1. 4
      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
  4. 19
      src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java
  5. 17
      src/main/java/com/gaotao/modules/production/service/impl/ProductionInboundServiceImpl.java

4
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 java.util.List;
import java.util.Map;
public interface IfsApiService {
@ -42,7 +43,7 @@ public interface IfsApiService {
* @return BoxLabel数据列表
* @throws JsonProcessingException JSON处理异常
*/
List<IfsBoxLabel> getBoxLabel(String site, Integer consignmentId, String jobNo,
List<IfsBoxLabel> getBoxLabel(String site, Integer consignmentId, String jobNo,
String lineNo, String relNo, Integer lineItemNo) throws JsonProcessingException;
// ==================== IFS库存属性变更接口 - rqrq ====================
@ -74,4 +75,5 @@ public interface IfsApiService {
*/
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;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.gaotao.common.utils.PageUtils;
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.dto.NoOrderPartAttributeDto;
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 java.util.List;
import java.util.Map;
/**
* 料件属性控制器
@ -22,6 +25,9 @@ public class PartAttributeController extends AbstractController {
@Autowired
private PartAttributeService partAttributeService;
@Autowired
private IfsApiService ifsApiService;
/**
* 分页查询料件属性列表
*/
@ -42,7 +48,9 @@ public class PartAttributeController extends AbstractController {
@GetMapping("/info")
public R info(@RequestParam String site, @RequestParam String 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);
}
/**

19
src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java

@ -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;

17
src/main/java/com/gaotao/modules/production/service/impl/ProductionInboundServiceImpl.java

@ -10,6 +10,9 @@ import com.gaotao.common.utils.ErrorLogUtils;
import com.gaotao.common.utils.HttpUtils;
import com.gaotao.common.utils.IfsErrorMessageUtils;
import com.gaotao.modules.api.entity.IfsShopOrder;
import com.gaotao.modules.api.entity.issueAndReturnVo.AnInventoryPartInStockVo;
import com.gaotao.modules.api.entity.issueAndReturnVo.InventoryPartVo;
import com.gaotao.modules.api.service.IfsApiIssueAndReturnService;
import com.gaotao.modules.api.service.IfsApiService;
import com.gaotao.modules.factory.dao.PartAttributeMapper;
import com.gaotao.modules.factory.entity.PartAttribute;
@ -62,7 +65,7 @@ public class ProductionInboundServiceImpl implements ProductionInboundService {
private ProductionInboundMapper productionInboundMapper;
@Autowired
private IssureNotifyService issureNotifyService;
private IfsApiIssueAndReturnService ifsApiIssueAndReturnService;
@Autowired
private HandlingUnitService handlingUnitService;
@ -566,7 +569,17 @@ public class ProductionInboundServiceImpl implements ProductionInboundService {
public Map<String, Object> submitShopOrderInbound(ShopOrderInboundDto dto) {
log.info("=== 开始生产订单入库 ===");
log.info("工单号: {}, 料号: {}, 入库数量: {}", dto.getOrderNo(), dto.getPartNo(), dto.getTransQty());
if (dto.getIfsExpiryDate() == null) {
List<InventoryPartVo> parts = ifsApiIssueAndReturnService.getInventoryPart(dto.getPartNo(),dto.getSite());
// 如果用户没有选择过期日期则分切物料尝试从IFS获取过期日期成品物料直接设置为当前时间+365天
if (!parts.isEmpty()) {
// 当前时间+365天作为过期日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DAY_OF_YEAR, parts.getFirst().getDurabilityDays());
dto.setIfsExpiryDate(calendar.getTime());
}
}
// 用于收集创建的HU unitIds
List<String> unitIds = new ArrayList<>();

Loading…
Cancel
Save