Commit 299be2ed4a76ba8e6cb8b19e931c8296bd5b1a72
Merge branch 'develop' of http://172.16.29.40:8010/wms/wms_suzhouqingyuan into develop
Showing
18 changed files
with
308 additions
and
27 deletions
src/main/java/com/huaheng/common/constant/QuantityConstant.java
... | ... | @@ -493,6 +493,7 @@ public class QuantityConstant { |
493 | 493 | * 其他出库类型 |
494 | 494 | */ |
495 | 495 | public static String SHIPMENT_QTCKLX= "QTCKLX"; |
496 | + public static String RECEIPT_QTCKLX= "QTRKLX"; | |
496 | 497 | |
497 | 498 | public static final String LOCAL_SERVER_IP = "localServerIP"; |
498 | 499 | |
... | ... | @@ -517,6 +518,12 @@ public class QuantityConstant { |
517 | 518 | public static final String SP_InStock = "SP_InStock"; |
518 | 519 | /*其他入库单回传*/ |
519 | 520 | public static final String STK_MISCELLANEOUS = "STK_MISCELLANEOUS"; |
521 | + /** | |
522 | + * 平库容器组盘自动生成任务 | |
523 | + */ | |
524 | + public static final String FLOOR_AUTO_CREATE_TASK = "FLOOR_AUTO_CREATE_TASK"; | |
525 | + | |
526 | + public static final String ZONE_FLOOR = "A"; | |
520 | 527 | |
521 | 528 | |
522 | 529 | |
... | ... |
src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
... | ... | @@ -162,7 +162,11 @@ public class RyTask extends BaseController { |
162 | 162 | @Override |
163 | 163 | public AjaxResult doProcess() { |
164 | 164 | for(TaskHeader taskHeader : taskHeaderList) { |
165 | - taskHeaderService.sendTaskToWcs(Convert.toIntArray(String.valueOf(taskHeader.getId()))); | |
165 | + try{ | |
166 | + taskHeaderService.sendTaskToWcs(Convert.toIntArray(String.valueOf(taskHeader.getId()))); | |
167 | + }catch (Exception e){ | |
168 | + | |
169 | + } | |
166 | 170 | } |
167 | 171 | return null; |
168 | 172 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java
... | ... | @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
6 | 6 | import com.huaheng.common.constant.QuantityConstant; |
7 | 7 | import com.huaheng.common.exception.service.ServiceException; |
8 | +import com.huaheng.common.support.Convert; | |
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; |
... | ... | @@ -33,6 +34,7 @@ import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
33 | 34 | import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; |
34 | 35 | import com.huaheng.pc.shipment.shipmentContainerHeader.service.ShipmentContainerHeaderService; |
35 | 36 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
37 | +import com.huaheng.pc.task.taskHeader.service.ReceiptTaskService; | |
36 | 38 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
37 | 39 | import org.springframework.stereotype.Service; |
38 | 40 | import org.springframework.transaction.annotation.Transactional; |
... | ... | @@ -40,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional; |
40 | 42 | import javax.annotation.Resource; |
41 | 43 | import java.math.BigDecimal; |
42 | 44 | import java.text.MessageFormat; |
45 | +import java.util.Arrays; | |
43 | 46 | import java.util.Calendar; |
44 | 47 | import java.util.Date; |
45 | 48 | import java.util.List; |
... | ... | @@ -70,6 +73,9 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
70 | 73 | private ConfigService configService; |
71 | 74 | @Resource |
72 | 75 | private ShipmentContainerHeaderService shipmentContainerHeaderService; |
76 | + @Resource | |
77 | + private ReceiptTaskService receiptTaskService; | |
78 | + | |
73 | 79 | /** |
74 | 80 | * 保存入库组盘 |
75 | 81 | * @param receiptCode 入库单编码 |
... | ... | @@ -189,6 +195,30 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
189 | 195 | } |
190 | 196 | } |
191 | 197 | receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); |
198 | + | |
199 | + String floorAutoCreateTask = configService.getKey(QuantityConstant.FLOOR_AUTO_CREATE_TASK); | |
200 | + if(StringUtils.isNotEmpty(floorAutoCreateTask)){ | |
201 | + String[] floorType = floorAutoCreateTask.split(","); | |
202 | + List<String> floorTypes = Arrays.asList(floorType); | |
203 | + Container container = containerService.getContainerByCode(containerCode); | |
204 | + if(floorTypes.contains(container.getContainerType())){ | |
205 | + //自动生成任务 | |
206 | + LambdaQueryWrapper<ReceiptContainerHeader> lambdaQueryWrapper= Wrappers.lambdaQuery(); | |
207 | + lambdaQueryWrapper.eq(ReceiptContainerHeader::getContainerCode,containerCode); | |
208 | + lambdaQueryWrapper.le(ReceiptContainerHeader::getStatus,10); | |
209 | + List<ReceiptContainerHeader> receiptContainerHeaders1=this.list(lambdaQueryWrapper); | |
210 | + for(ReceiptContainerHeader item:receiptContainerHeaders1) { | |
211 | + String ids = item.getId().toString(); | |
212 | + Integer[] idArray = Convert.toIntArray(ids); | |
213 | + List<Integer> islist= Arrays.asList(idArray); | |
214 | + try { | |
215 | + AjaxResult ajaxResult1=receiptTaskService.createReceiptTask(islist); | |
216 | + } catch (Exception e) { | |
217 | + e.printStackTrace(); | |
218 | + } | |
219 | + } | |
220 | + } | |
221 | + } | |
192 | 222 | return AjaxResult.success("success"); |
193 | 223 | } |
194 | 224 | |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/controller/ReceiptDetailController.java
... | ... | @@ -24,6 +24,7 @@ import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
24 | 24 | import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; |
25 | 25 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
26 | 26 | import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; |
27 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | |
27 | 28 | import com.huaheng.pc.system.user.domain.User; |
28 | 29 | import io.swagger.annotations.Api; |
29 | 30 | import io.swagger.annotations.ApiOperation; |
... | ... | @@ -32,6 +33,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; |
32 | 33 | import org.springframework.stereotype.Controller; |
33 | 34 | import org.springframework.ui.ModelMap; |
34 | 35 | import org.springframework.web.bind.annotation.*; |
36 | +import org.springframework.web.multipart.MultipartFile; | |
35 | 37 | |
36 | 38 | import javax.annotation.Resource; |
37 | 39 | import java.math.BigDecimal; |
... | ... | @@ -326,4 +328,28 @@ public class ReceiptDetailController extends BaseController { |
326 | 328 | return error("导出Excel失败,请联系网站管理员!"); |
327 | 329 | } |
328 | 330 | } |
331 | + @PostMapping("/importData") | |
332 | + @ResponseBody | |
333 | + public AjaxResult importData (MultipartFile file) throws Exception { | |
334 | + ExcelUtil<ReceiptDetail> util = new ExcelUtil<>(ReceiptDetail.class); | |
335 | + List<ReceiptDetail> list = util.importExcel(file.getInputStream()); | |
336 | + String operName = ShiroUtils.getLoginName(); | |
337 | + String message = receiptDetailService.insertExcelData(list, false, operName); | |
338 | + return AjaxResult.success(message); | |
339 | + } | |
340 | + | |
341 | + /** | |
342 | + * 导出模板 | |
343 | + * | |
344 | + * @return | |
345 | + * @throws Exception | |
346 | + */ | |
347 | + @GetMapping("/importTemplate") | |
348 | + @ResponseBody | |
349 | + public AjaxResult importTemplate () { | |
350 | + ExcelUtil<ReceiptDetail> util = new ExcelUtil<>(ReceiptDetail.class); | |
351 | + return util.importTemplateExcel("入库详情"); | |
352 | + } | |
353 | + | |
354 | + | |
329 | 355 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/domain/ReceiptDetail.java
... | ... | @@ -31,7 +31,7 @@ public class ReceiptDetail implements Serializable { |
31 | 31 | /** |
32 | 32 | * 入库单 |
33 | 33 | */ |
34 | - @Excel(name = "入库单号") | |
34 | + @Excel(name = "入库单号",type = Excel.Type.EXPORT) | |
35 | 35 | @TableField(value = "receiptCode") |
36 | 36 | @ApiModelProperty(value = "入库单") |
37 | 37 | private String receiptCode; |
... | ... | @@ -211,7 +211,7 @@ public class ReceiptDetail implements Serializable { |
211 | 211 | /** |
212 | 212 | * 未收数量 |
213 | 213 | */ |
214 | - @Excel(name = "实收数量") | |
214 | + @Excel(name = "实收数量",type = Excel.Type.EXPORT) | |
215 | 215 | @TableField(value = "taskQty") |
216 | 216 | @ApiModelProperty(value = "已收数量") |
217 | 217 | private BigDecimal taskQty; |
... | ... | @@ -275,7 +275,7 @@ public class ReceiptDetail implements Serializable { |
275 | 275 | /** |
276 | 276 | * 创建时间 |
277 | 277 | */ |
278 | - @Excel(name = "创建时间",dateFormat="yyyy-MM-dd HH:mm:ss") | |
278 | + @Excel(name = "创建时间",dateFormat="yyyy-MM-dd HH:mm:ss",type = Excel.Type.EXPORT) | |
279 | 279 | @TableField(value = "created", fill = FieldFill.INSERT) |
280 | 280 | @ApiModelProperty(value = "创建时间") |
281 | 281 | private Date created; |
... | ... | @@ -290,7 +290,7 @@ public class ReceiptDetail implements Serializable { |
290 | 290 | /** |
291 | 291 | * 创建时间 |
292 | 292 | */ |
293 | - @Excel(name = "最后修改时间",dateFormat="yyyy-MM-dd HH:mm:ss") | |
293 | + @Excel(name = "最后修改时间",dateFormat="yyyy-MM-dd HH:mm:ss",type = Excel.Type.EXPORT) | |
294 | 294 | @TableField(value = "lastUpdated", fill = FieldFill.INSERT_UPDATE) |
295 | 295 | @ApiModelProperty(value = "创建时间") |
296 | 296 | private Date lastUpdated; |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailService.java
... | ... | @@ -6,6 +6,7 @@ import com.huaheng.pc.config.statusFlow.domain.StatusFlowDetail; |
6 | 6 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
7 | 7 | import com.baomidou.mybatisplus.extension.service.IService; |
8 | 8 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
9 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | |
9 | 10 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
10 | 11 | |
11 | 12 | import java.util.List; |
... | ... | @@ -65,4 +66,6 @@ public interface ReceiptDetailService extends IService<ReceiptDetail>{ |
65 | 66 | List<ReceiptDetail> findByReceiptId(Integer id); |
66 | 67 | |
67 | 68 | boolean isNoCompletedQty(List<ReceiptDetail> receiptDetails,Integer receiptHeaderId); |
69 | + | |
70 | + String insertExcelData(List<ReceiptDetail> list, boolean updateSupport, String operName); | |
68 | 71 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java
... | ... | @@ -3,6 +3,7 @@ package com.huaheng.pc.receipt.receiptDetail.service; |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | 5 | import com.huaheng.common.constant.QuantityConstant; |
6 | +import com.huaheng.common.exception.BusinessException; | |
6 | 7 | import com.huaheng.common.exception.service.ServiceException; |
7 | 8 | import com.huaheng.common.support.Convert; |
8 | 9 | import com.huaheng.common.utils.StringUtils; |
... | ... | @@ -27,6 +28,8 @@ import com.huaheng.pc.config.statusFlow.domain.StatusFlowDetail; |
27 | 28 | import com.huaheng.pc.config.statusFlow.service.StatusFlowDetailService; |
28 | 29 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
29 | 30 | import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; |
31 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | |
32 | +import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; | |
30 | 33 | import com.huaheng.pc.system.dict.service.IDictDataService; |
31 | 34 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
32 | 35 | import org.springframework.stereotype.Service; |
... | ... | @@ -222,6 +225,95 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
222 | 225 | return false; |
223 | 226 | } |
224 | 227 | |
228 | + @Override | |
229 | + public String insertExcelData(List<ReceiptDetail> list, boolean updateSupport, String operName) { | |
230 | + if (StringUtils.isNull(list) || list.size() == 0) { | |
231 | + throw new BusinessException("导入数据不能为空!"); | |
232 | + } | |
233 | + ReceiptHeader receiptHeader=createHeader(list); | |
234 | + int successNum = 0; | |
235 | + int failureNum = 0; | |
236 | + StringBuilder successMsg = new StringBuilder(); | |
237 | + StringBuilder failureMsg = new StringBuilder(); | |
238 | + for (ReceiptDetail importData : list) { | |
239 | + /*if(StringUtils.isEmpty(importData.getWarehouseCode())){ | |
240 | + failureNum++; | |
241 | + String msg = "<br/>" + failureNum + "、仓库编码为空 导入失败:"; | |
242 | + failureMsg.append(msg ); | |
243 | + continue; | |
244 | + } | |
245 | + if(StringUtils.isEmpty(importData.getCompanyCode())){ | |
246 | + failureNum++; | |
247 | + String msg = "<br/>" + failureNum + "、货主编码为空 导入失败:"; | |
248 | + failureMsg.append(msg ); | |
249 | + continue; | |
250 | + }*/ | |
251 | + if(StringUtils.isNull(importData.getQty())){ | |
252 | + failureNum++; | |
253 | + String msg = "<br/>" + failureNum + "、数量为空 导入失败:"; | |
254 | + failureMsg.append(msg ); | |
255 | + continue; | |
256 | + } | |
257 | + try { | |
258 | + importData.setReceiptId(receiptHeader.getId()); | |
259 | + importData.setReceiptCode(receiptHeader.getCode()); | |
260 | + Material material = materialService.findAllByCode(importData.getMaterialCode()); | |
261 | + if(material==null){ | |
262 | + String msgs = "<br/>" + failureNum + "、物料编码 " + importData.getMaterialCode() + " 未找到 导入失败:"; | |
263 | + failureNum++; | |
264 | + failureMsg.append(msgs); | |
265 | + continue; | |
266 | + } | |
267 | + importData.setMaterialName(material.getName()); | |
268 | + importData.setMaterialSpec(material.getSpec()); | |
269 | + importData.setMaterialUnit(material.getUnit()); | |
270 | + importData.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
271 | + importData.setCompanyCode(QuantityConstant.DEFAULT_COMPANY); | |
272 | + importData.setInventorySts(QuantityConstant.GOOD); | |
273 | + this.save(importData); | |
274 | + receiptHeader.setTotalQty(receiptHeader.getTotalQty().add(importData.getQty())); | |
275 | + receiptHeader.setTotalLines(receiptHeader.getTotalLines()+1); | |
276 | + receiptHeaderService.updateById(receiptHeader); | |
277 | + successNum++; | |
278 | + successMsg.append("<br/>" + successNum + "、数据 " + importData.getMaterialCode() + " 导入成功"); | |
279 | + | |
280 | + } catch (Exception e) { | |
281 | + failureNum++; | |
282 | + String msg = "<br/>" + failureNum + "、物料编码 " + importData.getMaterialCode() + " 导入失败:"; | |
283 | + failureMsg.append(msg + e.getMessage()); | |
284 | + } | |
285 | + } | |
286 | + if (failureNum > 0) { | |
287 | + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); | |
288 | + throw new BusinessException(failureMsg.toString()); | |
289 | + } else { | |
290 | + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); | |
291 | + } | |
292 | + return successMsg.toString()+"\n"+failureMsg.toString(); | |
293 | + } | |
294 | + | |
295 | + private ReceiptHeader createHeader(List<ReceiptDetail> list){ | |
296 | + ReceiptHeader receiptHeader=new ReceiptHeader(); | |
297 | + String code =receiptHeaderService.createCode(QuantityConstant.RECEIPT_QTCKLX); | |
298 | + receiptHeader.setId(null); | |
299 | + receiptHeader.setLastUpdated(null); | |
300 | + receiptHeader.setLastUpdatedBy((ShiroUtils.getLoginName())); | |
301 | + receiptHeader.setCreated(null); | |
302 | + receiptHeader.setCreatedBy((ShiroUtils.getLoginName())); | |
303 | + receiptHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
304 | + receiptHeader.setCompanyCode(QuantityConstant.DEFAULT_COMPANY); | |
305 | + receiptHeader.setCode(code); | |
306 | + receiptHeader.setReceiptType(QuantityConstant.RECEIPT_QTCKLX); | |
307 | + receiptHeader.setTotalLines(BigDecimal.ZERO.intValue()); | |
308 | + receiptHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); | |
309 | + receiptHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); | |
310 | + receiptHeader.setTotalQty(BigDecimal.ZERO); | |
311 | + if (!receiptHeaderService.save(receiptHeader)) { | |
312 | + throw new ServiceException("导入失败,添加出库单头表失败"); | |
313 | + } | |
314 | + return receiptHeader; | |
315 | + } | |
316 | + | |
225 | 317 | /** |
226 | 318 | * 根据流程配置更新入库明细下一流程 |
227 | 319 | * @param receiptDetail |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiving/controller/ReceivingController.java
... | ... | @@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.ResponseBody; |
39 | 39 | import javax.annotation.Resource; |
40 | 40 | import java.math.BigDecimal; |
41 | 41 | import java.util.ArrayList; |
42 | +import java.util.Arrays; | |
42 | 43 | import java.util.List; |
43 | 44 | import java.util.Map; |
44 | 45 | |
... | ... | @@ -154,7 +155,7 @@ public class ReceivingController extends BaseController { |
154 | 155 | //找到主单的账套和仓库 |
155 | 156 | LambdaQueryWrapper<ReceiptHeader> lambdaQueryWrapper= Wrappers.lambdaQuery(); |
156 | 157 | lambdaQueryWrapper.eq(ReceiptHeader::getCode,code) |
157 | - .eq(ReceiptHeader::getCompanyCode, ShiroUtils.getCompanyCodeList()) | |
158 | + .in(ReceiptHeader::getCompanyCode, ShiroUtils.getCompanyCodeList()) | |
158 | 159 | .eq(ReceiptHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); |
159 | 160 | ReceiptHeader receiptHeader=receiptHeaderService.getOne(lambdaQueryWrapper); |
160 | 161 | if(receiptHeader == null) { |
... | ... | @@ -164,7 +165,7 @@ public class ReceivingController extends BaseController { |
164 | 165 | //找到子单物料 |
165 | 166 | LambdaQueryWrapper<ReceiptDetail> lambdaQuery=Wrappers.lambdaQuery(); |
166 | 167 | lambdaQuery.eq(ReceiptDetail::getReceiptCode,code) |
167 | - .eq(ReceiptDetail::getCompanyCode, ShiroUtils.getCompanyCodeList()) | |
168 | + .in(ReceiptDetail::getCompanyCode, ShiroUtils.getCompanyCodeList()) | |
168 | 169 | .eq(ReceiptDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) |
169 | 170 | .eq(ReceiptDetail::getId,id); |
170 | 171 | ReceiptDetail receiptDetail=receiptDetailService.getOne(lambdaQuery); |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/controller/ShipmentContainerHeaderController.java
... | ... | @@ -15,6 +15,9 @@ import com.huaheng.framework.web.domain.AjaxResult; |
15 | 15 | import com.huaheng.framework.web.page.PageDomain; |
16 | 16 | import com.huaheng.framework.web.page.TableDataInfo; |
17 | 17 | import com.huaheng.framework.web.page.TableSupport; |
18 | +import com.huaheng.framework.web.service.ConfigService; | |
19 | +import com.huaheng.pc.config.container.domain.Container; | |
20 | +import com.huaheng.pc.config.container.service.ContainerService; | |
18 | 21 | import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; |
19 | 22 | import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader; |
20 | 23 | import com.huaheng.pc.shipment.shipmentContainerHeader.service.ShipmentContainerHeaderService; |
... | ... | @@ -25,8 +28,8 @@ import org.springframework.stereotype.Controller; |
25 | 28 | import org.springframework.ui.ModelMap; |
26 | 29 | import org.springframework.web.bind.annotation.*; |
27 | 30 | |
28 | -import java.util.Arrays; | |
29 | -import java.util.List; | |
31 | +import javax.annotation.Resource; | |
32 | +import java.util.*; | |
30 | 33 | |
31 | 34 | /** |
32 | 35 | * 出库组盘头 信息操作处理 |
... | ... | @@ -40,6 +43,10 @@ public class ShipmentContainerHeaderController extends BaseController |
40 | 43 | { |
41 | 44 | @Autowired |
42 | 45 | private ShipmentContainerHeaderService shipmentContainerHeaderService; |
46 | + @Resource | |
47 | + private ContainerService containerService; | |
48 | + @Resource | |
49 | + private ConfigService configService; | |
43 | 50 | |
44 | 51 | |
45 | 52 | private String prefix = "shipment/shipmentContainerHeader"; |
... | ... | @@ -176,5 +183,44 @@ public class ShipmentContainerHeaderController extends BaseController |
176 | 183 | ajaxResult=shipmentContainerHeaderService.createTask(idList); |
177 | 184 | return ajaxResult; |
178 | 185 | } |
186 | + /** | |
187 | + * 生成任务 | |
188 | + */ | |
189 | + @RequiresPermissions("shipment:container:add") | |
190 | + @Log(title ="出库-任务生成", operating = "批量生成任务", action = BusinessType.UPDATE) | |
191 | + @PostMapping( "/floorCombination") | |
192 | + @ResponseBody | |
193 | + public AjaxResult floorCombination(String ids) | |
194 | + { | |
195 | + AjaxResult ajaxResult=new AjaxResult(); | |
196 | + if (StringUtils.isEmpty(ids)) { | |
197 | + return AjaxResult.error("id不能为空"); | |
198 | + } | |
199 | + Set<Integer> floorIds = new HashSet<>(); | |
200 | + List<Integer> idList = Arrays.asList(Convert.toIntArray(ids)); | |
201 | + String floorAutoCreateTask = configService.getKey(QuantityConstant.FLOOR_AUTO_CREATE_TASK); | |
202 | + for (Integer id : idList) { | |
203 | + //获取表头 | |
204 | + ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(id); | |
205 | + if(shipmentContainerHeader == null) { | |
206 | + return AjaxResult.error("出库货箱id:" + id + "未找到,操作中止"); | |
207 | + } | |
208 | + if(shipmentContainerHeader.getStatus() >= QuantityConstant.TASK_STATUS_RELEASE){ | |
209 | + return AjaxResult.error("出库货箱编码(" + shipmentContainerHeader.getContainerCode() + ")已经生成任务,请不要重复生成,操作中止"); | |
210 | + } | |
211 | + String containerCode = shipmentContainerHeader.getContainerCode(); | |
212 | + if(StringUtils.isNotEmpty(floorAutoCreateTask)) { | |
213 | + String[] floorType = floorAutoCreateTask.split(","); | |
214 | + List<String> floorTypes = Arrays.asList(floorType); | |
215 | + Container container = containerService.getContainerByCode(containerCode); | |
216 | + if (floorTypes.contains(container.getContainerType())) { | |
217 | + floorIds.add(id); | |
218 | + } | |
219 | + } | |
220 | + } | |
221 | + | |
222 | + ajaxResult=shipmentContainerHeaderService.createTask(new ArrayList<>(floorIds)); | |
223 | + return ajaxResult; | |
224 | + } | |
179 | 225 | |
180 | 226 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/ShipmentDetailController.java
... | ... | @@ -297,7 +297,7 @@ public class ShipmentDetailController extends BaseController |
297 | 297 | @ResponseBody |
298 | 298 | public AjaxResult importTemplate () { |
299 | 299 | ExcelUtil<ShipmentDetail> util = new ExcelUtil<>(ShipmentDetail.class); |
300 | - return util.importTemplateExcel("入库详情"); | |
300 | + return util.importTemplateExcel("出库详情"); | |
301 | 301 | } |
302 | 302 | |
303 | 303 | |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/domain/ShipmentDetail.java
... | ... | @@ -54,7 +54,7 @@ public class ShipmentDetail implements Serializable { |
54 | 54 | /** |
55 | 55 | * 出库单号 |
56 | 56 | */ |
57 | - @Excel(name = "出库单号") | |
57 | + @Excel(name = "出库单号",type = Excel.Type.EXPORT) | |
58 | 58 | @TableField(value = "shipmentCode") |
59 | 59 | @ApiModelProperty(value="出库单号") |
60 | 60 | private String shipmentCode; |
... | ... | @@ -146,7 +146,7 @@ public class ShipmentDetail implements Serializable { |
146 | 146 | /** |
147 | 147 | * 已出数量 |
148 | 148 | */ |
149 | - @Excel(name = "已出数量") | |
149 | + @Excel(name = "已出数量",type = Excel.Type.EXPORT) | |
150 | 150 | @TableField(value = "taskQty") |
151 | 151 | @ApiModelProperty(value="已出数量") |
152 | 152 | private BigDecimal taskQty; |
... | ... | @@ -288,7 +288,7 @@ public class ShipmentDetail implements Serializable { |
288 | 288 | /** |
289 | 289 | * 创建时间 |
290 | 290 | */ |
291 | - @Excel(name = "创建时间",dateFormat="yyyy-MM-dd HH:mm:ss") | |
291 | + @Excel(name = "创建时间",dateFormat="yyyy-MM-dd HH:mm:ss",type = Excel.Type.EXPORT) | |
292 | 292 | @TableField(value = "created") |
293 | 293 | @ApiModelProperty(value="创建时间") |
294 | 294 | private Date created; |
... | ... | @@ -304,7 +304,7 @@ public class ShipmentDetail implements Serializable { |
304 | 304 | /** |
305 | 305 | * 创建时间 |
306 | 306 | */ |
307 | - @Excel(name = "最后修改时间",dateFormat="yyyy-MM-dd HH:mm:ss") | |
307 | + @Excel(name = "最后修改时间",dateFormat="yyyy-MM-dd HH:mm:ss",type = Excel.Type.EXPORT) | |
308 | 308 | @TableField(value = "lastUpdated") |
309 | 309 | @ApiModelProperty(value="创建时间") |
310 | 310 | private Date lastUpdated; |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java
... | ... | @@ -407,7 +407,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
407 | 407 | importData.setShipmentCode(shipmentHeader.getCode()); |
408 | 408 | Material material = materialService.findAllByCode(importData.getMaterialCode()); |
409 | 409 | if(material==null){ |
410 | - String msgs = "<br/>" + failureNum + "、物料编码 " + importData.getMaterialCode() + " 导入失败:"; | |
410 | + String msgs = "<br/>" + failureNum + "、物料编码 " + importData.getMaterialCode() + " 未找到 导入失败:"; | |
411 | 411 | failureNum++; |
412 | 412 | failureMsg.append(msgs); |
413 | 413 | continue; |
... | ... | @@ -419,6 +419,9 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
419 | 419 | importData.setCompanyCode(QuantityConstant.DEFAULT_COMPANY); |
420 | 420 | importData.setInventorySts(QuantityConstant.GOOD); |
421 | 421 | this.save(importData); |
422 | + shipmentHeader.setTotalQty(shipmentHeader.getTotalQty().add(importData.getQty())); | |
423 | + shipmentHeader.setTotalLines(shipmentHeader.getTotalLines()+1); | |
424 | + shipmentHeaderService.updateById(shipmentHeader); | |
422 | 425 | successNum++; |
423 | 426 | successMsg.append("<br/>" + successNum + "、数据 " + importData.getMaterialCode() + " 导入成功"); |
424 | 427 | |
... | ... | @@ -449,11 +452,10 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
449 | 452 | shipmentHeader.setCompanyCode(QuantityConstant.DEFAULT_COMPANY); |
450 | 453 | shipmentHeader.setCode(code); |
451 | 454 | shipmentHeader.setShipmentType(QuantityConstant.SHIPMENT_QTCKLX); |
452 | - shipmentHeader.setTotalLines(list.size()); | |
455 | + shipmentHeader.setTotalLines(BigDecimal.ZERO.intValue()); | |
453 | 456 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); |
454 | 457 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); |
455 | - BigDecimal bigDecimal = list.stream().map(ShipmentDetail::getQty).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); | |
456 | - shipmentHeader.setTotalQty(bigDecimal); | |
458 | + shipmentHeader.setTotalQty(BigDecimal.ZERO); | |
457 | 459 | if (!shipmentHeaderService.save(shipmentHeader)) { |
458 | 460 | throw new ServiceException("导入失败,添加出库单头表失败"); |
459 | 461 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ReceiptTaskService.java
... | ... | @@ -216,6 +216,13 @@ public class ReceiptTaskService { |
216 | 216 | } |
217 | 217 | String taskId = String.valueOf(task.getId()); |
218 | 218 | taskIds.add(taskId); |
219 | + if(QuantityConstant.ZONE_FLOOR.equals(task.getZoneCode())){ | |
220 | + try{ | |
221 | + AjaxResult ajaxResult = taskHeaderService.completeTask(task.getToLocation()); | |
222 | + }catch (Exception e){ | |
223 | + e.printStackTrace(); | |
224 | + } | |
225 | + } | |
219 | 226 | } else { |
220 | 227 | throw new ServiceException("任务生成失败"); |
221 | 228 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ShipmentTaskService.java
... | ... | @@ -76,6 +76,8 @@ public class ShipmentTaskService { |
76 | 76 | private ShipmentPreferenceService shipmentPreferenceService; |
77 | 77 | @Resource |
78 | 78 | private ConfigService configService; |
79 | + @Resource | |
80 | + private ShipmentTaskService shipmentTaskService; | |
79 | 81 | /** |
80 | 82 | * 创建出库任务 |
81 | 83 | * @param shipmentTaskCreateModel |
... | ... | @@ -231,6 +233,13 @@ public class ShipmentTaskService { |
231 | 233 | if (!containerHeaderService.updateById(shipmentContainerHeader)) { |
232 | 234 | throw new ServiceException("修改组盘头状态失败,sql报错"); |
233 | 235 | } |
236 | + if(QuantityConstant.ZONE_FLOOR.equals(task.getZoneCode())){ | |
237 | + try{ | |
238 | + AjaxResult ajaxResult = shipmentTaskService.completeShipmentTask(task); | |
239 | + }catch (Exception e){ | |
240 | + e.printStackTrace(); | |
241 | + } | |
242 | + } | |
234 | 243 | |
235 | 244 | return AjaxResult.success(taskId); |
236 | 245 | } |
... | ... |
src/main/resources/application-druid.properties
... | ... | @@ -2,20 +2,19 @@ |
2 | 2 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
3 | 3 | spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver |
4 | 4 | # Ö÷¿â |
5 | -spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 | |
6 | -#spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 | |
5 | +#spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 | |
6 | +spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms_sushouqingyuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 | |
7 | +#spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms_suzhouqingyuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 | |
7 | 8 | #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huahengExample?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
8 | 9 | #spring.datasource.druid.master.url=jdbc:mysql://117.62.222.186:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 |
9 | 10 | |
10 | 11 | #spring.datasource.druid.master.username=softhuaheng |
11 | 12 | #spring.datasource.druid.master.password=HHrobot123. |
13 | +#?? | |
14 | +spring.datasource.druid.master.username=huaheng | |
15 | +spring.datasource.druid.master.password=HHrobot123. | |
12 | 16 | #spring.datasource.druid.master.username=root |
13 | 17 | #spring.datasource.druid.master.password=hhsoftware |
14 | -#?? | |
15 | -#spring.datasource.druid.master.username=huaheng | |
16 | -#spring.datasource.druid.master.password=HHrobot123. | |
17 | -spring.datasource.druid.master.username=root | |
18 | -spring.datasource.druid.master.password=hhsoftware | |
19 | 18 | # ´Ó¿â |
20 | 19 | spring.datasource.druid.slave.open = false |
21 | 20 | spring.datasource.druid.slave.url=jdbc:mysql://117.62.222.186:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
... | ... |
src/main/resources/templates/receipt/receiptHeader/receiptHeader.html
... | ... | @@ -90,6 +90,9 @@ |
90 | 90 | <a class="btn btn-outline btn-primary btn-rounded" onclick="approval()" shiro:hasPermission="receipt:receiptHeader:review"> |
91 | 91 | <i class="fa fa-level-up"></i> 审核通过 |
92 | 92 | </a> |
93 | + <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="receipt:receiptHeader:add"> | |
94 | + <i class="fa fa-upload"></i>导入 | |
95 | + </a> | |
93 | 96 | <!-- <a class="btn btn-outline btn-primary btn-rounded" onclick="addPool()" shiro:hasPermission="receipt:receiptHeader:addPool">--> |
94 | 97 | <!-- <i class="fa fa-check-circle"></i> 加入订单池--> |
95 | 98 | <!-- </a>--> |
... | ... | @@ -201,6 +204,20 @@ |
201 | 204 | </div> |
202 | 205 | </div> |
203 | 206 | </div> |
207 | +<script id="importTpl" type="text/template"> | |
208 | + <form enctype="multipart/form-data" class="mt20 mb10"> | |
209 | + <div class="col-xs-offset-1"> | |
210 | + <input type="file" id="file" name="file"/> | |
211 | + <div class="mt10 pt5"> | |
212 | + <input type="checkbox" id="updateSupport" name="updateSupport" title="如果数据已经存在,更新这条数据。"> 是否更新已经存在的数据 | |
213 | + <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a> | |
214 | + </div> | |
215 | + <font color="red" class="pull-left mt10"> | |
216 | + 提示:仅允许导入“xls”或“xlsx”格式文件! | |
217 | + </font> | |
218 | + </div> | |
219 | + </form> | |
220 | +</script> | |
204 | 221 | <div th:include="include :: footer"></div> |
205 | 222 | <script th:inline="javascript"> |
206 | 223 | var printFlag = [[${@permission.hasPermi('receipt:receiptHeader:report')}]]; |
... | ... | @@ -234,6 +251,8 @@ |
234 | 251 | updateUrl: prefix + "/edit/{id}", |
235 | 252 | removeUrl: prefix + "/remove", |
236 | 253 | exportUrl: detailPrefix + "/export", |
254 | + importUrl: detailPrefix+"/importData",//导入 | |
255 | + importTemplateUrl: detailPrefix + "/importTemplate",//导入模板 | |
237 | 256 | modalName: "入库单", |
238 | 257 | sidePagination:"server", |
239 | 258 | showExport: true, //导出 |
... | ... |
src/main/resources/templates/receipt/receiving/receiving.html
... | ... | @@ -152,8 +152,8 @@ |
152 | 152 | if(value.data){ |
153 | 153 | $("#bootstrap-table").bootstrapTable('load',value.data); |
154 | 154 | for (var i = 0; i < value.data.length; i++) { |
155 | - qty_show=value.data[i].totalQty + qty_show; | |
156 | - qtyCompleted_show=value.data[i].openQty + qtyCompleted_show; | |
155 | + qty_show=value.data[i].qty + qty_show; | |
156 | + qtyCompleted_show=value.data[i].taskQty + qtyCompleted_show; | |
157 | 157 | } |
158 | 158 | $("#material_length").text(value.data.length); |
159 | 159 | $("#qty_length").text(qty_show); |
... | ... |
src/main/resources/templates/shipment/shippingCombination/shippingCombination.html
... | ... | @@ -67,6 +67,9 @@ |
67 | 67 | <a class="btn btn-outline btn-warning btn-rounded" onclick="batchCreateTask()"> |
68 | 68 | <i class="fa fa-edit"></i> 生成任务 |
69 | 69 | </a> |
70 | + <a class="btn btn-outline btn-primary btn-rounded" onclick="floorCombination()"> | |
71 | + <i class="fa fa-edit"></i> 平库生成任务 | |
72 | + </a> | |
70 | 73 | <a class="menuItem btn btn-outline btn-warning btn-rounded" onclick="jumpReceiptTask()"> |
71 | 74 | <i class="fa fa-edit"></i> 跳转任务页面 |
72 | 75 | </a> |
... | ... | @@ -411,6 +414,39 @@ |
411 | 414 | chooseStation(ids); |
412 | 415 | } |
413 | 416 | |
417 | + function floorCombination() { | |
418 | + let rows=$("#bootstrap-table2").bootstrapTable('getSelections'); | |
419 | + if (rows.length == 0) { | |
420 | + $.modal.alertWarning("请至少选择一条记录"); | |
421 | + return; | |
422 | + } | |
423 | + var ids = ""; | |
424 | + for(var i=0; i<rows.length; i++) { | |
425 | + if(ids == "") { | |
426 | + ids = rows[i].shippingContainerId; | |
427 | + } else { | |
428 | + ids = ids + "," + rows[i].shippingContainerId | |
429 | + } | |
430 | + } | |
431 | + var url = ctx + "shipment/shipmentContainerHeader/floorCombination"; | |
432 | + var data = { "ids": ids }; | |
433 | + $.ajax({ | |
434 | + url: url, | |
435 | + type:'post', | |
436 | + data: data, | |
437 | + success:function (response) { | |
438 | + if (response.code == web_status.SUCCESS) { | |
439 | + $("#bootstrap-table2").bootstrapTable('refresh',{function (){ | |
440 | + | |
441 | + }}); | |
442 | + } else { | |
443 | + $.modal.alertError(response.msg); | |
444 | + } | |
445 | + $.modal.closeLoading(); | |
446 | + } | |
447 | + }) | |
448 | + } | |
449 | + | |
414 | 450 | |
415 | 451 | /* 批量取消组盘 */ |
416 | 452 | function batchRemoveHead() { |
... | ... |