diff --git a/java/local/src/main/java/cn/toesbieya/jxc/controller/BizStockController.java b/java/local/src/main/java/cn/toesbieya/jxc/controller/ReagentController.java similarity index 58% rename from java/local/src/main/java/cn/toesbieya/jxc/controller/BizStockController.java rename to java/local/src/main/java/cn/toesbieya/jxc/controller/ReagentController.java index e7a6c68..fa82527 100644 --- a/java/local/src/main/java/cn/toesbieya/jxc/controller/BizStockController.java +++ b/java/local/src/main/java/cn/toesbieya/jxc/controller/ReagentController.java @@ -1,29 +1,30 @@ package cn.toesbieya.jxc.controller; -import cn.toesbieya.jxc.model.vo.search.StockSearch; -import cn.toesbieya.jxc.service.BizStockService; import cn.toesbieya.jxc.model.vo.R; +import cn.toesbieya.jxc.model.vo.search.ReagentSearch; +import cn.toesbieya.jxc.service.ReagentService; + import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; @RestController -@RequestMapping("stock/current") -public class BizStockController { +@RequestMapping("stock/reagent") +public class ReagentController { + @Resource - private BizStockService service; + private ReagentService service; @PostMapping("search") - public R search(@RequestBody StockSearch vo) { + public R search(@RequestBody ReagentSearch vo) { return R.success(service.search(vo)); } @GetMapping("getDetail") - public R getDetail(@RequestParam String cids) { - if (StringUtils.isEmpty(cids)) return R.fail("参数错误"); - return R.success(service.getDetail(cids)); + public R getDetail(@RequestParam String name) { + if (StringUtils.isEmpty(name)) return R.fail("参数错误"); + return R.success(service.getDetail(name)); } @GetMapping("getDetailById") @@ -32,8 +33,8 @@ public class BizStockController { return R.success(service.getDetailById(ids)); } - @PostMapping("export") + /*@PostMapping("export") public void export(@RequestBody StockSearch vo, HttpServletResponse response) throws Exception { service.export(vo, response); - } + }*/ } diff --git a/java/local/src/main/java/cn/toesbieya/jxc/mapper/ReagentMapper.java b/java/local/src/main/java/cn/toesbieya/jxc/mapper/ReagentMapper.java new file mode 100644 index 0000000..730cfda --- /dev/null +++ b/java/local/src/main/java/cn/toesbieya/jxc/mapper/ReagentMapper.java @@ -0,0 +1,24 @@ +package cn.toesbieya.jxc.mapper; + +import cn.toesbieya.jxc.model.entity.ReagentInfo; +import cn.toesbieya.jxc.model.vo.result.ReagentResult; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; + +import java.util.List; + +public interface ReagentMapper extends BaseMapper { + + //List search(@Param(Constants.WRAPPER) Wrapper wrapper); + + +/* + // List export(@Param(Constants.WRAPPER) Wrapper wrapper); + + int insertBatch(@Param("list") List list); + + int outbound(@Param("id") Integer id, @Param("quantity") Integer num); +*/ + +} diff --git a/java/local/src/main/java/cn/toesbieya/jxc/model/entity/ReagentInfo.java b/java/local/src/main/java/cn/toesbieya/jxc/model/entity/ReagentInfo.java new file mode 100644 index 0000000..86490a2 --- /dev/null +++ b/java/local/src/main/java/cn/toesbieya/jxc/model/entity/ReagentInfo.java @@ -0,0 +1,114 @@ +package cn.toesbieya.jxc.model.entity; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import javax.persistence.Column; +import java.io.Serializable; + +/** + * reagent_info + * @author 强子烨 + */ +@Getter +@Setter +@ToString +public class ReagentInfo implements Serializable { + /** + * 试剂id + */ + private Integer id; + + /** + * 名称 + */ + private String name; + + /** + * 生产日期 + */ + private Long productionDate; + + /** + * 有效期(天) + */ + private Integer effective; + + /** + * 产品批次 + */ + private String batch; + + /** + * 数量 + */ + private Integer quantity; + + /** + * 货位 + */ + private String location; + + /** + * 仓库 + */ + private String storehouse; + + /** + * 规格 + */ + private String specification; + + /** + * 单位 + */ + private String unit; + + /** + * 状态,0停用,1启用 + */ + private Boolean enable = false; + + /** + * 创建人id + */ + private Integer creatorId; + + /** + * 创建时间 + */ + private Long createTime; + + /** + * 修改人id + */ + private Integer updateId; + + /** + * 修改时间 + */ + private Long updateTime; + + /** + * 备注 + */ + private String remark; + + /** + * 试剂厂商 + */ + @Column + private String manufacture; + /** + * 试剂类型 + */ + @Column + private String type; + /** + * 危险说明 + */ + @Column + private String risk; + +} \ No newline at end of file diff --git a/java/local/src/main/java/cn/toesbieya/jxc/model/vo/result/ReagentResult.java b/java/local/src/main/java/cn/toesbieya/jxc/model/vo/result/ReagentResult.java new file mode 100644 index 0000000..527f540 --- /dev/null +++ b/java/local/src/main/java/cn/toesbieya/jxc/model/vo/result/ReagentResult.java @@ -0,0 +1,13 @@ +package cn.toesbieya.jxc.model.vo.result; + +import lombok.Data; + +@Data +public class ReagentResult { + private Integer id; + private String name; //试剂名称(名称不唯一) + private String storehouse; //仓库名称 + private String location; //货位名称 + private Integer quantity; //库存数量 + private String unit; //单位 +} diff --git a/java/local/src/main/java/cn/toesbieya/jxc/model/vo/search/ReagentSearch.java b/java/local/src/main/java/cn/toesbieya/jxc/model/vo/search/ReagentSearch.java new file mode 100644 index 0000000..2e16956 --- /dev/null +++ b/java/local/src/main/java/cn/toesbieya/jxc/model/vo/search/ReagentSearch.java @@ -0,0 +1,17 @@ +package cn.toesbieya.jxc.model.vo.search; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class ReagentSearch extends BaseSearch{ + + private String name; + private String manufacture; + private String type; + private String risk; + +} diff --git a/java/local/src/main/java/cn/toesbieya/jxc/service/ReagentService.java b/java/local/src/main/java/cn/toesbieya/jxc/service/ReagentService.java new file mode 100644 index 0000000..8f55535 --- /dev/null +++ b/java/local/src/main/java/cn/toesbieya/jxc/service/ReagentService.java @@ -0,0 +1,93 @@ +package cn.toesbieya.jxc.service; + +import cn.toesbieya.jxc.mapper.ReagentMapper; +import cn.toesbieya.jxc.model.entity.ReagentInfo; +import cn.toesbieya.jxc.model.vo.result.PageResult; +import cn.toesbieya.jxc.model.vo.search.ReagentSearch; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageHelper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.util.List; + +@Service +@Slf4j +public class ReagentService { + @Resource + private ReagentMapper mapper; + + /*private final ExcelUtil.CommonMergeOptions mergeOptions = + new ExcelUtil.CommonMergeOptions( + new String[]{"id", "cname", "totalNum", "totalPrice", "cgddid", "cgPrice", "cgNum"}, + "cid", + "id" + );*/ + + + public PageResult search(ReagentSearch vo) { + PageHelper.startPage(vo.getPage(), vo.getPageSize()); + return new PageResult<>(getByCondition(vo)); + } + + public List getByCondition(ReagentSearch vo) { + return mapper.selectList(getSearchCondition(vo)); + } + + public List getDetail(String name) { + return mapper.selectList( + Wrappers.lambdaQuery(ReagentInfo.class) + .eq(!StringUtils.isEmpty(name), ReagentInfo::getName, name) + .gt(ReagentInfo::getQuantity, 0) + //.orderByDesc(ReagentInfo::getCgddid, ReagentInfo::getCgrkid) + ); + } + + public List getDetailById(String ids) { + return mapper.selectList( + Wrappers.lambdaQuery(ReagentInfo.class) + .inSql(!StringUtils.isEmpty(ids), ReagentInfo::getId, ids) + ); + } + + /*public void export(ReagentSearch vo, HttpServletResponse response) throws Exception { + List list = mapper.export(getSearchCondition(vo)); + ExcelUtil.export(list, response, "库存导出", mergeOptions); + }*/ + + + private Wrapper getSearchCondition(ReagentSearch vo) { + String name = vo.getName(); + String manufacture = vo.getManufacture(); + String type = vo.getType(); + String risk = vo.getRisk(); + + return Wrappers.lambdaQuery(ReagentInfo.class) + .inSql(!StringUtils.isEmpty(name), ReagentInfo::getId, name) + .inSql(!StringUtils.isEmpty(manufacture), ReagentInfo::getManufacture, manufacture) + .inSql(!StringUtils.isEmpty(type), ReagentInfo::getType, type) + .inSql(!StringUtils.isEmpty(risk), ReagentInfo::getRisk, risk); + + + /*String ids = vo.getIds(); + String cids = vo.getCids(); + String cgddids = vo.getCgddids(); + String cgrkids = vo.getCgrkids(); + Long startTime = vo.getStartTime(); + Long endTime = vo.getEndTime(); + + return Wrappers.lambdaQuery(ReagentInfo.class) + .inSql(!StringUtils.isEmpty(ids), ReagentInfo::getId, ids) + .inSql(!StringUtils.isEmpty(cids), ReagentInfo::getCid, cids) + .inSql(!StringUtils.isEmpty(cgddids), ReagentInfo::getCgddid, cgddids) + .inSql(!StringUtils.isEmpty(cgrkids), ReagentInfo::getCgrkid, cgrkids) + .gt(ReagentInfo::getNum, 0) + .ge(startTime != null, ReagentInfo::getCtime, startTime) + .le(endTime != null, ReagentInfo::getCtime, endTime);*/ + + } +} + diff --git a/java/local/src/main/resources/mapper/Reagent.xml b/java/local/src/main/resources/mapper/Reagent.xml new file mode 100644 index 0000000..ce6ce1a --- /dev/null +++ b/java/local/src/main/resources/mapper/Reagent.xml @@ -0,0 +1,55 @@ + + + + + + + \ No newline at end of file diff --git a/vue/full/src/api/stock/current.js b/vue/full/src/api/stock/current.js index d2a37aa..5c3ecc8 100644 --- a/vue/full/src/api/stock/current.js +++ b/vue/full/src/api/stock/current.js @@ -1,7 +1,7 @@ import {GetApi, PostApi} from "@/api/request" -export const search = new PostApi(`/stock/current/search`) +export const search = new PostApi(`/stock/reagent/search`) -export const getDetail = new GetApi(`/stock/current/getDetail`, cids => ({params: {cids}})) +export const getDetail = new GetApi(`/stock/reagent/getDetail`, name => ({params: {name}})) -export const getDetailById = new GetApi(`/stock/current/getDetailById`, ids => ({params: {ids}})) +export const getDetailById = new GetApi(`/stock/reagent/getDetailById`, id => ({params: {id}})) diff --git a/vue/full/src/router/module/admin/child/stock.js b/vue/full/src/router/module/admin/child/stock.js index 83ad114..2e9735a 100644 --- a/vue/full/src/router/module/admin/child/stock.js +++ b/vue/full/src/router/module/admin/child/stock.js @@ -1,9 +1,9 @@ /*路由表:库存管理*/ const router = { - path: 'current', - name: 'currentStock', - component: 'admin/stock/current/', + path: 'reagent', + name: 'reagentStock', + component: 'admin/stock/reagent/', meta: {title:'库存管理', icon: 'svg-stock'}, } diff --git a/vue/full/src/view/admin/stock/current/DetailDialog.vue b/vue/full/src/view/admin/stock/reagent/DetailDialog.vue similarity index 59% rename from vue/full/src/view/admin/stock/current/DetailDialog.vue rename to vue/full/src/view/admin/stock/reagent/DetailDialog.vue index 7a1452d..d828a7e 100644 --- a/vue/full/src/view/admin/stock/current/DetailDialog.vue +++ b/vue/full/src/view/admin/stock/reagent/DetailDialog.vue @@ -1,7 +1,6 @@ @@ -54,7 +65,7 @@ export default { components: {AbstractTable, LinerProgress, AbstractDialog}, - props: {value: Boolean, title: String, cid: Number}, + props: {value: Boolean, title: String, name: String}, data() { return { @@ -65,10 +76,10 @@ export default { methods: { summary({data}) { - let sum = ['合计', '', '', '', 0, 0] + let sum = ['合计', '', '', '', '', '', '', 0, 0] data.forEach(i => { sum[4] = plus(sum[4], i.num) - sum[5] = plus(sum[5], i.total) + //sum[5] = plus(sum[5], i.total) }) return sum }, @@ -80,31 +91,31 @@ export default { }, search() { - this.tableData = [] - if (!this.value || isEmpty(this.cid) || this.loading) return + if (!this.value || isEmpty(this.name) || this.loading) return this.loading = true getDetail - .request(this.cid) + .request(this.name) .then(({data}) => { - this.prepareData(data) + //this.prepareData(data) this.tableData = data }) .finally(() => this.loading = false) }, prepareData(data) { - data.sort((a, b) => { + //根据采购订单id 排序 + /*data.sort((a, b) => { if (a.cgddid > b.cgddid) return -1 if (a.cgddid < b.cgddid) return 1 return 0 - }) + })*/ const count = {} data.forEach(i => { - i.total = mul(i.num, i.price) + //i.total = mul(i.num, i.price) i._span = {rowspan: 0, colspan: 0} - count[i.cgddid] ? count[i.cgddid]++ : count[i.cgddid] = 1 + //count[i.cgddid] ? count[i.cgddid]++ : count[i.cgddid] = 1 }) - for (let i = 0; i < data.length; i++) { + /*for (let i = 0; i < data.length; i++) { let num = count[data[i].cgddid] if (num === 1) { data[i]._span = {rowspan: 1, colspan: 1} @@ -113,7 +124,7 @@ export default { data[i]._span = {rowspan: num, colspan: 1} i += num - 1 } - } + }*/ }, cancel() { diff --git a/vue/full/src/view/admin/stock/current/indexPage.vue b/vue/full/src/view/admin/stock/reagent/indexPage.vue similarity index 53% rename from vue/full/src/view/admin/stock/current/indexPage.vue rename to vue/full/src/view/admin/stock/reagent/indexPage.vue index 70e2cde..be17b3c 100644 --- a/vue/full/src/view/admin/stock/current/indexPage.vue +++ b/vue/full/src/view/admin/stock/reagent/indexPage.vue @@ -5,7 +5,7 @@ - - - + + + - - + + + + - - + + + + + + + + + + - + @@ -47,18 +66,25 @@ :summary-method="summary" > - - {{ row.cname }} + + + {{ row.name }} - - + + + + + + + + - + @@ -75,7 +101,7 @@ import {plus} from "@/util/math" import {getNodeId} from "@/util/tree" export default { - name: "currentStock", + name: "reagentStock", mixins: [tableMixin], @@ -84,50 +110,52 @@ export default { data() { return { searchForm: { - cids: null, - cgddids: null, - cgrkids: null + names: null, + manufacture: null, + type: null, + risk: null }, temp: { filter: '', - cname: null, - cids: null, - ctime: [] + names: null, }, detailDialog: false, + //导出表格 excel: { columns: [ {header: '序号', prop: 'id', width: 20, merge: true}, - {header: '分类名称', prop: 'cname', width: 20, merge: true}, + {header: '试剂', prop: 'name', width: 20, merge: true}, + {header: '货位', prop: 'location', width: 20, merge: true}, + {header: '仓库', prop: 'storehouse', width: 20, merge: true}, {header: '库存总数', prop: 'totalNum', width: 20, merge: true}, - {header: '库存总值', prop: 'totalPrice', width: 20, merge: true}, - {header: '采购订单号', prop: 'cgddid', width: 20, merge: true}, - {header: '采购单价', prop: 'cgPrice', width: 20, merge: true}, - {header: '采购数量', prop: 'cgNum', width: 20, merge: true}, - {header: '采购入库单号', prop: 'cgrkid', width: 20}, - {header: '入库时间', prop: 'ctime', width: 20}, - {header: '入库数量', prop: 'rkNum', width: 20}, + {header: '单位', prop: 'unit', width: 20, merge: true}, + + {header: '产品批次', prop: 'batch', width: 20, merge: true}, + {header: '规格', prop: 'specification', width: 20, merge: true}, + {header: '生产日期', prop: 'productionDate', width: 20, merge: true}, + {header: '有效期(天)', prop: 'effective', width: 20, merge: true}, + ], - merge: {primaryKey: 'cid', orderKey: 'id'} + merge: {primaryKey: 'name', orderKey: 'id'} } } }, computed: { title() { - return this.row ? `库存详细(${this.row.cname})` : '' + return this.row ? `库存详细(${this.row.name})` : '' }, - cid() { - return this.row ? this.row.cid : null + name() { + return this.row ? this.row.name : null } }, methods: { summary({data}) { - let sum = ['合计', '', '', 0] + let sum = ['合计', '', '', '', '', ''] data.forEach(i => { - sum[3] = plus(sum[3], i.totalPrice) + sum[4] = plus(sum[4], i.totalNum) //将总值改为总数量 }) return sum }, @@ -141,19 +169,19 @@ export default { this.$refs.tree.filter(v) }, - mergeSearchForm() { + /*mergeSearchForm() { return { ...this.searchForm, - startTime: this.temp.ctime ? this.temp.ctime[0] : null, - endTime: this.temp.ctime ? this.temp.ctime[1] + 86400000 : null + //startTime: this.temp.ctime ? this.temp.ctime[0] : null, + //endTime: this.temp.ctime ? this.temp.ctime[1] + 86400000 : null } - }, + },*/ search() { if (this.config.loading) return this.config.loading = true search - .request(this.mergeSearchForm()) + .request(this.searchForm) .then(({data: {list, total}}) => { this.searchForm.total = total this.tableData = list @@ -168,13 +196,13 @@ export default { nodeClick(obj) { const ids = getNodeId(obj.children) ids.unshift(obj.id) - this.searchForm.cids = ids.join(',') - this.temp.cname = obj.name + this.searchForm.names = ids.join(',') + this.temp.name = obj.name }, - clearCidSearch() { - this.searchForm.cids = null - this.temp.cname = null + clearNameSearch() { + this.searchForm.names = null + this.temp.name = null let tree = this.$refs.tree.$refs.tree tree.setCurrentKey() }, @@ -182,6 +210,7 @@ export default { more(row) { this.row = row this.detailDialog = true + } },