修复不同农场的同种农产品加工后会替换掉另一个加工后产品的数据
| | |
| | | //通过strainId和landId 确定是由哪一个品种库存加工而来 |
| | | FarmProductStock farmProductStock = farmProductStockService.selectBy2Id(process.getStrainId(),process.getLandId()); |
| | | //通过strainId和processId(processId为产品id)确定对应的加工库存 |
| | | ProcessInv processInv = processInvService.selectBy2Id(process.getStrainId(),process.getProcessId()); |
| | | ProcessInv processInv = processInvService.selectBySPId(process.getStrainId(),process.getProcessId()); |
| | | //农产品增加相应库存 |
| | | Double weight = Double.parseDouble(farmProductStock.getWeight())+process.getSaleNum(); |
| | | farmProductStock.setWeight(weight.toString()); |
| | |
| | | */ |
| | | List<ProcessInvVO> selectProcessInvPage(IPage page, @Param("processInv") ProcessInvVO processInv); |
| | | |
| | | ProcessInv selectBy2Id(@Param("strainId") Long strainId, @Param("productId") Long productId); |
| | | ProcessInv selectBySPId(@Param("strainId") Long strainId, @Param("productId") Long productId); |
| | | |
| | | ProcessInv selectBySFId(@Param("strainId")Long strainId, @Param("fpsId")String fpsId); |
| | | |
| | | Boolean add(@Param("processInv") ProcessInv processInv1); |
| | | |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectBy2Id" resultType="org.springblade.modules.processInv.entity.ProcessInv"> |
| | | <select id="selectBySPId" resultType="org.springblade.modules.processInv.entity.ProcessInv"> |
| | | SELECT id,strain_id,product_id,product_inventory_num,create_time,update_user,update_time,status,is_deleted |
| | | FROM sys_process_inv WHERE strain_id = #{strainId} AND product_id = #{productId} |
| | | FROM sys_process_inv |
| | | WHERE is_deleted = 0 AND strain_id = #{strainId} AND product_id = #{productId} |
| | | </select> |
| | | |
| | | <select id="selectBySFId" resultType="org.springblade.modules.processInv.entity.ProcessInv"> |
| | | SELECT id,strain_id,product_id,product_inventory_num,create_time,update_user,update_time,status,is_deleted |
| | | FROM sys_process_inv |
| | | WHERE is_deleted = 0 AND strain_id = #{strainId} AND product_id = #{fpsId} |
| | | </select> |
| | | |
| | | <insert id="add"> |
| | |
| | | * @param processId 产品id |
| | | * @return |
| | | */ |
| | | ProcessInv selectBy2Id(String strainId, String processId); |
| | | ProcessInv selectBySPId(String strainId, String processId); |
| | | |
| | | /** |
| | | * 彻底删除 |
| | |
| | | @Override |
| | | public Boolean insertOrUpdate(ProcessInv processInv) { |
| | | //通过strainId和productId查询对应数据 |
| | | ProcessInv processInv1 = baseMapper.selectBy2Id(processInv.getStrainId(),processInv.getProductId()); |
| | | ProcessInv processInv1 = baseMapper.selectBySFId(processInv.getStrainId(),processInv.getFpsId()); |
| | | if (processInv1 != null){ |
| | | //当存在该数据时,修改 |
| | | processInv1.setProductInventoryNum(processInv1.getProductInventoryNum()+processInv.getProductInventoryNum()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ProcessInv selectBy2Id(String strainId, String processId) { |
| | | return baseMapper.selectBy2Id(Long.parseLong(strainId),Long.parseLong(processId)); |
| | | public ProcessInv selectBySPId(String strainId, String processId) { |
| | | return baseMapper.selectBySPId(Long.parseLong(strainId),Long.parseLong(processId)); |
| | | } |
| | | |
| | | @Override |