Commit 0095a64c4b9bfbed6c5933cab712eac467c78861

Authored by mahuandong
2 parents 77970d74 a64798c6

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

src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java
@@ -38,8 +38,6 @@ public class adjustDetailController extends BaseController { @@ -38,8 +38,6 @@ public class adjustDetailController extends BaseController {
38 38
39 39
40 @Resource 40 @Resource
41 - private AdjustHeaderService adjustHeaderService;  
42 - @Resource  
43 private AdjustHeaderMapper adjustHeaderMapper; 41 private AdjustHeaderMapper adjustHeaderMapper;
44 @Resource 42 @Resource
45 private AdjustDetailService adjustDetailService; 43 private AdjustDetailService adjustDetailService;
@@ -49,7 +47,7 @@ public class adjustDetailController extends BaseController { @@ -49,7 +47,7 @@ public class adjustDetailController extends BaseController {
49 private String prefix = "inventory/adjustDetail"; 47 private String prefix = "inventory/adjustDetail";
50 48
51 49
52 - //@RequiresPermissions("inventory:cycleCount:view") 50 + @RequiresPermissions("inventory:adjustDetail:view")
53 @GetMapping() 51 @GetMapping()
54 public String adjustHeader() 52 public String adjustHeader()
55 { 53 {
@@ -60,7 +58,7 @@ public class adjustDetailController extends BaseController { @@ -60,7 +58,7 @@ public class adjustDetailController extends BaseController {
60 /** 58 /**
61 * 查询调整单主列表 59 * 查询调整单主列表
62 */ 60 */
63 - //@RequiresPermissions("inventory:cycleCount:list") 61 + @RequiresPermissions("inventory:adjustDetail:list")
64 @PostMapping("/list") 62 @PostMapping("/list")
65 @Log(title = "库存-调整",operating = "查看调整明细单", action = BusinessType.GRANT) 63 @Log(title = "库存-调整",operating = "查看调整明细单", action = BusinessType.GRANT)
66 @ResponseBody 64 @ResponseBody
@@ -121,7 +119,7 @@ public class adjustDetailController extends BaseController { @@ -121,7 +119,7 @@ public class adjustDetailController extends BaseController {
121 /** 119 /**
122 * 保存新增调整明细 120 * 保存新增调整明细
123 */ 121 */
124 - //@RequiresPermissions("inventory:cyclecountDetail:add") 122 + @RequiresPermissions("inventory:adjustDetail:add")
125 @Log(title = "库存-盘点", operating = "新增盘点补货明细", action = BusinessType.INSERT) 123 @Log(title = "库存-盘点", operating = "新增盘点补货明细", action = BusinessType.INSERT)
126 @PostMapping("/addAdjust") 124 @PostMapping("/addAdjust")
127 @ResponseBody 125 @ResponseBody
@@ -150,7 +148,7 @@ public class adjustDetailController extends BaseController { @@ -150,7 +148,7 @@ public class adjustDetailController extends BaseController {
150 * 调整数量,调整库存状态 148 * 调整数量,调整库存状态
151 * 调整插入库存 149 * 调整插入库存
152 */ 150 */
153 - //@RequiresPermissions("inventory:cyclecountAdjustDetail:addAdjust") 151 + @RequiresPermissions("inventory:adjustDetail:addAdjust")
154 @Log(title = "库存-调整单", operating = "调整单调整库存差异,调整数量", action = BusinessType.UPDATE) 152 @Log(title = "库存-调整单", operating = "调整单调整库存差异,调整数量", action = BusinessType.UPDATE)
155 @PostMapping("/adjustEdit") 153 @PostMapping("/adjustEdit")
156 @ResponseBody 154 @ResponseBody
@@ -177,6 +175,7 @@ public class adjustDetailController extends BaseController { @@ -177,6 +175,7 @@ public class adjustDetailController extends BaseController {
177 * @param ids 175 * @param ids
178 * @return 176 * @return
179 */ 177 */
  178 + @RequiresPermissions("inventory:adjustDetail:adjustAgree")
180 @Log(title = "库存-调整单", operating = "调整审批", action = BusinessType.OTHER) 179 @Log(title = "库存-调整单", operating = "调整审批", action = BusinessType.OTHER)
181 @PostMapping("/adjustAgree") 180 @PostMapping("/adjustAgree")
182 @ResponseBody 181 @ResponseBody
@@ -199,7 +198,7 @@ public class adjustDetailController extends BaseController { @@ -199,7 +198,7 @@ public class adjustDetailController extends BaseController {
199 /** 198 /**
200 * 删除调整单明细 199 * 删除调整单明细
201 */ 200 */
202 - //@RequiresPermissions("inventory:cyclecountDetail:remove") 201 + @RequiresPermissions("inventory:adjustDetail:remove")
203 @Log(title = "库存-调整", operating = "删除调整单明细", action = BusinessType.DELETE) 202 @Log(title = "库存-调整", operating = "删除调整单明细", action = BusinessType.DELETE)
204 @PostMapping( "/remove") 203 @PostMapping( "/remove")
205 @ResponseBody 204 @ResponseBody
@@ -212,7 +211,6 @@ public class adjustDetailController extends BaseController { @@ -212,7 +211,6 @@ public class adjustDetailController extends BaseController {
212 return AjaxResult.error("单据状态不允许删除"); 211 return AjaxResult.error("单据状态不允许删除");
213 } 212 }
214 adjustDetailService.removeById(id); 213 adjustDetailService.removeById(id);
215 -  
216 return AjaxResult.success("删除成功!"); 214 return AjaxResult.success("删除成功!");
217 } 215 }
218 216
src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java
@@ -157,7 +157,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj @@ -157,7 +157,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj
157 AjaxResult.error("该单据已调整,不允许再次调整!" ); 157 AjaxResult.error("该单据已调整,不允许再次调整!" );
158 } 158 }
159 //查询调整的库存明细 159 //查询调整的库存明细
160 - InventoryDetail inventoryDetail = new InventoryDetail(); 160 + InventoryDetail inventoryDetail ;
161 //调整单中不带库存明细时不查询 161 //调整单中不带库存明细时不查询
162 if(adjustDetail.getInventoryDetailId() != null) { 162 if(adjustDetail.getInventoryDetailId() != null) {
163 inventoryDetail = inventoryDetailService.getById(adjustDetail.getInventoryDetailId()); 163 inventoryDetail = inventoryDetailService.getById(adjustDetail.getInventoryDetailId());
src/main/java/com/huaheng/pc/inventory/adjustHeader/controller/adjustHeaderController.java
@@ -44,7 +44,7 @@ public class adjustHeaderController extends BaseController { @@ -44,7 +44,7 @@ public class adjustHeaderController extends BaseController {
44 private String prefix = "inventory/adjustHeader"; 44 private String prefix = "inventory/adjustHeader";
45 45
46 46
47 - //@RequiresPermissions("inventory:cycleCount:view") 47 + @RequiresPermissions("inventory:adjustHeader:view")
48 @GetMapping() 48 @GetMapping()
49 public String adjustHeader() 49 public String adjustHeader()
50 { 50 {
@@ -55,7 +55,7 @@ public class adjustHeaderController extends BaseController { @@ -55,7 +55,7 @@ public class adjustHeaderController extends BaseController {
55 /** 55 /**
56 * 查询调整单主列表 56 * 查询调整单主列表
57 */ 57 */
58 - //@RequiresPermissions("inventory:cycleCount:list") 58 + @RequiresPermissions("inventory:adjustHeader:list")
59 @PostMapping("/list") 59 @PostMapping("/list")
60 @Log(title = "库存-调整",operating = "查看调整主单", action = BusinessType.GRANT) 60 @Log(title = "库存-调整",operating = "查看调整主单", action = BusinessType.GRANT)
61 @ResponseBody 61 @ResponseBody
@@ -101,7 +101,7 @@ public class adjustHeaderController extends BaseController { @@ -101,7 +101,7 @@ public class adjustHeaderController extends BaseController {
101 /** 101 /**
102 * 新增保存调整单主 102 * 新增保存调整单主
103 */ 103 */
104 - //@RequiresPermissions("inventory:cycleCount:add") 104 + @RequiresPermissions("inventory:adjustHeader:add")
105 @Log(title = "库存-调整",operating = "新增调整主单", action = BusinessType.INSERT) 105 @Log(title = "库存-调整",operating = "新增调整主单", action = BusinessType.INSERT)
106 @PostMapping("/addsave") 106 @PostMapping("/addsave")
107 @ResponseBody 107 @ResponseBody
@@ -114,7 +114,7 @@ public class adjustHeaderController extends BaseController { @@ -114,7 +114,7 @@ public class adjustHeaderController extends BaseController {
114 /** 114 /**
115 * 删除调整单主 115 * 删除调整单主
116 */ 116 */
117 - //@RequiresPermissions("inventory:cycleCount:remove") 117 + @RequiresPermissions("inventory:adjustHeader:remove")
118 @Log(title = "库存-调整",operating = "删除调整主单", action = BusinessType.DELETE) 118 @Log(title = "库存-调整",operating = "删除调整主单", action = BusinessType.DELETE)
119 @PostMapping( "/remove") 119 @PostMapping( "/remove")
120 @ResponseBody 120 @ResponseBody
@@ -124,7 +124,7 @@ public class adjustHeaderController extends BaseController { @@ -124,7 +124,7 @@ public class adjustHeaderController extends BaseController {
124 return AjaxResult.error("id不能为空"); 124 return AjaxResult.error("id不能为空");
125 for (Integer id : Convert.toIntArray(ids)) 125 for (Integer id : Convert.toIntArray(ids))
126 { 126 {
127 - AjaxResult result = adjustHeaderService.delete(id); 127 + AjaxResult result = adjustHeaderService.deleteHeader(id);
128 if(result.code!=200){ 128 if(result.code!=200){
129 return result; 129 return result;
130 } 130 }
@@ -136,7 +136,7 @@ public class adjustHeaderController extends BaseController { @@ -136,7 +136,7 @@ public class adjustHeaderController extends BaseController {
136 * 调整单打印 136 * 调整单打印
137 * @return 137 * @return
138 */ 138 */
139 - //@RequiresPermissions("inventory:cyclecountAdjust:report") 139 + @RequiresPermissions("inventory:adjustHeader:report")
140 @GetMapping("/report/{id}") 140 @GetMapping("/report/{id}")
141 public String report(@PathVariable("id") Integer id, ModelMap mmap) 141 public String report(@PathVariable("id") Integer id, ModelMap mmap)
142 { 142 {
src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderService.java
@@ -11,7 +11,7 @@ public interface AdjustHeaderService extends IService<AdjustHeader> { @@ -11,7 +11,7 @@ public interface AdjustHeaderService extends IService<AdjustHeader> {
11 11
12 String createCode(); 12 String createCode();
13 13
14 - AjaxResult delete(Integer id); 14 + AjaxResult deleteHeader(Integer id);
15 15
16 AjaxResult addSave(AdjustHeader adjustHeader); 16 AjaxResult addSave(AdjustHeader adjustHeader);
17 17
src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderServiceImpl.java
1 package com.huaheng.pc.inventory.adjustHeader.service; 1 package com.huaheng.pc.inventory.adjustHeader.service;
2 2
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
3 import com.huaheng.common.utils.StringUtils; 5 import com.huaheng.common.utils.StringUtils;
4 import com.huaheng.common.utils.security.ShiroUtils; 6 import com.huaheng.common.utils.security.ShiroUtils;
5 import com.huaheng.framework.web.domain.AjaxResult; 7 import com.huaheng.framework.web.domain.AjaxResult;
  8 +import com.huaheng.pc.config.warehouse.domain.Warehouse;
6 import com.huaheng.pc.inventory.adjustDetail.domain.AdjustDetail; 9 import com.huaheng.pc.inventory.adjustDetail.domain.AdjustDetail;
  10 +import com.huaheng.pc.inventory.adjustDetail.service.AdjustDetailService;
7 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 12 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 import com.huaheng.pc.inventory.adjustHeader.domain.AdjustHeader; 13 import com.huaheng.pc.inventory.adjustHeader.domain.AdjustHeader;
@@ -13,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional; @@ -13,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
13 import javax.annotation.Resource; 17 import javax.annotation.Resource;
14 import java.text.SimpleDateFormat; 18 import java.text.SimpleDateFormat;
15 import java.util.Date; 19 import java.util.Date;
  20 +import java.util.List;
16 21
17 @Service 22 @Service
18 public class AdjustHeaderServiceImpl extends ServiceImpl<AdjustHeaderMapper, AdjustHeader> implements AdjustHeaderService { 23 public class AdjustHeaderServiceImpl extends ServiceImpl<AdjustHeaderMapper, AdjustHeader> implements AdjustHeaderService {
@@ -20,7 +25,8 @@ public class AdjustHeaderServiceImpl extends ServiceImpl&lt;AdjustHeaderMapper, Adj @@ -20,7 +25,8 @@ public class AdjustHeaderServiceImpl extends ServiceImpl&lt;AdjustHeaderMapper, Adj
20 25
21 @Resource 26 @Resource
22 private AdjustHeaderMapper adjustHeaderMapper; 27 private AdjustHeaderMapper adjustHeaderMapper;
23 - 28 + @Resource
  29 + private AdjustDetailService adjustDetailService;
24 30
25 31
26 32
@@ -48,22 +54,29 @@ public class AdjustHeaderServiceImpl extends ServiceImpl&lt;AdjustHeaderMapper, Adj @@ -48,22 +54,29 @@ public class AdjustHeaderServiceImpl extends ServiceImpl&lt;AdjustHeaderMapper, Adj
48 } 54 }
49 55
50 /** 56 /**
51 - * 删除  
52 - * 空缺 57 + * 调整主单删除
53 * @param id 58 * @param id
54 * @return 59 * @return
55 */ 60 */
  61 + @Transactional
56 @Override 62 @Override
57 - public AjaxResult delete(Integer id) { 63 + public AjaxResult deleteHeader(Integer id) {
58 AdjustHeader adjustHeader = this.getById(id); 64 AdjustHeader adjustHeader = this.getById(id);
59 if(adjustHeader == null){ 65 if(adjustHeader == null){
60 return AjaxResult.error("id为"+id.toString()+"的调整单不存在出,操作中止"); 66 return AjaxResult.error("id为"+id.toString()+"的调整单不存在出,操作中止");
61 } 67 }
62 -  
63 - //批量删除子单据 68 + //判断该主单下有没又存在子单,没有直接删除主单,有则不能删除
64 AdjustDetail temp = new AdjustDetail(); 69 AdjustDetail temp = new AdjustDetail();
65 temp.setAdjustCode(adjustHeader.getCode()); 70 temp.setAdjustCode(adjustHeader.getCode());
  71 + temp.setCompanyCode(adjustHeader.getCompanyCode());
  72 + temp.setWarehouseCode(adjustHeader.getWarehouseCode());
  73 + LambdaQueryWrapper<AdjustDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(temp);
  74 + List<AdjustDetail> adjustDetails = adjustDetailService.list(lambdaQueryWrapper);
  75 + if(adjustDetails.size() > 0){
  76 + throw new SecurityException("该主单存在明细,无法删除,操作失败!");
  77 + }
66 78
  79 + adjustHeaderMapper.deleteById(id); //直接删主单
67 return AjaxResult.success("删除成功"); 80 return AjaxResult.success("删除成功");
68 } 81 }
69 82
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
@@ -150,6 +150,9 @@ public class CycleCountDetailController extends BaseController { @@ -150,6 +150,9 @@ public class CycleCountDetailController extends BaseController {
150 @ResponseBody 150 @ResponseBody
151 public AjaxResult addSave(String cycleCountHeadCode, Integer[] inventoryDetailIdIds) 151 public AjaxResult addSave(String cycleCountHeadCode, Integer[] inventoryDetailIdIds)
152 { 152 {
  153 + if(inventoryDetailIdIds == null){
  154 + return AjaxResult.error("盘点的库存ID不能为空!");
  155 + }
153 return cycleCountDetailService.addDetails(cycleCountHeadCode,inventoryDetailIdIds); 156 return cycleCountDetailService.addDetails(cycleCountHeadCode,inventoryDetailIdIds);
154 } 157 }
155 158
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java
@@ -48,10 +48,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap @@ -48,10 +48,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
48 48
49 49
50 50
51 -  
52 -  
53 -  
54 -  
55 /** 51 /**
56 * 执行任务修改状态为10 52 * 执行任务修改状态为10
57 * @param detailid 53 * @param detailid
@@ -131,7 +127,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap @@ -131,7 +127,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
131 ccd.setCompanyCode(inventoryDetail.getCompanyCode()); 127 ccd.setCompanyCode(inventoryDetail.getCompanyCode());
132 ccd.setInventorySts(inventoryDetail.getInventorySts()); 128 ccd.setInventorySts(inventoryDetail.getInventorySts());
133 ccd.setCountId(inventoryDetail.getId()); 129 ccd.setCountId(inventoryDetail.getId());
134 - ccd.setEnableStatus(5); 130 + //ccd.setEnableStatus(1);
135 ccd.setLocationCode(inventoryDetail.getLocationCode()); 131 ccd.setLocationCode(inventoryDetail.getLocationCode());
136 ccd.setContainerCode(inventoryDetail.getContainerCode()); 132 ccd.setContainerCode(inventoryDetail.getContainerCode());
137 ccd.setMaterialCode(inventoryDetail.getMaterialCode()); 133 ccd.setMaterialCode(inventoryDetail.getMaterialCode());
@@ -226,10 +222,10 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap @@ -226,10 +222,10 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
226 LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(temp); 222 LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(temp);
227 Location loc = locationService.getOne(lambdaQueryWrapper); 223 Location loc = locationService.getOne(lambdaQueryWrapper);
228 if(!loc.getStatus().equals("empty")){ 224 if(!loc.getStatus().equals("empty")){
229 - return AjaxResult.error(cycleCountDetail.getLocationCode()+"状态非空闲,操作失败"); 225 + return AjaxResult.error(cycleCountDetail.getLocationCode()+"库位不在空闲状态,请先完成其他任务,操作失败!");
230 } 226 }
231 if(StringUtils.isEmpty(loc.getContainerCode())){ 227 if(StringUtils.isEmpty(loc.getContainerCode())){
232 - return AjaxResult.error(cycleCountDetail.getLocationCode()+"没有托盘,操作失败"); 228 + return AjaxResult.error(cycleCountDetail.getLocationCode()+"库位中没有容器,操作失败!");
233 } 229 }
234 230
235 //查询任务头和明细有相同容器,没有就新增任务头和明细 231 //查询任务头和明细有相同容器,没有就新增任务头和明细
@@ -363,9 +359,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap @@ -363,9 +359,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
363 if (inventoryDetail == null) { 359 if (inventoryDetail == null) {
364 return AjaxResult.error("没有对应库存信息,请重建盘点单"); 360 return AjaxResult.error("没有对应库存信息,请重建盘点单");
365 } 361 }
366 - if(qty.compareTo(inventoryDetail.getTaskQty()) < 0){ 362 + /*if(qty.compareTo(inventoryDetail.getTaskQty()) < 0){
367 return AjaxResult.error("登记数量不能小于任务分配数量"); 363 return AjaxResult.error("登记数量不能小于任务分配数量");
368 - } 364 + }*/
369 } 365 }
370 cyclecountDetail.setCountedQty(qty); 366 cyclecountDetail.setCountedQty(qty);
371 cyclecountDetail.setGapQty(qty.subtract(cyclecountDetail.getSystemQty())); 367 cyclecountDetail.setGapQty(qty.subtract(cyclecountDetail.getSystemQty()));
@@ -390,7 +386,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap @@ -390,7 +386,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
390 public AjaxResult createCyclecountWithGapQty(String cycleCountHeaderCode) { 386 public AjaxResult createCyclecountWithGapQty(String cycleCountHeaderCode) {
391 /*找出实盘登记中数量有差异的,重新生成盘点单*/ 387 /*找出实盘登记中数量有差异的,重新生成盘点单*/
392 388
393 -  
394 CycleCountHeader cycleCountHeader = new CycleCountHeader(); 389 CycleCountHeader cycleCountHeader = new CycleCountHeader();
395 cycleCountHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); 390 cycleCountHeader.setWarehouseCode(ShiroUtils.getWarehouseCode());
396 cycleCountHeader.setCode(cycleCountHeaderCode); 391 cycleCountHeader.setCode(cycleCountHeaderCode);
src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java
@@ -169,12 +169,10 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap @@ -169,12 +169,10 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap
169 169
170 //查询该条盘点单头 id 170 //查询该条盘点单头 id
171 CycleCountHeader cyclecountHeader = cycleCountHeaderMapper.selectById(id); 171 CycleCountHeader cyclecountHeader = cycleCountHeaderMapper.selectById(id);
172 -  
173 - if(cyclecountHeader.getStatusCyc() >= 35){ 172 + if(cyclecountHeader.getStatusCyc() < 100){
174 //查询是否已生成差异单 173 //查询是否已生成差异单
175 - throw new ServiceException("该条盘点单无法生成调整单,请检查状态!"); 174 + throw new ServiceException("该条盘点单无法生成调整单,必须为盘点任务完成,请检查状态!");
176 } 175 }
177 -  
178 AdjustHeader adjustHeader = new AdjustHeader(); 176 AdjustHeader adjustHeader = new AdjustHeader();
179 adjustHeader.setWarehouseCode(ShiroUtils.getWarehouseCode());//仓库 177 adjustHeader.setWarehouseCode(ShiroUtils.getWarehouseCode());//仓库
180 adjustHeader.setCode(adjustHeaderService.createCode());//生成差异单号 178 adjustHeader.setCode(adjustHeaderService.createCode());//生成差异单号
@@ -197,6 +195,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap @@ -197,6 +195,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap
197 //AdjustHeader adjust = adjustHeaderService.getById(adjustHeader.getId()); 195 //AdjustHeader adjust = adjustHeaderService.getById(adjustHeader.getId());
198 //循环明细条目,查找符合条件的数据写入调整单明细 196 //循环明细条目,查找符合条件的数据写入调整单明细
199 AdjustDetail adjustDetail = new AdjustDetail(); 197 AdjustDetail adjustDetail = new AdjustDetail();
  198 + List<AdjustDetail> adjustDetails = new ArrayList<>();
200 for(CycleCountDetail item:cycleCountDetailList){ 199 for(CycleCountDetail item:cycleCountDetailList){
201 //BigDecimal的比较 .compareTo(BigDecimal.ZERO) != 0 200 //BigDecimal的比较 .compareTo(BigDecimal.ZERO) != 0
202 201
@@ -224,14 +223,16 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap @@ -224,14 +223,16 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl&lt;CycleCountHeaderMap
224 adjustDetail.setCreated(new Date()); 223 adjustDetail.setCreated(new Date());
225 adjustDetail.setCreatedBy(ShiroUtils.getLoginName()); 224 adjustDetail.setCreatedBy(ShiroUtils.getLoginName());
226 //adjustDetail.setStatus(0);//状态 225 //adjustDetail.setStatus(0);//状态
227 -  
228 - adjustDetailService.save(adjustDetail); 226 + adjustDetails.add(adjustDetail);
  227 + //adjustDetailService.save(adjustDetail);
229 } 228 }
230 -  
231 } 229 }
232 - 230 + if(adjustDetails.size() == 0 ){
  231 + throw new SecurityException("该盘点单没有差异数据条目,无法生成调整单!");
  232 + }
  233 + adjustDetailService.saveBatch(adjustDetails);
233 //修改盘点主单状态为已生成差异单 234 //修改盘点主单状态为已生成差异单
234 - cyclecountHeader.setStatusCyc(35); 235 + cyclecountHeader.setStatusCyc(101);
235 this.saveOrUpdate(cyclecountHeader); 236 this.saveOrUpdate(cyclecountHeader);
236 237
237 return AjaxResult.success("差异调整及明细单生成完毕!"); 238 return AjaxResult.success("差异调整及明细单生成完毕!");
src/main/resources/templates/inventory/adjustDetail/adjustDetail.html
@@ -91,14 +91,16 @@ @@ -91,14 +91,16 @@
91 </div> 91 </div>
92 </div> 92 </div>
93 <div class="btn-group hidden-xs" id="toolbar" role="group"> 93 <div class="btn-group hidden-xs" id="toolbar" role="group">
94 - <a class="btn btn-outline btn-success btn-rounded" onclick="add()"> 94 + <a class="btn btn-outline btn-success btn-rounded" onclick="add()"
  95 + shiro:hasPermission="inventory:adjustDetail:add" >
95 <i class="fa fa-plus"></i> 新增 96 <i class="fa fa-plus"></i> 新增
96 </a> 97 </a>
97 - <a class="btn btn-outline btn-primary btn-rounded" onclick="agree()"> 98 + <a class="btn btn-outline btn-primary btn-rounded" onclick="agree()"
  99 + shiro:hasPermission="inventory:adjustDetail:adjustAgree" >
98 <i class="fa fa-edit"></i> 审批 100 <i class="fa fa-edit"></i> 审批
99 </a> 101 </a>
100 - <a class="btn btn-outline btn-danger btn-rounded" onclick="addAdjust()"/>  
101 - <!--shiro:hasPermission="inventory:cyclecountAdjustDetail:addAdjust"--> 102 + <a class="btn btn-outline btn-danger btn-rounded" onclick="addAdjust()"
  103 + shiro:hasPermission="inventory:adjustDetail:addAdjust">
102 <i class="fa fa-vcard"></i>调整 104 <i class="fa fa-vcard"></i>调整
103 </a> 105 </a>
104 <!--<a class="btn btn-outline btn-success btn-rounded" onclick="$.table.refresh()"> 106 <!--<a class="btn btn-outline btn-success btn-rounded" onclick="$.table.refresh()">
@@ -112,6 +114,7 @@ @@ -112,6 +114,7 @@
112 <script th:inline="javascript"> 114 <script th:inline="javascript">
113 var prefix = ctx + "inventory/adjustDetail"; 115 var prefix = ctx + "inventory/adjustDetail";
114 var prefix_head = ctx + "inventory/adjustHeader"; 116 var prefix_head = ctx + "inventory/adjustHeader";
  117 + var removes= [[${@permission.hasPermi('inventory:adjustDetail:remove')}]];
115 var type2 = [[${@dict.getType('adjustType')}]]; 118 var type2 = [[${@dict.getType('adjustType')}]];
116 var adjustStatus = [[${@dict.getType('adjustStatus')}]]; 119 var adjustStatus = [[${@dict.getType('adjustStatus')}]];
117 var inventoryStatus = [[${@dict.getType('inventoryStatus')}]]; 120 var inventoryStatus = [[${@dict.getType('inventoryStatus')}]];
@@ -353,7 +356,7 @@ @@ -353,7 +356,7 @@
353 align: 'center', 356 align: 'center',
354 formatter: function (value, row, index) { 357 formatter: function (value, row, index) {
355 var actions = []; 358 var actions = [];
356 - actions.push('<a class="btn btn-danger btn-xs" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> '); 359 + actions.push('<a class="btn btn-danger btn-xs ' + removes + ' " href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> ');
357 return actions.join(''); 360 return actions.join('');
358 } 361 }
359 } 362 }
src/main/resources/templates/inventory/adjustHeader/adjustHeader.html
@@ -69,13 +69,13 @@ @@ -69,13 +69,13 @@
69 </div> 69 </div>
70 <div class="btn-group hidden-xs" id="toolbar" role="group"> 70 <div class="btn-group hidden-xs" id="toolbar" role="group">
71 <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" 71 <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()"
72 - shiro:hasPermission="inventory:cycleCount:add"> 72 + shiro:hasPermission="inventory:adjustHeader:add">
73 <i class="fa fa-plus"></i> 新增 73 <i class="fa fa-plus"></i> 新增
74 </a> 74 </a>
75 - <!--<a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()"  
76 - shiro:hasPermission="inventory:cycleCount:remove">  
77 - <i class="fa fa-trash-o"></i> 删除  
78 - </a>--> 75 + <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()"
  76 + shiro:hasPermission="inventory:adjustHeader:remove">
  77 + <i class="fa fa-trash-o"></i> 删除
  78 + </a>
79 </div> 79 </div>
80 <table id="bootstrap-table" data-mobile-responsive="true" 80 <table id="bootstrap-table" data-mobile-responsive="true"
81 class="table table-bordered table-hover"></table> 81 class="table table-bordered table-hover"></table>
@@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
90 <script th:inline="javascript"> 90 <script th:inline="javascript">
91 var prefix = ctx + "inventory/adjustHeader"; 91 var prefix = ctx + "inventory/adjustHeader";
92 var upload = [[${@permission.hasPermi('inventoryHeader:adjustHeader:upload')}]]; 92 var upload = [[${@permission.hasPermi('inventoryHeader:adjustHeader:upload')}]];
93 - var report = [[${@permission.hasPermi('inventoryHeader:adjustHeader:report')}]]; 93 + var report = [[${@permission.hasPermi('inventory:adjustHeader:report')}]];
94 var datas = [[${@dict.getType('sys_normal_disable')}]]; 94 var datas = [[${@dict.getType('sys_normal_disable')}]];
95 var type2 = [[${@dict.getType('adjustType')}]]; 95 var type2 = [[${@dict.getType('adjustType')}]];
96 96
@@ -180,8 +180,8 @@ @@ -180,8 +180,8 @@
180 align: 'center', 180 align: 'center',
181 formatter: function (value, row, index) { 181 formatter: function (value, row, index) {
182 var actions = []; 182 var actions = [];
183 - /* actions.push('<a class="btn btn-success btn-xs " href="#" onclick="adjustPrint(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> ');  
184 - actions.push('<a class="btn btn-info btn-xs ' + upload + ' " href="#" onclick="upLoad(\'' + row.code + '\',\'' + row.sourceCode + '\')"><i class="fa fa-edit"></i>上传</a> '); 183 + actions.push('<a class="btn btn-success btn-xs " href="#" onclick="adjustPrint(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> ');
  184 + /* actions.push('<a class="btn btn-info btn-xs ' + upload + ' " href="#" onclick="upLoad(\'' + row.code + '\',\'' + row.sourceCode + '\')"><i class="fa fa-edit"></i>上传</a> ');
185 actions.push('<a class="btn btn-danger btn-xs " href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> ');*/ 185 actions.push('<a class="btn btn-danger btn-xs " href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> ');*/
186 actions.push('<a style="background: #b5bdc0" class="btn btn-default btn-xs " href="#" onclick="detail(\'' + row.id + '\',\'' + row.code + '\')"><i class="fa fa-list-ul"></i>明细</a>'); 186 actions.push('<a style="background: #b5bdc0" class="btn btn-default btn-xs " href="#" onclick="detail(\'' + row.id + '\',\'' + row.code + '\')"><i class="fa fa-list-ul"></i>明细</a>');
187 return actions.join(''); 187 return actions.join('');
src/main/resources/templates/inventory/cycleCountDetail/add.html
@@ -11,7 +11,6 @@ @@ -11,7 +11,6 @@
11 <input type="hidden" id="cycleCountHeadCode" name="cycleCountHeadCode" th:value="${cycleCountHeadCode}"> 11 <input type="hidden" id="cycleCountHeadCode" name="cycleCountHeadCode" th:value="${cycleCountHeadCode}">
12 <div class="select-list"> 12 <div class="select-list">
13 <ul> 13 <ul>
14 - <ul>  
15 <li> 14 <li>
16 库存头ID:<input id="inventoryHeaderId" type="text" name="inventoryHeaderId"/> 15 库存头ID:<input id="inventoryHeaderId" type="text" name="inventoryHeaderId"/>
17 </li> 16 </li>
@@ -79,12 +78,14 @@ @@ -79,12 +78,14 @@
79 <a id="search" class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a> 78 <a id="search" class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
80 <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="general:inventoryHeader:export"><i class="fa fa-download"></i>&nbsp;导出</a>--> 79 <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="general:inventoryHeader:export"><i class="fa fa-download"></i>&nbsp;导出</a>-->
81 </li> 80 </li>
82 - </ul> 81 + </ul>
83 </div> 82 </div>
84 </form> 83 </form>
85 </div> 84 </div>
86 <div class="col-sm-12 select-info"> 85 <div class="col-sm-12 select-info">
87 - <a class="btn btn-success btn-sm" onclick="addDetails()" style="float: left; margin-top: 12px" shiro:hasPermission="inventory:cyclecountDetail:add"><i class="fa fa-edit" ></i>&nbsp;批量添加盘点明细</a> 86 + <a class="btn btn-success btn-sm" onclick="addDetails()" style="float: left; margin-top: 12px"
  87 + shiro:hasPermission="inventory:cyclecountDetail:add">
  88 + <i class="fa fa-edit" ></i>&nbsp;添加盘点明细</a>
88 <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> 89 <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
89 </div> 90 </div>
90 </div> 91 </div>
@@ -94,7 +95,7 @@ @@ -94,7 +95,7 @@
94 <div th:include="include::footer"></div> 95 <div th:include="include::footer"></div>
95 96
96 <script th:inline="javascript"> 97 <script th:inline="javascript">
97 - var addFlag = [[${@permission.hasPermi('inventoryHeader:cycleCountDetail:add')}]]; 98 + var addFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:add')}]];
98 // var removeFlag = [[${@permission.hasPermi('inventoryHeader:inventoryHeader:remove')}]]; 99 // var removeFlag = [[${@permission.hasPermi('inventoryHeader:inventoryHeader:remove')}]];
99 var prefix = ctx + "inventory/inventoryDetail"; 100 var prefix = ctx + "inventory/inventoryDetail";
100 var prefix_cycleDetails = ctx + "inventory/cycleCountDetail"; 101 var prefix_cycleDetails = ctx + "inventory/cycleCountDetail";
@@ -132,7 +133,7 @@ @@ -132,7 +133,7 @@
132 { 133 {
133 checkbox: true 134 checkbox: true
134 }, 135 },
135 - { 136 + /*{
136 title: '操作', 137 title: '操作',
137 align: 'center', 138 align: 'center',
138 formatter: function(value, row, index) { 139 formatter: function(value, row, index) {
@@ -141,10 +142,10 @@ @@ -141,10 +142,10 @@
141 // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>'); 142 // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
142 return actions.join(''); 143 return actions.join('');
143 } 144 }
144 - }, 145 + },*/
145 { 146 {
146 field: 'id', 147 field: 'id',
147 - title: '明细ID', 148 + title: '库存明细ID',
148 sortable: true 149 sortable: true
149 }, 150 },
150 { 151 {
@@ -315,9 +316,13 @@ @@ -315,9 +316,13 @@
315 316
316 }); 317 });
317 318
318 - /*function addDetail(cycleCountHeadId) {  
319 - addInner($('cycleCountHeadId').val(),cycleCountHeadId);  
320 - }*/ 319 + function addDetail(id) {
  320 + /*var ids =[];
  321 + rows.forEach(function (item) {
  322 + ids.push(item.id);
  323 + });*/
  324 + addInner($('#cycleCountHeadCode').val(),id);
  325 + }
321 326
322 function addDetails() { 327 function addDetails() {
323 var rows=$("#bootstrap-table").bootstrapTable('getSelections'); 328 var rows=$("#bootstrap-table").bootstrapTable('getSelections');
@@ -339,7 +344,7 @@ @@ -339,7 +344,7 @@
339 url : prefix_cycleDetails + "/add", 344 url : prefix_cycleDetails + "/add",
340 data:{ 345 data:{
341 cycleCountHeadCode:cycleCountHeadCode, 346 cycleCountHeadCode:cycleCountHeadCode,
342 - inventoryDetailIdIds:ids 347 + inventoryDetailIds:ids
343 }, 348 },
344 async : false, 349 async : false,
345 error : function(request) { 350 error : function(request) {
src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html
@@ -318,13 +318,13 @@ @@ -318,13 +318,13 @@
318 align: 'center', 318 align: 'center',
319 formatter: function (value, row, index) { 319 formatter: function (value, row, index) {
320 var actions = []; 320 var actions = [];
321 -  
322 - actions.push('<a class="btn btn-success btn-xs ' + confirmFlag + '" href="#" onclick="confirmGapQty(\'' + row.id + '\')"><i class="fa fa-comment"></i>实盘登记</a> ');  
323 -  
324 - actions.push('<a class="btn btn-primary btn-xs ' + createTaskFalg + '" href="#" onclick="outcheck(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成盘点任务</a> ');  
325 - 321 + if(row.enableStatus >= 10 && row.enableStatus < 100){
  322 + actions.push('<a class="btn btn-success btn-xs ' + confirmFlag + '" href="#" onclick="confirmGapQty(\'' + row.id + '\')"><i class="fa fa-comment"></i>实盘登记</a> ');
  323 + }
  324 + if(row.enableStatus === 1 ){
  325 + actions.push('<a class="btn btn-primary btn-xs ' + createTaskFalg + '" href="#" onclick="outcheck(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成盘点任务</a> ');
  326 + }
326 actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>'); 327 actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>');
327 -  
328 return actions.join(''); 328 return actions.join('');
329 } 329 }
330 }] 330 }]
src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html
@@ -275,9 +275,9 @@ @@ -275,9 +275,9 @@
275 formatter: function (value, row, index) { 275 formatter: function (value, row, index) {
276 var actions = []; 276 var actions = [];
277 actions.push('<a class="btn btn-success btn-xs ' + reportFlag + '" href="#" onclick="cyclecountPrint(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> '); 277 actions.push('<a class="btn btn-success btn-xs ' + reportFlag + '" href="#" onclick="cyclecountPrint(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> ');
278 -  
279 - actions.push('<a class="btn btn-warning btn-xs ' + addAdjust + '" href="#" onclick="goAdjust(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成调整单</a> ');  
280 - 278 + if(row.statusCyc === 100){
  279 + actions.push('<a class="btn btn-warning btn-xs ' + addAdjust + '" href="#" onclick="goAdjust(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成调整单</a> ');
  280 + }
281 //actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); 281 //actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
282 actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> '); 282 actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> ');
283 return actions.join(''); 283 return actions.join('');
src/main/resources/templates/inventory/inventoryDetail/inventoryDetail.html
@@ -305,7 +305,9 @@ @@ -305,7 +305,9 @@
305 visible: false 305 visible: false
306 } 306 }
307 ] 307 ]
308 - },url = location.search.substr(1); 308 + },
  309 +
  310 + url = location.search.substr(1);
309 let strs = url.split("&"); 311 let strs = url.split("&");
310 $("#inventoryHeaderId").val(strs[0]); 312 $("#inventoryHeaderId").val(strs[0]);
311 $("#locationCode").val(strs[1]); 313 $("#locationCode").val(strs[1]);