| | |
| | | //通过strainId和landId 确定是由哪一个品种库存加工而来 |
| | | FarmProductStock farmProductStock = farmProductStockService.selectBy2Id(process.getStrainId(),process.getLandId()); |
| | | //通过strainId和processId(processId为产品id)确定对应的加工库存 |
| | | ProcessInv processInv = processInvService.selectBySPId(process.getStrainId(),process.getProcessId()); |
| | | ProcessInv processInv = processInvService.selectBySPId(process.getStrainId(),process.getProcessId(),farmProductStock.getId()); |
| | | //农产品增加相应库存 |
| | | Double weight = Double.parseDouble(farmProductStock.getWeight())+process.getSaleNum(); |
| | | farmProductStock.setWeight(weight.toString()); |
| | | farmProductStockService.updateById(farmProductStock); |
| | | //加工产品减少对应库存 |
| | | Double num = processInv.getProductInventoryNum()-process.getProcessNum(); |
| | | if (num<=0){ |
| | | if (num<0){ |
| | | //删除对应库存 |
| | | // processInvService.del(processInv.getId()); |
| | | throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("当前库存不足,不能删除数据!")); |
| | |
| | | */ |
| | | List<ProcessInvVO> selectProcessInvPage(IPage page, @Param("processInv") ProcessInvVO processInv); |
| | | |
| | | ProcessInv selectBySPId(@Param("strainId") Long strainId, @Param("productId") Long productId); |
| | | ProcessInv selectBySPId(@Param("strainId") Long strainId, @Param("productId") Long productId,@Param("fpsId") Long fpsId); |
| | | |
| | | ProcessInv selectBySFId(@Param("strainId")Long strainId, @Param("fpsId")String fpsId); |
| | | |
| | |
| | | <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 is_deleted = 0 AND strain_id = #{strainId} AND product_id = #{productId} |
| | | WHERE is_deleted = 0 AND strain_id = #{strainId} AND product_id = #{productId} AND fps_id = #{fpsId} |
| | | </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} |
| | | WHERE is_deleted = 0 AND strain_id = #{strainId} AND fps_id = #{fpsId} |
| | | </select> |
| | | |
| | | <insert id="add"> |
| | |
| | | * @param processId 产品id |
| | | * @return |
| | | */ |
| | | ProcessInv selectBySPId(String strainId, String processId); |
| | | ProcessInv selectBySPId(String strainId, String processId,Long fpsId); |
| | | |
| | | /** |
| | | * 彻底删除 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ProcessInv selectBySPId(String strainId, String processId) { |
| | | return baseMapper.selectBySPId(Long.parseLong(strainId),Long.parseLong(processId)); |
| | | public ProcessInv selectBySPId(String strainId, String processId,Long fpsId) { |
| | | return baseMapper.selectBySPId(Long.parseLong(strainId),Long.parseLong(processId),fpsId); |
| | | } |
| | | |
| | | @Override |