Commit 2d5ea1e824605e3bf71b82bdff57948740a51825
Merge remote-tracking branch 'origin/develop' into develop
Showing
6 changed files
with
107 additions
and
21 deletions
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
... | ... | @@ -109,10 +109,14 @@ public class CycleCountDetailController extends BaseController { |
109 | 109 | //分页查询 |
110 | 110 | Page<CycleCountDetail> page = new Page<>(pageNum, pageSize); |
111 | 111 | IPage<CycleCountDetail> iPage = cycleCountDetailService.page(page, lambdaQueryWrapper); |
112 | - return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | |
112 | + //根据盘点首选项确定显示字段 | |
113 | + List<CycleCountDetail> ipages = cycleCountDetailService.preferenceRealize(iPage.getRecords()) ; | |
114 | + return getMpDataTable(ipages, iPage.getTotal()); | |
113 | 115 | } else { |
114 | 116 | List<CycleCountDetail> list = cycleCountDetailService.list(lambdaQueryWrapper); |
115 | - return getDataTable(list); | |
117 | + //根据盘点首选项确定显示字段 | |
118 | + List<CycleCountDetail> cycleCountDetails = cycleCountDetailService.preferenceRealize(list) ; | |
119 | + return getDataTable(cycleCountDetails); | |
116 | 120 | } |
117 | 121 | } |
118 | 122 | //空List |
... | ... |
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailService.java
... | ... | @@ -3,8 +3,10 @@ package com.huaheng.pc.inventory.cycleCountDetail.service; |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | 4 | import com.huaheng.framework.web.domain.AjaxResult; |
5 | 5 | import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; |
6 | +import org.apache.poi.ss.formula.functions.T; | |
6 | 7 | |
7 | 8 | import java.math.BigDecimal; |
9 | +import java.util.List; | |
8 | 10 | |
9 | 11 | |
10 | 12 | public interface CycleCountDetailService extends IService<CycleCountDetail> { |
... | ... | @@ -14,7 +16,7 @@ public interface CycleCountDetailService extends IService<CycleCountDetail> { |
14 | 16 | |
15 | 17 | AjaxResult createCycleCountTaskByHeadId(String cycleCountHeadCode); |
16 | 18 | |
17 | - AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutdetailId); | |
19 | + AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutDetailId); | |
18 | 20 | |
19 | 21 | AjaxResult confirmGapQty(Integer detailId, BigDecimal qty); |
20 | 22 | |
... | ... | @@ -22,7 +24,7 @@ public interface CycleCountDetailService extends IService<CycleCountDetail> { |
22 | 24 | |
23 | 25 | AjaxResult createCyclecountWithGapQty(String cycleCountHeadCode); |
24 | 26 | |
25 | - | |
27 | + List<CycleCountDetail> preferenceRealize (List<CycleCountDetail> cycleCoutDetailList); | |
26 | 28 | |
27 | 29 | } |
28 | 30 | |
... | ... |
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java
... | ... | @@ -7,6 +7,10 @@ import com.huaheng.common.exception.service.ServiceException; |
7 | 7 | import com.huaheng.common.utils.StringUtils; |
8 | 8 | import com.huaheng.common.utils.security.ShiroUtils; |
9 | 9 | import com.huaheng.framework.web.domain.AjaxResult; |
10 | +import com.huaheng.pc.config.configValue.domain.ConfigValue; | |
11 | +import com.huaheng.pc.config.configValue.service.ConfigValueService; | |
12 | +import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference; | |
13 | +import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService; | |
10 | 14 | import com.huaheng.pc.config.location.domain.Location; |
11 | 15 | import com.huaheng.pc.config.location.service.LocationService; |
12 | 16 | import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; |
... | ... | @@ -43,9 +47,10 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
43 | 47 | private TaskHeaderService taskHeaderService; |
44 | 48 | @Resource |
45 | 49 | private TaskDetailService taskDetailService; |
46 | - | |
47 | - | |
48 | - | |
50 | + @Resource | |
51 | + private ConfigValueService configValueService; | |
52 | + @Resource | |
53 | + private CycleCountPreferenceService cycleCountPreferenceService; | |
49 | 54 | |
50 | 55 | |
51 | 56 | /** |
... | ... | @@ -101,6 +106,16 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
101 | 106 | if(cyclecountHeader.getStatusCyc() > 1){ |
102 | 107 | return AjaxResult.error("盘点单非新建状态,无法再添加明细"); |
103 | 108 | } |
109 | + //默认盘点配置,首选项 | |
110 | + ConfigValue configValue = new ConfigValue(); | |
111 | + configValue.setModuleType("cyclecount"); | |
112 | + configValue.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
113 | + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper = Wrappers.lambdaQuery(configValue); | |
114 | + configValue = configValueService.getOne(configValueLambdaQueryWrapper); | |
115 | + if(configValue == null){ | |
116 | + throw new SecurityException("请先在配置中添加盘点配置"); | |
117 | + } | |
118 | + String preferenceCode = configValue.getIdentifier(); | |
104 | 119 | //获取已经存在的明细 |
105 | 120 | CycleCountDetail cycleCountDetail = new CycleCountDetail(); |
106 | 121 | cycleCountDetail.setWarehouseCode(cyclecountHeader.getWarehouseCode()); |
... | ... | @@ -118,9 +133,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
118 | 133 | } |
119 | 134 | //查询该条库存明细 |
120 | 135 | InventoryDetail inventoryDetail = inventoryDetailService.getById(inventoryDetailId); |
121 | - | |
122 | 136 | //写入盘点明细 |
123 | 137 | CycleCountDetail ccd = new CycleCountDetail(); |
138 | + ccd.setPreferenceCode(preferenceCode); | |
124 | 139 | ccd.setCycleCountHeadCode(cyclecountHeader.getCode()); |
125 | 140 | ccd.setInventoryDetailId(inventoryDetailId); |
126 | 141 | ccd.setWarehouseCode(inventoryDetail.getWarehouseCode()); |
... | ... | @@ -189,7 +204,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
189 | 204 | } |
190 | 205 | } |
191 | 206 | } |
192 | - String msg = ""; | |
207 | + String msg = null; | |
193 | 208 | if(count==list.size()){ |
194 | 209 | msg="全部生成成功"; |
195 | 210 | } else if (count <= 0 && countErr <= 0){ |
... | ... | @@ -202,17 +217,17 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
202 | 217 | |
203 | 218 | /** |
204 | 219 | * 生成单条盘点任务 |
205 | - * @param cycleCoutdetailId | |
220 | + * @param cycleCoutDetailId | |
206 | 221 | * @return |
207 | 222 | */ |
208 | 223 | @Override |
209 | 224 | @Transactional |
210 | - public AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutdetailId) { | |
225 | + public AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutDetailId) { | |
211 | 226 | /*任务主表中存在库位,在盘点明细中生成任务时,不同的容器生成不同的主任务*/ |
212 | 227 | //在盘点单生成任务并执行后,同一容器的物料仍然可以生成任务,否则任务已完成则无法添加任务100 |
213 | 228 | //检查状态不为100的任务,在有和下发的盘点单容器相同的任务时,把该条明细的任务写入到当前相同容器的任务里 |
214 | 229 | |
215 | - CycleCountDetail cycleCountDetail = this.getById(cycleCoutdetailId); | |
230 | + CycleCountDetail cycleCountDetail = this.getById(cycleCoutDetailId); | |
216 | 231 | if(cycleCountDetail == null ){ |
217 | 232 | return AjaxResult.error("盘点明细ID错误,没有该条明细"); |
218 | 233 | } |
... | ... | @@ -456,11 +471,65 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
456 | 471 | return AjaxResult.success("生成复盘单成功!"); |
457 | 472 | } |
458 | 473 | |
474 | + /** | |
475 | + * 盘点首选项实现 | |
476 | + * @param cycleCoutDetailList | |
477 | + * @return | |
478 | + */ | |
479 | + @Transactional | |
480 | + @Override | |
481 | + public List<CycleCountDetail> preferenceRealize(List<CycleCountDetail> cycleCoutDetailList) { | |
482 | + List<CycleCountDetail> cycs = new ArrayList<>(); | |
483 | + /* | |
484 | + 根据当前明细条目的盘点首选Code,取出显示要求,再根据显示要求隐藏或显示字段*/ | |
485 | + /*//配置表 | |
486 | + ConfigValue configValue = new ConfigValue(); | |
487 | + configValue.setModuleType("cyclecount"); | |
488 | + configValue.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
489 | + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper = Wrappers.lambdaQuery(configValue); | |
490 | + ConfigValue value = configValueService.getOne(configValueLambdaQueryWrapper); | |
491 | + if(value == null){ | |
492 | + throw new SecurityException("请先在配置中添加盘点配置"); | |
493 | + }*/ | |
459 | 494 | |
495 | + //取出preference的数据来判断字段 | |
496 | + for(CycleCountDetail item:cycleCoutDetailList){ | |
497 | + //盘点首选项 | |
498 | + CycleCountPreference temp = new CycleCountPreference(); | |
499 | + temp.setCode(item.getPreferenceCode()); | |
500 | + temp.setWarehouseCode(item.getWarehouseCode()); | |
501 | + LambdaQueryWrapper<CycleCountPreference> cycleCountPreferenceLambdaQuery = Wrappers.lambdaQuery(temp); | |
502 | + CycleCountPreference cycleCountPreference = cycleCountPreferenceService.getOne(cycleCountPreferenceLambdaQuery); | |
503 | + if(cycleCountPreference == null){ | |
504 | + throw new SecurityException("没有对应的盘点首选项!"); | |
505 | + } | |
506 | + if(cycleCountPreference.getEnable() == false){ | |
507 | + throw new SecurityException("当前默认选中盘点首选项已停用!"); | |
508 | + } | |
509 | + //判断字段 | |
510 | + if(cycleCountPreference.getPromptLocation() == false){ | |
511 | + //库位 | |
512 | + item.setLocationCode(""); | |
513 | + } | |
514 | + if(cycleCountPreference.getPromptLpn() == false){ | |
515 | + //容器 | |
516 | + item.setContainerCode(""); | |
517 | + } | |
518 | + if(cycleCountPreference.getPromptItem() == false){ | |
519 | + //物料 | |
520 | + item.setMaterialCode(""); | |
521 | + item.setMaterialName(""); | |
522 | + item.setMaterialUnit(""); | |
523 | + } | |
524 | + if(cycleCountPreference.getPromptQuantity() == false){ | |
525 | + //系统数量 | |
526 | + item.setSystemQty(null); | |
527 | + } | |
528 | + cycs.add(item); | |
529 | + } | |
460 | 530 | |
461 | - | |
462 | - | |
463 | - | |
531 | + return cycs; | |
532 | + } | |
464 | 533 | |
465 | 534 | |
466 | 535 | } |
... | ... |
src/main/resources/templates/config/configValue/configValue.html
... | ... | @@ -48,6 +48,8 @@ |
48 | 48 | var prefix = ctx + "config/configValue"; |
49 | 49 | var editFlag = [[${@permission.hasPermi('config:configValue:edit')}]]; |
50 | 50 | var removeFlag = [[${@permission.hasPermi('config:configValue:remove')}]]; |
51 | + var recordType=[[${@dict.getType('recordType')}]]; | |
52 | + | |
51 | 53 | $(function() { |
52 | 54 | var options = { |
53 | 55 | url: prefix + "/list", |
... | ... | @@ -74,8 +76,12 @@ |
74 | 76 | title : '模块' |
75 | 77 | }, |
76 | 78 | { |
77 | - field : 'recordType', | |
78 | - title : '类型' | |
79 | + field: 'recordType', | |
80 | + title: '类型', | |
81 | + formatter: function(value, row, index) { | |
82 | + return $.table.selectDictLabel(recordType, value); | |
83 | + }, | |
84 | + | |
79 | 85 | }, |
80 | 86 | { |
81 | 87 | field : 'identifier', |
... | ... |
src/main/resources/templates/config/cycleCountPreference/edit.html
... | ... | @@ -164,13 +164,14 @@ |
164 | 164 | promptQuantity: { |
165 | 165 | required: true, |
166 | 166 | }, |
167 | - allowAddNewInventory: { | |
168 | - required: true, | |
169 | - } | |
170 | 167 | }, |
171 | 168 | submitHandler: function(form) { |
172 | 169 | var tableValue = $.common.getTableValue("#form-cycleCountPreference-edit"); |
173 | - /*tableValue = formValueReplace(tableValue, "id", $("input[name='id']").is(':checked'));*/ | |
170 | + tableValue = formValueReplace(tableValue, "promptLocation", $("input[name='promptLocation']").is(':checked')); | |
171 | + tableValue = formValueReplace(tableValue, "promptLpn", $("input[name='promptLpn']").is(':checked')); | |
172 | + tableValue = formValueReplace(tableValue, "promptItem", $("input[name='promptItem']").is(':checked')); | |
173 | + tableValue = formValueReplace(tableValue, "promptQuantity", $("input[name='promptQuantity']").is(':checked')); | |
174 | + tableValue = formValueReplace(tableValue, "enable", $("input[name='enable']").is(':checked')); | |
174 | 175 | $.operate.save(prefix + "/edit", tableValue); |
175 | 176 | } |
176 | 177 | }); |
... | ... |
src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html