| | |
| | | public Response getLockedByProductId( @RequestParam int productId){ |
| | | return service.getLockedByProductId(productId); |
| | | } |
| | | |
| | | /*@GetMapping("manualUpdate") |
| | | @Transactional |
| | | public void manualUpdate(){ |
| | | //material属性转移到bom和bomHistory |
| | | bomHistoryService.updateMaterialField2BomHistory(); |
| | | bomService.updateMaterialField2Bom(); |
| | | }*/ |
| | | |
| | | } |
| | |
| | | |
| | | //查询产品丝印锁定状态 |
| | | List<AttachLock> selectInAttachLock(int productId); |
| | | |
| | | List<ProductBomHistory> selectListWithMaterialField(); |
| | | |
| | | void updateMaterialField2BomHistoryBatch(List<ProductBomHistory> bomHistoryList); |
| | | |
| | | } |
| | |
| | | |
| | | //6.在productBom中插入pHsitoryBom查询出的数据 |
| | | int insertBomSelectBomH(Integer id,Integer subVersionMax); |
| | | |
| | | List<ProductBom> selectListWithMaterialField(); |
| | | |
| | | void updateMaterialField2BomBatch(List<ProductBom> bomList); |
| | | |
| | | } |
| | |
| | | List<ProductBomHistory> addList = new LinkedList<>(); |
| | | List<ProductBomHistory> deleteList = new LinkedList<>(); |
| | | //物料id,对比字段:数量 |
| | | String separator = "&&&&&"; |
| | | baseBomHistoryList.forEach(baseBom->{ |
| | | bomHistoryList.forEach(bom->{ |
| | | StringBuilder diffStr = new StringBuilder(); |
| | | if(bom.getMaterialId().equals(baseBom.getMaterialId())){ |
| | | if(!bom.getQuantity().equals(baseBom.getQuantity())){ |
| | | String diffQuantity = separator+"原数量:"+baseBom.getQuantity()+"/新数量:"+bom.getQuantity(); |
| | | diffStr.append(diffQuantity); |
| | | } |
| | | if(!bom.getProducer().equals(baseBom.getProducer())){ |
| | | String diffProducer = separator+"原生产商:"+baseBom.getProducer()+"/新生产商:"+bom.getProducer(); |
| | | diffStr.append(diffProducer); |
| | | } |
| | | if(!bom.getMaterial().equals(baseBom.getMaterial())){ |
| | | String diffMaterial = separator+"原封装类型|材质:"+baseBom.getMaterial()+"/新封装类型|材质:"+bom.getMaterial(); |
| | | diffStr.append(diffMaterial); |
| | | } |
| | | if(!bom.getThickness().equals(baseBom.getThickness())){ |
| | | String diffThickness = separator+"原元件编号|料厚:"+baseBom.getThickness()+"/新元件编号|料厚:"+bom.getThickness(); |
| | | diffStr.append(diffThickness); |
| | | } |
| | | if(!bom.getSurfaceDetail().equals(baseBom.getSurfaceDetail())){ |
| | | String diffSurfaceDetail = separator+"原表面处理|物料详情:"+baseBom.getSurfaceDetail()+"/新表面处理|物料详情:"+bom.getSurfaceDetail(); |
| | | diffStr.append(diffSurfaceDetail); |
| | | } |
| | | if(!bom.getNotes().equals(baseBom.getNotes())){ |
| | | String diffNotes = separator+"原备注:"+baseBom.getNotes()+"/新备注:"+bom.getNotes(); |
| | | diffStr.append(diffNotes); |
| | | } |
| | | |
| | | String diff = diffStr.toString(); |
| | | if(!diff.equals("")) { |
| | | ProductBomHistory history = new ProductBomHistory(); |
| | | String diffQuantity = "原数量:"+baseBom.getQuantity()+"/新数量:"+bom.getQuantity(); |
| | | history.setNotes(diffQuantity); |
| | | history.setNotes(diff.substring(5)); |
| | | history.setMaterialObj(bom.getMaterialObj()); |
| | | diffList.add(history); |
| | | } |
| | |
| | | //query2.eq("product_id",productId).le("sub_s_version",latestSubVersion).ge("sub_e_version",latestSubVersion); |
| | | return mapper.getBomListByProductIdAndSubVersion(productId,latestSubVersion); |
| | | } |
| | | |
| | | public void updateMaterialField2BomHistory() { |
| | | List<ProductBomHistory> bomHistoryList = mapper.selectListWithMaterialField(); |
| | | mapper.updateMaterialField2BomHistoryBatch(bomHistoryList); |
| | | |
| | | } |
| | | } |
| | |
| | | return mapper.getEnabledBomListByParentCodeAndCustomCode(parentCode,customCode); |
| | | } |
| | | |
| | | public void updateMaterialField2Bom() { |
| | | List<ProductBom> bomList = mapper.selectListWithMaterialField(); |
| | | mapper.updateMaterialField2BomBatch(bomList); |
| | | } |
| | | } |
| | |
| | | where apply_material_code=#{parentCode} |
| | | </select> |
| | | <select id="getBomListByProductIdAndSubVersion" resultMap="Map_ProductBomHistory"> |
| | | SELECT h.product_id,h.material_id,h.quantity,m.* |
| | | <!--SELECT h.product_id,h.material_id,h.quantity,m.*--> |
| | | SELECT |
| | | h.product_id, |
| | | h.material_id, |
| | | h.quantity, |
| | | h.category, |
| | | h.producer, |
| | | h.material, |
| | | h.thickness, |
| | | h.surface_detail, |
| | | h.notes, |
| | | m.id, |
| | | m.type, |
| | | m.sub_code, |
| | | m.sub_name, |
| | | m.sub_model, |
| | | m.unit, |
| | | m.picture_url, |
| | | m.file_url, |
| | | m.dwg_url, |
| | | m.create_date |
| | | FROM tb_product_bom_history h,tb_material m |
| | | where product_id = #{productId} |
| | | and sub_s_version <= #{subVersion} |
| | |
| | | where parent_model = #{item.parentModel} and sub_model = #{item.subModel} and id !=0 |
| | | </foreach> |
| | | </update> |
| | | <update id="updateMaterialField2BomBatch"> |
| | | <foreach collection="list" item="his" separator=";"> |
| | | update tb_product_bom set |
| | | category = #{his.category}, |
| | | producer = #{his.producer}, |
| | | material = #{his.material}, |
| | | thickness = #{his.thickness}, |
| | | surface_detail = #{his.surfaceDetail}, |
| | | notes = #{his.notes} |
| | | where id = #{his.id} |
| | | </foreach> |
| | | </update> |
| | | |
| | | |
| | | <select id="searchCadDrawer" resultType="ProductBom" parameterType="ProductBom"> |
| | |
| | | and p.parent_code = #{parentCode} and p.custom_code = #{customCode} |
| | | and p.version!=-1 |
| | | </select> |
| | | <select id="selectListWithMaterialField" resultType="com.whyc.pojo.ProductBom"> |
| | | select h.id,m.* from tb_product_bom h,tb_material m where h.material_id = m.id; |
| | | </select> |
| | | <insert id="insertBomSelectBomH"> |
| | | insert into tb_product_bom(product_id,material_id,sub_version,quantity) |
| | | select product_id,material_id,#{subVersionMax},quantity from tb_product_bom_history where tb_product_bom_history.product_id=#{id} |