| | |
| | | } |
| | | } |
| | | } |
| | | priTag = tagService.selectByName(itemTB.getItemKind(), 2); |
| | | mat = sync(mat, itemTB); |
| | | if (!Cools.isEmpty(itemTB.getItemKind())) { |
| | | priTag = tagService.selectByName(itemTB.getItemKind(), 2); |
| | | } |
| | | |
| | | mat.setTagId(priTag.getId()); |
| | | mat = sync(mat, itemTB); |
| | | if (priTag!=null){ |
| | | mat.setTagId(priTag.getId()); |
| | | } |
| | | mat.setStatus(1); |
| | | if(itemTB.getTemp2() != null){ |
| | | mat.setLength(Double.parseDouble(itemTB.getTemp2())); |
| | | } |
| | | // mat.setLength(Double.parseDouble(itemTB.getTemp2())); |
| | | mat.setCreateTime(now); |
| | | mat.setUpdateTime(now); |
| | | if (!matService.insert(mat)) { |
| | |
| | | log.info("同步新物料[商品编号:{}]", mat.getMatnr()); |
| | | } |
| | | } else { |
| | | Tag priTag = null; |
| | | if (!Cools.isEmpty(itemTB.getItemKind())) { |
| | | priTag = tagService.selectByName(itemTB.getItemKind(), 2); |
| | | if (priTag == null) { |
| | | Tag top = tagService.getTop(); |
| | | NodeUtils nodeUtils = new NodeUtils(); |
| | | nodeUtils.executePath(top.getId()); |
| | | priTag = new Tag( |
| | | null, // 编号 |
| | | itemTB.getItemKind(), // 名称 |
| | | top.getId(), // 父级 |
| | | top.getName(), // 父级名称 |
| | | nodeUtils.path.toString(), // 关联路径 |
| | | nodeUtils.pathName.toString(), // 关联路径名 |
| | | 0, // 类型 |
| | | null, // 负责人 |
| | | null, // 图片 |
| | | null, // 简要描述 |
| | | null, // 数量 |
| | | 2, // 等级 |
| | | null, // 排序 |
| | | 1, // 状态 |
| | | now, // 添加时间 |
| | | null, // 添加人员 |
| | | now, // 修改时间 |
| | | null, // 修改人员 |
| | | null // 备注 |
| | | ); |
| | | if (tagMapper.insert(priTag) == 0) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(itemTB.getItemKind())) { |
| | | priTag = tagService.selectByName(itemTB.getItemKind(), 2); |
| | | } |
| | | |
| | | mat = sync(mat, itemTB); |
| | | if (priTag!=null){ |
| | | mat.setTagId(priTag.getId()); |
| | | } |
| | | if (!matService.update(mat, new EntityWrapper<Mat>().eq("matnr", itemTB.getItemId()))) { |
| | | throw new CoolException("更新已存在商品信息失败,请联系管理员"); |
| | | } |
| | |
| | | |
| | | private Mat sync(Mat mat, ItemTB itemTB) { |
| | | mat.setModel(itemTB.getItemCode()); |
| | | mat.setThreeCode(itemTB.getItemCode()); |
| | | mat.setMatnr(itemTB.getItemId()); |
| | | mat.setMaktx(itemTB.getItemName()); |
| | | mat.setSpecs(itemTB.getItemSpc()); |
| | | mat.setUnit(itemTB.getItemUnit()); |
| | | mat.setSku(itemTB.getItemPic()); |
| | | mat.setMemo(itemTB.getRemark()); |
| | | mat.setCreateTime(itemTB.getMakeDate()); |
| | | mat.setTemp1(itemTB.getTemp1()); |
| | |
| | | */ |
| | | protected void deleteFromMainDatabase(ItemTB itemTB) { |
| | | EntityWrapper<Mat> matCodeEntityWrapper = new EntityWrapper<>(); |
| | | matCodeEntityWrapper.eq("matnr", itemTB.getItemCode()); |
| | | matCodeEntityWrapper.eq("matnr", itemTB.getItemId()); |
| | | matMapper.delete(matCodeEntityWrapper); |
| | | } |
| | | |