diff --git a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWcsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWcsServiceImpl.java index 21d84cc..bc16a32 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWcsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/api/service/impl/ToWcsServiceImpl.java @@ -223,18 +223,28 @@ public class ToWcsServiceImpl implements IToWcsService { } if (ObjUtil.isNull(basCargoSpace)) { if ("1519".equals(basCargoSpaceParam.getCargoHight())){ - return AjaxResult.error("没有空货位"); - } - //去除排的条件 再次查询货位 - basCargoSpaceParam.setThePlatoon(null); - basCargoSpaceParam.setRule1(null); - basCargoSpaceParam.setRule2(null); - basCargoSpaceParam.setTheFloor(null); - basCargoSpaceParam.setCargoHight(null); - basCargoSpace = basCargoSpaceService.selectEmptyCargoSpaceByWarehouseId(basCargoSpaceParam); - if (ObjUtil.isNull(basCargoSpace)) { - return AjaxResult.error("没有空货位"); + basCargoSpaceParam.setThePlatoon(null); + basCargoSpaceParam.setRule1(null); + basCargoSpaceParam.setRule2(null); + //basCargoSpaceParam.setTheFloor(null); + //basCargoSpaceParam.setCargoHight(null); + basCargoSpace = basCargoSpaceService.selectEmptyCargoSpaceByWarehouseId(basCargoSpaceParam); + if (ObjUtil.isNull(basCargoSpace)) { + return AjaxResult.error("没有空货位"); + } + }else { + //去除排的条件 再次查询货位 + basCargoSpaceParam.setThePlatoon(null); + basCargoSpaceParam.setRule1(null); + basCargoSpaceParam.setRule2(null); + basCargoSpaceParam.setTheFloor(null); + basCargoSpaceParam.setCargoHight(null); + basCargoSpace = basCargoSpaceService.selectEmptyCargoSpaceByWarehouseId(basCargoSpaceParam); + if (ObjUtil.isNull(basCargoSpace)) { + return AjaxResult.error("没有空货位"); + } } + } //修改作业状态为正执行 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/bas/cargoSpace/controller/BasCargoSpaceController.java b/ruoyi-admin/src/main/java/com/ruoyi/bas/cargoSpace/controller/BasCargoSpaceController.java index 5c1db48..3c21119 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/bas/cargoSpace/controller/BasCargoSpaceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/bas/cargoSpace/controller/BasCargoSpaceController.java @@ -92,7 +92,7 @@ public class BasCargoSpaceController extends BaseController /** * 修改库存信息 */ - @PreAuthorize("@ss.hasPermi('bas:Cargospace:edit')") + @PreAuthorize("@ss.hasPermi('bas:cargoSpace:edit')") @Log(title = "库存信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody BasCargoSpace basCargoSpace) @@ -103,7 +103,7 @@ public class BasCargoSpaceController extends BaseController /** * 删除库存信息 */ - @PreAuthorize("@ss.hasPermi('bas:Cargospace:remove')") + @PreAuthorize("@ss.hasPermi('bas:cargoSpace:remove')") @Log(title = "库存信息", businessType = BusinessType.DELETE) @DeleteMapping("/{cargoSpaceIds}") public AjaxResult remove(@PathVariable String[] cargoSpaceIds) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/bas/cargoSpace/service/impl/BasCargoSpaceServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/bas/cargoSpace/service/impl/BasCargoSpaceServiceImpl.java index b0ce643..e9c8009 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/bas/cargoSpace/service/impl/BasCargoSpaceServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/bas/cargoSpace/service/impl/BasCargoSpaceServiceImpl.java @@ -9,10 +9,14 @@ import com.ruoyi.bas.cargoSpace.mapper.BasCargoSpaceMapper; import com.ruoyi.bas.cargoSpace.service.IBasCargoSpaceService; import com.ruoyi.bas.warehouse.domain.BasWarehouse; import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Optional; /** * 库存信息Service业务层处理 @@ -47,7 +51,34 @@ public class BasCargoSpaceServiceImpl extends ServiceImpl selectBasCargoSpaceList(BasCargoSpace basCargoSpace) - { + {if (!"admin".equals(SecurityUtils.getUsername())){ + LoginUser loginUser = SecurityUtils.getLoginUser(); + List roles = loginUser.getUser().getRoles(); + + //入库需要查看本部门任务 + Optional first = roles.stream().filter(x -> "role1".equals(x.getRoleKey())).findFirst(); + if (first.isPresent()){ + //二联合普通人员 + basCargoSpace.setWarehouseId("02"); + + } + Optional first1 = roles.stream().filter(x -> "role2".equals(x.getRoleKey())).findFirst(); + if (first1.isPresent()){ + //三联合普通人员 + basCargoSpace.setWarehouseId("01"); + + } + Optional first2 = roles.stream().filter(x -> "role3".equals(x.getRoleKey())).findFirst(); + if (first2.isPresent()){ + //二联合管理员 + basCargoSpace.setWarehouseId("02"); + } + Optional first3 = roles.stream().filter(x -> "role4".equals(x.getRoleKey())).findFirst(); + if (first3.isPresent()){ + //三联合管理员 + basCargoSpace.setWarehouseId("01"); + } + } return basCargoSpaceMapper.selectBasCargoSpaceList(basCargoSpace); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/impl/MydoJobServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/impl/MydoJobServiceImpl.java index 81fa6e3..450324f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/impl/MydoJobServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/job/mydojob/service/impl/MydoJobServiceImpl.java @@ -533,37 +533,42 @@ public class MydoJobServiceImpl implements IMydoJobService { log.error("任务不存在"); return AjaxResult.error(job.getTrayCode()+"该托盘任务不存在"); } - MydoJobDetail mydoJobDetail = new MydoJobDetail(); - mydoJobDetail.setJobId(jobId); - List mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetail); - for (MydoJobDetail detail : mydoJobDetails) { - //修改库存的出库数量 - BasStock basStock = basStockMapper.selectBasStockByStockId(detail.getStockId()); - if (basStock != null) { - BigDecimal outQuantity = Convert.toBigDecimal(basStock.getOutQuantity()); - BigDecimal substract = outQuantity.subtract(Convert.toBigDecimal(detail.getOutQuantity())); - basStock.setOutQuantity(String.valueOf(substract)); - basStockMapper.updateBasStock(basStock); + if (job.getStatus().equals("1")){ + MydoJobDetail mydoJobDetail = new MydoJobDetail(); + mydoJobDetail.setJobId(jobId); + List mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetail); + for (MydoJobDetail detail : mydoJobDetails) { + //修改库存的出库数量 + BasStock basStock = basStockMapper.selectBasStockByStockId(detail.getStockId()); + if (basStock != null) { + BigDecimal outQuantity = Convert.toBigDecimal(basStock.getOutQuantity()); + BigDecimal substract = outQuantity.subtract(Convert.toBigDecimal(detail.getOutQuantity())); + basStock.setOutQuantity(String.valueOf(substract)); + basStockMapper.updateBasStock(basStock); + } + //修改单据数量 + OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByStockoutDetailId(detail.getInOrOutDId()); + if (outStockoutDetail != null) { + BigDecimal allotQuantity = outStockoutDetail.getAllotQuantity(); + BigDecimal substract = allotQuantity.subtract(Convert.toBigDecimal(detail.getOutQuantity())); + outStockoutDetail.setAllotQuantity(substract); + outStockoutDetailService.updateOutStockoutDetail(outStockoutDetail); + } } - //修改单据数量 - OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByStockoutDetailId(detail.getInOrOutDId()); - if (outStockoutDetail != null) { - BigDecimal allotQuantity = outStockoutDetail.getAllotQuantity(); - BigDecimal substract = allotQuantity.subtract(Convert.toBigDecimal(detail.getOutQuantity())); - outStockoutDetail.setAllotQuantity(substract); - outStockoutDetailService.updateOutStockoutDetail(outStockoutDetail); + //修改货位状态 + BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(job.getCargoSpaceId()); + if (cargoSpace != null) { + cargoSpace.setStatus("2"); + basCargoSpaceService.updateBasCargoSpace(cargoSpace); } + job.setStatus("5"); + job.setFinishTime(DateUtil.formatDateTime(DateUtil.date())); + updateMydoJob(job); + insertHistory(jobId); + }else { + return AjaxResult.error(job.getTrayCode()+"该托盘任务已发送堆垛机,无法作废"); } - //修改货位状态 - BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(job.getCargoSpaceId()); - if (cargoSpace != null) { - cargoSpace.setStatus("2"); - basCargoSpaceService.updateBasCargoSpace(cargoSpace); - } - job.setStatus("5"); - job.setFinishTime(DateUtil.formatDateTime(DateUtil.date())); - updateMydoJob(job); - insertHistory(jobId); + } } catch (Exception e) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/kpi/service/impl/KpiServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/kpi/service/impl/KpiServiceImpl.java index 0fa7c04..4bccbb0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/kpi/service/impl/KpiServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/kpi/service/impl/KpiServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.kpi.service.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; @@ -8,6 +9,7 @@ import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace; import com.ruoyi.bas.cargoSpace.mapper.BasCargoSpaceMapper; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.job.mydojob.domain.MydoJob; @@ -297,6 +299,34 @@ public class KpiServiceImpl implements KpiService // 新增:根据仓库和巷道统计各状态货位数量(用于前端饼图) @Override public Map getSpaceStatusCounts(String warehouseId, String roadwayId) { + if (!"admin".equals(SecurityUtils.getUsername())){ + LoginUser loginUser = SecurityUtils.getLoginUser(); + List roles = loginUser.getUser().getRoles(); + + //入库需要查看本部门任务 + Optional first = roles.stream().filter(x -> "role1".equals(x.getRoleKey())).findFirst(); + if (first.isPresent()){ + //二联合普通人员 + warehouseId = "02"; + + } + Optional first1 = roles.stream().filter(x -> "role2".equals(x.getRoleKey())).findFirst(); + if (first1.isPresent()){ + //三联合普通人员 + warehouseId = "01"; + + } + Optional first2 = roles.stream().filter(x -> "role3".equals(x.getRoleKey())).findFirst(); + if (first2.isPresent()){ + //二联合管理员 + warehouseId = "02"; + } + Optional first3 = roles.stream().filter(x -> "role4".equals(x.getRoleKey())).findFirst(); + if (first3.isPresent()){ + //三联合管理员 + warehouseId = "01"; + } + } BasCargoSpace query = new BasCargoSpace(); query.setWarehouseId(warehouseId); query.setRoadwayId(roadwayId); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/search/ViewInJobFlow/controller/ViewInJobFlowController.java b/ruoyi-admin/src/main/java/com/ruoyi/search/ViewInJobFlow/controller/ViewInJobFlowController.java index 5b70e1f..25dc14a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/search/ViewInJobFlow/controller/ViewInJobFlowController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/search/ViewInJobFlow/controller/ViewInJobFlowController.java @@ -23,7 +23,7 @@ import com.ruoyi.common.core.page.TableDataInfo; /** * 入库作业流水Controller - * + * * @author ruoyi * @date 2025-10-28 */ @@ -56,7 +56,7 @@ public class ViewInJobFlowController extends BaseController { List list = viewInJobFlowService.selectViewInJobFlowList(viewInJobFlow); ExcelUtil util = new ExcelUtil(ViewInJobFlow.class); - util.exportExcel(response, list, "入库作业流水数据"); + util.exportExcel(response, list, "作业流水数据"); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/search/ViewInJobFlow/domain/ViewInJobFlow.java b/ruoyi-admin/src/main/java/com/ruoyi/search/ViewInJobFlow/domain/ViewInJobFlow.java index 9239c2f..5ff3c55 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/search/ViewInJobFlow/domain/ViewInJobFlow.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/search/ViewInJobFlow/domain/ViewInJobFlow.java @@ -25,12 +25,12 @@ public class ViewInJobFlow extends BaseEntity /** 任务编码 */ @Excel(name = "任务编码") private String jobId; - /** 入库单 */ - @Excel(name = "入库单") + /** 主单 */ + @Excel(name = "主单") private String inOrOutId; - /** 入库子单 */ - @Excel(name = "入库子单") + /** 子单 */ + @Excel(name = "子单") private String inOrOutDId; /** 任务号 */ @@ -42,7 +42,7 @@ public class ViewInJobFlow extends BaseEntity private String status; /** 任务类型 */ - @Excel(name = "任务类型",dictType = "in_job_type") + @Excel(name = "任务类型",dictType = "job_type") private Long inOrOut; @@ -68,6 +68,8 @@ public class ViewInJobFlow extends BaseEntity /** 托盘条码 */ @Excel(name = "托盘条码") private String trayCode; + @Excel(name = "货位") + private String cargoSpaceId; /** 物料编码 */ @Excel(name = "物料编码") @@ -80,8 +82,8 @@ public class ViewInJobFlow extends BaseEntity @Excel(name = "规格") private String spec; /** 入库数量 */ - @Excel(name = "入库数量") - private String inQuantity; + @Excel(name = "数量") + private String quantity; /** 开始时间 */ @Excel(name = "开始时间") private String startTime; @@ -177,6 +179,15 @@ public class ViewInJobFlow extends BaseEntity private String dateStart; private String dateEnd; + public String getCargoSpaceId() { + return cargoSpaceId; + } + + public void setCargoSpaceId(String cargoSpaceId) { + this.cargoSpaceId = cargoSpaceId; + } + + public String getDateStart() { return dateStart; } @@ -441,14 +452,12 @@ public class ViewInJobFlow extends BaseEntity return enableFlag; } - public void setInQuantity(String inQuantity) - { - this.inQuantity = inQuantity; + public String getQuantity() { + return quantity; } - public String getInQuantity() - { - return inQuantity; + public void setQuantity(String quantity) { + this.quantity = quantity; } public void setLotNo(String lotNo) @@ -610,7 +619,7 @@ public class ViewInJobFlow extends BaseEntity .append("upperNum", getUpperNum()) .append("limitNum", getLimitNum()) .append("enableFlag", getEnableFlag()) - .append("inQuantity", getInQuantity()) + .append("quantity", getQuantity()) .append("lotNo", getLotNo()) .append("inOrOutId", getInOrOutId()) .append("inOrOutDId", getInOrOutDId()) diff --git a/ruoyi-admin/src/main/resources/mapper/search/ViewInJobFlowMapper.xml b/ruoyi-admin/src/main/resources/mapper/search/ViewInJobFlowMapper.xml index ecfd78e..eade581 100644 --- a/ruoyi-admin/src/main/resources/mapper/search/ViewInJobFlowMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/search/ViewInJobFlowMapper.xml @@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -31,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -49,12 +50,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select job_detail_id, job_id, task_no, status, in_or_out, tray_code, create_time, start_time, finish_time, entrance_id, warehouse_id, product_id, product_name, parent_id, price, cargo_no, unit, spec, remark, productType, systemItem, productCtm, productCtu, upperNum, limitNum, enableFlag, in_quantity, lot_no, in_or_out_id, in_or_out_d_id, priceTotal, origin, turnovertype, account, purpose, units, contract, cases, quality, managementNo,department_id from view_in_job_flow vijf + select job_detail_id, job_id, task_no, status, in_or_out, tray_code,cargo_space_id, create_time, start_time, finish_time, entrance_id, warehouse_id, product_id, product_name, parent_id, price, cargo_no, unit, spec, remark, productType, systemItem, productCtm, productCtu, upperNum, limitNum, enableFlag, quantity, lot_no, in_or_out_id, in_or_out_d_id, priceTotal, origin, turnovertype, account, purpose, units, contract, cases, quality, managementNo,department_id from view_in_job_flow vijf diff --git a/ruoyi-ui/src/views/search/ViewInJobFlow/index.vue b/ruoyi-ui/src/views/search/ViewInJobFlow/index.vue index 469c760..c6da4a0 100644 --- a/ruoyi-ui/src/views/search/ViewInJobFlow/index.vue +++ b/ruoyi-ui/src/views/search/ViewInJobFlow/index.vue @@ -98,8 +98,8 @@ - - + +