|
|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.spring.modules.part.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
@ -10,7 +11,10 @@ import com.spring.common.exception.XJException; |
|
|
|
import com.spring.common.utils.DateUtils; |
|
|
|
import com.spring.common.utils.PageUtils; |
|
|
|
import com.spring.ifs.api.IfsServer; |
|
|
|
import com.spring.ifs.bean.BaseSearchBean; |
|
|
|
import com.spring.ifs.bean.InventoryServiceBean; |
|
|
|
import com.spring.ifs.bean.MasterServiceBean; |
|
|
|
import com.spring.ifs.data.BaseSearchData; |
|
|
|
import com.spring.modules.app.dao.UserDao; |
|
|
|
import com.spring.modules.app.service.UserService; |
|
|
|
import com.spring.modules.base.data.PartSubPropertiesValueData; |
|
|
|
@ -64,6 +68,9 @@ public class MasterPartInformationServiceImpl extends ServiceImpl<MasterPartInfo |
|
|
|
@Autowired |
|
|
|
private MasterServiceBean masterServiceBean; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BaseSearchBean baseSearchBean; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IfsServer ifsServer; |
|
|
|
|
|
|
|
@ -272,7 +279,7 @@ public class MasterPartInformationServiceImpl extends ServiceImpl<MasterPartInfo |
|
|
|
PartIfsCatalog partIfsCatalog = getPartIfsCatalog(data); |
|
|
|
Map<String, String> updateResponse = masterServiceBean.modifyPartCatalog(srv, partIfsCatalog); |
|
|
|
if (!"200".equals(updateResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("ifs 物料件异常信息:" + updateResponse.get("resultMsg")); |
|
|
|
throw new RuntimeException("IFS 物料件编辑异常信息:" + updateResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -327,22 +334,32 @@ public class MasterPartInformationServiceImpl extends ServiceImpl<MasterPartInfo |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public List<PartSubPropertiesValueData> getMasterPartItem(PartSubPropertiesValueData data) { |
|
|
|
// // 判断物料是否选择了模板 |
|
|
|
// MasterPartInformationEntity masterPart = masterPartInformationMapper.selectOne(new QueryWrapper<MasterPartInformationEntity>().eq("part_no", data.getPartNo())); |
|
|
|
// if (StringUtils.isNotBlank(masterPart.getCodeNo())) { |
|
|
|
// // 如果选择了模板但物料属性是空,则调用接口查出属性新增 |
|
|
|
// |
|
|
|
// } |
|
|
|
// // |
|
|
|
|
|
|
|
// 判断物料是否选择了模板 |
|
|
|
MasterPartInformationEntity masterPart = masterPartInformationMapper.selectOne(new QueryWrapper<MasterPartInformationEntity>().eq("part_no", data.getPartNo())); |
|
|
|
// 查询是否已存在属性 |
|
|
|
List<PartSubPropertiesValueHeaderData> checkValueHeaderData = partInformationMapper.checkValueHeaderData(data); |
|
|
|
if ("Y".equals(masterPart.getOfficialFlag()) && StringUtils.isNotBlank(masterPart.getCodeNo()) && checkValueHeaderData.isEmpty()) { |
|
|
|
// 如果物料是正式物料 && 选择了模板 && 物料属性是空值,则调用接口查出属性新增 |
|
|
|
Server srv = getIfsServer(data.getUpdateBy()); |
|
|
|
BaseSearchData baseSearchData = new BaseSearchData(); |
|
|
|
baseSearchData.setLuName("PartCatalog"); |
|
|
|
baseSearchData.setKeyRef("PART_NO=" + data.getPartNo() + "^"); |
|
|
|
Map<String, String> getInfoResponse = baseSearchBean.getTechnicalAttributesByCon(srv, baseSearchData); |
|
|
|
if (!"200".equals(getInfoResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS 获取物料件属性异常信息:" + getInfoResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
String s = String.valueOf(getInfoResponse.get("obj")); |
|
|
|
List<RoutingIfsItem> ifsItems = JSON.parseArray(s, RoutingIfsItem.class); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 初次或修改物料模板则重新加载模板 |
|
|
|
if (checkValueHeaderData.isEmpty()) { |
|
|
|
// 删除物料的属性和属性值 |
|
|
|
partInformationMapper.deletePartSubPropertiesValueHeader(data); |
|
|
|
partInformationMapper.deletePartSubPropertiesValue(data); |
|
|
|
// 重新加载属性和属性值 |
|
|
|
// 加载默认属性和属性值 |
|
|
|
partInformationMapper.savePartSubPropertiesValueHeader(data); |
|
|
|
partInformationMapper.savePartSubPropertiesValue(data); |
|
|
|
} |
|
|
|
|