| | |
| | | String parentModel = product.getParentModel(); |
| | | List<ProductBom> bomList = product.getBomList(); |
| | | String fileUrl = product.getFileUrl(); |
| | | Date date = new Date(); |
| | | //查询产品最新的版本号 |
| | | ProductHistory latestProduct = phService.getLatestVersion(parentCode, customCode); |
| | | ProductHistory enabledProduct = phService.getEnabledByParentCodeAndCustomCode(parentCode, customCode); |
| | |
| | | |
| | | //更新product_history/product_bom_history/product/product_bom, |
| | | // product的主键沿用对应product_history的 |
| | | //根据编码和型号确定物料id并对应quantity,存入数据库 |
| | | //根据编码和型号确定物料id并对应quantity,存入数据库. |
| | | //List<Material> bomMaterialList = mService.getListByCodeAndModelList2(bomList); |
| | | List<ProductBom> bomMaterialList = pbService.getListByCodeAndModelList2(bomList); |
| | | // -> product_history |
| | |
| | | productHistory.setParentModel(product.getParentModel()); |
| | | productHistory.setNotes(product.getNotes()); |
| | | productHistory.setCustomCode(product.getCustomCode()); |
| | | productHistory.setCreateTime(product.getCreateTime()); |
| | | productHistory.setVersion(product.getVersion()); |
| | | productHistory.setCreateTime(date); |
| | | productHistory.setVersionTime(product.getVersionTime()); |
| | | productHistory.setVersion(nextVersion); |
| | | //版本新增,初始bom子件版本为1 |
| | | productHistory.setSubVersionMax(1); |
| | | productHistory.setEnabled(1); |
| | | phService.insertAndUpdateEnabled(productHistory); |
| | | // -> product |
| | | product.setId(productHistory.getId()); |
| | | product.setCreateTime(new Date()); |
| | | product.setCreateTime(date); |
| | | product.setVersion(nextVersion); |
| | | deleteAndInsert(product); |
| | | // -> product_bom |
| | |
| | | bom.setMaterialId(bomMaterial.getId()); |
| | | bom.setQuantity(bomMaterial.getQuantity()); |
| | | bom.setSubVersion(1); |
| | | bom.setCreateDate(new Date()); |
| | | bom.setCreateDate(date); |
| | | |
| | | productBomList.add(bom); |
| | | }); |
| | |
| | | bomHistory.setQuantity(bomMaterial.getQuantity()); |
| | | bomHistory.setSubSVersion(1); |
| | | bomHistory.setSubEVersion(1); |
| | | bomHistory.setCreateDate(new Date()); |
| | | bomHistory.setCreateDate(date); |
| | | |
| | | bomHistoryList.add(bomHistory); |
| | | }); |