| | |
| | | import com.chinaztt.mes.basic.util.DictUtils; |
| | | import com.chinaztt.mes.basic.util.PartUtils; |
| | | import com.chinaztt.mes.basic.util.TransactionUtils; |
| | | import com.chinaztt.mes.basic.vo.PartVo; |
| | | import com.chinaztt.mes.common.util.JsonUtil; |
| | | import com.chinaztt.mes.common.util.MultipartFileToFile; |
| | | import com.chinaztt.ztt.common.core.util.R; |
| | |
| | | import org.apache.http.impl.client.HttpClientBuilder; |
| | | import org.apache.http.params.CoreConnectionPNames; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cloud.client.discovery.DiscoveryClient; |
| | | import org.springframework.core.env.Environment; |
| | |
| | | throw new RuntimeException("零件号版本号重复:" + partByFind.getPartName() + "-" + partByFind.getPartNo()); |
| | | } |
| | | baseMapper.insert(part); |
| | | //对接IFS |
| | | // R result = ifsFeignClient.importInventPartStd(new JSONObject().fluentPut("BATCH_INFO", new JSONArray().fluentAdd(ifsDataMake(part))), true); |
| | | // if (result.getCode() == 1) { |
| | | // throw new RuntimeException("IFS错误——" + result.getMsg()); |
| | | // } |
| | | return true; |
| | | } |
| | | |
| | |
| | | },threadPoolTaskExecutor); |
| | | } |
| | | |
| | | //触发零件 |
| | | @Override |
| | | public String triggerAdd(PartVo partVo) { |
| | | log.info("接收主数据平台数据为===================》"+JSONObject.toJSONString(partVo)); |
| | | Part part = new Part(); |
| | | BeanUtils.copyProperties(partVo,part); |
| | | //创建者 |
| | | part.setCreateUser(partVo.getCreate_name()); |
| | | //更新者 |
| | | part.setUpdateUser(partVo.getUpdate_name()); |
| | | //零件号 |
| | | part.setPartNo(partVo.getMaterial_number()); |
| | | //名称 |
| | | part.setPartName(partVo.getMaterial_description()); |
| | | //零件描述 |
| | | part.setDescription(partVo.getMaterial_name()); |
| | | //单位 |
| | | part.setUnit(partVo.getUnit()); |
| | | //一级分类 |
| | | part.setAssortment(partVo.getFirstCategoryName()); |
| | | //二级分类 |
| | | part.setCategory(partVo.getSecondCategoryName()); |
| | | //三级分类 |
| | | part.setThreeLevelClassification(partVo.getThirdCategoryName()); |
| | | //规格 |
| | | part.setSpecs(partVo.getMaterial_spec()); |
| | | //版本号 |
| | | part.setEngChgLevel(partVo.getTemplate_version().substring(1)); |
| | | //计划方法 |
| | | part.setPlanningMethod("A"); |
| | | //型号 |
| | | part.setPartModel(partVo.getMaterial_spec()); |
| | | if (partVo.getType().equals("add")){ |
| | | int insert = baseMapper.insert(part); |
| | | log.info("新增"+part.getPartNo()+"零件号成功"); |
| | | return insert>0?"1":"0" ; |
| | | }else { |
| | | int update = baseMapper.update(part, Wrappers.<Part>lambdaUpdate().eq(Part::getPartNo, part.getPartNo())); |
| | | log.info("修改"+part.getPartNo()+"零件号成功"); |
| | | return update>0?"1":"0" ; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public void asyncExcel(MultipartFile file,Map<String, String> dicmattype,Map<String, String> dicunit){ |
| | | File file1 = MultipartFileToFile.multipartFileToFile(file); |
| | | CsvReader reader = CsvUtil.getReader(); |
| | |
| | | no.add(rawList.get(1)); |
| | | part.setPartName(rawList.get(2)); |
| | | part.setDescription(rawList.get(3)); |
| | | part.setDomainNo(rawList.get(4)); |
| | | part.setDomainName(rawList.get(5)); |
| | | part.setMaterialType(rawList.get(6)); |
| | | part.setUnit(rawList.get(8)); |
| | | part.setAssets(rawList.get(16)); |