Commit 726d86f9288198af74c1a0acade7844119042c22

Authored by 王富生
2 parents c590e968 7f297997

Merge remote-tracking branch 'origin/de_wangfs_202511' into de_wangfs_202511

urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/mechanicalcost/vo/MechanicalCostSaveReqVO.java
@@ -75,7 +75,7 @@ public class MechanicalCostSaveReqVO { @@ -75,7 +75,7 @@ public class MechanicalCostSaveReqVO {
75 private String companyId; 75 private String companyId;
76 76
77 @Schema(description = "部门id", example = "13645") 77 @Schema(description = "部门id", example = "13645")
78 - private Long deptId; 78 + private List<Long> deptId;
79 79
80 @Schema(description = "备注", example = "随便") 80 @Schema(description = "备注", example = "随便")
81 private String remark; 81 private String remark;
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/rentalmechanicalcost/vo/RentalMechanicalCostSaveReqVO.java
@@ -66,7 +66,7 @@ public class RentalMechanicalCostSaveReqVO { @@ -66,7 +66,7 @@ public class RentalMechanicalCostSaveReqVO {
66 private String companyId; 66 private String companyId;
67 67
68 @Schema(description = "部门id", example = "25446") 68 @Schema(description = "部门id", example = "25446")
69 - private Long deptId; 69 + private List<Long> deptId;
70 70
71 @Schema(description = "道路ID数组(多选)") 71 @Schema(description = "道路ID数组(多选)")
72 private String roadIds; 72 private String roadIds;
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadSaveReqVO.java
@@ -90,11 +90,9 @@ public class RoadSaveReqVO { @@ -90,11 +90,9 @@ public class RoadSaveReqVO {
90 private Long deptId; 90 private Long deptId;
91 91
92 @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") 92 @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
93 - @NotEmpty(message = "创建者不能为空")  
94 private String creatorName; 93 private String creatorName;
95 94
96 @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") 95 @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
97 - @NotEmpty(message = "更新者不能为空")  
98 private String updaterName; 96 private String updaterName;
99 97
100 -}  
101 \ No newline at end of file 98 \ No newline at end of file
  99 +}
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/departmentcost/DepartmentCostServiceImpl.java
@@ -60,16 +60,6 @@ public class DepartmentCostServiceImpl implements DepartmentCostService { @@ -60,16 +60,6 @@ public class DepartmentCostServiceImpl implements DepartmentCostService {
60 // 更新 60 // 更新
61 DepartmentCostDO updateObj = BeanUtils.toBean(updateReqVO, DepartmentCostDO.class); 61 DepartmentCostDO updateObj = BeanUtils.toBean(updateReqVO, DepartmentCostDO.class);
62 62
63 - // add bt wq 20251119 插入增加校验  
64 - LambdaQueryWrapper<DepartmentCostDO> queryWrapper = Wrappers.lambdaQuery();  
65 - queryWrapper.eq(DepartmentCostDO::getSalaryMonth, updateObj.getSalaryMonth());  
66 - queryWrapper.eq(DepartmentCostDO::getExpenseName, updateObj.getExpenseName());  
67 - queryWrapper.eq(DepartmentCostDO::getCompanyId, updateObj.getCompanyId());  
68 - List<DepartmentCostDO> list = departmentCostMapper.selectList(queryWrapper);  
69 - if (!CollectionUtils.isEmpty(list)) {  
70 - throw exception(COST_FEE_NOT_EXISTS);  
71 - }  
72 - // add bt wq 20251119 插入增加校验  
73 departmentCostMapper.updateById(updateObj); 63 departmentCostMapper.updateById(updateObj);
74 } 64 }
75 65
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/material/MaterialServiceImpl.java
@@ -36,7 +36,7 @@ public class MaterialServiceImpl implements MaterialService { @@ -36,7 +36,7 @@ public class MaterialServiceImpl implements MaterialService {
36 QueryWrapper<MaterialDO> queryWrapper = new QueryWrapper<>(); 36 QueryWrapper<MaterialDO> queryWrapper = new QueryWrapper<>();
37 queryWrapper.lambda().eq(MaterialDO::getMaterialCode, createReqVO.getMaterialCode()) 37 queryWrapper.lambda().eq(MaterialDO::getMaterialCode, createReqVO.getMaterialCode())
38 .eq(MaterialDO::getSpecCode, createReqVO.getSpecCode()) 38 .eq(MaterialDO::getSpecCode, createReqVO.getSpecCode())
39 - .eq(MaterialDO::getMaterialTypeId, createReqVO.getTypeDetailId()); 39 + .eq(MaterialDO::getTypeDetailId, createReqVO.getTypeDetailId());
40 List<MaterialDO> tdMaterials = materialMapper.selectList(queryWrapper); 40 List<MaterialDO> tdMaterials = materialMapper.selectList(queryWrapper);
41 if (null != tdMaterials && tdMaterials.size() > 0) { 41 if (null != tdMaterials && tdMaterials.size() > 0) {
42 MaterialDO material = tdMaterials.get(0); 42 MaterialDO material = tdMaterials.get(0);
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventory/MaterialInventoryService.java
@@ -80,7 +80,7 @@ public interface MaterialInventoryService { @@ -80,7 +80,7 @@ public interface MaterialInventoryService {
80 * @Date 2025/11/28 23:36 80 * @Date 2025/11/28 23:36
81 * @Param materialId 81 * @Param materialId
82 */ 82 */
83 - MaterialInventoryDO selectTdMaterialInventoryByMaterialId(Long materialId); 83 + MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId, Long companyId);
84 84
85 85
86 /** 86 /**
@@ -98,4 +98,13 @@ public interface MaterialInventoryService { @@ -98,4 +98,13 @@ public interface MaterialInventoryService {
98 * @return 98 * @return
99 */ 99 */
100 int updateInVentoryAlremNum(Long materialId, Long alermNum); 100 int updateInVentoryAlremNum(Long materialId, Long alermNum);
  101 +
  102 + /**
  103 + * @Author wangqian
  104 + * @Description 查询物料信息根据
  105 + * @Date 2025/11/28 23:36
  106 + * @Param materialId
  107 + */
  108 + MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId);
  109 +
101 } 110 }
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventory/MaterialInventoryServiceImpl.java
@@ -3,6 +3,7 @@ package com.zteits.urbanops.module.garden.service.materialinventory; @@ -3,6 +3,7 @@ package com.zteits.urbanops.module.garden.service.materialinventory;
3 import com.baomidou.mybatisplus.core.conditions.Wrapper; 3 import com.baomidou.mybatisplus.core.conditions.Wrapper;
4 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 5 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  6 +import com.baomidou.mybatisplus.core.toolkit.StringUtils;
6 import com.baomidou.mybatisplus.core.toolkit.Wrappers; 7 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
7 import com.zteits.urbanops.framework.common.pojo.PageResult; 8 import com.zteits.urbanops.framework.common.pojo.PageResult;
8 import com.zteits.urbanops.framework.common.util.object.BeanUtils; 9 import com.zteits.urbanops.framework.common.util.object.BeanUtils;
@@ -92,6 +93,10 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { @@ -92,6 +93,10 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService {
92 93
93 @Override 94 @Override
94 public PageResult<MaterialInventoryDO> getMaterialInventoryPage(MaterialInventoryPageReqVO pageReqVO) { 95 public PageResult<MaterialInventoryDO> getMaterialInventoryPage(MaterialInventoryPageReqVO pageReqVO) {
  96 + //查询自己单位入库的库存
  97 + if(getCompanyId() != 100) {
  98 + pageReqVO.setBelongCompanyId(getCompanyId());
  99 + }
95 return materialInventoryMapper.selectPage(pageReqVO); 100 return materialInventoryMapper.selectPage(pageReqVO);
96 } 101 }
97 102
@@ -99,7 +104,7 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { @@ -99,7 +104,7 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService {
99 public int insertMaterialInventory(MaterialInventoryDO materialInventory) { 104 public int insertMaterialInventory(MaterialInventoryDO materialInventory) {
100 LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery(); 105 LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery();
101 queryWrapper.eq(MaterialInventoryDO::getBelongCompanyId, materialInventory.getBelongCompanyId()); 106 queryWrapper.eq(MaterialInventoryDO::getBelongCompanyId, materialInventory.getBelongCompanyId());
102 - queryWrapper.eq(MaterialInventoryDO::getTypeDetailId, materialInventory.getTypeDetailId()); 107 + queryWrapper.eq(MaterialInventoryDO::getMaterialId, materialInventory.getMaterialId());
103 MaterialInventoryDO object = materialInventoryMapper.selectOne(queryWrapper); 108 MaterialInventoryDO object = materialInventoryMapper.selectOne(queryWrapper);
104 if(object != null){ 109 if(object != null){
105 object.setInventoryTotalNum(object.getInventoryTotalNum()+ materialInventory.getCurrentNum()); 110 object.setInventoryTotalNum(object.getInventoryTotalNum()+ materialInventory.getCurrentNum());
@@ -118,25 +123,27 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { @@ -118,25 +123,27 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService {
118 } 123 }
119 124
120 @Override 125 @Override
121 - public MaterialInventoryDO selectTdMaterialInventoryByMaterialId(Long materialId) { 126 + public MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId, Long companyId) {
122 if (materialId == null) { 127 if (materialId == null) {
123 - throw exception0(BAD_REQUEST.getCode(),"更新库存失败:materialId为空!"); 128 + throw exception0(BAD_REQUEST.getCode(),"更新库存失败:typeDetailId为空!");
124 } 129 }
125 LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery(); 130 LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery();
126 - queryWrapper.eq(MaterialInventoryDO::getTypeDetailId, materialId); 131 + queryWrapper.eq(MaterialInventoryDO::getMaterialId, materialId);
  132 + queryWrapper.eq(MaterialInventoryDO::getBelongCompanyId, companyId);
127 return materialInventoryMapper.selectOne(queryWrapper); 133 return materialInventoryMapper.selectOne(queryWrapper);
128 } 134 }
129 135
130 @Override 136 @Override
131 public int updateInVentoryByMaterialId(MaterialInventoryDO materialInventory, Long outNum) { 137 public int updateInVentoryByMaterialId(MaterialInventoryDO materialInventory, Long outNum) {
132 // 1. 入参空值校验(避免无效更新或SQL异常) 138 // 1. 入参空值校验(避免无效更新或SQL异常)
  139 + if (materialInventory == null || materialInventory.getInventoryId() == null) {
  140 + throw exception0(BAD_REQUEST.getCode(),"更新库存失败:InventoryId为空!");
  141 + }
133 if (outNum == null) { 142 if (outNum == null) {
134 throw exception0(BAD_REQUEST.getCode(),"更新库存失败:outNum为空!"); 143 throw exception0(BAD_REQUEST.getCode(),"更新库存失败:outNum为空!");
135 } 144 }
136 - MaterialInventoryDO out = new MaterialInventoryDO();  
137 - out.setInventoryId(materialInventory.getInventoryId());  
138 - out.setOutTotalNum(materialInventory.getInventoryTotalNum() + outNum);  
139 - out.setCurrentNum(materialInventory.getCurrentNum() - outNum); 145 + materialInventory.setOutTotalNum(materialInventory.getInventoryTotalNum() + outNum);
  146 + materialInventory.setCurrentNum(materialInventory.getCurrentNum() - outNum);
140 return materialInventoryMapper.updateById(materialInventory); 147 return materialInventoryMapper.updateById(materialInventory);
141 } 148 }
142 149
@@ -157,4 +164,14 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { @@ -157,4 +164,14 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService {
157 // 3. 执行更新(MyBatis-Plus支持直接传wrapper,第一个参数为null即可) 164 // 3. 执行更新(MyBatis-Plus支持直接传wrapper,第一个参数为null即可)
158 return materialInventoryMapper.update(null, updateWrapper); 165 return materialInventoryMapper.update(null, updateWrapper);
159 } 166 }
  167 +
  168 + @Override
  169 + public MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId) {
  170 + if (materialId == null) {
  171 + throw exception0(BAD_REQUEST.getCode(),"更新库存失败:materialId为空!");
  172 + }
  173 + LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery();
  174 + queryWrapper.eq(MaterialInventoryDO::getMaterialId, materialId);
  175 + return materialInventoryMapper.selectOne(queryWrapper);
  176 + }
160 } 177 }
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventoryin/MaterialInventoryInServiceImpl.java
@@ -74,8 +74,6 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic @@ -74,8 +74,6 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
74 in.setTypeDetailId(material.getTypeDetailId()); 74 in.setTypeDetailId(material.getTypeDetailId());
75 in.setTypeDetailName(material.getTypeDetailName()); 75 in.setTypeDetailName(material.getTypeDetailName());
76 in.setSpecifications(material.getSpecifications()); 76 in.setSpecifications(material.getSpecifications());
77 -// in.setBelongCompanyId(material.getBelongCompanyId());  
78 -// in.setBelongCompanyName(material.getBelongCompanyName());  
79 in.setBelongCompanyId(deptRespDTO.getId()); 77 in.setBelongCompanyId(deptRespDTO.getId());
80 in.setBelongCompanyName(deptRespDTO.getName()); 78 in.setBelongCompanyName(deptRespDTO.getName());
81 in.setInInventoryNum(createReqVO.getInInventoryNum()); 79 in.setInInventoryNum(createReqVO.getInInventoryNum());
@@ -103,8 +101,8 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic @@ -103,8 +101,8 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
103 inventory.setTypeDetailId(material.getTypeDetailId()); 101 inventory.setTypeDetailId(material.getTypeDetailId());
104 inventory.setTypeDetailName(material.getTypeDetailName()); 102 inventory.setTypeDetailName(material.getTypeDetailName());
105 inventory.setSpecifications(in.getSpecifications()); 103 inventory.setSpecifications(in.getSpecifications());
106 - inventory.setBelongCompanyId(in.getBelongCompanyId());  
107 - inventory.setBelongCompanyName(in.getBelongCompanyName()); 104 + inventory.setBelongCompanyId(deptRespDTO.getId());
  105 + inventory.setBelongCompanyName(deptRespDTO.getName());
108 inventory.setUnitId(in.getUnitId()); 106 inventory.setUnitId(in.getUnitId());
109 inventory.setUnitName(in.getUnitName()); 107 inventory.setUnitName(in.getUnitName());
110 inventory.setCurrentNum(in.getInInventoryNum()); 108 inventory.setCurrentNum(in.getInInventoryNum());
@@ -133,8 +131,6 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic @@ -133,8 +131,6 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
133 updateObj.setMaterialTypeId(material.getMaterialTypeId()); 131 updateObj.setMaterialTypeId(material.getMaterialTypeId());
134 updateObj.setMaterialTypeName(material.getMaterialTypeName()); 132 updateObj.setMaterialTypeName(material.getMaterialTypeName());
135 updateObj.setSpecifications(material.getSpecifications()); 133 updateObj.setSpecifications(material.getSpecifications());
136 - updateObj.setBelongCompanyId(material.getBelongCompanyId());  
137 - updateObj.setBelongCompanyName(material.getBelongCompanyName());  
138 updateObj.setUnitId(material.getUnitId()); 134 updateObj.setUnitId(material.getUnitId());
139 updateObj.setUnitName(material.getUnitName()); 135 updateObj.setUnitName(material.getUnitName());
140 materialInventoryInMapper.updateById(updateObj); 136 materialInventoryInMapper.updateById(updateObj);
@@ -148,20 +144,17 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic @@ -148,20 +144,17 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
148 if (null == materialInventoryIn) { 144 if (null == materialInventoryIn) {
149 throw exception(MATERIAL_INVENTORY_IN_NOT_EXISTS); 145 throw exception(MATERIAL_INVENTORY_IN_NOT_EXISTS);
150 } 146 }
151 - MaterialInventoryDO materialInventory = materialInventoryService.selectTdMaterialInventoryByMaterialId(materialInventoryIn.getMaterialId());  
152 - if(null == materialInventory){ 147 + MaterialInventoryDO inventory = materialInventoryService.selectMaterialInventoryByMaterialId(materialInventoryIn.getMaterialId(),getCompanyId());
  148 + if(null == inventory){
153 throw exception0(BAD_REQUEST.getCode(),"参数错误"); 149 throw exception0(BAD_REQUEST.getCode(),"参数错误");
154 } 150 }
155 //库存已使用 151 //库存已使用
156 - if(materialInventory.getCurrentNum() < materialInventoryIn.getInInventoryNum()){ 152 + if(inventory.getCurrentNum() < materialInventoryIn.getInInventoryNum()){
157 throw exception0(BAD_REQUEST.getCode(),"库存已使用"); 153 throw exception0(BAD_REQUEST.getCode(),"库存已使用");
158 } 154 }
159 //入库记录减扣 155 //入库记录减扣
160 - MaterialInventoryDO inventory = new MaterialInventoryDO();  
161 - inventory.setInventoryId(materialInventory.getInventoryId());  
162 - inventory.setMaterialId(materialInventory.getMaterialId());  
163 - inventory.setCurrentNum(materialInventory.getCurrentNum() - materialInventoryIn.getInInventoryNum());  
164 - inventory.setInventoryTotalNum(materialInventory.getInventoryTotalNum() - materialInventoryIn.getInInventoryNum()); 156 + inventory.setCurrentNum(inventory.getCurrentNum() - materialInventoryIn.getInInventoryNum());
  157 + inventory.setInventoryTotalNum(inventory.getInventoryTotalNum() - materialInventoryIn.getInInventoryNum());
165 materialInventoryService.updateTdMaterialInventory(inventory); 158 materialInventoryService.updateTdMaterialInventory(inventory);
166 // 删除 159 // 删除
167 materialInventoryInMapper.deleteById(id); 160 materialInventoryInMapper.deleteById(id);
@@ -187,6 +180,10 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic @@ -187,6 +180,10 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
187 180
188 @Override 181 @Override
189 public PageResult<MaterialInventoryInDO> getMaterialInventoryInPage(MaterialInventoryInPageReqVO pageReqVO) { 182 public PageResult<MaterialInventoryInDO> getMaterialInventoryInPage(MaterialInventoryInPageReqVO pageReqVO) {
  183 + //查询自己单位入库的记录
  184 + if(getCompanyId() != 100) {
  185 + pageReqVO.setBelongCompanyId(getCompanyId());
  186 + }
190 return materialInventoryInMapper.selectPage(pageReqVO); 187 return materialInventoryInMapper.selectPage(pageReqVO);
191 } 188 }
192 189
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventoryout/MaterialInventoryOutServiceImpl.java
1 package com.zteits.urbanops.module.garden.service.materialinventoryout; 1 package com.zteits.urbanops.module.garden.service.materialinventoryout;
2 2
  3 +import cn.hutool.core.util.RandomUtil;
3 import com.zteits.urbanops.framework.common.pojo.PageResult; 4 import com.zteits.urbanops.framework.common.pojo.PageResult;
4 import com.zteits.urbanops.framework.common.util.object.BeanUtils; 5 import com.zteits.urbanops.framework.common.util.object.BeanUtils;
5 import com.zteits.urbanops.module.garden.controller.admin.materialinventoryout.vo.MaterialInventoryOutPageReqVO; 6 import com.zteits.urbanops.module.garden.controller.admin.materialinventoryout.vo.MaterialInventoryOutPageReqVO;
@@ -52,7 +53,7 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ @@ -52,7 +53,7 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
52 if(null == material){ 53 if(null == material){
53 throw exception0(BAD_REQUEST.getCode(), "无效参数-materialId"); 54 throw exception0(BAD_REQUEST.getCode(), "无效参数-materialId");
54 } 55 }
55 - MaterialInventoryDO materialInventory = materialInventoryService.selectTdMaterialInventoryByMaterialId(out.getMaterialId()); 56 + MaterialInventoryDO materialInventory = materialInventoryService.selectMaterialInventoryByMaterialId(material.getMaterialId(),getCompanyId());
56 if(null == materialInventory){ 57 if(null == materialInventory){
57 throw exception0(BAD_REQUEST.getCode(),createReqVO.getMaterialName()+"没有库存"); 58 throw exception0(BAD_REQUEST.getCode(),createReqVO.getMaterialName()+"没有库存");
58 } 59 }
@@ -64,6 +65,8 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ @@ -64,6 +65,8 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
64 if(null == deptRespDTO){ 65 if(null == deptRespDTO){
65 throw exception0(BAD_REQUEST.getCode(), "无效参数-登录人所属单位为空"); 66 throw exception0(BAD_REQUEST.getCode(), "无效参数-登录人所属单位为空");
66 } 67 }
  68 + out.setInventoryOutNo(System.currentTimeMillis()+ RandomUtil.randomInt(10, 100000)+"");
  69 + out.setMaterialId(createReqVO.getMaterialId());
67 out.setMaterialName(material.getMaterialName()); 70 out.setMaterialName(material.getMaterialName());
68 out.setMaterialTypeId(material.getMaterialTypeId()); 71 out.setMaterialTypeId(material.getMaterialTypeId());
69 out.setMaterialTypeName(material.getMaterialTypeName()); 72 out.setMaterialTypeName(material.getMaterialTypeName());
@@ -76,8 +79,10 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ @@ -76,8 +79,10 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
76 // out.setBelongCompanyName(material.getBelongCompanyName()); 79 // out.setBelongCompanyName(material.getBelongCompanyName());
77 out.setBelongCompanyId(deptRespDTO.getId()); 80 out.setBelongCompanyId(deptRespDTO.getId());
78 out.setBelongCompanyName(deptRespDTO.getName()); 81 out.setBelongCompanyName(deptRespDTO.getName());
  82 + out.setOutInventoryNum(createReqVO.getOutInventoryNum());
79 out.setUnitId(material.getUnitId()); 83 out.setUnitId(material.getUnitId());
80 out.setUnitName(material.getUnitName()); 84 out.setUnitName(material.getUnitName());
  85 + out.setOutDate(createReqVO.getOutDate());
81 materialInventoryOutMapper.insert(out); 86 materialInventoryOutMapper.insert(out);
82 87
83 //更新库存 88 //更新库存
@@ -103,23 +108,19 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ @@ -103,23 +108,19 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
103 throw exception(MATERIAL_INVENTORY_OUT_NOT_EXISTS); 108 throw exception(MATERIAL_INVENTORY_OUT_NOT_EXISTS);
104 } 109 }
105 110
106 - //查询库存  
107 - MaterialInventoryDO materialInventory = materialInventoryService.selectTdMaterialInventoryByMaterialId(materialInventoryOut.getMaterialId());  
108 - if(null == materialInventory){ 111 + MaterialInventoryDO inventory = materialInventoryService.selectMaterialInventoryByMaterialId(materialInventoryOut.getMaterialId(),getCompanyId());
  112 + if(null == inventory){
109 throw exception0(BAD_REQUEST.getCode(),"参数错误"); 113 throw exception0(BAD_REQUEST.getCode(),"参数错误");
110 } 114 }
111 //库存已使用 115 //库存已使用
112 - if(materialInventory.getCurrentNum() < materialInventoryOut.getOutInventoryNum()){ 116 + if(inventory.getCurrentNum() < materialInventoryOut.getOutInventoryNum()){
113 throw exception0(BAD_REQUEST.getCode(),"库存已使用"); 117 throw exception0(BAD_REQUEST.getCode(),"库存已使用");
114 } 118 }
115 119
116 //入库记录减扣 120 //入库记录减扣
117 - MaterialInventoryDO inventory = new MaterialInventoryDO();  
118 - inventory.setInventoryId(materialInventory.getInventoryId());  
119 - inventory.setMaterialId(materialInventory.getMaterialId());  
120 - inventory.setCurrentNum(materialInventory.getCurrentNum() + materialInventoryOut.getOutInventoryNum());  
121 - inventory.setInventoryTotalNum(materialInventory.getInventoryTotalNum() + materialInventoryOut.getOutInventoryNum());  
122 - inventory.setOutTotalNum(materialInventory.getOutTotalNum() - materialInventoryOut.getOutInventoryNum()); 121 + inventory.setCurrentNum(inventory.getCurrentNum() + materialInventoryOut.getOutInventoryNum());
  122 + inventory.setInventoryTotalNum(inventory.getInventoryTotalNum() + materialInventoryOut.getOutInventoryNum());
  123 + inventory.setOutTotalNum(inventory.getOutTotalNum() - materialInventoryOut.getOutInventoryNum());
123 materialInventoryService.updateTdMaterialInventory(inventory); 124 materialInventoryService.updateTdMaterialInventory(inventory);
124 125
125 // 删除 126 // 删除
@@ -146,6 +147,10 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ @@ -146,6 +147,10 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
146 147
147 @Override 148 @Override
148 public PageResult<MaterialInventoryOutDO> getMaterialInventoryOutPage(MaterialInventoryOutPageReqVO pageReqVO) { 149 public PageResult<MaterialInventoryOutDO> getMaterialInventoryOutPage(MaterialInventoryOutPageReqVO pageReqVO) {
  150 + //查询自己单位出库的记录
  151 + if(getCompanyId() != 100) {
  152 + pageReqVO.setBelongCompanyId(getCompanyId());
  153 + }
149 return materialInventoryOutMapper.selectPage(pageReqVO); 154 return materialInventoryOutMapper.selectPage(pageReqVO);
150 } 155 }
151 156