| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.ProductBomApproving; |
| | | import com.whyc.service.ProductBomApprovingService; |
| | | import com.whyc.util.Zip4jUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.Product; |
| | | import com.whyc.service.*; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
| | |
| | | } |
| | | @PostMapping("zipParse") |
| | | @ApiOperation("zip解析") |
| | | public Response zipParse(@RequestParam("file") MultipartFile file) throws IOException, InvalidFormatException { |
| | | return service.zipParse(file); |
| | | public Response zipParse(@RequestParam("file") MultipartFile file,@RequestParam(required = false) String baseStr) throws IOException, InvalidFormatException { |
| | | //要做对比的产品,传入了物料(parent_code)和定制表单号(custom_code) |
| | | Product baseProduct = (baseStr==null?null:ActionUtil.getGson().fromJson(baseStr, Product.class)); |
| | | return service.zipParse(file,baseProduct); |
| | | } |
| | | |
| | | @PostMapping |
| | |
| | | |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty("版本时间") |
| | | private Date versionTime; |
| | | |
| | | private Integer version; |
| | | |
| | | @TableField(exist = false) |
| | |
| | | |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty("版本时间") |
| | | private Date versionTime; |
| | | |
| | | private Integer version; |
| | | |
| | | @ApiModelProperty(value = "是否启用:更新自动启用,同时可以手动启用某个") |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | |
| | | @Autowired |
| | | private ProductBomService bomService; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | //根据子件名称和母料型号查询历史版本记录 |
| | | public Response getBomHistoryByPModelAndSName(String pmodel, String sname) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | |
| | | return new Response().setIII(1,diffList,addList,deleteList,"对比完成"); |
| | | } |
| | | |
| | | /** |
| | | * @param baseProduct 基准产品为null,则直接找上传产品的最新标准版本 |
| | | * @param product 上传产品 |
| | | * @return |
| | | */ |
| | | public Map<String, List> parseCompare(Product baseProduct, Product product) { |
| | | List<ProductBom> bomList = product.getBomList(); |
| | | List<ProductBom> baseBomList = new LinkedList<>(); |
| | | |
| | | Map<String,List> compareMap = new HashMap<>(); |
| | | List<ProductBomHistory> diffList = new LinkedList<>(); |
| | | List<ProductBomHistory> addList = new LinkedList<>(); |
| | | List<ProductBomHistory> deleteList = new LinkedList<>(); |
| | | |
| | | //根据baseProduct的code和custom_code,查找到基准产品 |
| | | if(baseProduct == null){ |
| | | //productService. |
| | | }else{ |
| | | |
| | | } |
| | | |
| | | //对比:根据code+model定位,比较数量 |
| | | |
| | | compareMap.put("diffList",diffList); |
| | | compareMap.put("addList",addList); |
| | | compareMap.put("deleteList",deleteList); |
| | | return compareMap; |
| | | } |
| | | |
| | | /**关联查询到具体的bom内物料信息*/ |
| | | private List<ProductBomHistory> getLatestBomListByProductId(int productId) { |
| | | QueryWrapper<ProductBomHistory> query = Wrappers.query(); |
| | |
| | | |
| | | import java.io.*; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | mapper.insert(product); |
| | | } |
| | | |
| | | public Response zipParse(MultipartFile file) throws IOException, InvalidFormatException { |
| | | public Response zipParse(MultipartFile file, Product baseProduct) throws IOException, InvalidFormatException { |
| | | Product product = new Product(); |
| | | List<ProductBom> bomList = new LinkedList<>(); |
| | | Response response = new Response(); |
| | |
| | | product.setBomList(bomList); |
| | | } |
| | | } |
| | | return response.setII(1, true, product, filePath); |
| | | //产品bom对比 |
| | | Map<String,List> compareMap = pbhService.parseCompare(baseProduct,product); |
| | | return response.setIII(1, true, product,compareMap, filePath); |
| | | |
| | | } |
| | | |