16 files modified
9 files added
| | |
| | | |
| | | <select id="selectLandPage" resultMap="landResultMap"> |
| | | SELECT l.land_name, |
| | | l.land_area , |
| | | ST_ASTEXT(land_range) as land_range, |
| | | l.url, |
| | | d.dict_value as dic, |
| | | c.dict_value as dica |
| | | l.land_area , |
| | | ST_ASTEXT(land_range) as land_range, |
| | | l.url, |
| | | d.dict_value as dic, |
| | | c.dict_value as dica |
| | | FROM `sys_land` l |
| | | LEFT JOIN (SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'land' AND is_deleted = 0) d |
| | | ON d.dict_key = l.land_type |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'landunit' |
| | | AND is_deleted = 0) c ON c.dict_key = l.type |
| | | LEFT JOIN (SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'land' AND is_deleted = 0) d |
| | | ON d.dict_key = l.land_type |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'landunit' |
| | | AND is_deleted = 0) c ON c.dict_key = l.type |
| | | where l.is_deleted = 0 |
| | | <if test="land.landType!=null and land.landType != ''"> |
| | | and l.land_type = #{land.landType} |
| | | </if> |
| | | <if test="land.landName!=null and land.landName != ''"> |
| | | and l.land_name like concat('%', #{land.landName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | <insert id="saveLandInfo"> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.soldr.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.soldrecord.service.ISoldrecordService; |
| | | import org.springblade.modules.stock.entity.Stock; |
| | | import org.springblade.modules.stock.service.IStockService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.soldr.entity.Soldr; |
| | | import org.springblade.modules.soldr.vo.SoldrVO; |
| | | import org.springblade.modules.soldr.service.ISoldrService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | |
| | | /** |
| | | * 已出库存数量记录表 控制器 |
| | | * |
| | | * @author BladeX |
| | | * @since 2022-05-27 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/soldr/soldr") |
| | | @Api(value = "已出库存数量记录表", tags = "已出库存数量记录表接口") |
| | | public class SoldrController extends BladeController { |
| | | |
| | | private final ISoldrService soldrService; |
| | | private final ISoldrecordService soldrecordService; |
| | | private final IStockService stockService; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入soldr") |
| | | public R<Soldr> detail(Soldr soldr) { |
| | | Soldr detail = soldrService.getOne(Condition.getQueryWrapper(soldr)); |
| | | return R.data(detail); |
| | | } |
| | | |
| | | /** |
| | | * 分页 已出库存数量记录表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入soldr") |
| | | public R<IPage<Soldr>> list(Soldr soldr, Query query) { |
| | | IPage<Soldr> pages = soldrService.page(Condition.getPage(query), Condition.getQueryWrapper(soldr)); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 自定义分页 已出库存数量记录表 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入soldr") |
| | | public R<IPage<SoldrVO>> page(SoldrVO soldr, Query query) { |
| | | IPage<SoldrVO> pages = soldrService.selectLists(Condition.getPage(query), soldr); |
| | | for (int i = 0; i < pages.getRecords().size(); i++) { |
| | | String specs = pages.getRecords().get(i).getSpecs1(); |
| | | Integer amount = pages.getRecords().get(i).getAmount1(); |
| | | Integer num = Integer.parseInt(specs); |
| | | String dic1 = pages.getRecords().get(i).getDic1(); |
| | | String dic2 = pages.getRecords().get(i).getDic2(); |
| | | String s = specs + dic1 + "/" + dic2; |
| | | pages.getRecords().get(i).setSpn(s); |
| | | pages.getRecords().get(i).setCnum(num * amount); |
| | | |
| | | } |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 新增 已出库存数量记录表 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入soldr") |
| | | public R save(@Valid @RequestBody Soldr soldr) { |
| | | return R.status(soldrService.save(soldr)); |
| | | } |
| | | |
| | | /** |
| | | * 修改 已出库存数量记录表 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入soldr") |
| | | public R update(@Valid @RequestBody Soldr soldr) { |
| | | return R.status(soldrService.updateById(soldr)); |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改 已出库存数量记录表 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入soldr") |
| | | public R submit(@Valid @RequestBody Soldr soldr) { |
| | | return R.status(soldrService.saveOrUpdate(soldr)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除 已出库存数量记录表 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | return R.status(soldrService.deleteLogic(Func.toLongList(ids))); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/out") |
| | | public R out(Integer num, Long id, Integer type) { |
| | | //如果等于就修改并删除 |
| | | if (type == 0) { |
| | | Stock stock = new Stock(); |
| | | stock.setId(id); |
| | | Stock detail1 = stockService.getOne(Condition.getQueryWrapper(stock)); |
| | | Integer amount = detail1.getAmount(); |
| | | stock.setAmount(amount + num); |
| | | stockService.Updaet(stock); |
| | | //删除 |
| | | soldrService.del(id); |
| | | } |
| | | //如果小于就修改 |
| | | else { |
| | | Soldr soldr = new Soldr(); |
| | | soldr.setSid(id); |
| | | Soldr detail = soldrService.getOne(Condition.getQueryWrapper(soldr)); |
| | | Integer amount1 = detail.getAmount1(); |
| | | soldrecordService.updateSold(amount1 - num, id); |
| | | Stock stock = new Stock(); |
| | | stock.setId(id); |
| | | Stock detail1 = stockService.getOne(Condition.getQueryWrapper(stock)); |
| | | Integer amount = detail1.getAmount(); |
| | | stock.setAmount(amount + num); |
| | | stockService.Updaet(stock); |
| | | } |
| | | return R.success("退回成功"); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.soldr.dto; |
| | | |
| | | import org.springblade.modules.soldr.entity.Soldr; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * 已出库存数量记录表数据传输对象实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2022-05-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class SoldrDTO extends Soldr { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.soldr.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import org.springblade.core.mp.base.BaseEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * 已出库存数量记录表实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2022-05-27 |
| | | */ |
| | | @Data |
| | | @TableName("sys_soldr") |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class Soldr extends BaseEntity { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 农资id |
| | | */ |
| | | private String stockId1; |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Integer amount1; |
| | | private Integer tenantId1; |
| | | /** |
| | | * 规格 |
| | | */ |
| | | private String specs1; |
| | | /** |
| | | * 规格值(0:克 1:斤 2:公斤 3:吨 4:毫升 5:升 ) |
| | | */ |
| | | private Integer specsVal1; |
| | | /** |
| | | * 规格值2( 0:袋 1:包 2:瓶 3:盒 4:箱 5:桶 6:支) |
| | | */ |
| | | private Integer specsVal2; |
| | | /** |
| | | * 出库类型 |
| | | */ |
| | | private String type; |
| | | private Long sid; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.soldr.mapper; |
| | | |
| | | import org.springblade.modules.soldr.entity.Soldr; |
| | | import org.springblade.modules.soldr.vo.SoldrVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.soldrecord.vo.SoldrecordVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 已出库存数量记录表 Mapper 接口 |
| | | * |
| | | * @author BladeX |
| | | * @since 2022-05-27 |
| | | */ |
| | | public interface SoldrMapper extends BaseMapper<Soldr> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param page |
| | | * @param soldr |
| | | * @return |
| | | */ |
| | | List<SoldrVO> selectSoldrPage(IPage page, SoldrVO soldr); |
| | | List<SoldrVO> selectLists(IPage page, SoldrVO soldr); |
| | | void del(Long id); |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.springblade.modules.soldr.mapper.SoldrMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="soldrResultMap" type="org.springblade.modules.soldr.entity.Soldr"> |
| | | <result column="id" property="id"/> |
| | | <result column="create_user" property="createUser"/> |
| | | <result column="create_dept" property="createDept"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_user" property="updateUser"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="status" property="status"/> |
| | | <result column="is_deleted" property="isDeleted"/> |
| | | <result column="stock_id1" property="stockId1"/> |
| | | <result column="amount1" property="amount1"/> |
| | | <result column="tenant_id1" property="tenantId1"/> |
| | | <result column="specs1" property="specs1"/> |
| | | <result column="specs_val1" property="specsVal1"/> |
| | | <result column="specs_val2" property="specsVal2"/> |
| | | <result column="type" property="type"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="selectSoldrPage" resultMap="soldrResultMap"> |
| | | select * from sys_soldr where is_deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectLists" resultType="org.springblade.modules.soldr.vo.SoldrVO"> |
| | | SELECT st.stock_id1, |
| | | st.specs1, |
| | | st.amount1 AS amount1, |
| | | stf.factory_name AS factoryName, |
| | | a.dict_value AS stype, |
| | | d.dict_value AS dic1, |
| | | c.dict_value AS dic2, |
| | | stf.agricultural_name as agrname |
| | | FROM sys_soldr st |
| | | LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_id1 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs1' AND is_deleted = 0) d ON d.dict_key = st.specs_val1 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs2' AND is_deleted = 0) c ON c.dict_key = st.specs_val2 |
| | | LEFT JOIN ( SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'stockType' AND is_deleted = 0 ) a ON |
| | | a.dict_key = stf.type |
| | | WHERE st.is_deleted = 0 |
| | | <if test="soldr.stype!=null and soldr.stype != ''"> |
| | | and stf.type = #{soldr.stype} |
| | | </if> |
| | | <if test="soldr.stockId1!=null and soldr.stockId1 != ''"> |
| | | and st.stock_id1 = #{soldr.stockId1} |
| | | </if> |
| | | </select> |
| | | |
| | | <delete id="del"> |
| | | delete from sys_soldr where sid=#{id} |
| | | </delete> |
| | | </mapper> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.soldr.service; |
| | | |
| | | import org.springblade.modules.soldr.entity.Soldr; |
| | | import org.springblade.modules.soldr.vo.SoldrVO; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | /** |
| | | * 已出库存数量记录表 服务类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2022-05-27 |
| | | */ |
| | | public interface ISoldrService extends BaseService<Soldr> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param page |
| | | * @param soldr |
| | | * @return |
| | | */ |
| | | IPage<SoldrVO> selectSoldrPage(IPage<SoldrVO> page, SoldrVO soldr); |
| | | IPage<SoldrVO> selectLists(IPage<SoldrVO> page, SoldrVO soldr); |
| | | void del(Long id); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.soldr.service.impl; |
| | | |
| | | import org.springblade.modules.soldr.entity.Soldr; |
| | | import org.springblade.modules.soldr.vo.SoldrVO; |
| | | import org.springblade.modules.soldr.mapper.SoldrMapper; |
| | | import org.springblade.modules.soldr.service.ISoldrService; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | /** |
| | | * 已出库存数量记录表 服务实现类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2022-05-27 |
| | | */ |
| | | @Service |
| | | public class SoldrServiceImpl extends BaseServiceImpl<SoldrMapper, Soldr> implements ISoldrService { |
| | | |
| | | @Override |
| | | public IPage<SoldrVO> selectSoldrPage(IPage<SoldrVO> page, SoldrVO soldr) { |
| | | return page.setRecords(baseMapper.selectSoldrPage(page, soldr)); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SoldrVO> selectLists(IPage<SoldrVO> page, SoldrVO soldr) { |
| | | return page.setRecords(baseMapper.selectLists(page, soldr)); |
| | | } |
| | | |
| | | @Override |
| | | public void del(Long id) { |
| | | baseMapper.del(id); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.soldr.vo; |
| | | |
| | | import org.springblade.modules.soldr.entity.Soldr; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * 已出库存数量记录表视图实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2022-05-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class SoldrVO extends Soldr { |
| | | private static final long serialVersionUID = 1L; |
| | | String stype; |
| | | String factoryName; |
| | | String dic1; |
| | | String dic2; |
| | | String dic3; |
| | | String spn; |
| | | String agrname; |
| | | Integer cnum; |
| | | } |
| | |
| | | IPage<SoldrecordVO> pages = soldrecordService.selectLists(Condition.getPage(query), soldrecord); |
| | | for (int i=0;i<pages.getRecords().size();i++){ |
| | | String specs = pages.getRecords().get(i).getSpecs1(); |
| | | Integer amount = pages.getRecords().get(i).getAmount1(); |
| | | Integer num=Integer.parseInt(specs); |
| | | String dic1 = pages.getRecords().get(i).getDic1(); |
| | | String dic2 = pages.getRecords().get(i).getDic2(); |
| | | String s = specs+dic1 +"/"+ dic2; |
| | | pages.getRecords().get(i).setSpn(s); |
| | | pages.getRecords().get(i).setCnum(num*amount); |
| | | |
| | | } |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 查看变更明细 |
| | | */ |
| | | @GetMapping("/pagebg") |
| | | public R<IPage<SoldrecordVO>> pagebg(SoldrecordVO soldrecord, Query query) { |
| | | IPage<SoldrecordVO> pages = soldrecordService.selectListbg(Condition.getPage(query), soldrecord); |
| | | for (int i=0;i<pages.getRecords().size();i++){ |
| | | String specs = pages.getRecords().get(i).getSpecs1(); |
| | | String dic1 = pages.getRecords().get(i).getDic1(); |
| | | String dic2 = pages.getRecords().get(i).getDic2(); |
| | | String s = specs+dic1 +"/"+ dic2; |
| | | pages.getRecords().get(i).setSpn(s); |
| | | } |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 新增 已出库存记录表 |
| | | */ |
| | | @PostMapping("/save") |
| | |
| | | * 规格值2( 0:袋 1:包 2:瓶 3:盒 4:箱 5:桶 6:支) |
| | | */ |
| | | private Integer specsVal2; |
| | | private String type; |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | List<SoldrecordVO> selectSoldrecordPage(IPage page, SoldrecordVO soldrecord); |
| | | List<SoldrecordVO> selectLists(IPage page, SoldrecordVO soldrecord); |
| | | List<SoldrecordVO> selectListbg(IPage page, SoldrecordVO soldrecord); |
| | | void updateSold(Integer amount,Long id); |
| | | void delc(String id); |
| | | } |
| | |
| | | |
| | | |
| | | <select id="selectSoldrecordPage" resultMap="soldrecordResultMap"> |
| | | select * from sys_soldrecord where is_deleted = 0 |
| | | select * |
| | | from sys_soldrecord |
| | | where is_deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectLists" resultType="org.springblade.modules.soldrecord.vo.SoldrecordVO"> |
| | | SELECT st.*, |
| | | stf.factory_name AS factoryName, |
| | | stf.type AS stype, |
| | | d.dict_value AS dic1, |
| | | c.dict_value AS dic2 |
| | | SELECT st.stock_id1, |
| | | st.specs1, |
| | | SUM(st.amount1 ) AS amount1, |
| | | stf.factory_name AS factoryName, |
| | | a.dict_value AS stype, |
| | | d.dict_value AS dic1, |
| | | c.dict_value AS dic2, |
| | | stf.agricultural_name as agrname |
| | | FROM sys_soldrecord st |
| | | LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_id1 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs1' AND is_deleted = 0) d ON d.dict_key = st.specs_val1 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs2' AND is_deleted = 0) c ON c.dict_key = st.specs_val2 |
| | | LEFT JOIN ( SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'stockType' AND is_deleted = 0 ) a ON |
| | | a.dict_key = stf.type |
| | | WHERE st.is_deleted = 0 |
| | | <if test="soldrecord.stype!=null and soldrecord.stype != ''"> |
| | | and stf.type = #{soldrecord.stype} |
| | | </if> |
| | | <if test="soldrecord.stockId1!=null and soldrecord.stockId1 != ''"> |
| | | and st.stock_id1 = #{soldrecord.stockId1} |
| | | </if> |
| | | GROUP BY |
| | | st.stock_id1, |
| | | st.specs1, |
| | | stf.factory_name, |
| | | a.dict_value, |
| | | d.dict_value, |
| | | c.dict_value |
| | | </select> |
| | | <!--查看变更明细--> |
| | | <select id="selectListbg" resultType="org.springblade.modules.soldrecord.vo.SoldrecordVO"> |
| | | SELECT st.stock_id1, |
| | | st.specs1, |
| | | st.amount1, |
| | | stf.factory_name AS factoryName, |
| | | stf.type as stype, |
| | | d.dict_value AS dic1, |
| | | c.dict_value AS dic2, |
| | | b.dict_value AS dic3, |
| | | stf.agricultural_name AS agrname |
| | | FROM sys_soldrecord st |
| | | LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_id1 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs2' AND is_deleted = 0) c ON c.dict_key = st.specs_val2 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockPurchase1' AND is_deleted = 0) b ON b.dict_key = st.type |
| | | WHERE st.is_deleted = 0 |
| | | <if test="soldrecord.stype!=null and soldrecord.stype != ''"> |
| | | and stf.type = #{soldrecord.stype} |
| | | </if> |
| | | <if test="soldrecord.stockId1!=null and soldrecord.stockId1 != ''"> |
| | | and st.stock_id1 = #{soldrecord.stockId1} |
| | | </if> |
| | | </select> |
| | | |
| | | <update id="updateSold"> |
| | | update sys_soldr set amount1=#{amount} where sid = #{id} |
| | | </update> |
| | | |
| | | <delete id="delc"> |
| | | delete from sys_soldrecord where stock_id1 = #{id} |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | */ |
| | | IPage<SoldrecordVO> selectSoldrecordPage(IPage<SoldrecordVO> page, SoldrecordVO soldrecord); |
| | | IPage<SoldrecordVO> selectLists(IPage<SoldrecordVO> page, SoldrecordVO soldrecord); |
| | | IPage<SoldrecordVO> selectListbg(IPage<SoldrecordVO> page, SoldrecordVO soldrecord); |
| | | void updateSold(Integer amount,Long id); |
| | | void delc(String id); |
| | | } |
| | |
| | | return page.setRecords(baseMapper.selectLists(page,soldrecord)); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SoldrecordVO> selectListbg(IPage<SoldrecordVO> page, SoldrecordVO soldrecord) { |
| | | return page.setRecords(baseMapper.selectListbg(page,soldrecord)); |
| | | } |
| | | |
| | | @Override |
| | | public void updateSold(Integer amount,Long id) { |
| | | baseMapper.updateSold(amount,id); |
| | | } |
| | | |
| | | @Override |
| | | public void delc(String id) { |
| | | baseMapper.delc(id); |
| | | } |
| | | |
| | | } |
| | |
| | | String factoryName; |
| | | String dic1; |
| | | String dic2; |
| | | String dic3; |
| | | String spn; |
| | | String agrname; |
| | | Integer cnum; |
| | | } |
| | |
| | | IPage<StockVO> pages = stockService.selectLists(Condition.getPage(query), stock); |
| | | for (int i=0;i<pages.getRecords().size();i++){ |
| | | String specs = pages.getRecords().get(i).getSpecs(); |
| | | Integer amount = pages.getRecords().get(i).getAmount(); |
| | | Integer num=Integer.parseInt(specs); |
| | | String dic1 = pages.getRecords().get(i).getDic1(); |
| | | String dic2 = pages.getRecords().get(i).getDic2(); |
| | | String s = specs+dic1 +"/"+ dic2; |
| | | pages.getRecords().get(i).setSpn(s); |
| | | pages.getRecords().get(i).setCnum(num*amount); |
| | | |
| | | } |
| | | return R.data(pages); |
| | |
| | | stock.setState("0"); |
| | | stock.setSp1("stockSpecs1"); |
| | | stock.setSp2("stockSpecs2"); |
| | | boolean save = stockService.save(stock); |
| | | //农资记录表 |
| | | Stockrecord stockrecord =new Stockrecord(); |
| | | //农资ID |
| | | stockrecord.setSid(stock.getId()); |
| | | stockrecord.setStockId1(stock.getStockId()); |
| | | stockrecord.setAmount1(stock.getAmount()); |
| | | stockrecord.setTime1(stock.getTime()); |
| | |
| | | stockrecord.setSp1("stockSpecs1"); |
| | | stockrecord.setSp2("stockSpecs2"); |
| | | stockrecordService.save(stockrecord); |
| | | return R.status(stockService.save(stock)); |
| | | return R.status(save); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<StockVO> selectStockPage(IPage page, StockVO stock); |
| | | List<StockVO> selectLists(IPage page, StockVO stock); |
| | | int UpdaeAmountc(@Param("stock") Stock stock); |
| | | int Updaet(@Param("stock") Stock stock); |
| | | } |
| | |
| | | <select id="selectLists" resultType="org.springblade.modules.stock.vo.StockVO"> |
| | | SELECT st.*, |
| | | stf.factory_name AS factoryName, |
| | | stf.type AS stype, |
| | | a.dict_value AS stype, |
| | | d.dict_value AS dic1, |
| | | c.dict_value AS dic2 |
| | | c.dict_value AS dic2, |
| | | stf.agricultural_name as agrname |
| | | FROM sys_stock st |
| | | LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_id |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs2' AND is_deleted = 0) c ON c.dict_key = st.specs_value2 |
| | | WHERE st.is_deleted = 0 |
| | | LEFT JOIN ( SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'stockType' AND is_deleted = 0 ) a ON |
| | | a.dict_key = stf.type |
| | | WHERE st.is_deleted = 0 and state=0 |
| | | <if test="stock.stype!=null and stock.stype != ''"> |
| | | and stf.type = #{stock.stype} |
| | | </if> |
| | |
| | | <if test="stock.type!=null and stock.type != ''"> |
| | | and st.type = #{stock.type} |
| | | </if> |
| | | <if test="stock.agrname!=null and stock.agrname != ''"> |
| | | and stf.agricultural_name like concat('%', #{stock.agrname},'%') |
| | | </if> |
| | | </select> |
| | | <!--入库出库--> |
| | | <update id="UpdaeAmountc"> |
| | | update sys_stock set amount = #{stock.amount} ,state=#{stock.state} where stock_id=#{stock.stockId} |
| | | update sys_stock set amount = #{stock.amount} ,state=#{stock.state} where id=#{stock.id} |
| | | </update> |
| | | |
| | | <!--入库出库--> |
| | | <update id="Updaet"> |
| | | update sys_stock set amount = #{stock.amount} where id=#{stock.id} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | IPage<StockVO> selectStockPage(IPage<StockVO> page, StockVO stock); |
| | | IPage<StockVO> selectLists(IPage<StockVO> page, StockVO stock); |
| | | boolean UpdaeAmountc(Stock stock); |
| | | boolean Updaet(Stock stock); |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean Updaet(Stock stock) { |
| | | //更新 |
| | | int i = baseMapper.Updaet(stock); |
| | | if (i>0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | |
| | | String dic1; |
| | | String dic2; |
| | | String spn; |
| | | String agrname; |
| | | Integer cnum; |
| | | |
| | | } |
| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.soldr.entity.Soldr; |
| | | import org.springblade.modules.soldr.service.ISoldrService; |
| | | import org.springblade.modules.soldrecord.entity.Soldrecord; |
| | | import org.springblade.modules.soldrecord.service.ISoldrecordService; |
| | | import org.springblade.modules.stock.entity.Stock; |
| | |
| | | private final IStockService stockService; |
| | | private final IDictBizService dictService; |
| | | private final ISoldrecordService soldrecordService; |
| | | private final ISoldrService soldrService; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | |
| | | //当前总量 |
| | | int i = num - amount1; |
| | | Stock stock = new Stock(); |
| | | stock.setStockId(stockrecord.getStockId1()); |
| | | stock.setId(stockrecord.getSid()); |
| | | stock.setAmount(i); |
| | | if (i == 0) { |
| | | stock.setState("1"); |
| | | stockService.UpdaeAmountc(stock); |
| | | //同时删除所有农资记录 |
| | | soldrecordService.delc(stockrecord.getStockId1()); |
| | | soldrService.del(stockrecord.getSid()); |
| | | } else { |
| | | stock.setState("0"); |
| | | stockService.UpdaeAmountc(stock); |
| | |
| | | soldrecord.setSpecs1(stockrecord.getSpecs1()); |
| | | soldrecord.setSpecsVal1(stockrecord.getSpecsVal1()); |
| | | soldrecord.setSpecsVal2(stockrecord.getSpecsVal2()); |
| | | soldrecordService.save(soldrecord); |
| | | soldrecord.setType(stockrecord.getType1()); |
| | | String type1 = stockrecord.getType1(); |
| | | if (type1.equals("0")) { |
| | | //已出库农资数量记录 |
| | | Soldr soldr = new Soldr(); |
| | | soldr.setSid(stockrecord.getSid()); |
| | | soldr.setStockId1(stockrecord.getStockId1()); |
| | | soldr.setStockId1(stockrecord.getStockId1()); |
| | | soldr.setAmount1(amount1); |
| | | soldr.setSpecs1(stockrecord.getSpecs1()); |
| | | soldr.setSpecsVal1(stockrecord.getSpecsVal1()); |
| | | soldr.setSpecsVal2(stockrecord.getSpecsVal2()); |
| | | soldr.setType(stockrecord.getType1()); |
| | | //已出库农资数量 |
| | | Soldr detail = soldrService.getOne(Condition.getQueryWrapper(soldr)); |
| | | if (null != detail) { |
| | | Integer amount11 = detail.getAmount1(); |
| | | soldrecordService.updateSold(amount11 + amount1, detail.getSid()); |
| | | } else { |
| | | soldrService.save(soldr); |
| | | } |
| | | //已出库农资 |
| | | soldrecordService.save(soldrecord); |
| | | } |
| | | } |
| | | //入库 |
| | | else { |
| | |
| | | //当前总量 |
| | | int i = num + amount1; |
| | | Stock stock = new Stock(); |
| | | stock.setStockId(stockrecord.getStockId1()); |
| | | stock.setId(stockrecord.getSid()); |
| | | stock.setAmount(i); |
| | | stock.setState("0"); |
| | | stockService.UpdaeAmountc(stock); |
| | |
| | | private Integer stockType1; |
| | | private String sp1; |
| | | private String sp2; |
| | | private Long sid; |
| | | } |
| New file |
| | |
| | | INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
| | | VALUES ('1530028300817145857', 1123598815738675201, 'soldr', '出入库农资数量管理', 'menu', '/soldr/soldr', NULL, 1, 1, 0, 1, NULL, 0); |
| | | INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
| | | VALUES ('1530028300817145858', '1530028300817145857', 'soldr_add', '新增', 'add', '/soldr/soldr/add', 'plus', 1, 2, 1, 1, NULL, 0); |
| | | INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
| | | VALUES ('1530028300817145859', '1530028300817145857', 'soldr_edit', '修改', 'edit', '/soldr/soldr/edit', 'form', 2, 2, 2, 1, NULL, 0); |
| | | INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
| | | VALUES ('1530028300817145860', '1530028300817145857', 'soldr_delete', '删除', 'delete', '/api/soldr/soldr/remove', 'delete', 3, 2, 3, 1, NULL, 0); |
| | | INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
| | | VALUES ('1530028300817145861', '1530028300817145857', 'soldr_view', '查看', 'view', '/soldr/soldr/view', 'file-text', 4, 2, 2, 1, NULL, 0); |