Commit cbcf213d20c3474fda535d6e77d76ae940cd9fce
Merge branch 'develop' of http://172.16.29.40:8010/wms/wms2 into develop
Showing
15 changed files
with
231 additions
and
130 deletions
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
... | ... | @@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | 5 | import com.huaheng.api.wcs.domain.TaskFinishDomain; |
6 | 6 | import com.huaheng.api.wcs.domain.WcsTask; |
7 | +import com.huaheng.api.wcs.service.warecellAllocation.WarecellAllocationService; | |
7 | 8 | import com.huaheng.common.exception.service.ServiceException; |
8 | 9 | import com.huaheng.common.utils.StringUtils; |
9 | 10 | import com.huaheng.common.utils.security.ShiroUtils; |
10 | 11 | import com.huaheng.framework.web.domain.AjaxResult; |
12 | +import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; | |
13 | +import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService; | |
11 | 14 | import com.huaheng.pc.config.location.domain.Location; |
12 | 15 | import com.huaheng.pc.config.location.service.LocationService; |
13 | 16 | import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; |
... | ... | @@ -22,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
22 | 25 | import org.springframework.stereotype.Service; |
23 | 26 | import org.springframework.transaction.annotation.Transactional; |
24 | 27 | |
28 | +import javax.annotation.Resource; | |
25 | 29 | import java.util.ArrayList; |
26 | 30 | import java.util.List; |
27 | 31 | |
... | ... | @@ -39,6 +43,10 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
39 | 43 | private ReceiptContainerHeaderService receiptContainerHeaderService; |
40 | 44 | @Autowired |
41 | 45 | private ReceiptContainerDetailService receiptContainerDetailService; |
46 | + @Resource | |
47 | + private WarecellAllocationService warecellAllocationService; | |
48 | + @Resource | |
49 | + private FilterConfigDetailService filterConfigDetailService; | |
42 | 50 | |
43 | 51 | /** |
44 | 52 | * 重入处理 |
... | ... | @@ -60,7 +68,7 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
60 | 68 | return AjaxResult.error("目的库位为空"); |
61 | 69 | } |
62 | 70 | if(StringUtils.isEmpty(taskFinishDomain.getRedirectionLocationCode())){ |
63 | - return AjaxResult.error("目的库位为空"); | |
71 | + return AjaxResult.error("重入的库位编码为空"); | |
64 | 72 | } |
65 | 73 | |
66 | 74 | |
... | ... | @@ -105,7 +113,26 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
105 | 113 | } |
106 | 114 | }else { |
107 | 115 | //重入的库位由wms提供 |
116 | + //查询任务明细 | |
117 | + LambdaQueryWrapper<TaskDetail> taskDetailLambda = Wrappers.lambdaQuery(); | |
118 | + taskDetailLambda.eq(TaskDetail::getTaskId, taskFinishDomain.getTaskNo()); | |
119 | + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambda); | |
120 | + //查询入库组盘明细 | |
121 | + List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>(); | |
122 | + for (TaskDetail taskDetail : taskDetailList) { | |
123 | + receiptContainerDetailList.add(receiptContainerDetailService.getById(taskDetail.getAllocationId())); | |
124 | + } | |
125 | + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetailList.get(0).getReceiptContainerId()); | |
126 | + String locatingRule = warecellAllocationService.taskPositioning(receiptContainerDetailList.get(0)); | |
127 | + | |
128 | + LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery(); | |
129 | + filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule); | |
130 | + FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda); | |
108 | 131 | |
132 | + //根据定位规则查询库位编码 | |
133 | + LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); | |
134 | + locationLambda.last(filterConfigDetail.getStatement()); | |
135 | + newlocation = locationService.getOne(locationLambda); | |
109 | 136 | } |
110 | 137 | |
111 | 138 | //修改任务 |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationService.java
... | ... | @@ -2,9 +2,12 @@ package com.huaheng.api.wcs.service.warecellAllocation; |
2 | 2 | |
3 | 3 | import com.huaheng.api.wcs.domain.WcsTask; |
4 | 4 | import com.huaheng.framework.web.domain.AjaxResult; |
5 | +import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; | |
5 | 6 | |
6 | 7 | public interface WarecellAllocationService { |
7 | 8 | |
8 | 9 | //仓位分配 |
9 | 10 | AjaxResult WarecellAllocation(WcsTask wcsTask); |
11 | + | |
12 | + String taskPositioning(ReceiptContainerDetail receiptContainerDetail); | |
10 | 13 | } |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... | ... | @@ -35,6 +35,7 @@ import com.huaheng.pc.task.taskDetail.service.TaskDetailService; |
35 | 35 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
36 | 36 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
37 | 37 | import com.jhlabs.image.LightFilter; |
38 | +import com.mchange.v1.util.Sublist; | |
38 | 39 | import io.swagger.annotations.ResponseHeader; |
39 | 40 | import org.springframework.stereotype.Service; |
40 | 41 | |
... | ... | @@ -129,48 +130,12 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
129 | 130 | |
130 | 131 | for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetailList) { |
131 | 132 | ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId()); |
132 | - String locatingRule = receiptContainerHeader.getLocatingRule(); //定位规则 | |
133 | - if (StringUtils.isEmpty(locatingRule)){ | |
134 | - locatingRule = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()).getLocatingRule(); | |
135 | - //入库单明细定位规则不为空时执行 | |
136 | - if (StringUtils.isEmpty(locatingRule)){ | |
137 | - //入库单明细为空时,查询物料表中是否含有定位规则 | |
138 | - LambdaQueryWrapper<Material> materialLambda = Wrappers.lambdaQuery(); | |
139 | - materialLambda.eq(Material::getCode, receiptContainerDetail.getMaterialCode()); | |
140 | - Material material = materialService.getOne(materialLambda); | |
141 | - locatingRule = material.getLocatingRule(); | |
142 | 133 | |
143 | - if (StringUtils.isEmpty(locatingRule)){ | |
144 | - //物料表中定位规则为空时,查询物料类别 | |
145 | - LambdaQueryWrapper<MaterialType> materialTypeLambda = Wrappers.lambdaQuery(); | |
146 | - materialTypeLambda.eq(MaterialType::getCode, material.getType()); | |
147 | - MaterialType materialType = materialTypeService.getOne(materialTypeLambda); | |
148 | - locatingRule = materialType.getLocatingRule(); | |
149 | - if (StringUtils.isEmpty(locatingRule)){ | |
150 | - //物料类别中定位规则为空时,查询入库首选项 | |
151 | - LambdaQueryWrapper<ConfigValue> configValueLambda = Wrappers.lambdaQuery(); | |
152 | - configValueLambda.eq(ConfigValue::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
153 | - .eq(ConfigValue::getModuleType, "receipt") | |
154 | - .eq(ConfigValue::getRecordType, "入库首选项"); | |
155 | - ConfigValue configValue = configValueService.getOne(configValueLambda); | |
156 | - LambdaQueryWrapper<ReceiptPreference> receiptPreferenceLambda = Wrappers.lambdaQuery(); | |
157 | - receiptPreferenceLambda.eq(ReceiptPreference::getCode, configValue.getValue()); | |
158 | - ReceiptPreference receiptPreference = receiptPreferenceService.getOne(receiptPreferenceLambda); | |
159 | - locatingRule = receiptPreferenceService.getOne(receiptPreferenceLambda).getLocationRule(); | |
160 | - } | |
161 | - } | |
162 | - } | |
163 | - | |
164 | - } | |
165 | - //通过定位规则查找自定义sql | |
166 | - if (StringUtils.isEmpty(locatingRule)){ | |
167 | - throw new ServiceException("未绑定定位规则"); | |
168 | - } | |
134 | + String locatingRule = this.taskPositioning(receiptContainerDetail); | |
169 | 135 | |
170 | 136 | LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery(); |
171 | 137 | filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule); |
172 | 138 | FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda); |
173 | - | |
174 | 139 | String[] locatingRules = filterConfigDetail.getStatement().split("limit"); |
175 | 140 | |
176 | 141 | //根据定位规则查询库位编码 |
... | ... | @@ -178,7 +143,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
178 | 143 | locationLambda.last(locatingRules[0]); |
179 | 144 | List<Location> locationList = locationService.list(locationLambda); |
180 | 145 | // locationList.stream().filter(location -> location.getLocationType().equals(locationTypeList.get(0))); |
181 | - locationCode = filter(locationList, locationTypeList); | |
146 | + locationCode = filter(locationList, locationTypeList, wcsTask.getRoadWay()); | |
182 | 147 | if (StringUtils.isEmpty(locationCode)){ |
183 | 148 | throw new ServiceException("没有库位可分配"); |
184 | 149 | } |
... | ... | @@ -205,6 +170,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
205 | 170 | } |
206 | 171 | |
207 | 172 | } |
173 | + | |
208 | 174 | if (StringUtils.isNotEmpty(locationCode)){ |
209 | 175 | //修改任务明细目标库位 |
210 | 176 | for (TaskDetail taskDetail : taskDetailList) { |
... | ... | @@ -226,20 +192,65 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
226 | 192 | |
227 | 193 | /** |
228 | 194 | * 库位筛选 |
229 | - * @param locationList | |
230 | - * @param locationTypeList | |
195 | + * @param locationList 库位列表 | |
196 | + * @param locationTypeList 库位类型列表 | |
197 | + * @param roadway 巷道 | |
231 | 198 | * @return |
232 | 199 | */ |
233 | - public String filter(List<Location> locationList, List<LocationType> locationTypeList){ | |
234 | - String locationCode = null; | |
235 | - for (Location location: locationList){ | |
236 | - for (LocationType locationType: locationTypeList) { | |
237 | - if (location.getLocationType().equals(locationType.getCode())){ | |
238 | - locationCode = location.getCode(); | |
239 | - return locationCode; | |
200 | + public String filter(List<Location> locationList, List<LocationType> locationTypeList, String roadway){ | |
201 | + List<String> codeList = locationTypeList.stream().map(t-> t.getCode()).collect(Collectors.toList()); | |
202 | + List<Location> newLocation = locationList.stream().filter(t-> codeList.contains(t.getLocationType()) && t.getRoadway().equals(roadway)).collect(Collectors.toList()); | |
203 | + if (newLocation.isEmpty()){ | |
204 | + return null; | |
205 | + } else{ | |
206 | + return newLocation.get(0).getCode(); | |
207 | + } | |
208 | + } | |
209 | + | |
210 | + /** | |
211 | + * 定位 | |
212 | + * @param receiptContainerDetail | |
213 | + * @return | |
214 | + */ | |
215 | + public String taskPositioning(ReceiptContainerDetail receiptContainerDetail){ | |
216 | + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId()); | |
217 | + String locatingRule = receiptContainerHeader.getLocatingRule(); //定位规则 | |
218 | + if (StringUtils.isEmpty(locatingRule)){ | |
219 | + locatingRule = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()).getLocatingRule(); | |
220 | + //入库单明细定位规则不为空时执行 | |
221 | + if (StringUtils.isEmpty(locatingRule)){ | |
222 | + //入库单明细为空时,查询物料表中是否含有定位规则 | |
223 | + LambdaQueryWrapper<Material> materialLambda = Wrappers.lambdaQuery(); | |
224 | + materialLambda.eq(Material::getCode, receiptContainerDetail.getMaterialCode()); | |
225 | + Material material = materialService.getOne(materialLambda); | |
226 | + locatingRule = material.getLocatingRule(); | |
227 | + | |
228 | + if (StringUtils.isEmpty(locatingRule)){ | |
229 | + //物料表中定位规则为空时,查询物料类别 | |
230 | + LambdaQueryWrapper<MaterialType> materialTypeLambda = Wrappers.lambdaQuery(); | |
231 | + materialTypeLambda.eq(MaterialType::getCode, material.getType()); | |
232 | + MaterialType materialType = materialTypeService.getOne(materialTypeLambda); | |
233 | + locatingRule = materialType.getLocatingRule(); | |
234 | + if (StringUtils.isEmpty(locatingRule)){ | |
235 | + //物料类别中定位规则为空时,查询入库首选项 | |
236 | + LambdaQueryWrapper<ConfigValue> configValueLambda = Wrappers.lambdaQuery(); | |
237 | + configValueLambda.eq(ConfigValue::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
238 | + .eq(ConfigValue::getModuleType, "receipt") | |
239 | + .eq(ConfigValue::getRecordType, "入库首选项"); | |
240 | + ConfigValue configValue = configValueService.getOne(configValueLambda); | |
241 | + LambdaQueryWrapper<ReceiptPreference> receiptPreferenceLambda = Wrappers.lambdaQuery(); | |
242 | + receiptPreferenceLambda.eq(ReceiptPreference::getCode, configValue.getValue()); | |
243 | + ReceiptPreference receiptPreference = receiptPreferenceService.getOne(receiptPreferenceLambda); | |
244 | + locatingRule = receiptPreferenceService.getOne(receiptPreferenceLambda).getLocationRule(); | |
245 | + } | |
240 | 246 | } |
241 | 247 | } |
242 | 248 | } |
243 | - return null; | |
249 | + //通过定位规则查找自定义sql | |
250 | + if (StringUtils.isEmpty(locatingRule)){ | |
251 | + throw new ServiceException("未绑定定位规则"); | |
252 | + } | |
253 | + | |
254 | + return locatingRule; | |
244 | 255 | } |
245 | 256 | } |
... | ... |
src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
... | ... | @@ -123,7 +123,7 @@ public class LocationController extends BaseController { |
123 | 123 | /** |
124 | 124 | * 批量新增保存库位 |
125 | 125 | */ |
126 | - @RequiresPermissions("config:location:add") | |
126 | + @RequiresPermissions("config:location:addBatch") | |
127 | 127 | @ApiOperation(value="新增库位", notes="批量新增库位", httpMethod = "POST") |
128 | 128 | @Log(title = "通用-库位管理", operating = "新增库位", action = BusinessType.INSERT) |
129 | 129 | @PostMapping("/addBatchSave") |
... | ... |
src/main/java/com/huaheng/pc/config/location/domain/Location.java
... | ... | @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName; |
7 | 7 | import java.io.Serializable; |
8 | 8 | import java.util.Date; |
9 | 9 | import lombok.Data; |
10 | +import org.springframework.transaction.annotation.Transactional; | |
10 | 11 | |
11 | 12 | @Data |
12 | 13 | @TableName(value = "location") |
... | ... | @@ -72,6 +73,12 @@ public class Location implements Serializable { |
72 | 73 | private Integer iGrid; |
73 | 74 | |
74 | 75 | /** |
76 | + * 巷道 | |
77 | + */ | |
78 | + @TableField(value = "roadway") | |
79 | + private String roadway; | |
80 | + | |
81 | + /** | |
75 | 82 | * 名称 |
76 | 83 | */ |
77 | 84 | @TableField(value = "name") |
... | ... | @@ -174,56 +181,4 @@ public class Location implements Serializable { |
174 | 181 | private Boolean deleted; |
175 | 182 | |
176 | 183 | private static final long serialVersionUID = 1L; |
177 | - | |
178 | - public static final String COL_CODE = "code"; | |
179 | - | |
180 | - public static final String COL_WAREHOUSECODE = "warehouseCode"; | |
181 | - | |
182 | - public static final String COL_ZONECODE = "zoneCode"; | |
183 | - | |
184 | - public static final String COL_LOCATIONTYPE = "locationType"; | |
185 | - | |
186 | - public static final String COL_CONTAINERCODE = "containerCode"; | |
187 | - | |
188 | - public static final String COL_IROW = "iRow"; | |
189 | - | |
190 | - public static final String COL_ICOLUMN = "iColumn"; | |
191 | - | |
192 | - public static final String COL_ILAYER = "iLayer"; | |
193 | - | |
194 | - public static final String COL_IGRID = "iGrid"; | |
195 | - | |
196 | - public static final String COL_NAME = "name"; | |
197 | - | |
198 | - public static final String COL_ENABLE = "enable"; | |
199 | - | |
200 | - public static final String COL_LASTCYCLECOUNTDATE = "lastCycleCountDate"; | |
201 | - | |
202 | - public static final String COL_CREATED = "created"; | |
203 | - | |
204 | - public static final String COL_CREATEDBY = "createdBy"; | |
205 | - | |
206 | - public static final String COL_LASTUPDATED = "lastUpdated"; | |
207 | - | |
208 | - public static final String COL_LASTUPDATEDBY = "lastUpdatedBy"; | |
209 | - | |
210 | - public static final String COL_VERSION = "version"; | |
211 | - | |
212 | - public static final String COL_USERDEF1 = "userDef1"; | |
213 | - | |
214 | - public static final String COL_USERDEF2 = "userDef2"; | |
215 | - | |
216 | - public static final String COL_USERDEF3 = "userDef3"; | |
217 | - | |
218 | - public static final String COL_USERDEF4 = "userDef4"; | |
219 | - | |
220 | - public static final String COL_USERDEF5 = "userDef5"; | |
221 | - | |
222 | - public static final String COL_USERDEF6 = "userDef6"; | |
223 | - | |
224 | - public static final String COL_USERDEF7 = "userDef7"; | |
225 | - | |
226 | - public static final String COL_USERDEF8 = "userDef8"; | |
227 | - | |
228 | - public static final String COL_SYSTEMCREATED = "systemCreated"; | |
229 | 184 | } |
230 | 185 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... | ... | @@ -73,13 +73,18 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
73 | 73 | return AjaxResult.success("新增库位成功"); |
74 | 74 | } |
75 | 75 | |
76 | + /** | |
77 | + * 批量新增库位 | |
78 | + * @param location | |
79 | + * @return boolean | |
80 | + */ | |
76 | 81 | @Override |
77 | 82 | public boolean insertLocation(Location location) { |
78 | 83 | /* 判断库位类型编码是否存在*/ |
79 | - LambdaQueryWrapper<LocationType> typelambda = Wrappers.lambdaQuery(); | |
80 | - typelambda.eq(LocationType::getCode,location.getLocationType()) | |
84 | + LambdaQueryWrapper<LocationType> typeLambda = Wrappers.lambdaQuery(); | |
85 | + typeLambda.eq(LocationType::getCode,location.getLocationType()) | |
81 | 86 | .select(LocationType::getCode); |
82 | - List<Map<String, Object>> list = locationTypeService.listMaps(typelambda); | |
87 | + List<Map<String, Object>> list = locationTypeService.listMaps(typeLambda); | |
83 | 88 | if (list.size() < 1){ |
84 | 89 | throw new ServiceException("库位类型编码不存在"); |
85 | 90 | } |
... | ... | @@ -97,6 +102,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
97 | 102 | if(!location.getZoneCode().equals(location.getLocationType())){ |
98 | 103 | throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配"); |
99 | 104 | } |
105 | + | |
100 | 106 | String prefix = location.getLocationType().substring(1); |
101 | 107 | List<Location> locations = new ArrayList<>(); |
102 | 108 | for (int i=1; i<=location.getIRow().intValue(); i++) { |
... | ... | @@ -109,6 +115,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
109 | 115 | param.setIColumn(j); |
110 | 116 | param.setILayer(k); |
111 | 117 | param.setIGrid(m); |
118 | + param.setRoadway(location.getRoadway()); | |
112 | 119 | param.setZoneCode(location.getZoneCode()); |
113 | 120 | param.setLocationType(location.getLocationType()); |
114 | 121 | param.setStatus(location.getStatus()); |
... | ... | @@ -121,6 +128,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
121 | 128 | String.format("%02d", j), |
122 | 129 | String.format("%02d", k), |
123 | 130 | String.format("%02d", m)); |
131 | + //查询该库位编码是否存在 | |
124 | 132 | LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery(); |
125 | 133 | queryWrapper.eq(Location::getCode,code) |
126 | 134 | .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode()); |
... | ... | @@ -133,8 +141,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
133 | 141 | } |
134 | 142 | } |
135 | 143 | } |
136 | - Boolean result = locationService.saveBatch(locations); | |
137 | - return result; | |
144 | + return locationService.saveBatch(locations); | |
138 | 145 | } |
139 | 146 | |
140 | 147 | @Override |
... | ... |
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/mybatis/config/LocationMapper.xml
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | <result column="iColumn" jdbcType="INTEGER" property="iColumn" /> |
14 | 14 | <result column="iLayer" jdbcType="INTEGER" property="iLayer" /> |
15 | 15 | <result column="iGrid" jdbcType="INTEGER" property="iGrid" /> |
16 | + <result column="roadway" jdbcType="VARCHAR" property="roadway" /> | |
16 | 17 | <result column="name" jdbcType="VARCHAR" property="name" /> |
17 | 18 | <result column="lastCycleCountDate" jdbcType="TIMESTAMP" property="lastCycleCountDate" /> |
18 | 19 | <result column="created" jdbcType="TIMESTAMP" property="created" /> |
... | ... | @@ -33,7 +34,7 @@ |
33 | 34 | <sql id="Base_Column_List"> |
34 | 35 | <!--@mbg.generated--> |
35 | 36 | id, code, warehouseCode, zoneCode, locationType, containerCode, iRow, iColumn, iLayer, |
36 | - iGrid, `name`, `enable`, lastCycleCountDate, created, createdBy, lastUpdated, lastUpdatedBy, | |
37 | + iGrid, roadway, `name`, `enable`, lastCycleCountDate, created, createdBy, lastUpdated, lastUpdatedBy, | |
37 | 38 | version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, |
38 | 39 | systemCreated |
39 | 40 | </sql> |
... | ... |
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/config/location/addBatch.html
... | ... | @@ -30,6 +30,12 @@ |
30 | 30 | </div> |
31 | 31 | </div> |
32 | 32 | <div class="form-group"> |
33 | + <label class="col-sm-3 control-label">巷道:</label> | |
34 | + <div class="col-sm-8"> | |
35 | + <input id="roadway" name="roadway" class="form-control" type="text"> | |
36 | + </div> | |
37 | + </div> | |
38 | + <div class="form-group"> | |
33 | 39 | <label class="col-sm-3 control-label">库位类型:</label> |
34 | 40 | <div class="col-sm-8"> |
35 | 41 | <select id="locationType" name="locationType" class="form-control" th:with="locationType=${@locationType.getLocationPrefix()}"> |
... | ... | @@ -104,6 +110,7 @@ |
104 | 110 | "iColumn": $("input[name='iColumn']").val(), |
105 | 111 | "iLayer": $("input[name='iLayer']").val(), |
106 | 112 | "iGrid": $("input[name='iGrid']").val(), |
113 | + "roadway": $("input[name='roadway']").val(), | |
107 | 114 | "locationType": $("#locationType option:selected").val(), |
108 | 115 | "zoneCode": $("#zone option:selected").attr("code"), |
109 | 116 | "status" : $("#status option:selected").val(), |
... | ... |
src/main/resources/templates/config/location/location.html
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:location:add"> |
69 | 69 | <i class="fa fa-plus"></i> 新增 |
70 | 70 | </a> |
71 | - <a class="btn btn-outline btn-primary btn-rounded" onclick="addBatch()" shiro:hasPermission="config:location:add"> | |
71 | + <a class="btn btn-outline btn-primary btn-rounded" onclick="addBatch()" shiro:hasPermission="config:location:addBatch"> | |
72 | 72 | <i class="fa fa-plus-square-o"></i> 批量新增 |
73 | 73 | </a> |
74 | 74 | <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="config:location:remove"> |
... | ... | @@ -133,6 +133,10 @@ |
133 | 133 | title : '格' |
134 | 134 | }, |
135 | 135 | { |
136 | + field : 'roadway', | |
137 | + title : '巷道' | |
138 | + }, | |
139 | + { | |
136 | 140 | field : 'name', |
137 | 141 | title : '名称', |
138 | 142 | visible : false |
... | ... |
src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html