src/main/java/com/whyc/controller/ProductBomController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/controller/ProductController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/dto/ProductSocketDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/ProductBomMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/ProductBomService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/webSocket/ProductSocket.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/ProductBomMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/ProductBomController.java
@@ -61,11 +61,11 @@ return service.getAllBom(parentCode,parentName,parentModel,pageCurr,pageSize); }*/ @ApiOperation(tags = "产品管理",value = "根据母料型号查询子件信息及有最新版本关联的散装件信息") /*@ApiOperation(tags = "产品管理",value = "根据母料型号查询子件信息及有最新版本关联的散装件信息") @GetMapping("getSubByMaterialProduct") public Response getSubByMaterialProduct(@RequestParam String parentModel){ return service.getSubByMaterialProduct(parentModel); } }*/ @ApiOperation(tags = "产品管理",value = "产品打包下载") @GetMapping("downloadBom") src/main/java/com/whyc/controller/ProductController.java
@@ -2,6 +2,7 @@ import com.whyc.dto.Response; import com.whyc.pojo.ProductHistory; import com.whyc.service.ProductBomService; import com.whyc.service.ProductHistoryService; import com.whyc.service.ProductService; import io.swagger.annotations.Api; @@ -22,6 +23,9 @@ @Autowired private ProductHistoryService historyService; @Autowired private ProductBomService bomService; @ApiOperation(tags = "物料管理",value = "根据物料编码查询所有包含该物料的产品信息",notes = "8.17修改后使用") @GetMapping("getProductByMaterial") public Response getProductByMaterial(@RequestParam String subCode){ @@ -39,5 +43,9 @@ public Response getProductVersion( @RequestParam String parentModel, String customCode){ return historyService.getProductVersion(parentModel,customCode); } @ApiOperation(value = "根据产品id查询子件及其关联的物料信息",notes = "8.17修改后使用") @GetMapping("getBomAndMaterial") public Response getBomAndMaterial( @RequestParam int productId){ return bomService.getBomAndMaterial(productId); } } src/main/java/com/whyc/dto/ProductSocketDto.java
File was renamed from src/main/java/com/whyc/dto/BomVersionSocketDto.java @@ -4,10 +4,11 @@ import java.io.Serializable; @Data public class BomVersionSocketDto implements Serializable { public class ProductSocketDto implements Serializable { private String parentCode; private String parentName; private String parentModel; private String customCode; private int pageCurr; private int pageSize; src/main/java/com/whyc/mapper/ProductBomMapper.java
@@ -15,8 +15,11 @@ //查询所有产品中没有与指定散装件关联的子件 List<ProductBom> getAllSubWithOutMaterial(int MaterialId); //根据母料型号查询子件信息及有关联的散装件信息 List<ProductBom> getSubByMaterialProduct(String parentModel); /*//根据母料型号查询子件信息及有关联的散装件信息 List<ProductBom> getSubByMaterialProduct(String parentModel);*/ //查询出存在的旧的关联子件 List<Material> getOldMaterial(String oldSubName); //根据产品id查询子件及其关联的物料信息 List<ProductBom> getBomAndMaterial(int productId); } src/main/java/com/whyc/service/ProductBomService.java
@@ -164,7 +164,7 @@ } /** * 获取所有产品信息*/ public Response getAllBom(String parentCode,String parentName,String parentModel, int pageCurr,int pageSize) { /*public Response getAllBom(String parentCode,String parentName,String parentModel, int pageCurr,int pageSize) { PageHelper.startPage(pageCurr,pageSize); QueryWrapper wrapper=new QueryWrapper(); wrapper.select("distinct parent_code","parent_name","parent_model","version").orderByAsc("id"); @@ -180,7 +180,7 @@ List list=mapper.selectList(wrapper); PageInfo pageInfo=new PageInfo(list); return new Response().setII(1,list!=null?true:false,pageInfo,"返回数据"); } }*/ //产品打包下载 public void downloadBom(HttpServletRequest req, HttpServletResponse resp, String parentModel) { HSSFWorkbook wb = new HSSFWorkbook(); @@ -363,7 +363,7 @@ List<ProductBom> list=mapper.getAllSubWithOutMaterial(MaterialId); return new Response().setII(1,list.size()>0?true:false,list,"返回数据"); } //根据母料型号查询子件信息及有最新版本关联的散装件信息 /*//根据母料型号查询子件信息及有最新版本关联的散装件信息 public Response getSubByMaterialProduct(String parentModel) { List<ProductBom> list=mapper.getSubByMaterialProduct(parentModel); //查询出存在替换关系得散装件 @@ -385,5 +385,10 @@ ); } return new Response().setII(1,list.size()>0?true:false,list,"返回数据"); }*/ //根据产品id查询子件及其关联的物料信息 public Response getBomAndMaterial(int productId) { List<ProductBom> list=mapper.getBomAndMaterial(productId); return new Response().setII(1,list.size()>0?true:false,list,"返回物料信息及关联物料"); } } src/main/java/com/whyc/webSocket/ProductSocket.java
File was renamed from src/main/java/com/whyc/webSocket/BomVersionSocket.java @@ -1,9 +1,9 @@ package com.whyc.webSocket; import com.whyc.config.WebSocketConfig; import com.whyc.dto.BomVersionSocketDto; import com.whyc.dto.ProductSocketDto; import com.whyc.dto.Response; import com.whyc.service.ProductBomService; import com.whyc.service.ProductService; import com.whyc.util.ActionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,8 +17,8 @@ * 产品信息及版本 */ @Component @ServerEndpoint(value = "/bomversion",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) public class BomVersionSocket { @ServerEndpoint(value = "/product",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) public class ProductSocket { private Session session; private static final int executeTime = 2000; @@ -31,11 +31,11 @@ private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>(); private static ProductBomService bomService; private static ProductService productService; @Autowired public void setBomService(ProductBomService bomService) { BomVersionSocket.bomService = bomService; public void setBomService(ProductService productService) { ProductSocket.productService = productService; } @OnOpen @@ -46,7 +46,7 @@ @OnMessage public void onMessage(Session session, String message){ this.session=session; BomVersionSocketDto bomVersion=ActionUtil.getGson().fromJson(message,BomVersionSocketDto.class); ProductSocketDto productDto=ActionUtil.getGson().fromJson(message, ProductSocketDto.class); thread = new Thread("Thread_RealTime") { @Override public void run() { @@ -54,7 +54,7 @@ Thread thread = currentThread(); threadFlagMap.put(thread.getId(), true); try { Response res = bomService.getAllBom(bomVersion.getParentCode(),bomVersion.getParentName(),bomVersion.getParentModel(),bomVersion.getPageCurr(),bomVersion.getPageSize()); Response res = productService.getAllProduct(productDto.getParentCode(),productDto.getParentName(),productDto.getParentModel(),productDto.getCustomCode(),productDto.getPageCurr(),productDto.getPageSize()); if (session.isOpen()) { //推送信息 synchronized (session) { src/main/resources/mapper/ProductBomMapper.xml
@@ -61,11 +61,11 @@ ) = 0 </select> <resultMap id="MaterialList" type="productBom"> <!--<resultMap id="MaterialList" type="productBom"> <id property="id" column="id"></id> <!--<result property="parentCode" column="parent_code"></result> <!–<result property="parentCode" column="parent_code"></result> <result property="parentName" column="parent_name"></result> <result property="parentModel" column="parent_model"></result>--> <result property="parentModel" column="parent_model"></result>–> <result property="type" column="type"></result> <result property="category" column="category"></result> <result property="subCode" column="sub_code"></result> @@ -82,10 +82,10 @@ <result property="fileUrl" column="file_url"></result> <result property="upUserId" column="up_user_id"></result> <result property="createDate" column="create_date"></result> <!-- <result property="updateDate" column="update_date"></result>--> <!– <result property="updateDate" column="update_date"></result>–> <result property="version" column="version"></result> <result property="dwgUrl" column="dwg_url"></result> <!--<result property="parentVersion" column="parent_version"></result>--> <!–<result property="parentVersion" column="parent_version"></result>–> <result property="replaceStatus" column="replaceStatus"></result> <collection property="Materials" javaType="java.util.ArrayList" ofType="com.whyc.pojo.Material" column="{subName=sub_name,parentModel=parent_model,eVersion=version}" select="selectMaterial"> </collection> @@ -103,7 +103,7 @@ select DISTINCT tb_Material.* FROM db_doc.tb_Material,db_doc.tb_Material_product_history where tb_Material.id=tb_Material_product_history.Material_id and tb_Material_product_history.sub_name=#{subName} and tb_Material_product_history.parent_model=#{parentModel} and tb_Material_product_history.e_version=#{eVersion} </select> </select>--> <select id="getOldMaterial" resultType="com.whyc.pojo.Material"> select DISTINCT tb_Material.* @@ -113,4 +113,40 @@ and tb_Material_product_history.sub_name=#{oldSubName} and tb_Material_product_history.link_type=1 and tb_Material_product_history.e_version=tb_product_bom.version </select> <resultMap id="MaterialList" type="productBom"> <id property="id" column="id"></id> <result property="type" column="type"></result> <result property="category" column="category"></result> <result property="subCode" column="sub_code"></result> <result property="subName" column="sub_name"></result> <result property="subModel" column="sub_model"></result> <result property="unit" column="unit"></result> <result property="quantity" column="quantity"></result> <result property="producer" column="producer"></result> <result property="material" column="material"></result> <result property="thickness" column="thickness"></result> <result property="surfaceDetail" column="surface_detail"></result> <result property="notes" column="notes"></result> <result property="pictureUrl" column="picture_url"></result> <result property="fileUrl" column="file_url"></result> <result property="upUserId" column="up_user_id"></result> <result property="createDate" column="create_date"></result> <result property="version" column="version"></result> <result property="dwgUrl" column="dwg_url"></result> <result property="replaceStatus" column="replaceStatus"></result> <collection property="materials" javaType="java.util.ArrayList" ofType="com.whyc.pojo.Material" column="{productId=product_id,subCode=sub_code,version=version}" select="selectMaterial"> </collection> </resultMap> <select id="getBomAndMaterial" resultMap="MaterialList" parameterType="java.lang.Integer"> select distinct *,0 as replaceStatus from db_doc.tb_product_bom <where> product_id = #{productId} </where> order by id asc </select> <select id="selectMaterial" resultType="com.whyc.pojo.Material"> select DISTINCT tb_Material.* FROM db_doc.tb_Material,db_doc.tb_Material_product_history where tb_Material.id=tb_Material_product_history.Material_id and tb_Material_product_history.product_id=#{productId} and tb_Material_product_history.sub_code=#{subCode} and tb_Material_product_history.version=#{version} </select> </mapper>