Commit d038b1b2c2fd3860bcebb6353876446f7ba7c294
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # src/main/resources/application-druid.properties
Showing
117 changed files
with
1624 additions
and
547 deletions
Too many changes to show.
To preserve performance only 100 of 117 files are displayed.
README.md
1 | 1 | 版本说明 |
2 | 2 | WMS_v2 |
3 | - 1. 入库 | |
4 | - 单据新建-0 | |
5 | - | |
3 | + | |
4 | + /*** | |
5 | + * 1.差异单页面 | |
6 | + * 盘点有差异之后生成差异单,差异单不做操作,展示,和生成调整单 | |
7 | + * | |
8 | + * 2.实盘登记页面, | |
9 | + * 做到盘点任务明细后面, | |
10 | + * 当员工确定容器,扫码物料,弹出选中已经生成的任务进行盘点登记, | |
11 | + * 可以扫码容器选中任务 | |
12 | + * 新增盘有按钮,可以新增一条盘点明细 | |
13 | + * | |
14 | + * | |
15 | + * 3.配置 | |
16 | + * 根据 容器多选,库位多选,巷道,物料多选,库存时间段,呆滞时间 | |
17 | + * 根据配置条件自动生成盘点单 | |
18 | + * 在盘点单下发任务时,重新查询库存,同步变更库存物料数量 | |
19 | + * 给一个自动生成盘点单按钮,定时扫描是否开启 | |
20 | + * | |
21 | + * | |
22 | + * 4.下发任务至WCS时做校验,是否同库位同容器已经有任务在执行 | |
23 | + * | |
24 | + * */ | |
6 | 25 | |
7 | 26 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/HuaHengServletInitializer.java
... | ... | @@ -34,7 +34,7 @@ public class HuaHengServletInitializer extends SpringBootServletInitializer |
34 | 34 | |
35 | 35 | public static void main(String[] args) |
36 | 36 | { |
37 | - SpringApplication.run(HuaHengApplication.class, args); | |
37 | + //SpringApplication.run(HuaHengServletInitializer.class, args); | |
38 | 38 | System.out.println("*************** 华恒WMS启动成功WAR ***************\n" + |
39 | 39 | " >>> WMS_Servlet启动成功! <<< \n"+ |
40 | 40 | " へ /|▓\n"+ |
... | ... |
src/main/java/com/huaheng/api/acs/controller/StateInfoUp.java
... | ... | @@ -15,7 +15,7 @@ import javax.annotation.Resource; |
15 | 15 | |
16 | 16 | @RestController |
17 | 17 | @RequestMapping("/api/ACS/v1") |
18 | -@Api(tags = {"ACS"}, description = "登陆接口") | |
18 | +@Api(tags = {"ACS信息上传接口"}, value = "ACS信息上传接口") | |
19 | 19 | public class StateInfoUp extends BaseController { |
20 | 20 | @Resource |
21 | 21 | private AcsService acsService; |
... | ... |
src/main/java/com/huaheng/api/acs/controller/TaskConfirm.java
... | ... | @@ -15,7 +15,7 @@ import javax.annotation.Resource; |
15 | 15 | |
16 | 16 | @RestController |
17 | 17 | @RequestMapping("/api/ACS/v1") |
18 | -@Api(tags = {"ACS"}, description = "登陆接口") | |
18 | +@Api(tags = {"ACS任务回传接口"}, value = "ACS任务回传接口") | |
19 | 19 | public class TaskConfirm extends BaseController { |
20 | 20 | @Resource |
21 | 21 | private AcsService acsService; |
... | ... |
src/main/java/com/huaheng/api/general/controller/AdjustApi.java
src/main/java/com/huaheng/api/general/controller/BasicDataApi.java
... | ... | @@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*; |
21 | 21 | |
22 | 22 | @RestController |
23 | 23 | @RequestMapping("/api/basicData") |
24 | -@Api(tags = {"basicData"}, description = "基础数据接口") | |
24 | +@Api(tags = {"基础数据接口"}, value = "基础数据接口basicData") | |
25 | 25 | public class BasicDataApi extends BaseController { |
26 | 26 | |
27 | 27 | @Autowired |
... | ... |
src/main/java/com/huaheng/api/general/controller/CycleCountApi.java
... | ... | @@ -18,7 +18,7 @@ import javax.annotation.Resource; |
18 | 18 | |
19 | 19 | @RestController |
20 | 20 | @RequestMapping("/api/cycleCountApi") |
21 | -@Api(tags = {"cycleCount"}, description = "盘点单接口") | |
21 | +@Api(tags = {"盘点单接口"}, value = "盘点单接口cycleCount") | |
22 | 22 | public class CycleCountApi { |
23 | 23 | |
24 | 24 | @Resource |
... | ... |
src/main/java/com/huaheng/api/general/controller/LoginApi.java
... | ... | @@ -19,7 +19,7 @@ import java.util.Map; |
19 | 19 | |
20 | 20 | @RestController |
21 | 21 | @RequestMapping("/api") |
22 | -@Api(tags = {"Login"}, description = "登陆接口") | |
22 | +@Api(tags = {"登陆接口"}, value = "登陆接口Login") | |
23 | 23 | public class LoginApi extends BaseController { |
24 | 24 | |
25 | 25 | @Autowired |
... | ... | @@ -29,12 +29,15 @@ public class LoginApi extends BaseController { |
29 | 29 | @ApiOperation("登陆接口") |
30 | 30 | public AjaxResult login(@RequestBody @ApiParam(value="登陆的Map集合") Map<String, String> param) |
31 | 31 | { |
32 | - if (param.get("username") == null) | |
32 | + if (param.get("username") == null) { | |
33 | 33 | throw new JSONException("username(用户名)不能为空"); |
34 | - if (param.get("password") == null) | |
34 | + } | |
35 | + if (param.get("password") == null) { | |
35 | 36 | throw new JSONException("password(密码)不能为空"); |
36 | - if (param.get("warehouseCode") == null) | |
37 | + } | |
38 | + if (param.get("warehouseCode") == null) { | |
37 | 39 | throw new JSONException("warehouseCode(仓库编码)不能为空"); |
40 | + } | |
38 | 41 | String username = param.get("username"); |
39 | 42 | String password = param.get("password"); |
40 | 43 | String warehouseCode = param.get("warehouseCode"); |
... | ... |
src/main/java/com/huaheng/api/general/controller/ReceiptApi.java
src/main/java/com/huaheng/api/general/controller/ReceiptController.java
... | ... | @@ -17,7 +17,7 @@ import javax.annotation.Resource; |
17 | 17 | */ |
18 | 18 | @RestController |
19 | 19 | @RequestMapping("/api/receipt") |
20 | -@Api(tags = {"basicData"}, description = "入库接口") | |
20 | +@Api(tags = {"入库接口"}, value = "入库接口receiptApi") | |
21 | 21 | public class ReceiptController { |
22 | 22 | |
23 | 23 | @Resource |
... | ... |
src/main/java/com/huaheng/api/general/controller/ShipmentApi.java
src/main/java/com/huaheng/api/general/service/AdjustService.java
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
... | ... | @@ -104,7 +104,7 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
104 | 104 | Location newlocation =new Location(); |
105 | 105 | String code=ShiroUtils.getWarehouseCode(); |
106 | 106 | //重入的库位由wcs提供 |
107 | - if(!taskFinishDomain.getRedirectionLocationCode().equals("0")) { | |
107 | + if(!"0".equals(taskFinishDomain.getRedirectionLocationCode())) { | |
108 | 108 | LambdaQueryWrapper<Location> locationLa = Wrappers.lambdaQuery(); |
109 | 109 | locationLa.eq(Location::getCode, taskFinishDomain.getRedirectionLocationCode()) |
110 | 110 | .eq(Location::getStatus,"empty") |
... | ... |
src/main/java/com/huaheng/common/constant/QuantityConstant.java
... | ... | @@ -197,35 +197,37 @@ public class QuantityConstant { |
197 | 197 | |
198 | 198 | //8、波次状态 |
199 | 199 | |
200 | - //新建波次 | |
201 | - public static final Integer WAVE_STATUS_BUILD = 0; | |
200 | + //未执行 | |
201 | + public static final Integer WAVE_STATUS_BUILD = 10; | |
202 | 202 | |
203 | - //开始波次 | |
204 | - public static final Integer WAVE_STATUS_START = 100; | |
203 | + //执行中 | |
204 | + public static final Integer WAVE_STATUS_START = 20; | |
205 | 205 | |
206 | - //剔除不符合条件订单 | |
207 | - public static final Integer WAVE_STATUS_EXCLUDE = 150; | |
206 | + //结束 | |
207 | + public static final Integer WAVE_STATUS_END = 30; | |
208 | 208 | |
209 | - //指定分配规则 | |
210 | - public static final Integer WAVE_STATUS_ASSIGN = 200; | |
209 | + //执行失败 | |
210 | + public static final Integer WAVE_STATUS_ERROR = 40; | |
211 | 211 | |
212 | - //分配库存 | |
213 | - public static final Integer WAVE_STATUS_ALLOCATION = 300; | |
214 | 212 | |
215 | - //订单分组 | |
216 | - public static final Integer WAVE_STATUS_GROUPING = 400; | |
213 | + //波次新建 | |
214 | + public static final Integer WAVE_STEP_BUILD = 0; | |
217 | 215 | |
218 | - //创建货箱 | |
219 | - public static final Integer WAVE_STATUS_CREATECONTAINER = 500; | |
216 | + //剔除订单 | |
217 | + public static final Integer WAVE_STEP_CULL = 5; | |
220 | 218 | |
221 | - //生成任务 | |
222 | - public static final Integer WAVE_STATUS_BUILDTASK = 600; | |
219 | + //波次执行 | |
220 | + public static final Integer WAVE_STEP_START = 10; | |
221 | + | |
222 | + //波次释放 | |
223 | + public static final Integer WAVE_STEP_FREED = 130; | |
224 | + | |
225 | + //波次完成 | |
226 | + public static final Integer WAVE_STEP_END = 100; | |
223 | 227 | |
224 | - //结束波次 | |
225 | - public static final Integer WAVE_STATUS_END = 900; | |
228 | + //波次失败 | |
229 | + public static final Integer WAVE_STEP_ERROR = 120; | |
226 | 230 | |
227 | - //失败 | |
228 | - public static final Integer WAVE_STATUS_FAILED = 999; | |
229 | 231 | |
230 | 232 | |
231 | 233 | |
... | ... |
src/main/java/com/huaheng/common/jasper/DocTypeUtil.java
... | ... | @@ -20,21 +20,21 @@ public class DocTypeUtil { |
20 | 20 | DocType type = DocType.PDF; |
21 | 21 | docType = docType.toUpperCase(); |
22 | 22 | |
23 | - if(docType.equals("DOC")){ | |
23 | + if("DOC".equals(docType)){ | |
24 | 24 | type =DocType.DOC; |
25 | - } else if (docType.equals("XLS")) { | |
25 | + } else if ("XLS".equals(docType)) { | |
26 | 26 | type = DocType.XLS; |
27 | - } else if(docType.equals("XLSX")) { | |
27 | + } else if("XLSX".equals(docType)) { | |
28 | 28 | type = DocType.XLSX; |
29 | - }else if (docType.equals("XML")) { | |
29 | + }else if ("XML".equals(docType)) { | |
30 | 30 | type = DocType.XML; |
31 | - } else if (docType.equals("RTF")) { | |
31 | + } else if ("RTF".equals(docType)) { | |
32 | 32 | type = DocType.RTF; |
33 | - } else if (docType.equals("CSV")) { | |
33 | + } else if ("CSV".equals(docType)) { | |
34 | 34 | type = DocType.CSV; |
35 | - } else if (docType.equals("HTML")) { | |
35 | + } else if ("HTML".equals(docType)) { | |
36 | 36 | type = DocType.HTML; |
37 | - } else if (docType.equals("TXT")) { | |
37 | + } else if ("TXT".equals(docType)) { | |
38 | 38 | type = DocType.TXT; |
39 | 39 | } |
40 | 40 | return type; |
... | ... |
src/main/java/com/huaheng/common/jasper/JasperreportUtils.java
1 | 1 | package com.huaheng.common.jasper; |
2 | 2 | |
3 | +import com.huaheng.common.exception.service.ServiceException; | |
3 | 4 | import net.sf.jasperreports.engine.*; |
4 | 5 | import net.sf.jasperreports.engine.export.*; |
5 | 6 | import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter; |
... | ... | @@ -138,6 +139,9 @@ public class JasperreportUtils { |
138 | 139 | case DOC: |
139 | 140 | contentType = "application/msword"; |
140 | 141 | break; |
142 | + default: | |
143 | + throw new ServiceException("格式错误!"); | |
144 | + | |
141 | 145 | } |
142 | 146 | return contentType; |
143 | 147 | } |
... | ... | @@ -192,7 +196,6 @@ public class JasperreportUtils { |
192 | 196 | * @param docType |
193 | 197 | * @return |
194 | 198 | */ |
195 | - @SuppressWarnings("deprecation") | |
196 | 199 | public JRAbstractExporter getJRExporter(DocType docType) { |
197 | 200 | JRAbstractExporter exporter = null; |
198 | 201 | switch (docType) { |
... | ... | @@ -223,6 +226,8 @@ public class JasperreportUtils { |
223 | 226 | case TXT: |
224 | 227 | exporter = new JRTextExporter(); |
225 | 228 | break; |
229 | + default: | |
230 | + throw new ServiceException("格式错误!"); | |
226 | 231 | } |
227 | 232 | return exporter; |
228 | 233 | } |
... | ... | @@ -251,7 +256,7 @@ public class JasperreportUtils { |
251 | 256 | |
252 | 257 | |
253 | 258 | // 3、判断资源类型 |
254 | - if (ext.equals("xls")) { | |
259 | + if ("xls".equals(ext)) { | |
255 | 260 | SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); |
256 | 261 | // 删除记录最下面的空行 |
257 | 262 | configuration.setRemoveEmptySpaceBetweenRows(Boolean.TRUE); |
... | ... | @@ -261,7 +266,7 @@ public class JasperreportUtils { |
261 | 266 | configuration.setWhitePageBackground(Boolean.FALSE); |
262 | 267 | exporter.setConfiguration(configuration); |
263 | 268 | } |
264 | - if(ext.equals("xlsx")) { | |
269 | + if("xlsx".equals(ext)) { | |
265 | 270 | SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); |
266 | 271 | configuration.setRemoveEmptySpaceBetweenRows(Boolean.TRUE); |
267 | 272 | configuration.setRemoveEmptySpaceBetweenColumns(Boolean.TRUE); |
... | ... | @@ -270,7 +275,7 @@ public class JasperreportUtils { |
270 | 275 | configuration.setDetectCellType(Boolean.TRUE); |
271 | 276 | exporter.setConfiguration(configuration); |
272 | 277 | } |
273 | - if (ext.equals("txt")) { | |
278 | + if ("txt".equals(ext)) { | |
274 | 279 | SimpleTextReportConfiguration configuration = new SimpleTextReportConfiguration(); |
275 | 280 | configuration.setCharWidth((float)8); |
276 | 281 | configuration.setCharHeight((float)15); |
... | ... | @@ -297,17 +302,17 @@ public class JasperreportUtils { |
297 | 302 | |
298 | 303 | // 7、解决中文乱码问题 |
299 | 304 | response.setCharacterEncoding("UTF-8"); |
300 | - if (ext.equals("csv") || ext.equals("doc") || ext.equals("rtf") || ext.equals("txt")) { | |
305 | + if ("csv".equals(ext) || "doc".equals(ext) || "rtf".equals(ext) || "txt".equals(ext)) { | |
301 | 306 | outWriter = response.getWriter(); |
302 | 307 | SimpleWriterExporterOutput outPut = new SimpleWriterExporterOutput(outWriter); |
303 | 308 | exporter.setExporterOutput(outPut); |
304 | 309 | //exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, outWriter); |
305 | 310 | } else { |
306 | - if(ext.equals("xml")) { | |
311 | + if("xml".equals(ext)) { | |
307 | 312 | outWriter = response.getWriter(); |
308 | 313 | XmlExporterOutput outPut = new SimpleXmlExporterOutput(outWriter); |
309 | 314 | exporter.setExporterOutput(outPut); |
310 | - }else if(ext.equals("html")){ | |
315 | + }else if("html".equals(ext)){ | |
311 | 316 | outWriter = response.getWriter(); |
312 | 317 | HtmlExporterOutput outPut = new SimpleHtmlExporterOutput(outWriter); |
313 | 318 | exporter.setExporterOutput(outPut); |
... | ... | @@ -457,7 +462,7 @@ public class JasperreportUtils { |
457 | 462 | } |
458 | 463 | if (null != val) { |
459 | 464 | if (type.endsWith("String")) { |
460 | - if (val.equals("0")) { | |
465 | + if ("0".equals(val)) { | |
461 | 466 | f.set(obj, "--"); |
462 | 467 | } else { |
463 | 468 | /* |
... | ... |
src/main/java/com/huaheng/common/utils/DataUtils.java
... | ... | @@ -40,8 +40,11 @@ public class DataUtils { |
40 | 40 | */ |
41 | 41 | public static String getString(Object object) |
42 | 42 | { |
43 | - if (object == null) return null; | |
44 | - else return object.toString(); | |
43 | + if (object == null) { | |
44 | + return null; | |
45 | + } else { | |
46 | + return object.toString(); | |
47 | + } | |
45 | 48 | } |
46 | 49 | |
47 | 50 | /** |
... | ... | @@ -51,8 +54,11 @@ public class DataUtils { |
51 | 54 | */ |
52 | 55 | public static Integer getInteger(Object object) |
53 | 56 | { |
54 | - if (object == null) return null; | |
55 | - else return Integer.valueOf(object.toString()); | |
57 | + if (object == null) { | |
58 | + return null; | |
59 | + } else { | |
60 | + return Integer.valueOf(object.toString()); | |
61 | + } | |
56 | 62 | } |
57 | 63 | |
58 | 64 | /** |
... | ... | @@ -62,8 +68,11 @@ public class DataUtils { |
62 | 68 | */ |
63 | 69 | public static BigDecimal getBigDecimal(Object object) |
64 | 70 | { |
65 | - if (object == null) return null; | |
66 | - else return new BigDecimal(object.toString()); | |
71 | + if (object == null) { | |
72 | + return null; | |
73 | + } else { | |
74 | + return new BigDecimal(object.toString()); | |
75 | + } | |
67 | 76 | } |
68 | 77 | |
69 | 78 | /** |
... | ... | @@ -73,8 +82,11 @@ public class DataUtils { |
73 | 82 | */ |
74 | 83 | public static Double getDouble(Object object) |
75 | 84 | { |
76 | - if (object == null) return null; | |
77 | - else return new Double(object.toString()); | |
85 | + if (object == null) { | |
86 | + return null; | |
87 | + } else { | |
88 | + return new Double(object.toString()); | |
89 | + } | |
78 | 90 | } |
79 | 91 | |
80 | 92 | /** |
... | ... |
src/main/java/com/huaheng/common/utils/YamlUtil.java
src/main/java/com/huaheng/common/utils/http/HttpUtils.java
... | ... | @@ -192,7 +192,7 @@ public class HttpUtils |
192 | 192 | String ret = ""; |
193 | 193 | while ((ret = br.readLine()) != null) |
194 | 194 | { |
195 | - if (ret != null && !ret.trim().equals("")) | |
195 | + if (ret != null && !"".equals(ret.trim())) | |
196 | 196 | { |
197 | 197 | result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8")); |
198 | 198 | } |
... | ... |
src/main/java/com/huaheng/common/utils/poi/ExcelUtil.java
... | ... | @@ -35,9 +35,9 @@ public class ExcelUtil<T> |
35 | 35 | private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); |
36 | 36 | |
37 | 37 | /** |
38 | - * Excel sheet最大行数,默认65536 | |
38 | + * Excel sheet最大行数,默认65535 | |
39 | 39 | */ |
40 | - public static final int sheetSize = 65536; | |
40 | + public static final int Sheet_Size = 65535; | |
41 | 41 | |
42 | 42 | /** |
43 | 43 | * 工作表名称 |
... | ... | @@ -292,7 +292,7 @@ public class ExcelUtil<T> |
292 | 292 | try |
293 | 293 | { |
294 | 294 | // 取出一共有多少个sheet. |
295 | - double sheetNo = Math.ceil(list.size() / sheetSize); | |
295 | + double sheetNo = Math.ceil(list.size() / Sheet_Size); | |
296 | 296 | for (int index = 0; index <= sheetNo; index++) |
297 | 297 | { |
298 | 298 | createSheet(sheetNo, index); |
... | ... | @@ -353,12 +353,12 @@ public class ExcelUtil<T> |
353 | 353 | * |
354 | 354 | * @param index 序号 |
355 | 355 | * @param row 单元格行 |
356 | - * @param cell 类型单元格 | |
356 | + * | |
357 | 357 | */ |
358 | 358 | public void fillExcelData(int index, Row row) |
359 | 359 | { |
360 | - int startNo = index * sheetSize; | |
361 | - int endNo = Math.min(startNo + sheetSize, list.size()); | |
360 | + int startNo = index * Sheet_Size; | |
361 | + int endNo = Math.min(startNo + Sheet_Size, list.size()); | |
362 | 362 | for (int i = startNo; i < endNo; i++) |
363 | 363 | { |
364 | 364 | row = sheet.createRow(i + 1 - startNo); |
... | ... |
src/main/java/com/huaheng/mobile/download/ApkController.java
... | ... | @@ -24,11 +24,16 @@ public class ApkController { |
24 | 24 | @ApiOperation("获取apk更新信息") |
25 | 25 | public AjaxResult getUpdateApkInfo(@RequestBody Map<String, String> param) { |
26 | 26 | System.out.println("getUpdateApkInfo pkgName:" + param.get("pkgName")); |
27 | - if (param.get("pkgName") == null) | |
27 | + if (param.get("pkgName") == null) { | |
28 | 28 | throw new JSONException("pkgName不能为空"); |
29 | - if (param.get("versionCode") == null) | |
29 | + } | |
30 | + if (param.get("versionCode") == null) { | |
30 | 31 | throw new JSONException("versionCode不能为空"); |
32 | + } | |
31 | 33 | List<ApkInfo> apkinfos = apkMapper.getApkInfoByPkgName(param.get("pkgName")); |
34 | + if(apkinfos == null || apkinfos.size() <= 0) { | |
35 | + return AjaxResult.error("当前已经是最新版本"); | |
36 | + } | |
32 | 37 | ApkInfo apkInfo = apkinfos.get(0); |
33 | 38 | int maxVersion = Integer.MAX_VALUE; |
34 | 39 | String project = param.containsKey("project") ? param.get("project") : null; |
... | ... | @@ -61,16 +66,21 @@ public class ApkController { |
61 | 66 | @ApiOperation("插入apk更新信息") |
62 | 67 | public ApkInfo insertApkInfo(@RequestBody Map<String, String> param) { |
63 | 68 | System.out.println("insertApkInfo pkgName:" + param.get("pkgName")); |
64 | - if (param.get("pkgName") == null) | |
69 | + if (param.get("pkgName") == null) { | |
65 | 70 | throw new JSONException("pkgName不能为空"); |
66 | - if (param.get("versionCode") == null) | |
71 | + } | |
72 | + if (param.get("versionCode") == null) { | |
67 | 73 | throw new JSONException("versionCode不能为空"); |
68 | - if (param.get("versionName") == null) | |
74 | + } | |
75 | + if (param.get("versionName") == null) { | |
69 | 76 | throw new JSONException("versionName"); |
70 | - if (param.get("url") == null) | |
77 | + } | |
78 | + if (param.get("url") == null) { | |
71 | 79 | throw new JSONException("url"); |
72 | - if (param.get("md5") == null) | |
80 | + } | |
81 | + if (param.get("md5") == null) { | |
73 | 82 | throw new JSONException("md5"); |
83 | + } | |
74 | 84 | ApkInfo apkInfo = buildApkInfo(param); |
75 | 85 | try { |
76 | 86 | apkMapper.insertApkInfo(apkInfo.getPkgName(), apkInfo.getVersionCode(), apkInfo.getVersionName(), apkInfo.getUrl(), apkInfo.getMd5()); |
... | ... |
src/main/java/com/huaheng/mobile/general/MobileUserController.java
... | ... | @@ -40,7 +40,7 @@ import java.util.stream.Collectors; |
40 | 40 | */ |
41 | 41 | @RestController |
42 | 42 | @RequestMapping("/mobile/") |
43 | -@Api(tags = {"MobileUserController"}, description = "移动端用户信息") | |
43 | +@Api(tags = {"移动端用户信息"}, value = "移动端用户信息MobileUserController") | |
44 | 44 | public class MobileUserController extends BaseController { |
45 | 45 | |
46 | 46 | @Resource |
... | ... | @@ -102,10 +102,7 @@ public class MobileUserController extends BaseController { |
102 | 102 | @PostMapping("/getCompanyInfo") |
103 | 103 | @ApiOperation("获取公司信息") |
104 | 104 | public AjaxResult getCompanyInfo() { |
105 | - LambdaQueryWrapper<Company> queryWrapper = Wrappers.lambdaQuery(); | |
106 | - queryWrapper.eq(Company::getDeleted, false); | |
107 | - | |
108 | - List<Company> companies = companyService.list(queryWrapper); | |
105 | + List<Company> companies = companyService.selectCompanyByCurrentUserId(); | |
109 | 106 | List<CompanyInfo> companyInfos = new ArrayList<>(); |
110 | 107 | for(Company company : companies) { |
111 | 108 | companyInfos.add(new CompanyInfo(company.getId(), company.getCode(), company.getName())); |
... | ... |
src/main/java/com/huaheng/mobile/invenory/MobileInventoryController.java
... | ... | @@ -37,7 +37,7 @@ import java.util.*; |
37 | 37 | @CrossOrigin |
38 | 38 | @RestController |
39 | 39 | @RequestMapping("/mobile/inventory") |
40 | -@Api(tags = {"MobileInventoryController"}, description = "手机立体库库存相关") | |
40 | +@Api(tags = {"手机立体库库存相关"}, value = "手机立体库库存相关MobileInventoryController") | |
41 | 41 | public class MobileInventoryController { |
42 | 42 | |
43 | 43 | @Resource |
... | ... | @@ -157,7 +157,24 @@ public class MobileInventoryController { |
157 | 157 | if(location == null) { |
158 | 158 | return AjaxResult.error("没有这个库位"); |
159 | 159 | } |
160 | - return AjaxResult.success("库位存在"); | |
160 | + return AjaxResult.success("库位存在").setData(code); | |
161 | + } | |
162 | + | |
163 | + @PostMapping( "/isContainer") | |
164 | + @ApiOperation("判断是不是库位") | |
165 | + @ResponseBody | |
166 | + public AjaxResult isContainer(@RequestBody @ApiParam(value="任务id") Map<String, String> param) { | |
167 | + String code = param.get("code"); | |
168 | + if (StringUtils.isEmpty(code)) { | |
169 | + return AjaxResult.error("location不能为空"); | |
170 | + } | |
171 | + LambdaQueryWrapper<Container> queryWrapper = Wrappers.lambdaQuery(); | |
172 | + queryWrapper.eq(Container::getCode, code); | |
173 | + Container container = containerService.getOne(queryWrapper); | |
174 | + if(container == null) { | |
175 | + return AjaxResult.error("没有这个容器"); | |
176 | + } | |
177 | + return AjaxResult.success("容器存在").setData(code); | |
161 | 178 | } |
162 | 179 | |
163 | 180 | @PostMapping("/getLocationCode") |
... | ... | @@ -369,6 +386,15 @@ public class MobileInventoryController { |
369 | 386 | public AjaxResult getEmptyContainerInLocation(@RequestBody Map<String, String> param) { |
370 | 387 | String warehouCOde = ShiroUtils.getWarehouseCode(); |
371 | 388 | List<Location> list = containerService.getEmptyContainerInLocation(null,null,ShiroUtils.getWarehouseCode()); |
389 | + List<Location> removeList = new ArrayList<>(); | |
390 | + for(Location location : list) { | |
391 | + String containerCode = location.getContainerCode(); | |
392 | + Integer taskCount = taskService.UncompleteCount(containerCode); | |
393 | + if (taskCount != null && taskCount.intValue() > 0) { | |
394 | + removeList.add(location); | |
395 | + } | |
396 | + } | |
397 | + list.removeAll(removeList); | |
372 | 398 | return AjaxResult.success(list); |
373 | 399 | } |
374 | 400 | |
... | ... | @@ -384,7 +410,7 @@ public class MobileInventoryController { |
384 | 410 | for(Location location : locations) { |
385 | 411 | for(Container container : containers) { |
386 | 412 | if(container.getCode().equals(location.getContainerCode())) { |
387 | - if(container.getStatus().equals("some")) { | |
413 | + if("some".equals(container.getStatus())) { | |
388 | 414 | location.setStatus("some"); |
389 | 415 | } |
390 | 416 | } |
... | ... |
src/main/java/com/huaheng/mobile/receipt/MobileBatchReceiptController.java
... | ... | @@ -3,6 +3,7 @@ package com.huaheng.mobile.receipt; |
3 | 3 | import com.alibaba.fastjson.JSONException; |
4 | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
5 | 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
6 | +import com.huaheng.api.general.domain.Receipt; | |
6 | 7 | import com.huaheng.common.constant.QuantityConstant; |
7 | 8 | import com.huaheng.api.general.domain.ReceiptDomain; |
8 | 9 | import com.huaheng.common.constant.QuantityConstant; |
... | ... | @@ -30,6 +31,8 @@ import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
30 | 31 | import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; |
31 | 32 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
32 | 33 | import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; |
34 | +import com.huaheng.pc.system.dict.domain.DictData; | |
35 | +import com.huaheng.pc.system.dict.service.IDictDataService; | |
33 | 36 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
34 | 37 | import com.huaheng.pc.task.taskDetail.service.TaskDetailService; |
35 | 38 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
... | ... | @@ -42,9 +45,8 @@ import org.springframework.web.bind.annotation.*; |
42 | 45 | |
43 | 46 | import javax.annotation.Resource; |
44 | 47 | import java.math.BigDecimal; |
45 | -import java.util.Date; | |
46 | -import java.util.List; | |
47 | -import java.util.Map; | |
48 | +import java.text.SimpleDateFormat; | |
49 | +import java.util.*; | |
48 | 50 | |
49 | 51 | /** |
50 | 52 | * |
... | ... | @@ -54,7 +56,7 @@ import java.util.Map; |
54 | 56 | @CrossOrigin |
55 | 57 | @RestController |
56 | 58 | @RequestMapping("/mobile/receipt/batch") |
57 | -@Api(tags = {"MobileBatchReceiptController"}, description = "移动端收货") | |
59 | +@Api(tags = {"移动端收货"}, value = "移动端收货MobileBatchReceiptController") | |
58 | 60 | public class MobileBatchReceiptController { |
59 | 61 | |
60 | 62 | @Resource |
... | ... | @@ -77,6 +79,8 @@ public class MobileBatchReceiptController { |
77 | 79 | private TaskDetailService taskDetailService; |
78 | 80 | @Resource |
79 | 81 | private CompanyService companyService; |
82 | + @Resource | |
83 | + private IDictDataService dictDataService; | |
80 | 84 | |
81 | 85 | |
82 | 86 | @PostMapping("/scanContainer") |
... | ... | @@ -97,10 +101,10 @@ public class MobileBatchReceiptController { |
97 | 101 | if (container == null) { |
98 | 102 | return AjaxResult.error("托盘编码错误"); |
99 | 103 | } |
100 | - if (!container.getStatus().equals("empty")) { | |
104 | + if (!"empty".equals(container.getStatus())) { | |
101 | 105 | return AjaxResult.error("托盘状态不为空"); |
102 | 106 | } |
103 | - if (!container.getLocationCode().equals("")) { | |
107 | + if (!"".equals(container.getLocationCode())) { | |
104 | 108 | return AjaxResult.error(""); |
105 | 109 | } |
106 | 110 | return result; |
... | ... | @@ -327,6 +331,73 @@ public class MobileBatchReceiptController { |
327 | 331 | return AjaxResult.success("收货成功"); |
328 | 332 | } |
329 | 333 | |
334 | + @PostMapping("/listReceipt") | |
335 | + @ApiOperation("移动端根据表单整盘入库") | |
336 | + @Log(title = "移动端根据表单整盘入库", action = BusinessType.OTHER) | |
337 | + @Transactional(rollbackFor = Exception.class) | |
338 | + public AjaxResult listReceipt(@RequestBody @ApiParam(value="收货单") List<ReceiptBill> receiptBills) throws Exception { | |
339 | + if (receiptBills == null || receiptBills.size() <=0) { | |
340 | + throw new JSONException("没有收货信息"); | |
341 | + } | |
342 | + String containerCode = receiptBills.get(0).receiptContainerCode; | |
343 | + String companyCode = receiptBills.get(0).getCompanyCode(); | |
344 | + String receiptDetailId = receiptBills.get(0).getReceiptDetailId(); | |
345 | + String locationCode = receiptBills.get(0).locationCode; | |
346 | + | |
347 | + LambdaQueryWrapper<Container> containerQueryWrapper = Wrappers.lambdaQuery(); | |
348 | + containerQueryWrapper.eq(Container::getCode, containerCode); | |
349 | + Container container = containerService.getOne(containerQueryWrapper); | |
350 | + if(container == null) { | |
351 | + throw new JSONException("不存在这个托盘"); | |
352 | + } | |
353 | + | |
354 | + if(locationCode != null) { | |
355 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
356 | + locationLambdaQueryWrapper.eq(Location::getCode, locationCode); | |
357 | + Location location = locationService.getOne(locationLambdaQueryWrapper); | |
358 | + if(location == null) { | |
359 | + throw new JSONException("不存在这个托盘"); | |
360 | + } | |
361 | + | |
362 | + if(!"empty".equals(location.getStatus())) { | |
363 | + throw new JSONException("库位状态不是空闲"); | |
364 | + } | |
365 | + } | |
366 | + | |
367 | + LambdaQueryWrapper<ReceiptDetail> receiptDetailQueryWrapper = Wrappers.lambdaQuery(); | |
368 | + receiptDetailQueryWrapper.eq(ReceiptDetail::getId, receiptDetailId); | |
369 | + ReceiptDetail receiptDetail = receiptDetailService.getOne(receiptDetailQueryWrapper); | |
370 | + if(receiptDetail == null) { | |
371 | + throw new JSONException("没有找到入库单详情"); | |
372 | + } | |
373 | + | |
374 | + LambdaQueryWrapper<ReceiptHeader> receiptHeaderQueryWrapper = Wrappers.lambdaQuery(); | |
375 | + receiptHeaderQueryWrapper.eq(ReceiptHeader::getId, receiptDetail.getReceiptId()); | |
376 | + ReceiptHeader receiptHeader = receiptHeaderService.getOne(receiptHeaderQueryWrapper); | |
377 | + if(receiptHeader == null) { | |
378 | + throw new JSONException("没有找到入库单"); | |
379 | + } | |
380 | + | |
381 | + List<ReceiptContainerView> receiptContainerViewList = new ArrayList<>(); | |
382 | + for(ReceiptBill receiptBill : receiptBills) { | |
383 | + if(receiptBill.getQty().compareTo(BigDecimal.ZERO) == 0) { | |
384 | + continue; | |
385 | + } | |
386 | + ReceiptContainerView receiptContainerView = new ReceiptContainerView(); | |
387 | + receiptContainerView.setLocationCode(receiptBill.getLocationCode()); | |
388 | + receiptContainerView.setCompanyCode(receiptBill.getCompanyCode()); | |
389 | + receiptContainerView.setReceiptContainerCode(receiptBill.getReceiptContainerCode()); | |
390 | + receiptContainerView.setReceiptDetailId(Integer.parseInt(receiptBill.getReceiptDetailId())); | |
391 | + receiptContainerView.setQty(receiptBill.getQty()); | |
392 | + receiptContainerView.setTaskType((short)100); | |
393 | + receiptContainerViewList.add(receiptContainerView); | |
394 | + } | |
395 | + receiptContainerHeaderService.batchSave(receiptContainerViewList); | |
396 | + AjaxResult retResult = taskHeaderService.createQuickTask(containerCode); | |
397 | + | |
398 | + return retResult; | |
399 | + } | |
400 | + | |
330 | 401 | @PostMapping("/findReceipt") |
331 | 402 | @ApiOperation("移动端查询入库单") |
332 | 403 | @Log(title = "移动端查询入库单", action = BusinessType.OTHER) |
... | ... | @@ -338,9 +409,6 @@ public class MobileBatchReceiptController { |
338 | 409 | } else if (StringUtils.isNull(companyCode)){ |
339 | 410 | return AjaxResult.error("公司编码为空"); |
340 | 411 | } |
341 | -// else if (StringUtils.isNull(referType)) { | |
342 | -// return AjaxResult.error("上游系统关联单类型为空"); | |
343 | -// } | |
344 | 412 | |
345 | 413 | /* 查询入库单,如果数据库中不存在,则调用ERP接口拉取单据,成功后再次查询返回结果*/ |
346 | 414 | LambdaQueryWrapper<ReceiptHeader> receiptLambdaQueryWrapper = Wrappers.lambdaQuery(); |
... | ... | @@ -393,7 +461,7 @@ public class MobileBatchReceiptController { |
393 | 461 | if (loc == null) { |
394 | 462 | return AjaxResult.error("目标库位不存在"); |
395 | 463 | } |
396 | - if (!loc.getStatus().equals("empty")) { | |
464 | + if (!"empty".equals(loc.getStatus())) { | |
397 | 465 | return AjaxResult.error("目标库位非空闲"); |
398 | 466 | } |
399 | 467 | } |
... | ... | @@ -434,4 +502,37 @@ public class MobileBatchReceiptController { |
434 | 502 | |
435 | 503 | return AjaxResult.success(taskHeader.getId()); |
436 | 504 | } |
505 | + | |
506 | + @PostMapping("/searchReceipt") | |
507 | + @ApiOperation("移动端查询入库单") | |
508 | + @Log(title = "移动端查询入库单", action = BusinessType.OTHER) | |
509 | + public AjaxResult searchReceipt(@RequestBody @ApiParam(value = "物料号") Map<String, String> param){ | |
510 | + String companyCode = param.get("companyCode"); | |
511 | + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
512 | + String now = df.format(new Date()); | |
513 | + Calendar c = Calendar.getInstance(); | |
514 | + c.setTime(new Date()); | |
515 | + c.add(Calendar.DATE, -7); | |
516 | + Date first = c.getTime(); | |
517 | + String start = df.format(first);//前一天 | |
518 | + LambdaQueryWrapper<ReceiptHeader> receiptHeaderQueryWrapper = Wrappers.lambdaQuery(); | |
519 | + receiptHeaderQueryWrapper.eq(ReceiptHeader::getCompanyCode, companyCode) | |
520 | + .eq(ReceiptHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
521 | + .le(ReceiptHeader::getCreated, now) | |
522 | + .gt(ReceiptHeader::getCreated, start) | |
523 | + .orderByDesc(ReceiptHeader::getCreated); | |
524 | + List<ReceiptHeader> receiptHeaderList = receiptHeaderService.list(receiptHeaderQueryWrapper); | |
525 | + return AjaxResult.success(receiptHeaderList); | |
526 | + } | |
527 | + | |
528 | + @PostMapping("/getDictListData") | |
529 | + @ApiOperation("移动端查询字典信息") | |
530 | + @Log(title = "移动端查询字典信息", action = BusinessType.OTHER) | |
531 | + public AjaxResult getDictListData(@RequestBody @ApiParam(value = "物料号") Map<String, String> param){ | |
532 | + String dictType = param.get("dictType"); | |
533 | + List<DictData> dictDataList = dictDataService.selectDictDataByType(dictType); | |
534 | + return AjaxResult.success(dictDataList); | |
535 | + } | |
536 | + | |
537 | + | |
437 | 538 | } |
... | ... |
src/main/java/com/huaheng/mobile/receipt/MobileOneByOneReceiptController.java
... | ... | @@ -23,7 +23,7 @@ import java.math.BigDecimal; |
23 | 23 | @CrossOrigin |
24 | 24 | @RestController |
25 | 25 | @RequestMapping("/mobile/receipt/oneByOne") |
26 | -@Api(tags = {"MobileOneByOneReceiptController"}, description = "移动端逐件收货") | |
26 | +@Api(tags = {"移动端逐件收货"}, value = "移动端逐件收货MobileOneByOneReceiptController") | |
27 | 27 | public class MobileOneByOneReceiptController { |
28 | 28 | |
29 | 29 | @Resource |
... | ... |
src/main/java/com/huaheng/mobile/receipt/MobilePutawayController.java
... | ... | @@ -30,7 +30,7 @@ import java.util.Map; |
30 | 30 | */ |
31 | 31 | @RestController |
32 | 32 | @RequestMapping("/mobile/putaway/execute") |
33 | -@Api(tags = {"MobilePutawayController"}, description = "手机收货上架") | |
33 | +@Api(tags = {"手机收货上架"}, value = "手机收货上架MobilePutawayController") | |
34 | 34 | public class MobilePutawayController { |
35 | 35 | |
36 | 36 | @Resource |
... | ... |
src/main/java/com/huaheng/mobile/shipment/MobileTaskForASRSController.java
... | ... | @@ -24,7 +24,7 @@ import java.util.Map; |
24 | 24 | @CrossOrigin |
25 | 25 | @RestController |
26 | 26 | @RequestMapping("/mobile/task/taskForASRS") |
27 | -@Api(tags = {"MobileTaskForASRSController"}, description = "手机立体库任务拣货相关") | |
27 | +@Api(tags = {"手机立体库任务拣货相关"}, value = "手机立体库任务拣货相关MobileTaskForASRSController") | |
28 | 28 | public class MobileTaskForASRSController { |
29 | 29 | |
30 | 30 | |
... | ... |
src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java
... | ... | @@ -48,7 +48,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl |
48 | 48 | { |
49 | 49 | for (UserCompany userCompanyItem : userCompanys) |
50 | 50 | { |
51 | - if (companyItem.getId() == userCompanyItem.getCompanyId()) | |
51 | + if (companyItem.getId().equals(userCompanyItem.getCompanyId())) | |
52 | 52 | { |
53 | 53 | companyItem.setFlag(true); |
54 | 54 | break; |
... | ... |
src/main/java/com/huaheng/pc/config/configValue/controller/ConfigValueController.java
... | ... | @@ -101,7 +101,7 @@ public class ConfigValueController extends BaseController { |
101 | 101 | @ResponseBody |
102 | 102 | public AjaxResult addSave(ConfigValue configValue) { |
103 | 103 | //检测盘点首选项是否停用 |
104 | - if(configValue.getRecordType().equals("cycleCountPreference")){ | |
104 | + if("cycleCountPreference".equals(configValue.getRecordType())){ | |
105 | 105 | CycleCountPreference cycleCountPreferenceTemp = new CycleCountPreference(); |
106 | 106 | cycleCountPreferenceTemp.setCode(configValue.getIdentifier()); |
107 | 107 | cycleCountPreferenceTemp.setWarehouseCode(configValue.getWarehouseCode()); |
... | ... |
src/main/java/com/huaheng/pc/config/configWarning/service/ConfigWarningService.java
... | ... | @@ -104,7 +104,7 @@ public class ConfigWarningService extends ServiceImpl<ConfigWarningMapper, Confi |
104 | 104 | |
105 | 105 | /** |
106 | 106 | * 物料预警 |
107 | - * @param map 任务明细 | |
107 | + * @param materialCode,materialName 任务明细 | |
108 | 108 | */ |
109 | 109 | public void materialWarning(String materialCode, String materialName){ |
110 | 110 | /* 查询预警配置*/ |
... | ... |
src/main/java/com/huaheng/pc/config/container/controller/ContainerController.java
... | ... | @@ -149,7 +149,7 @@ public class ContainerController extends BaseController { |
149 | 149 | |
150 | 150 | for (Integer id : Convert.toIntArray(ids)) { |
151 | 151 | Container container = containerService.getById(id); |
152 | - if (container.getStatus().equals("empty") && StringUtils.isEmpty(container.getLocationCode())) { | |
152 | + if ("empty".equals(container.getStatus()) && StringUtils.isEmpty(container.getLocationCode())) { | |
153 | 153 | container.setEnable(false); |
154 | 154 | container.setLastUpdatedBy(ShiroUtils.getLoginName()); |
155 | 155 | containerService.updateById(container); |
... | ... |
src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
... | ... | @@ -56,8 +56,9 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
56 | 56 | } |
57 | 57 | |
58 | 58 | private Integer getNumber(String type) { |
59 | - if (!containerTypeService.checkConfig(type)) | |
59 | + if (!containerTypeService.checkConfig(type)) { | |
60 | 60 | throw new ServiceException("容器类型编码不存在"); |
61 | + } | |
61 | 62 | LambdaQueryWrapper<Container> lambda = Wrappers.lambdaQuery(); |
62 | 63 | lambda.select(Container::getCode).eq(Container::getContainerType, type) |
63 | 64 | .orderByDesc(Container::getId).last("Limit 1"); |
... | ... | @@ -72,6 +73,7 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
72 | 73 | } |
73 | 74 | } |
74 | 75 | |
76 | + @Override | |
75 | 77 | public String importMaterial(List<Container> containerList, Boolean updateSupport, String operName){ |
76 | 78 | if (StringUtils.isNull(containerList) || containerList.size() == 0) { |
77 | 79 | throw new BusinessException("导入数据不能为空!"); |
... | ... | @@ -128,8 +130,9 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
128 | 130 | * */ |
129 | 131 | @Override |
130 | 132 | public void updateLocationCodeAndStatus(String containerCode, String locationCode, String status) { |
131 | - if (StringUtils.isNotEmpty(containerCode) || StringUtils.isNotEmpty(locationCode)) | |
133 | + if (StringUtils.isNotEmpty(containerCode) || StringUtils.isNotEmpty(locationCode)) { | |
132 | 134 | containerMapper.updateLocationCodeAndStatus(ShiroUtils.getWarehouseCode(), containerCode, locationCode, status); |
135 | + } | |
133 | 136 | } |
134 | 137 | |
135 | 138 | /** |
... | ... | @@ -138,6 +141,7 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
138 | 141 | * @param containerCode 容器编码 |
139 | 142 | * @return |
140 | 143 | */ |
144 | + @Override | |
141 | 145 | @Transactional |
142 | 146 | public void removeContainer(String containerType, String containerCode) { |
143 | 147 | if ("LS".equals(containerType)) { |
... | ... |
src/main/java/com/huaheng/pc/config/containerCapacity/controller/ContainerCapacityController.java
... | ... | @@ -142,8 +142,9 @@ public class ContainerCapacityController extends BaseController { |
142 | 142 | @ResponseBody |
143 | 143 | public AjaxResult remove(String ids) |
144 | 144 | { |
145 | - if (StringUtils.isEmpty(ids)) | |
145 | + if (StringUtils.isEmpty(ids)) { | |
146 | 146 | return AjaxResult.error("id不能为空"); |
147 | + } | |
147 | 148 | for (Integer id : Convert.toIntArray(ids)) |
148 | 149 | { |
149 | 150 | |
... | ... |
src/main/java/com/huaheng/pc/config/containerType/controller/ContainerTypeController.java
... | ... | @@ -137,8 +137,9 @@ public class ContainerTypeController extends BaseController |
137 | 137 | @ResponseBody |
138 | 138 | public AjaxResult remove(String ids) |
139 | 139 | { |
140 | - if (StringUtils.isEmpty(ids)) | |
141 | - return AjaxResult.error("id不能为空"); | |
140 | + if (StringUtils.isEmpty(ids)) { | |
141 | + return AjaxResult.error("id不能为空"); | |
142 | + } | |
142 | 143 | for (Integer id : Convert.toIntArray(ids)) |
143 | 144 | { |
144 | 145 | containerTypeService.removeById(id); |
... | ... |
src/main/java/com/huaheng/pc/config/cycleCountPreference/controller/cycleCountPreferenceController.java
... | ... | @@ -28,6 +28,10 @@ import java.util.ArrayList; |
28 | 28 | import java.util.Date; |
29 | 29 | import java.util.List; |
30 | 30 | |
31 | + | |
32 | +/** | |
33 | + * 盘点单首选项 | |
34 | + * */ | |
31 | 35 | @Controller |
32 | 36 | @RequestMapping("/config/cycleCountPreference") |
33 | 37 | public class cycleCountPreferenceController extends BaseController { |
... | ... |
src/main/java/com/huaheng/pc/config/excelTemplate/service/ExcelTemplateServiceImpl.java
... | ... | @@ -14,6 +14,7 @@ import java.util.Map; |
14 | 14 | @Service("excelService") |
15 | 15 | public class ExcelTemplateServiceImpl extends ServiceImpl<ExcelTemplateMapper, ExcelTemplate> implements ExcelTemplateService{ |
16 | 16 | |
17 | + @Override | |
17 | 18 | public List<Map<String, Object>> getList(){ |
18 | 19 | LambdaQueryWrapper<ExcelTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
19 | 20 | lambdaQueryWrapper.eq(ExcelTemplate::getWarehouseCode, ShiroUtils.getWarehouseCode()) |
... | ... |
src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
... | ... | @@ -258,7 +258,7 @@ public class LocationController extends BaseController { |
258 | 258 | List<String> batchList = inventoryDetails.stream().map(InventoryDetail::getBatch).collect(Collectors.toList()); |
259 | 259 | List<String> materialCodeList = inventoryDetails.stream().map(InventoryDetail::getMaterialCode).collect(Collectors.toList()); |
260 | 260 | List<BigDecimal> qtyList = inventoryDetails.stream().map(InventoryDetail::getQty).collect(Collectors.toList()); |
261 | - if (status.equals("empty")) { | |
261 | + if ("empty".equals(status)) { | |
262 | 262 | if(StringUtils.isEmpty(containerCode)) { |
263 | 263 | userDef3 = LocationStatus.IDLE_EMPTY_LOCATION; |
264 | 264 | } else { |
... | ... | @@ -272,7 +272,7 @@ public class LocationController extends BaseController { |
272 | 272 | userDef3 = LocationStatus.IDLE_FULL_CONTAINER; |
273 | 273 | } |
274 | 274 | } |
275 | - } else if(status.equals("lock")) { | |
275 | + } else if("lock".equals(status)) { | |
276 | 276 | if(StringUtils.isEmpty(containerCode)) { |
277 | 277 | userDef3 = LocationStatus.LOCK_EMPTY_LOCATION; |
278 | 278 | } else { |
... | ... |
src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java
src/main/java/com/huaheng/pc/config/location/service/LocationService.java
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... | ... | @@ -268,5 +268,10 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
268 | 268 | return locationMapper.pickLocation(); |
269 | 269 | } |
270 | 270 | |
271 | + @Override | |
272 | + public List<Location> selectContainerEmpty(String warehouseCode) { | |
273 | + return locationMapper.selectContainerEmpty(warehouseCode); | |
274 | + } | |
275 | + | |
271 | 276 | |
272 | 277 | } |
... | ... |
src/main/java/com/huaheng/pc/config/locationType/controller/LocationTypeController.java
... | ... | @@ -153,8 +153,9 @@ public class LocationTypeController extends BaseController |
153 | 153 | @ResponseBody |
154 | 154 | public AjaxResult remove(String ids) |
155 | 155 | { |
156 | - if (StringUtils.isEmpty(ids)) | |
157 | - return AjaxResult.error("id不能为空"); | |
156 | + if (StringUtils.isEmpty(ids)) { | |
157 | + return AjaxResult.error("id不能为空"); | |
158 | + } | |
158 | 159 | for (Integer id : Convert.toIntArray(ids)) |
159 | 160 | { |
160 | 161 | locationTypeService.removeById(id); |
... | ... |
src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java
... | ... | @@ -3,6 +3,7 @@ package com.huaheng.pc.config.locationType.service; |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
6 | +import com.huaheng.common.utils.StringUtils; | |
6 | 7 | import com.huaheng.common.utils.security.ShiroUtils; |
7 | 8 | import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference; |
8 | 9 | import com.huaheng.pc.config.locationType.domain.LocationType; |
... | ... | @@ -20,6 +21,7 @@ public class LocationTypeServiceImpl extends ServiceImpl<LocationTypeMapper, Loc |
20 | 21 | public List<Map<String, Object>> getLocationPrefix(){ |
21 | 22 | LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
22 | 23 | lambdaQueryWrapper.eq(LocationType::getWarehouseCode, ShiroUtils.getWarehouseCode()) |
24 | + .select(LocationType::getCode,LocationType::getName) | |
23 | 25 | .eq(LocationType::getEnable, true); |
24 | 26 | return this.listMaps(lambdaQueryWrapper); |
25 | 27 | } |
... | ... |
src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceServiceImpl.java
... | ... | @@ -3,6 +3,7 @@ package com.huaheng.pc.config.shipmentPreference.service; |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
6 | +import com.huaheng.common.constant.QuantityConstant; | |
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; |
... | ... | @@ -91,7 +92,10 @@ public class ShipmentPreferenceServiceImpl extends ServiceImpl<ShipmentPreferenc |
91 | 92 | //判断单据是否按出库流程操作 |
92 | 93 | ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); |
93 | 94 | if (shipmentHeader == null || shipmentHeader.getFirstStatus() < status) { |
94 | - throw new ServiceException("单据状态不对,此操作不符合出库流程,请按照出库流程出库"); | |
95 | + throw new ServiceException("出库单ID为"+id+"的单据状态不对,请按照出库流程先审核单据"); | |
96 | + } | |
97 | + if(shipmentHeader.getLastStatus() > QuantityConstant.SHIPMENT_HEADER_WAVE){ | |
98 | + throw new ServiceException("出库单ID为"+id+"的单据无法加入波次"); | |
95 | 99 | } |
96 | 100 | shipmentHeaderList.add(shipmentHeader); |
97 | 101 | } |
... | ... | @@ -104,6 +108,9 @@ public class ShipmentPreferenceServiceImpl extends ServiceImpl<ShipmentPreferenc |
104 | 108 | if (shipmentHeader == null || shipmentHeader.getFirstStatus() < status) { |
105 | 109 | throw new ServiceException("单据状态不对,此操作不符合出库流程,请按照出库流程出库"); |
106 | 110 | } |
111 | + if(shipmentHeader.getLastStatus() > QuantityConstant.SHIPMENT_HEADER_WAVE){ | |
112 | + throw new ServiceException("出库单"+code+"的单据无法加入波次"); | |
113 | + } | |
107 | 114 | shipmentHeaderList.add(shipmentHeader); |
108 | 115 | } |
109 | 116 | } |
... | ... |
src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeServiceImpl.java
... | ... | @@ -53,6 +53,7 @@ public class ShipmentTypeServiceImpl extends ServiceImpl<ShipmentTypeMapper, Shi |
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | + @Override | |
56 | 57 | public List<Map<String, Object>> getType(){ |
57 | 58 | LambdaQueryWrapper<ShipmentType> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
58 | 59 | lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ShiroUtils.getWarehouseCode()),ShipmentType::getWarehouseCode, ShiroUtils.getWarehouseCode()) |
... | ... |
src/main/java/com/huaheng/pc/config/supplier/controller/SupplierController.java
... | ... | @@ -139,8 +139,9 @@ public class SupplierController extends BaseController { |
139 | 139 | @PostMapping( "/remove") |
140 | 140 | @ResponseBody |
141 | 141 | public AjaxResult remove(String ids) { |
142 | - if (StringUtils.isEmpty(ids)) | |
142 | + if (StringUtils.isEmpty(ids)) { | |
143 | 143 | return AjaxResult.error("id不能为空"); |
144 | + } | |
144 | 145 | for (Integer id : Convert.toIntArray(ids)) { |
145 | 146 | Supplier supplier = supplierService.getById(id); |
146 | 147 | |
... | ... |
src/main/java/com/huaheng/pc/config/supplier/service/SupplierService.java
... | ... | @@ -2,7 +2,13 @@ package com.huaheng.pc.config.supplier.service; |
2 | 2 | |
3 | 3 | import com.huaheng.pc.config.supplier.domain.Supplier; |
4 | 4 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | + | |
6 | +import java.util.List; | |
7 | +import java.util.Map; | |
8 | + | |
5 | 9 | public interface SupplierService extends IService<Supplier>{ |
6 | 10 | |
11 | + List<Map<String, Object>> getCode(); | |
12 | + | |
7 | 13 | |
8 | 14 | } |
... | ... |
src/main/java/com/huaheng/pc/config/supplier/service/SupplierServiceImpl.java
1 | 1 | package com.huaheng.pc.config.supplier.service; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
5 | +import com.huaheng.common.utils.security.ShiroUtils; | |
3 | 6 | import org.springframework.stereotype.Service; |
4 | 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
5 | 8 | import com.huaheng.pc.config.supplier.mapper.SupplierMapper; |
6 | 9 | import com.huaheng.pc.config.supplier.domain.Supplier; |
7 | 10 | |
8 | -@Service | |
11 | +import java.util.List; | |
12 | +import java.util.Map; | |
13 | + | |
14 | +@Service("SupplierService") | |
9 | 15 | public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> implements SupplierService{ |
10 | 16 | |
17 | + @Override | |
18 | + public List<Map<String, Object>> getCode(){ | |
19 | + LambdaQueryWrapper<Supplier> lambda = Wrappers.lambdaQuery(); | |
20 | + lambda.select(Supplier::getCode, Supplier::getId, Supplier::getName) | |
21 | + .eq(Supplier::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
22 | + return this.listMaps(lambda); | |
23 | + } | |
11 | 24 | } |
... | ... |
src/main/java/com/huaheng/pc/config/transfer/controller/TransferController.java
0 → 100644
1 | +package com.huaheng.pc.config.transfer.controller; | |
2 | + | |
3 | + | |
4 | +import org.springframework.stereotype.Controller; | |
5 | +import org.springframework.web.bind.annotation.RequestMapping; | |
6 | + | |
7 | + | |
8 | +/** | |
9 | + * 移库配置 | |
10 | + * 配置闲时时间段, | |
11 | + * 闲时移库热门物料到靠近出口的位置 | |
12 | + * | |
13 | + *需要首先收集热门物料的信息。 | |
14 | + * 或者查询最近一根约的出入单,确定物料热度 | |
15 | + * | |
16 | + * | |
17 | + * */ | |
18 | +@Controller | |
19 | +@RequestMapping("/config/transfer") | |
20 | +public class TransferController { | |
21 | + | |
22 | + | |
23 | + | |
24 | + | |
25 | + | |
26 | + | |
27 | +} | |
... | ... |
src/main/java/com/huaheng/pc/config/transfer/domain/Transfer.java
0 → 100644
1 | +package com.huaheng.pc.config.transfer.domain; | |
2 | + | |
3 | + | |
4 | +import com.baomidou.mybatisplus.annotation.TableName; | |
5 | +import lombok.Data; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | + | |
9 | +@Data | |
10 | +//@TableName(value = "") | |
11 | +public class Transfer implements Serializable { | |
12 | + | |
13 | + | |
14 | + | |
15 | + | |
16 | + | |
17 | + | |
18 | + | |
19 | +} | |
... | ... |
src/main/java/com/huaheng/pc/config/transfer/mapper/TransferMapper.java
0 → 100644
src/main/java/com/huaheng/pc/config/transfer/service/TransferService.java
0 → 100644
src/main/java/com/huaheng/pc/config/transfer/service/TransferServiceImpl.java
0 → 100644
1 | +package com.huaheng.pc.config.transfer.service; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | +import com.huaheng.pc.config.transfer.domain.Transfer; | |
5 | +import com.huaheng.pc.config.transfer.mapper.TransferMapper; | |
6 | +import org.springframework.stereotype.Service; | |
7 | + | |
8 | + | |
9 | +/** | |
10 | + * 移库配置 | |
11 | + * */ | |
12 | +@Service("TransferService") | |
13 | +public class TransferServiceImpl extends ServiceImpl<TransferMapper, Transfer> implements TransferService { | |
14 | + | |
15 | + | |
16 | + | |
17 | + | |
18 | + | |
19 | + | |
20 | + | |
21 | + | |
22 | + | |
23 | + | |
24 | + | |
25 | + | |
26 | + | |
27 | + | |
28 | + | |
29 | + | |
30 | +} | |
... | ... |
src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java
... | ... | @@ -136,8 +136,9 @@ public class WareHouseController extends BaseController { |
136 | 136 | @PostMapping( "/remove") |
137 | 137 | @ResponseBody |
138 | 138 | public AjaxResult remove(String codes) { |
139 | - if (StringUtils.isEmpty(codes)) | |
139 | + if (StringUtils.isEmpty(codes)) { | |
140 | 140 | return AjaxResult.error("id不能为空"); |
141 | + } | |
141 | 142 | for (String code : Convert.toStrArray(codes)) { |
142 | 143 | Warehouse warehouse = new Warehouse(); |
143 | 144 | InventoryHeader inventory = new InventoryHeader(); |
... | ... |
src/main/java/com/huaheng/pc/config/zone/controller/ZoneController.java
... | ... | @@ -138,8 +138,9 @@ public class ZoneController extends BaseController { |
138 | 138 | @ResponseBody |
139 | 139 | public AjaxResult remove(String ids) |
140 | 140 | { |
141 | - if (StringUtils.isEmpty(ids)) | |
141 | + if (StringUtils.isEmpty(ids)) { | |
142 | 142 | return AjaxResult.error("id不能为空"); |
143 | + } | |
143 | 144 | for (Integer id : Convert.toIntArray(ids)) |
144 | 145 | { |
145 | 146 | Zone record = new Zone(); |
... | ... |
src/main/java/com/huaheng/pc/config/zone/service/ZoneServiceImpl.java
... | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
6 | 6 | import com.huaheng.common.exception.service.ServiceException; |
7 | +import com.huaheng.common.utils.security.ShiroUtils; | |
7 | 8 | import com.huaheng.pc.config.zone.domain.Zone; |
8 | 9 | import com.huaheng.pc.config.zone.mapper.ZoneMapper; |
9 | 10 | import org.springframework.stereotype.Service; |
... | ... | @@ -23,7 +24,8 @@ public class ZoneServiceImpl extends ServiceImpl<ZoneMapper, Zone> implements Zo |
23 | 24 | @Transactional |
24 | 25 | public List<Map<String, Object>> getZoneCodeList() { |
25 | 26 | LambdaQueryWrapper<Zone> lambda = Wrappers.lambdaQuery(); |
26 | - lambda.select(Zone::getId, Zone::getCode, Zone::getName); | |
27 | + lambda.select(Zone::getId, Zone::getCode, Zone::getName) | |
28 | + .eq(Zone::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
27 | 29 | return this.listMaps(lambda); |
28 | 30 | } |
29 | 31 | |
... | ... |
src/main/java/com/huaheng/pc/config/zoneCapacity/controller/ZoneCapacityController.java
... | ... | @@ -137,8 +137,9 @@ public class ZoneCapacityController extends BaseController |
137 | 137 | @ResponseBody |
138 | 138 | public AjaxResult remove(String ids) |
139 | 139 | { |
140 | - if (StringUtils.isEmpty(ids)) | |
141 | - return AjaxResult.error("id不能为空"); | |
140 | + if (StringUtils.isEmpty(ids)) { | |
141 | + return AjaxResult.error("id不能为空"); | |
142 | + } | |
142 | 143 | for (Integer id : Convert.toIntArray(ids)) |
143 | 144 | { |
144 | 145 | zoneCapacityService.removeById(id); |
... | ... |
src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java
... | ... | @@ -182,7 +182,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj |
182 | 182 | location.setWarehouseCode(inventoryDetail.getWarehouseCode()); |
183 | 183 | LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(location); |
184 | 184 | location = locationService.getOne(lambdaQueryWrapper); |
185 | - if (!location.getStatus().equals("empty")) { | |
185 | + if (!"empty".equals(location.getStatus())) { | |
186 | 186 | return AjaxResult.error (inventoryDetail.getId() + "库存非空闲,请等待其他任务完成再进行调整!"); |
187 | 187 | } |
188 | 188 | //判断调整库存状态还是数量 |
... | ... |
src/main/java/com/huaheng/pc/inventory/adjustHeader/controller/adjustHeaderController.java
... | ... | @@ -120,8 +120,9 @@ public class adjustHeaderController extends BaseController { |
120 | 120 | @ResponseBody |
121 | 121 | public AjaxResult remove(String ids) |
122 | 122 | { |
123 | - if (StringUtils.isEmpty(ids)) | |
123 | + if (StringUtils.isEmpty(ids)) { | |
124 | 124 | return AjaxResult.error("id不能为空"); |
125 | + } | |
125 | 126 | for (Integer id : Convert.toIntArray(ids)) |
126 | 127 | { |
127 | 128 | AjaxResult result = adjustHeaderService.deleteHeader(id); |
... | ... |
src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderServiceImpl.java
... | ... | @@ -97,11 +97,14 @@ public class AdjustHeaderServiceImpl extends ServiceImpl<AdjustHeaderMapper, Adj |
97 | 97 | throw new SecurityException("选择单据类型为质检调整时,质检单编码不能为空!"); |
98 | 98 | } |
99 | 99 | break; |
100 | - case "adjust": //盘点调整 | |
100 | + case "cyclecountAdjust": //盘点调整 | |
101 | 101 | if(StringUtils.isEmpty(adjustHeader.getCycleCountCode())){ |
102 | 102 | throw new SecurityException("选择单据类型为盘点调整时,盘点单编码不能为空!"); |
103 | 103 | } |
104 | 104 | break; |
105 | + //除质检和调整需要前置单据,其他不需要 | |
106 | + default: | |
107 | + break; | |
105 | 108 | } |
106 | 109 | |
107 | 110 | adjustHeader.setCreated(new Date()); |
... | ... |
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
... | ... | @@ -169,8 +169,9 @@ public class CycleCountDetailController extends BaseController { |
169 | 169 | @ResponseBody |
170 | 170 | public AjaxResult remove(String ids){ |
171 | 171 | |
172 | - if (StringUtils.isEmpty(ids)) | |
172 | + if (StringUtils.isEmpty(ids)) { | |
173 | 173 | return AjaxResult.error("删除的明细id不能为空"); |
174 | + } | |
174 | 175 | Integer[] detailsIds = Convert.toIntArray(ids); |
175 | 176 | CycleCountDetail cyclecountDetail = cycleCountDetailService.getById(detailsIds[0]); |
176 | 177 | CycleCountHeader ch = new CycleCountHeader(); |
... | ... |
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java
... | ... | @@ -135,6 +135,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
135 | 135 | //查询该条库存明细 |
136 | 136 | InventoryDetail inventoryDetail = inventoryDetailService.getById(inventoryDetailId); |
137 | 137 | //写入盘点明细 |
138 | + if(!inventoryDetail.getCompanyCode().equals(cyclecountHeader.getCompanyCode())){ | |
139 | + throw new ServiceException("库存与盘点主单货主不一致!"); | |
140 | + } | |
138 | 141 | CycleCountDetail ccd = new CycleCountDetail(); |
139 | 142 | ccd.setPreferenceCode(preferenceCode); |
140 | 143 | ccd.setCycleCountHeadCode(cyclecountHeader.getCode()); |
... | ... | @@ -237,7 +240,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
237 | 240 | temp.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
238 | 241 | LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(temp); |
239 | 242 | Location loc = locationService.getOne(lambdaQueryWrapper); |
240 | - if(!loc.getStatus().equals("empty")){ | |
243 | + if(!"empty".equals(loc.getStatus())){ | |
241 | 244 | return AjaxResult.error(cycleCountDetail.getLocationCode()+"库位不在空闲状态,请先完成其他任务,操作失败!"); |
242 | 245 | } |
243 | 246 | if(StringUtils.isEmpty(loc.getContainerCode())){ |
... | ... | @@ -355,12 +358,12 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
355 | 358 | LambdaQueryWrapper<CycleCountHeader> cycleCountHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountHeader); |
356 | 359 | cycleCountHeader = cycleCountHeaderService.getOne(cycleCountHeaderLambdaQueryWrapper); //主单 |
357 | 360 | //任务执行后再实盘登记 |
358 | - if(cyclecountDetail.getEnableStatus() < QuantityConstant.CYCLECOUNT_STATUS_EXECUTING){ | |
361 | + /*if(cyclecountDetail.getEnableStatus() < QuantityConstant.CYCLECOUNT_STATUS_EXECUTING){ | |
359 | 362 | return AjaxResult.error("盘点任务未执行不能登记数量!"); |
360 | 363 | } |
361 | 364 | if(cyclecountDetail.getEnableStatus() == QuantityConstant.CYCLECOUNT_STATUS_COMPLETED){ |
362 | 365 | return AjaxResult.error("盘点任务完成后不能再登记数量!"); |
363 | - } | |
366 | + }*/ | |
364 | 367 | if(cycleCountHeader == null){ |
365 | 368 | return AjaxResult.error("主单据不存在"); |
366 | 369 | } |
... | ... |
src/main/java/com/huaheng/pc/inventory/cycleCountHeader/controller/CycleCountHeaderController.java
... | ... | @@ -157,8 +157,9 @@ public class CycleCountHeaderController extends BaseController { |
157 | 157 | @ResponseBody |
158 | 158 | public AjaxResult remove(String ids) |
159 | 159 | { |
160 | - if (StringUtils.isEmpty(ids)) | |
160 | + if (StringUtils.isEmpty(ids)) { | |
161 | 161 | return AjaxResult.error("id不能为空"); |
162 | + } | |
162 | 163 | for (Integer id : Convert.toIntArray(ids)) |
163 | 164 | { |
164 | 165 | AjaxResult result = cycleCountHeaderService.delete(id); |
... | ... |
src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java
... | ... | @@ -67,7 +67,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap |
67 | 67 | List<CycleCountDetail> list = cycleCountDetailService.list(lam); |
68 | 68 | //当有子单的状态为100时触发主单的完成状态 |
69 | 69 | //100状态只有全部完成才写入主单 |
70 | - long count100 = list.stream().filter(t->t.getEnableStatus() == QuantityConstant.CYCLECOUNT_STATUS_COMPLETED).count(); //明细已完成的条数 | |
70 | + long count100 = list.stream().filter(t-> t.getEnableStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED)).count(); //明细已完成的条数 | |
71 | 71 | if(count100 == list.size() ){ |
72 | 72 | cyclecountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); |
73 | 73 | this.saveOrUpdate(cyclecountHeader); |
... | ... | @@ -141,6 +141,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap |
141 | 141 | /** |
142 | 142 | * 新增盘点差异调整单 |
143 | 143 | * */ |
144 | + @Override | |
144 | 145 | @Transactional |
145 | 146 | public AjaxResult insertByAdjust(Integer id) { |
146 | 147 | |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailServiceImpl.java
... | ... | @@ -83,7 +83,7 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
83 | 83 | if(loc == null){ |
84 | 84 | throw new ServiceException("库存没有库位!"); |
85 | 85 | } |
86 | - if(!loc.getStatus().equals("empty")){ | |
86 | + if(!"empty".equals(loc.getStatus())){ | |
87 | 87 | throw new ServiceException(inventoryDetail.getLocationCode()+"状态非空闲,操作失败"); |
88 | 88 | } |
89 | 89 | if(StringUtils.isEmpty(loc.getContainerCode())){ |
... | ... | @@ -157,7 +157,7 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
157 | 157 | } |
158 | 158 | |
159 | 159 | //查找未质检的 |
160 | - if(inventoryDetail.getQcCheck().equals("2")) { | |
160 | + if("2".equals(inventoryDetail.getQcCheck())) { | |
161 | 161 | codeSet.add(inventoryDetail.getReceiptCode()); |
162 | 162 | } |
163 | 163 | } |
... | ... | @@ -167,7 +167,7 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
167 | 167 | //对库存分类,已入库单划分 |
168 | 168 | for(Integer id : ids){ |
169 | 169 | InventoryDetail inventoryDetail=this.getById(id); |
170 | - if(inventoryDetail.getReceiptCode().equals(code) && inventoryDetail.getQcCheck().equals("2")){ | |
170 | + if(inventoryDetail.getReceiptCode().equals(code) && "2".equals(inventoryDetail.getQcCheck())){ | |
171 | 171 | inventoryDetails.add(inventoryDetail); |
172 | 172 | } |
173 | 173 | } |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryHeader/controller/InventoryHeaderController.java
... | ... | @@ -177,18 +177,18 @@ public class InventoryHeaderController extends BaseController |
177 | 177 | /** |
178 | 178 | * 空托盘出库查看任务 |
179 | 179 | * @param containerCode |
180 | - * @param location | |
180 | + * @param sourceLocation | |
181 | 181 | * @return |
182 | 182 | */ |
183 | 183 | @RequiresPermissions("inventory:inventoryHeader:emptyCheckOut") |
184 | 184 | @PostMapping("/emptyCheckOut") |
185 | 185 | @Log(title = "任务-任务管理", operating = "生成空托盘出库查看任务", action = BusinessType.INSERT) |
186 | 186 | @ResponseBody |
187 | - public AjaxResult emptyCheckOut(String containerCode,String location){ | |
188 | - /*if(StringUtils.isEmpty(containerCode) || StringUtils.isEmpty(location)){ | |
187 | + public AjaxResult emptyCheckOut(String containerCode,String sourceLocation){ | |
188 | + if(StringUtils.isEmpty(containerCode) || StringUtils.isEmpty(sourceLocation)){ | |
189 | 189 | throw new ServiceException("容器和库位不能有空值!"); |
190 | - }*/ | |
191 | - return inventoryHeaderService.createEmptyCheckOut(containerCode, location); | |
190 | + } | |
191 | + return inventoryHeaderService.createEmptyCheckOut(containerCode, sourceLocation); | |
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
... | ... | @@ -219,5 +219,6 @@ public class InventoryHeaderController extends BaseController |
219 | 219 | |
220 | 220 | |
221 | 221 | |
222 | - | |
222 | + | |
223 | + | |
223 | 224 | } |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryHeader/domain/InventoryHeader.java
... | ... | @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName; |
7 | 7 | import io.swagger.annotations.ApiModel; |
8 | 8 | import io.swagger.annotations.ApiModelProperty; |
9 | 9 | import java.io.Serializable; |
10 | +import java.math.BigDecimal; | |
10 | 11 | import java.util.Date; |
11 | 12 | import lombok.Data; |
12 | 13 | |
... | ... | @@ -75,7 +76,7 @@ public class InventoryHeader implements Serializable { |
75 | 76 | */ |
76 | 77 | @TableField(value = "totalQty") |
77 | 78 | @ApiModelProperty(value="总数量") |
78 | - private Integer totalQty; | |
79 | + private BigDecimal totalQty; | |
79 | 80 | |
80 | 81 | /** |
81 | 82 | * 总行量 |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java
... | ... | @@ -103,22 +103,25 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
103 | 103 | if (StringUtils.isNotEmpty(container.getLocationCode())) { |
104 | 104 | return AjaxResult.error("容器已在库位[" + container.getLocationCode() + "]上"); |
105 | 105 | } |
106 | - //库位 | |
107 | - Location temp = new Location(); | |
108 | - temp.setCode(destinationLocation); | |
109 | - temp.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
110 | - LambdaQueryWrapper lambda = Wrappers.lambdaQuery(temp); | |
111 | - Location loc = locationService.getOne(lambda); | |
106 | + Location loc = null; | |
112 | 107 | if(StringUtils.isNotEmpty(destinationLocation)) { |
113 | - //校验目标地址 | |
114 | - if (loc == null) { | |
115 | - return AjaxResult.error("目标库位不存在"); | |
116 | - } | |
117 | - if (StringUtils.isNotEmpty(loc.getContainerCode())) { | |
118 | - return AjaxResult.error("目标库位已存在托盘"); | |
119 | - } | |
120 | - if (!loc.getStatus().equals("empty")) { | |
121 | - return AjaxResult.error("目标库位非空闲"); | |
108 | + //库位 | |
109 | + Location temp = new Location(); | |
110 | + temp.setCode(destinationLocation); | |
111 | + temp.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
112 | + LambdaQueryWrapper lambda = Wrappers.lambdaQuery(temp); | |
113 | + loc = locationService.getOne(lambda); | |
114 | + if (StringUtils.isNotEmpty(destinationLocation)) { | |
115 | + //校验目标地址 | |
116 | + if (loc == null) { | |
117 | + return AjaxResult.error("目标库位不存在"); | |
118 | + } | |
119 | + if (StringUtils.isNotEmpty(loc.getContainerCode())) { | |
120 | + return AjaxResult.error("目标库位已存在托盘"); | |
121 | + } | |
122 | + if (!"empty".equals(loc.getStatus())) { | |
123 | + return AjaxResult.error("目标库位非空闲"); | |
124 | + } | |
122 | 125 | } |
123 | 126 | } |
124 | 127 | |
... | ... | @@ -133,21 +136,25 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
133 | 136 | |
134 | 137 | //创建主任务 |
135 | 138 | TaskHeader taskHeader = new TaskHeader(); |
136 | - taskHeader.setWarehouseCode(loc.getWarehouseCode()); | |
139 | + taskHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
137 | 140 | taskHeader.setCompanyCode(ShiroUtils.getCompanyCodeList().get(0));//货主 |
138 | 141 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_SHELF); //入库内部类型都给100 |
139 | 142 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_EMPTYRECEIPT); |
140 | 143 | taskHeader.setContainerCode(container.getCode()); |
141 | 144 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
142 | 145 | taskHeader.setFromLocation(""); |
143 | - taskHeader.setToLocation(loc.getCode()); | |
146 | + if(loc != null) { | |
147 | + taskHeader.setToLocation(loc.getCode()); | |
148 | + } | |
144 | 149 | taskHeader.setCreated(new Date()); |
145 | 150 | taskHeader.setCreatedBy(ShiroUtils.getLoginName()); |
146 | 151 | taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); |
147 | 152 | taskHeader.setLastUpdated(new Date()); |
148 | 153 | if(taskHeaderService.save(taskHeader)){ |
149 | 154 | //锁定库位状态 |
150 | - locationService.updateStatus(loc.getContainerCode(),"lock"); | |
155 | + if(loc != null) { | |
156 | + locationService.updateStatus(loc.getContainerCode(), "lock"); | |
157 | + } | |
151 | 158 | }else{ |
152 | 159 | throw new ServiceException("空托入库主表生成失败!"); |
153 | 160 | } |
... | ... | @@ -168,11 +175,10 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
168 | 175 | if(taskDetailService.save(taskDetail) == false){ |
169 | 176 | throw new ServiceException("空托入库任务明细生成失败!"); |
170 | 177 | } |
171 | - | |
172 | - /** | |
173 | - * 锁库位 | |
174 | - */ | |
175 | - locationService.updateStatus(loc.getCode(), "lock"); | |
178 | + //锁库位 | |
179 | + if(loc != null) { | |
180 | + locationService.updateStatus(loc.getCode(), "lock"); | |
181 | + } | |
176 | 182 | return AjaxResult.success(taskHeader.getId()); |
177 | 183 | } |
178 | 184 | |
... | ... | @@ -206,7 +212,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
206 | 212 | if(StringUtils.isEmpty(loc.getContainerCode())){ |
207 | 213 | return AjaxResult.error("源货位没有托盘"); |
208 | 214 | } |
209 | - if(!loc.getStatus().equals("empty")){ | |
215 | + if(!"empty".equals(loc.getStatus())){ | |
210 | 216 | return AjaxResult.error("源货位非空闲"); |
211 | 217 | } |
212 | 218 | //判断托盘是否已经存在任务 |
... | ... | @@ -285,7 +291,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
285 | 291 | if(StringUtils.isEmpty(loc.getContainerCode())){ |
286 | 292 | return AjaxResult.error("源货位没有托盘"); |
287 | 293 | } |
288 | - if(!loc.getStatus().equals("empty")){ | |
294 | + if(!"empty".equals(loc.getStatus())){ | |
289 | 295 | return AjaxResult.error("源货位非空闲"); |
290 | 296 | } |
291 | 297 | //创建任务 |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java
... | ... | @@ -101,7 +101,10 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
101 | 101 | receiptContainerHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
102 | 102 | receiptContainerHeader.setCompanyCode(receiptDetail.getCompanyCode()); |
103 | 103 | receiptContainerHeader.setContainerCode(containerCode); |
104 | - Container container = containerService.findAllByCode(containerCode); | |
104 | + Container condition = new Container(); | |
105 | + condition.setCode(containerCode); | |
106 | + LambdaQueryWrapper<Container> containerHeaderQueryWrapper = Wrappers.lambdaQuery(condition); | |
107 | + Container container = containerService.getOne(containerHeaderQueryWrapper); | |
105 | 108 | receiptContainerHeader.setContainerType(container.getContainerType()); |
106 | 109 | receiptContainerHeader.setTaskType(String.valueOf(taskType)); |
107 | 110 | if (taskType.equals(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT)) { |
... | ... | @@ -240,10 +243,12 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
240 | 243 | if (checkLocationCode(list.get(0).getLocationCode(), list.get(0).getLocationCode(), Integer.valueOf(list.get(0).getTaskType())) == true) { |
241 | 244 | locationService.updateStatus(list.get(0).getLocationCode(), "lock"); |
242 | 245 | } |
243 | - ReceiptContainerView view = list.get(0); | |
244 | - AjaxResult ajaxResult = saveCountain(view.getReceiptCode(), view.getReceiptContainerCode(), | |
245 | - view.getReceiptDetailId(), view.getLocationCode(), view.getQty().intValue(), null); | |
246 | - return null; | |
246 | + AjaxResult ajaxResult = null; | |
247 | + for (ReceiptContainerView receiptContainerView : list) { | |
248 | + ajaxResult = saveCountain(receiptContainerView.getReceiptCode(), receiptContainerView.getReceiptContainerCode(), | |
249 | + receiptContainerView.getReceiptDetailId(), receiptContainerView.getLocationCode(), receiptContainerView.getQty().intValue(), null); | |
250 | + } | |
251 | + return ajaxResult; | |
247 | 252 | } |
248 | 253 | |
249 | 254 | /** |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java
... | ... | @@ -178,6 +178,7 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
178 | 178 | * @param receiptDetail |
179 | 179 | * @return |
180 | 180 | */ |
181 | + @Override | |
181 | 182 | @Transactional |
182 | 183 | public ReceiptDetail queryflow(ReceiptDetail receiptDetail){ |
183 | 184 | //当单据状态为驳回或作废时不更新状态 |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptHeader/domain/ReceiptHeader.java
... | ... | @@ -76,6 +76,13 @@ public class ReceiptHeader implements Serializable { |
76 | 76 | private Integer referId; |
77 | 77 | |
78 | 78 | /** |
79 | + * 供应商编码 | |
80 | + */ | |
81 | + @TableField(value = "supplierCode") | |
82 | + @ApiModelProperty(value="供应商编码") | |
83 | + private String supplierCode; | |
84 | + | |
85 | + /** | |
79 | 86 | * 关联订单类型 |
80 | 87 | */ |
81 | 88 | @TableField(value = "referType") |
... | ... |
src/main/java/com/huaheng/pc/report/excelReport/controller/ExcelReportController.java
... | ... | @@ -101,8 +101,9 @@ public class ExcelReportController extends BaseController { |
101 | 101 | @PostMapping( "/remove") |
102 | 102 | @ResponseBody |
103 | 103 | public AjaxResult remove(String ids) { |
104 | - if (StringUtils.isEmpty(ids)) | |
104 | + if (StringUtils.isEmpty(ids)) { | |
105 | 105 | return AjaxResult.error("id不能为空"); |
106 | + } | |
106 | 107 | for (Integer id : Convert.toIntArray(ids)) |
107 | 108 | { |
108 | 109 | int i = mapper.delete(id); |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerDetail/controller/ShipmentContainerDetailController.java
... | ... | @@ -108,8 +108,9 @@ public class ShipmentContainerDetailController extends BaseController |
108 | 108 | @ResponseBody |
109 | 109 | public AjaxResult remove(String ids) |
110 | 110 | { |
111 | - if (StringUtils.isEmpty(ids)) | |
112 | - return AjaxResult.error("id不能为空"); | |
111 | + if (StringUtils.isEmpty(ids)) { | |
112 | + return AjaxResult.error("id不能为空"); | |
113 | + } | |
113 | 114 | return shipmentContainerHeaderService.cancelCombinationDetail(Arrays.asList((Convert.toIntArray(ids)))); |
114 | 115 | } |
115 | 116 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/controller/ShipmentContainerHeaderController.java
... | ... | @@ -141,8 +141,9 @@ public class ShipmentContainerHeaderController extends BaseController |
141 | 141 | @ResponseBody |
142 | 142 | public AjaxResult remove(String ids) |
143 | 143 | { |
144 | - if (StringUtils.isEmpty(ids)) | |
145 | - return AjaxResult.error("id不能为空"); | |
144 | + if (StringUtils.isEmpty(ids)) { | |
145 | + return AjaxResult.error("id不能为空"); | |
146 | + } | |
146 | 147 | List<Integer> IdList = Arrays.asList(Convert.toIntArray(ids)); |
147 | 148 | return shipmentContainerHeaderService.cancelCombination(IdList); |
148 | 149 | |
... | ... | @@ -158,8 +159,9 @@ public class ShipmentContainerHeaderController extends BaseController |
158 | 159 | public AjaxResult createTask(String ids) |
159 | 160 | { |
160 | 161 | AjaxResult ajaxResult=new AjaxResult(); |
161 | - if (StringUtils.isEmpty(ids)) | |
162 | + if (StringUtils.isEmpty(ids)) { | |
162 | 163 | return AjaxResult.error("id不能为空"); |
164 | + } | |
163 | 165 | List<Integer> idList = Arrays.asList(Convert.toIntArray(ids)); |
164 | 166 | for (Integer id : idList) { |
165 | 167 | //获取表头 |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/domain/ShipmentContainerHeader.java
... | ... | @@ -107,6 +107,14 @@ public class ShipmentContainerHeader implements Serializable { |
107 | 107 | @ApiModelProperty(value="货主编码") |
108 | 108 | private String companyCode; |
109 | 109 | |
110 | + | |
111 | + /** | |
112 | + * 序号 | |
113 | + */ | |
114 | + @TableField(value = "waveId") | |
115 | + @ApiModelProperty(value="序号") | |
116 | + private Integer waveId; | |
117 | + | |
110 | 118 | /** |
111 | 119 | * 数量 |
112 | 120 | */ |
... | ... | @@ -958,4 +966,12 @@ public class ShipmentContainerHeader implements Serializable { |
958 | 966 | public void setSystemCreated(Integer systemCreated) { |
959 | 967 | this.systemCreated = systemCreated; |
960 | 968 | } |
969 | + | |
970 | + public Integer getWaveId() { | |
971 | + return waveId; | |
972 | + } | |
973 | + | |
974 | + public void setWaveId(Integer waveId) { | |
975 | + this.waveId = waveId; | |
976 | + } | |
961 | 977 | } |
962 | 978 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java
... | ... | @@ -137,7 +137,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
137 | 137 | inventoryDetail.setTaskQty(inventoryDetail.getTaskQty().add(shipmentCombinationModel.getShipQty())); |
138 | 138 | inventoryDetailService.saveOrUpdate(inventoryDetail); |
139 | 139 | //获取库位,然后锁定 |
140 | - if(location.getStatus().equals("empty")) { | |
140 | + if("empty".equals(location.getStatus())) { | |
141 | 141 | location.setStatus("lock"); |
142 | 142 | locationService.saveOrUpdate(location); |
143 | 143 | } |
... | ... | @@ -346,7 +346,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
346 | 346 | taskDetail.setWaveId(shipmentContainerDetaill.getWaveId()); |
347 | 347 | taskDetail.setBatch(shipmentContainerDetaill.getBatch()); |
348 | 348 | taskDetail.setProjectNo(shipmentContainerDetail.getProjectNo()); |
349 | - if (shipmentContainerHeader.getStatus() == QuantityConstant.SHIPMENT_CONTAINER_TASK) { | |
349 | + if (shipmentContainerHeader.getStatus().equals(QuantityConstant.SHIPMENT_CONTAINER_TASK)) { | |
350 | 350 | taskDetail.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
351 | 351 | } else { |
352 | 352 | taskDetail.setStatus(QuantityConstant.TASK_STATUS_RELEASE); |
... | ... | @@ -481,6 +481,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
481 | 481 | |
482 | 482 | |
483 | 483 | //出库自动组盘 |
484 | + @Override | |
484 | 485 | public AjaxResult autoCombination(List<ShipmentDetail> shipmentDetailList){ |
485 | 486 | int num = 0; |
486 | 487 | List<Integer> list=new ArrayList<>(); |
... | ... | @@ -501,7 +502,9 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
501 | 502 | List<InventoryDetail> inventoryList = shippingCombinationService.getInventorys(item); |
502 | 503 | if(inventoryList.size() < 1 && item.getWaveId() != 0){ |
503 | 504 | Wave wave = waveService.getById(item.getWaveId()); |
504 | - wave.setStatus(QuantityConstant.WAVE_STATUS_FAILED); | |
505 | + wave.setStatus(QuantityConstant.WAVE_STATUS_ERROR); | |
506 | + wave.setCurrentWaveStep(QuantityConstant.WAVE_STEP_ERROR); | |
507 | + wave.setLastWaveStep(QuantityConstant.WAVE_STEP_BUILD); | |
505 | 508 | waveService.updateById(wave); |
506 | 509 | throw new ServiceException("主单为"+item.getShipmentCode()+"子单id为"+item.getId() + "的单据没有库存,波次失败"); |
507 | 510 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/ShipmentDetailController.java
... | ... | @@ -87,6 +87,9 @@ public class ShipmentDetailController extends BaseController |
87 | 87 | PageDomain pageDomain = TableSupport.buildPageRequest(); |
88 | 88 | Integer pageNum = pageDomain.getPageNum(); |
89 | 89 | Integer pageSize = pageDomain.getPageSize(); |
90 | + List<ShipmentDetail> shipmentDetails =new ArrayList<>(); | |
91 | + List<ShipmentDetail> shipmentDetailList =new ArrayList<>(); | |
92 | + List<ShipmentDetail> shipmentDetailLists =new ArrayList<>(); | |
90 | 93 | |
91 | 94 | lambdaQueryWrapper |
92 | 95 | .eq(ShipmentDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) |
... | ... | @@ -104,14 +107,30 @@ public class ShipmentDetailController extends BaseController |
104 | 107 | return getMpDataTable(iPage.getRecords(),iPage.getTotal()); |
105 | 108 | } else { |
106 | 109 | List<ShipmentDetail> list = shipmentDetailService.list(lambdaQueryWrapper); |
107 | - list.forEach(t->{ | |
110 | + for(ShipmentDetail item : list){ | |
108 | 111 | InventoryDetail inventory=new InventoryDetail(); |
109 | - inventory.setWarehouseCode(t.getWarehouseCode()); | |
110 | - inventory.setMaterialCode(t.getMaterialCode()); | |
111 | - inventory.setInventorySts(t.getInventorySts()); | |
112 | - t.setInventoryQty(inventoryDetailService.getSumQty(inventory)); | |
113 | - }); | |
114 | - return getDataTable(list); | |
112 | + inventory.setWarehouseCode(item.getWarehouseCode()); | |
113 | + inventory.setMaterialCode(item.getMaterialCode()); | |
114 | + inventory.setInventorySts(item.getInventorySts()); | |
115 | + item.setInventoryQty(inventoryDetailService.getSumQty(inventory)); | |
116 | + if(item.getShipQty().compareTo(item.getRequestQty()) !=0){ | |
117 | + if(item.getInventoryQty().compareTo(new BigDecimal(0)) == 0){ | |
118 | + shipmentDetails.add(item); | |
119 | + }else { | |
120 | + shipmentDetailList.add(item); | |
121 | + } | |
122 | + }else { | |
123 | + shipmentDetailLists.add(item); | |
124 | + } | |
125 | + | |
126 | + } | |
127 | + if(shipmentDetailList !=null && shipmentDetailList.size()>0) { | |
128 | + shipmentDetails.addAll(shipmentDetailList); | |
129 | + } | |
130 | + if(shipmentDetailLists !=null && shipmentDetailLists.size()>0) { | |
131 | + shipmentDetails.addAll(shipmentDetailLists); | |
132 | + } | |
133 | + return getDataTable(shipmentDetails); | |
115 | 134 | } |
116 | 135 | } |
117 | 136 | |
... | ... | @@ -180,15 +199,16 @@ public class ShipmentDetailController extends BaseController |
180 | 199 | @ResponseBody |
181 | 200 | public AjaxResult remove(String ids) |
182 | 201 | { |
183 | - if (StringUtils.isEmpty(ids)) | |
184 | - return AjaxResult.error("id不能为空"); | |
202 | + if (StringUtils.isEmpty(ids)) { | |
203 | + return AjaxResult.error("id不能为空"); | |
204 | + } | |
185 | 205 | for (Integer id : Convert.toIntArray(ids)) |
186 | 206 | { |
187 | 207 | ShipmentDetail shipmentDetail=shipmentDetailService.getById(id); |
188 | 208 | if(shipmentDetail == null){ |
189 | 209 | return AjaxResult.error("id为"+id+"的单据明细找不到"); |
190 | 210 | } |
191 | - if(shipmentDetail.getStatus()>100 && shipmentDetail.getStatus()<500){ | |
211 | + if(shipmentDetail.getStatus()>=100){ | |
192 | 212 | return AjaxResult.error("此单据状态在订单池和拣货完成之间,无法删除"); |
193 | 213 | } |
194 | 214 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java
... | ... | @@ -111,8 +111,9 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
111 | 111 | shipmentHeaderService.saveOrUpdate(shipmentHeader); |
112 | 112 | return AjaxResult.success("新增单据明细成功"); |
113 | 113 | } |
114 | - else | |
114 | + else { | |
115 | 115 | return AjaxResult.error("新增单据明细失败"); |
116 | + } | |
116 | 117 | } |
117 | 118 | |
118 | 119 | |
... | ... | @@ -125,8 +126,9 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
125 | 126 | @Override |
126 | 127 | @Transactional |
127 | 128 | public AjaxResult deleteDetail(String id) { |
128 | - if (StringUtils.isEmpty(id)) | |
129 | + if (StringUtils.isEmpty(id)) { | |
129 | 130 | return AjaxResult.error("id不能为空"); |
131 | + } | |
130 | 132 | String[] ids = id.split(","); |
131 | 133 | List<Map<String,Integer>> list = shipmentDetailMapper.SelectFirstStatus(id); |
132 | 134 | if (list.size() < 1) { |
... | ... | @@ -135,7 +137,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
135 | 137 | if (list.size() > 1) { |
136 | 138 | return AjaxResult.error("有多个主单据,不能一起删除!"); |
137 | 139 | } |
138 | - if (list.get(0).get("status") > QuantityConstant.SHIPMENT_HEADER_POOL) { | |
140 | + if (list.get(0).get("firstStatus") > QuantityConstant.SHIPMENT_HEADER_POOL) { | |
139 | 141 | return AjaxResult.error("单据状进入订单池,不允许删除明细"); |
140 | 142 | } |
141 | 143 | Integer result = shipmentDetailMapper.batchDelete(ids); |
... | ... | @@ -155,8 +157,9 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
155 | 157 | } |
156 | 158 | return AjaxResult.success("删除单据明细成功"); |
157 | 159 | } |
158 | - else | |
160 | + else { | |
159 | 161 | return AjaxResult.error("删除单据明细失败"); |
162 | + } | |
160 | 163 | } |
161 | 164 | |
162 | 165 | @Override |
... | ... | @@ -243,7 +246,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
243 | 246 | wave.setMasterCode(code); |
244 | 247 | wave.setWaveName(waveMaster.getName()); |
245 | 248 | wave.setStatus(QuantityConstant.WAVE_STATUS_BUILD); |
246 | - wave.setCurrentWaveStep(QuantityConstant.WAVE_STATUS_BUILD.toString()); | |
249 | + wave.setCurrentWaveStep(QuantityConstant.WAVE_STEP_BUILD); | |
247 | 250 | wave.setTotalShipments(Convert.toIntArray(ids).length); |
248 | 251 | wave.setTotalLines(shipmentDetailList.size()); |
249 | 252 | wave.setTotalQty(qty); |
... | ... | @@ -268,7 +271,11 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
268 | 271 | } |
269 | 272 | |
270 | 273 | for(ShipmentHeader shipmentHeader :shipmentHeaderList){ |
271 | - shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); | |
274 | + shipmentHeader.setWaveId(wave.getId()); | |
275 | + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); | |
276 | + if(shipmentHeader.getLastStatus()<QuantityConstant.SHIPMENT_HEADER_WAVE) { | |
277 | + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); | |
278 | + } | |
272 | 279 | } |
273 | 280 | flag = shipmentHeaderService.updateBatchById(shipmentHeaderList); |
274 | 281 | if(flag == false){ |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetailHistory/service/ShipmentDetailHistoryServiceImpl.java
... | ... | @@ -37,8 +37,9 @@ public class ShipmentDetailHistoryServiceImpl extends ServiceImpl<ShipmentDetail |
37 | 37 | @Override |
38 | 38 | @Transactional |
39 | 39 | public AjaxResult deleteDetail(String id) { |
40 | - if (StringUtils.isEmpty(id)) | |
40 | + if (StringUtils.isEmpty(id)) { | |
41 | 41 | return AjaxResult.error("id不能为空"); |
42 | + } | |
42 | 43 | String[] ids = id.split(","); |
43 | 44 | List<Map<String,Integer>> list = shipmentDetailHistoryMapper.SelectFirstStatus(id); |
44 | 45 | if (list.size() < 1) { |
... | ... | @@ -67,7 +68,8 @@ public class ShipmentDetailHistoryServiceImpl extends ServiceImpl<ShipmentDetail |
67 | 68 | } |
68 | 69 | return AjaxResult.success("删除单据明细成功"); |
69 | 70 | } |
70 | - else | |
71 | + else { | |
71 | 72 | return AjaxResult.error("删除单据明细失败"); |
73 | + } | |
72 | 74 | } |
73 | 75 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/controller/ShipmentHeaderHistoryController.java
... | ... | @@ -101,8 +101,9 @@ public class ShipmentHeaderHistoryController extends BaseController |
101 | 101 | @PostMapping( "/remove") |
102 | 102 | @ResponseBody |
103 | 103 | public AjaxResult remove(String ids) { |
104 | - if (StringUtils.isEmpty(ids)) | |
105 | - return AjaxResult.error("id不能为空"); | |
104 | + if (StringUtils.isEmpty(ids)) { | |
105 | + return AjaxResult.error("id不能为空"); | |
106 | + } | |
106 | 107 | for (Integer id : Convert.toIntArray(ids)) |
107 | 108 | { |
108 | 109 | boolean result=shipmentHeaderHistoryService.removeById(id); |
... | ... |
src/main/java/com/huaheng/pc/shipment/shippingCombination/controller/ShippingCombinationController.java
... | ... | @@ -2,6 +2,7 @@ package com.huaheng.pc.shipment.shippingCombination.controller; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | +import com.huaheng.common.constant.QuantityConstant; | |
5 | 6 | import com.huaheng.common.exception.service.ServiceException; |
6 | 7 | import com.huaheng.common.utils.StringUtils; |
7 | 8 | import com.huaheng.common.utils.security.ShiroUtils; |
... | ... | @@ -19,6 +20,7 @@ import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailServiceImpl; |
19 | 20 | import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; |
20 | 21 | import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService; |
21 | 22 | import com.huaheng.pc.shipment.shippingCombination.service.ShippingCombinationService; |
23 | +import com.huaheng.pc.task.taskHeader.domain.ShipmentTaskCreateModel; | |
22 | 24 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
23 | 25 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
24 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -161,6 +163,12 @@ public class ShippingCombinationController extends BaseController { |
161 | 163 | @ResponseBody |
162 | 164 | public AjaxResult Addcombination(ShipmentCombinationModel shipmentCombinationModel){ |
163 | 165 | ShipmentContainerHeader shipmentContainerHeader= shipmentContainerHeaderService.combination(shipmentCombinationModel); |
166 | + ShipmentTaskCreateModel shipmentTask = new ShipmentTaskCreateModel(); | |
167 | + shipmentTask.setShipmentContainerHeaderIds(shipmentContainerHeader.getId()); | |
168 | + AjaxResult ajaxResult = taskHeaderService.createTaskFromShipmentContainers(shipmentTask); | |
169 | + if (ajaxResult.hasErr()){ | |
170 | + throw new ServiceException("任务生成失败"); | |
171 | + } | |
164 | 172 | return AjaxResult.success(shipmentContainerHeader.getId()); |
165 | 173 | } |
166 | 174 | |
... | ... | @@ -174,6 +182,17 @@ public class ShippingCombinationController extends BaseController { |
174 | 182 | @ResponseBody |
175 | 183 | public AjaxResult autoCombination(String shipmentCode){ |
176 | 184 | AjaxResult ajaxResult = shipmentContainerHeaderService.autoCombination(shipmentCode); |
185 | + LambdaQueryWrapper<ShipmentContainerHeader> shipmentContainerHeader=Wrappers.lambdaQuery(); | |
186 | + shipmentContainerHeader.eq(ShipmentContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_BUILD); | |
187 | + List<ShipmentContainerHeader> shipmentContainerHeaders=shipmentContainerHeaderService.list(shipmentContainerHeader); | |
188 | + for(ShipmentContainerHeader item: shipmentContainerHeaders){ | |
189 | + ShipmentTaskCreateModel shipmentTask = new ShipmentTaskCreateModel(); | |
190 | + shipmentTask.setShipmentContainerHeaderIds(item.getId()); | |
191 | + AjaxResult ajaxResults = taskHeaderService.createTaskFromShipmentContainers(shipmentTask); | |
192 | + if (ajaxResults.hasErr()){ | |
193 | + throw new ServiceException("任务生成失败"); | |
194 | + } | |
195 | + } | |
177 | 196 | return ajaxResult; |
178 | 197 | } |
179 | 198 | |
... | ... |
src/main/java/com/huaheng/pc/shipment/wave/controller/WaveController.java
... | ... | @@ -73,6 +73,8 @@ public class WaveController extends BaseController { |
73 | 73 | .eq(Wave::getWarehouseCode, ShiroUtils.getWarehouseCode()) |
74 | 74 | .eq(StringUtils.isNotEmpty(wave.getWaveMode() |
75 | 75 | ), Wave::getWaveMode,wave.getWaveMode()) |
76 | + .eq(StringUtils.isNotEmpty(wave.getCreatedBy() | |
77 | + ), Wave::getCreatedBy,wave.getCreatedBy()) | |
76 | 78 | .eq(wave.getStatus()!=null, Wave::getStatus,wave.getStatus()) |
77 | 79 | .like(StringUtils.isNotEmpty(wave.getWaveName() |
78 | 80 | ), Wave::getWaveName,wave.getWaveName()); |
... | ... | @@ -173,6 +175,37 @@ public class WaveController extends BaseController { |
173 | 175 | return result; |
174 | 176 | } |
175 | 177 | |
178 | + /** | |
179 | + * 剔除单据 | |
180 | + */ | |
181 | + @RequiresPermissions("shipment:wave:cullWave") | |
182 | + @Log(title = "出库-波次", operating = "剔除单据", action = BusinessType.UPDATE) | |
183 | + @PostMapping("/cullWave") | |
184 | + @ResponseBody | |
185 | + public AjaxResult cullWave(String ids) { | |
186 | + if (StringUtils.isEmpty(ids)){ | |
187 | + return AjaxResult.error("id不能为空"); | |
188 | + } | |
189 | + AjaxResult result=waveService.cullWave(ids); | |
190 | + return result; | |
191 | + } | |
192 | + | |
193 | + | |
194 | + /** | |
195 | + * 波次完成 | |
196 | + */ | |
197 | + @RequiresPermissions("shipment:wave:endWave") | |
198 | + @Log(title = "出库-波次", operating = "波次完成", action = BusinessType.UPDATE) | |
199 | + @PostMapping("/endWave") | |
200 | + @ResponseBody | |
201 | + public AjaxResult endWave(String ids) { | |
202 | + if (StringUtils.isEmpty(ids)){ | |
203 | + return AjaxResult.error("id不能为空"); | |
204 | + } | |
205 | + AjaxResult result=waveService.endWave(ids); | |
206 | + return result; | |
207 | + } | |
208 | + | |
176 | 209 | |
177 | 210 | /** |
178 | 211 | * 释放 |
... | ... |
src/main/java/com/huaheng/pc/shipment/wave/domain/Wave.java
... | ... | @@ -56,14 +56,14 @@ public class Wave implements Serializable { |
56 | 56 | */ |
57 | 57 | @TableField(value = "currentWaveStep") |
58 | 58 | @ApiModelProperty(value="当前波次步骤") |
59 | - private String currentWaveStep; | |
59 | + private Integer currentWaveStep; | |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * 上一波次步骤 |
63 | 63 | */ |
64 | 64 | @TableField(value = "lastWaveStep") |
65 | 65 | @ApiModelProperty(value="上一波次步骤") |
66 | - private String lastWaveStep; | |
66 | + private Integer lastWaveStep; | |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * 总单数 |
... | ... |
src/main/java/com/huaheng/pc/shipment/wave/service/WaveService.java
... | ... | @@ -8,24 +8,25 @@ import com.huaheng.common.exception.service.ServiceException; |
8 | 8 | import com.huaheng.common.support.Convert; |
9 | 9 | import com.huaheng.common.utils.security.ShiroUtils; |
10 | 10 | import com.huaheng.framework.web.domain.AjaxResult; |
11 | +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; | |
12 | +import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader; | |
11 | 13 | import com.huaheng.pc.shipment.shipmentContainerHeader.service.ShipmentContainerHeaderService; |
12 | 14 | import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; |
13 | 15 | import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; |
14 | 16 | import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; |
15 | 17 | import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService; |
18 | +import com.huaheng.pc.shipment.shippingCombination.service.ShippingCombinationService; | |
16 | 19 | import com.huaheng.pc.shipment.wave.domain.Wave; |
17 | 20 | import com.huaheng.pc.shipment.wave.mapper.WaveMapper; |
18 | 21 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
19 | 22 | import com.huaheng.pc.task.taskDetail.service.TaskDetailService; |
23 | +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; | |
20 | 24 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
21 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
22 | 26 | import org.springframework.stereotype.Service; |
23 | 27 | import org.springframework.transaction.annotation.Transactional; |
24 | 28 | |
25 | -import java.util.ArrayList; | |
26 | -import java.util.Arrays; | |
27 | -import java.util.HashSet; | |
28 | -import java.util.List; | |
29 | +import java.util.*; | |
29 | 30 | |
30 | 31 | @Service |
31 | 32 | public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
... | ... | @@ -41,6 +42,8 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
41 | 42 | private TaskHeaderService taskHeaderService; |
42 | 43 | @Autowired |
43 | 44 | private ShipmentHeaderService shipmentHeaderService; |
45 | + @Autowired | |
46 | + private ShippingCombinationService shippingCombinationService; | |
44 | 47 | |
45 | 48 | /** |
46 | 49 | * 开始波次,对带有此波次号的单据进行后续的后台操作 |
... | ... | @@ -59,8 +62,8 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
59 | 62 | |
60 | 63 | //1、查看此波次的状态,状态不为o时,无法开始波次 |
61 | 64 | Wave wave = this.getById(id); |
62 | - if(wave == null || (wave.getStatus()> QuantityConstant.WAVE_STATUS_BUILD && | |
63 | - wave.getStatus() < QuantityConstant.WAVE_STATUS_FAILED)){ | |
65 | + if(wave == null || (wave.getCurrentWaveStep()> QuantityConstant.WAVE_STEP_BUILD && | |
66 | + wave.getCurrentWaveStep() < QuantityConstant.WAVE_STEP_ERROR)){ | |
64 | 67 | return AjaxResult.error("id为"+id+"的波次找不到,或者状态不能做开始操作"); |
65 | 68 | } |
66 | 69 | waves.add(wave); |
... | ... | @@ -79,15 +82,22 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
79 | 82 | |
80 | 83 | //3、自动组盘 |
81 | 84 | AjaxResult ajaxResult=shipmentContainerHeaderService.autoCombination(list); |
82 | - if(ajaxResult.getData() != null){ | |
83 | - //4、生成任务 | |
84 | - shipmentContainerHeaderService.createTask(Arrays.asList(Convert.toIntArray(ajaxResult.getData().toString()))); | |
85 | + if(ajaxResult.getCode() != 200){ | |
86 | + for(Wave wave : waves) { | |
87 | + wave.setStatus(QuantityConstant.WAVE_STATUS_ERROR); | |
88 | + wave.setCurrentWaveStep(QuantityConstant.WAVE_STEP_ERROR); | |
89 | + wave.setLastWaveStep(QuantityConstant.WAVE_STEP_BUILD); | |
90 | + this.updateById(wave); | |
91 | + } | |
92 | + throw new ServiceException("波次执行失败,组盘失败"); | |
85 | 93 | } |
86 | 94 | |
95 | + | |
87 | 96 | //5、修改波次的状态 |
88 | 97 | for(Wave wave : waves){ |
89 | - wave.setStatus(QuantityConstant.WAVE_STATUS_END); | |
90 | - wave.setCurrentWaveStep("生成任务"); | |
98 | + wave.setStatus(QuantityConstant.WAVE_STATUS_START); | |
99 | + wave.setCurrentWaveStep(QuantityConstant.WAVE_STEP_START); | |
100 | + wave.setLastWaveStep(QuantityConstant.WAVE_STEP_BUILD); | |
91 | 101 | } |
92 | 102 | Boolean flag = this.updateBatchById(waves); |
93 | 103 | if(flag == false){ |
... | ... | @@ -98,6 +108,110 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
98 | 108 | |
99 | 109 | |
100 | 110 | /** |
111 | + * 剔除单据,剔除无法组盘的单据 | |
112 | + * 1、找到无法组盘的单据 | |
113 | + * 2、剔除单据 | |
114 | + * 3、修改波次的状态 | |
115 | + */ | |
116 | + | |
117 | + @Transactional | |
118 | + public AjaxResult cullWave(String ids) { | |
119 | + //判断波次是否可以完成 | |
120 | + for (Integer id : Convert.toIntArray(ids)) { | |
121 | + Wave wave =this.getById(id); | |
122 | + if(wave == null){ | |
123 | + return AjaxResult.error("id为"+id+"的波次不存在"); | |
124 | + } | |
125 | + | |
126 | + if(!wave.getCurrentWaveStep().equals(QuantityConstant.WAVE_STEP_BUILD) && | |
127 | + !wave.getCurrentWaveStep().equals(QuantityConstant.WAVE_STEP_ERROR)){ | |
128 | + return AjaxResult.error("id为"+id+"的波次已执行,无法剔除单据"); | |
129 | + } | |
130 | + | |
131 | + LambdaQueryWrapper<ShipmentDetail> detailLamb = Wrappers.lambdaQuery(); | |
132 | + detailLamb.eq(ShipmentDetail::getWaveId,id) | |
133 | + .eq(ShipmentDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()); | |
134 | + List<ShipmentDetail> shipmentDetailList =shipmentDetailService.list(detailLamb); | |
135 | + for(ShipmentDetail item :shipmentDetailList){ | |
136 | + List<InventoryDetail> list =shippingCombinationService.getInventorys(item); | |
137 | + if(list.isEmpty()){ | |
138 | + item.setWaveId(0); | |
139 | + shipmentDetailService.updateById(item); | |
140 | + } | |
141 | + } | |
142 | + | |
143 | + //修改波次状态 | |
144 | + wave.setStatus(QuantityConstant.WAVE_STATUS_BUILD); | |
145 | + wave.setCurrentWaveStep(QuantityConstant.WAVE_STEP_CULL); | |
146 | + wave.setLastWaveStep(QuantityConstant.WAVE_STEP_START); | |
147 | + wave.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
148 | + wave.setLastUpdated(new Date()); | |
149 | + this.updateById(wave); | |
150 | + } | |
151 | + return AjaxResult.success("波次运行成功"); | |
152 | + } | |
153 | + | |
154 | + | |
155 | + | |
156 | + /** | |
157 | + * 完成波次,对带有此波次号的组盘进行后续的后台操作 | |
158 | + * 1、查看波次是否符合完成波次的条件 | |
159 | + * 2、生成任务 | |
160 | + * 3、修改波次的状态 | |
161 | + */ | |
162 | + | |
163 | + @Transactional | |
164 | + public AjaxResult endWave(String ids) { | |
165 | + //判断波次是否可以完成 | |
166 | + for (Integer id : Convert.toIntArray(ids)) { | |
167 | + Wave wave =this.getById(id); | |
168 | + if(wave == null){ | |
169 | + return AjaxResult.error("id为"+id+"的波次不存在"); | |
170 | + } | |
171 | + | |
172 | + if(!wave.getCurrentWaveStep().equals(QuantityConstant.WAVE_STEP_START)){ | |
173 | + return AjaxResult.error("id为"+id+"的波次未执行,无法完成"); | |
174 | + } | |
175 | + | |
176 | + //2、找到此波次的所有阻盘头,生成任务 | |
177 | + LambdaQueryWrapper<ShipmentContainerHeader> shipmentContainerHeaderLamb = Wrappers.lambdaQuery(); | |
178 | + shipmentContainerHeaderLamb.eq(ShipmentContainerHeader::getWarehouseCode,ShiroUtils.getWarehouseCode()) | |
179 | + .eq(ShipmentContainerHeader::getWaveId,id); | |
180 | + List<ShipmentContainerHeader> shipmentContainerHeaders =shipmentContainerHeaderService.list(shipmentContainerHeaderLamb); | |
181 | + | |
182 | + if(shipmentContainerHeaders.isEmpty()){ | |
183 | + return AjaxResult.error("id为"+id+"的波次的出库组盘头未找到"); | |
184 | + } | |
185 | + | |
186 | + //找到未生成出库任务的组盘头 | |
187 | + List<Integer> idList =new ArrayList<>(); | |
188 | + for(ShipmentContainerHeader item : shipmentContainerHeaders){ | |
189 | + if(item.getStatus().equals(QuantityConstant.SHIPMENT_CONTAINER_BUILD)){ | |
190 | + idList.add(item.getId()); | |
191 | + } | |
192 | + } | |
193 | + if(idList.isEmpty()){ | |
194 | + return AjaxResult.error("id为"+id+"的波次的出库组盘头都已生成任务"); | |
195 | + } | |
196 | + | |
197 | + AjaxResult ajaxResult =shipmentContainerHeaderService.createTask(idList); | |
198 | + if(ajaxResult.hasErr()){ | |
199 | + throw new ServiceException("id为"+id+"的波次的出库组盘头生成任务失败"); | |
200 | + } | |
201 | + | |
202 | + //修改波次状态 | |
203 | + wave.setCurrentWaveStep(QuantityConstant.WAVE_STEP_END); | |
204 | + wave.setLastWaveStep(QuantityConstant.WAVE_STEP_START); | |
205 | + wave.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
206 | + wave.setLastUpdated(new Date()); | |
207 | + this.updateById(wave); | |
208 | + } | |
209 | + return AjaxResult.success("波次运行成功"); | |
210 | + } | |
211 | + | |
212 | + | |
213 | + | |
214 | + /** | |
101 | 215 | * 释放波次,执行任务 |
102 | 216 | * 1、查看此波次的状态,是否可以释放波次 |
103 | 217 | * 2、查看波次的状态,是成功释放还是失败释放 |
... | ... | @@ -112,39 +226,42 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
112 | 226 | */ |
113 | 227 | @Transactional |
114 | 228 | public AjaxResult freed(String ids) { |
115 | - Boolean flag = false; | |
116 | - List<TaskDetail> taskDetailList = new ArrayList<>(); | |
117 | - for (Integer id : Convert.toIntArray(ids)) { | |
229 | + Boolean flag = false; | |
230 | + for (Integer id : Convert.toIntArray(ids)) { | |
118 | 231 | |
119 | - //1、查看此波次是否可以释放 | |
120 | - Wave wave = this.getById(id); | |
121 | - if(wave == null || (wave.getStatus()!=QuantityConstant.WAVE_STATUS_END && wave.getStatus()!=QuantityConstant.WAVE_STATUS_FAILED)){ | |
122 | - return AjaxResult.error(id+"波次不可释放"); | |
123 | - } | |
232 | + //1、查看此波次是否可以释放 | |
233 | + Wave wave = this.getById(id); | |
234 | + if(wave == null || wave.getStatus().equals(QuantityConstant.WAVE_STATUS_START)){ | |
235 | + return AjaxResult.error(id+"波次不可释放,正在执行中"); | |
236 | + } | |
124 | 237 | |
125 | 238 | //2、查看此波次的状态,看是成功释放还是失败释放 |
126 | - if(wave.getStatus() == QuantityConstant.WAVE_STATUS_END) { | |
127 | - //成功释放——找到此波次的未执行的子任务列表 | |
128 | - LambdaQueryWrapper<TaskDetail> lam = Wrappers.lambdaQuery(); | |
129 | - lam.eq(TaskDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
130 | - .eq(TaskDetail::getStatus, QuantityConstant.TASK_STATUS_BUILD) | |
131 | - .eq(TaskDetail::getWaveId, id); | |
132 | - List<TaskDetail> taskDetails = taskDetailService.list(lam); | |
133 | - if (taskDetails != null) { | |
134 | - taskDetailList.addAll(taskDetails); | |
135 | - } | |
136 | - }else { | |
137 | - //失败释放——找到次波次的所有子单据 | |
239 | + //失败释放——找到次波次的所有子单据和主单 | |
138 | 240 | LambdaQueryWrapper<ShipmentDetail> detailLam = Wrappers.lambdaQuery(); |
139 | 241 | detailLam.eq(ShipmentDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) |
140 | 242 | .eq(ShipmentDetail::getWaveId,wave.getId()); |
141 | 243 | List<ShipmentDetail> shipmentDetails =shipmentDetailService.list(detailLam); |
142 | 244 | |
143 | - //2.修改子单据的波次为0 | |
245 | + LambdaQueryWrapper<ShipmentHeader> headerLam =Wrappers.lambdaQuery(); | |
246 | + headerLam.eq(ShipmentHeader::getWarehouseCode,ShiroUtils.getWarehouseCode()) | |
247 | + .eq(ShipmentHeader::getWaveId,wave.getId()); | |
248 | + List<ShipmentHeader> shipmentHeaders = shipmentHeaderService.list(headerLam); | |
249 | + | |
250 | + if(shipmentDetails.isEmpty()) { | |
251 | + throw new ServiceException("该波次"+id+"的子单未查到"); | |
252 | + } | |
253 | + | |
254 | + if(shipmentHeaders.isEmpty()) { | |
255 | + throw new ServiceException("该波次"+id+"的主单未查到"); | |
256 | + } | |
257 | + | |
258 | + //2.修改主子单据的波次为0 | |
144 | 259 | //3.修改主子单的状态 |
145 | 260 | HashSet<Integer> set = new HashSet<>(); |
146 | 261 | for(ShipmentDetail item : shipmentDetails){ |
147 | - if(item.getShipQty().compareTo(item.getRequestQty())!=0) { | |
262 | + if(item.getShipQty().compareTo(item.getRequestQty())==0) { | |
263 | + item.setStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); | |
264 | + }else { | |
148 | 265 | item.setStatus(QuantityConstant.SHIPMENT_HEADER_POOL); |
149 | 266 | } |
150 | 267 | item.setWaveId(0); |
... | ... | @@ -154,30 +271,55 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
154 | 271 | if(flag == false){ |
155 | 272 | throw new ServiceException("修改出库子单状态失败"); |
156 | 273 | } |
157 | - for(Integer shipmentId :set){ | |
158 | - ShipmentHeader shipmentHeader = shipmentHeaderService.getById(shipmentId); | |
159 | - if(shipmentHeader == null){ | |
160 | - throw new ServiceException("没有对应的出库主单"); | |
161 | - } | |
162 | - if(shipmentHeader.getFirstStatus()<= QuantityConstant.SHIPMENT_HEADER_WAVE) { | |
274 | + | |
275 | + for(ShipmentHeader shipmentHeader : shipmentHeaders) { | |
276 | + if (shipmentHeader.getFirstStatus() <= QuantityConstant.SHIPMENT_HEADER_WAVE) { | |
163 | 277 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_POOL); |
164 | - flag = shipmentHeaderService.updateById(shipmentHeader); | |
165 | - if (flag == false) { | |
166 | - throw new ServiceException("修改出库主单失败"); | |
167 | - } | |
278 | + } | |
279 | + if (shipmentHeader.getLastStatus() <= QuantityConstant.SHIPMENT_HEADER_WAVE) { | |
280 | + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_POOL); | |
281 | + } | |
282 | + flag = shipmentHeaderService.updateById(shipmentHeader); | |
283 | + if (flag == false) { | |
284 | + throw new ServiceException("修改出库主单失败"); | |
168 | 285 | } |
169 | 286 | } |
170 | - } | |
171 | - } | |
172 | 287 | |
173 | - HashSet<Integer> idSet = new HashSet(); | |
174 | - //成功释放——遍历子任务列表,找出主单(distinct)id | |
175 | - for(TaskDetail item : taskDetailList){ | |
176 | - idSet.add(item.getTaskId()); | |
177 | - } | |
178 | - //成功释放——将这些主任务执行 | |
179 | - taskHeaderService.sendTaskToWcs(idSet.toArray(new Integer[idSet.size()])); | |
288 | + if(wave.getCurrentWaveStep().equals(QuantityConstant.WAVE_STEP_END)) { | |
289 | + //成功释放——找到此波次的未执行的子任务列表 | |
290 | + LambdaQueryWrapper<TaskHeader> lam = Wrappers.lambdaQuery(); | |
291 | + lam.eq(TaskHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
292 | + .eq(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_BUILD) | |
293 | + .eq(TaskHeader::getWaveId, id); | |
294 | + List<TaskHeader> taskHeaders = taskHeaderService.list(lam); | |
295 | + if (taskHeaders == null) { | |
296 | + throw new ServiceException("该波次的主任务找不到"); | |
297 | + } | |
298 | + List<Integer> taskIds =new ArrayList<>(); | |
299 | + for(TaskHeader item :taskHeaders){ | |
300 | + taskIds.add(item.getId()); | |
301 | + } | |
302 | + taskHeaderService.sendTaskToWcs(taskIds.toArray(new Integer[taskIds.size()])); | |
303 | + } | |
180 | 304 | |
305 | + //修改波次状态 | |
306 | + if(wave.getCurrentWaveStep().equals(QuantityConstant.WAVE_STEP_END)) { | |
307 | + wave.setStatus(QuantityConstant.WAVE_STATUS_END); | |
308 | + wave.setCurrentWaveStep(QuantityConstant.WAVE_STEP_FREED); | |
309 | + wave.setLastWaveStep(QuantityConstant.WAVE_STEP_END); | |
310 | + } | |
311 | + if(wave.getCurrentWaveStep().equals(QuantityConstant.WAVE_STATUS_BUILD)){ | |
312 | + wave.setCurrentWaveStep(QuantityConstant.WAVE_STEP_FREED); | |
313 | + wave.setLastWaveStep(QuantityConstant.WAVE_STEP_BUILD); | |
314 | + } | |
315 | + if(wave.getCurrentWaveStep().equals(QuantityConstant.WAVE_STATUS_ERROR)){ | |
316 | + wave.setCurrentWaveStep(QuantityConstant.WAVE_STEP_FREED); | |
317 | + wave.setLastWaveStep(QuantityConstant.WAVE_STEP_ERROR); | |
318 | + } | |
319 | + wave.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
320 | + wave.setLastUpdated(new Date()); | |
321 | + this.updateById(wave); | |
322 | + } | |
181 | 323 | return AjaxResult.success("波次释放成功"); |
182 | 324 | } |
183 | 325 | } |
... | ... |
src/main/java/com/huaheng/pc/system/dict/service/DictDataServiceImpl.java
... | ... | @@ -31,8 +31,9 @@ public class DictDataServiceImpl implements IDictDataService |
31 | 31 | @Override |
32 | 32 | public List<DictData> selectDictDataList(DictData dictData) |
33 | 33 | { |
34 | - if (dictData.getWarehouseCode() == null) | |
34 | + if (dictData.getWarehouseCode() == null) { | |
35 | 35 | dictData.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
36 | + } | |
36 | 37 | return dictDataMapper.selectDictDataList(dictData); |
37 | 38 | } |
38 | 39 | |
... | ... | @@ -106,8 +107,9 @@ public class DictDataServiceImpl implements IDictDataService |
106 | 107 | @Override |
107 | 108 | public int insertDictData(DictData dictData) |
108 | 109 | { |
109 | - if (dictData.getWarehouseCode() == null) | |
110 | + if (dictData.getWarehouseCode() == null) { | |
110 | 111 | dictData.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
112 | + } | |
111 | 113 | dictData.setCreateBy(ShiroUtils.getLoginName()); |
112 | 114 | return dictDataMapper.insertDictData(dictData); |
113 | 115 | } |
... | ... | @@ -139,10 +141,11 @@ public class DictDataServiceImpl implements IDictDataService |
139 | 141 | dictData.setDictType(type); |
140 | 142 | dictData.setDictValue(dictValue); |
141 | 143 | Integer id = dictDataMapper.checkConfig(dictData); |
142 | - if (id == null) | |
144 | + if (id == null) { | |
143 | 145 | return false; |
144 | - else | |
146 | + } else { | |
145 | 147 | return true; |
148 | + } | |
146 | 149 | } |
147 | 150 | |
148 | 151 | |
... | ... | @@ -151,6 +154,7 @@ public class DictDataServiceImpl implements IDictDataService |
151 | 154 | * @param warehouseCode |
152 | 155 | * @return |
153 | 156 | */ |
157 | + @Override | |
154 | 158 | public int deleteDictDataByWarehouseCode(String warehouseCode){ |
155 | 159 | return dictDataMapper.deleteDictDataByWarehouseCode(warehouseCode); |
156 | 160 | } |
... | ... | @@ -160,8 +164,9 @@ public class DictDataServiceImpl implements IDictDataService |
160 | 164 | { |
161 | 165 | List<DictData> dictDataList=new ArrayList<>(); |
162 | 166 | for(DictData dictData: dictDatas) { |
163 | - if (dictData.getWarehouseCode() == null) | |
167 | + if (dictData.getWarehouseCode() == null) { | |
164 | 168 | dictData.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
169 | + } | |
165 | 170 | dictData.setCreateBy(ShiroUtils.getLoginName()); |
166 | 171 | dictDataList.add(dictData); |
167 | 172 | } |
... | ... |
src/main/java/com/huaheng/pc/system/dict/service/DictTypeServiceImpl.java
... | ... | @@ -39,8 +39,9 @@ public class DictTypeServiceImpl implements IDictTypeService |
39 | 39 | @Override |
40 | 40 | public List<DictType> selectDictTypeList(DictType dictType) |
41 | 41 | { |
42 | - if (dictType.getWarehouseCode() == null) | |
42 | + if (dictType.getWarehouseCode() == null) { | |
43 | 43 | dictType.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
44 | + } | |
44 | 45 | return dictTypeMapper.selectDictTypeList(dictType); |
45 | 46 | } |
46 | 47 | |
... | ... | @@ -103,8 +104,9 @@ public class DictTypeServiceImpl implements IDictTypeService |
103 | 104 | @Override |
104 | 105 | public int insertDictType(DictType dictType) |
105 | 106 | { |
106 | - if (dictType.getWarehouseCode() == null) | |
107 | + if (dictType.getWarehouseCode() == null) { | |
107 | 108 | dictType.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
109 | + } | |
108 | 110 | dictType.setCreateBy(ShiroUtils.getLoginName()); |
109 | 111 | return dictTypeMapper.insertDictType(dictType); |
110 | 112 | } |
... | ... | @@ -170,8 +172,9 @@ public class DictTypeServiceImpl implements IDictTypeService |
170 | 172 | { |
171 | 173 | List<DictType> dictTypeList=new ArrayList<>(); |
172 | 174 | for(DictType dictType:dictTypes){ |
173 | - if (dictType.getWarehouseCode() == null) | |
175 | + if (dictType.getWarehouseCode() == null) { | |
174 | 176 | dictType.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
177 | + } | |
175 | 178 | dictType.setCreateBy(ShiroUtils.getLoginName()); |
176 | 179 | dictTypeList.add(dictType); |
177 | 180 | } |
... | ... |
src/main/java/com/huaheng/pc/system/user/controller/HomeController.java
... | ... | @@ -102,7 +102,7 @@ public class HomeController extends BaseController { |
102 | 102 | @ResponseBody |
103 | 103 | public AjaxResult getInventoryStatus(String type){ |
104 | 104 | List<Map<String, Object>> list=new ArrayList<>(); |
105 | - if(type.equals("1")) { | |
105 | + if("1".equals(type)) { | |
106 | 106 | Warehouse warehouse=new Warehouse(); |
107 | 107 | List<Warehouse> warehouseList=warehouseService.selectListEntityByEqual(warehouse); |
108 | 108 | for(Warehouse item:warehouseList) { |
... | ... | @@ -171,15 +171,15 @@ public class HomeController extends BaseController { |
171 | 171 | List<TaskDetail> receiptDetails=new ArrayList<>(); |
172 | 172 | List<TaskDetail> shipmentDetails=new ArrayList<>(); |
173 | 173 | Map map=new ModelMap(); |
174 | - if(type.equals("1")) { | |
174 | + if("1".equals(type)) { | |
175 | 175 | receiptDetails = receiptDetailService.getReceiptQtyLast7Days(); |
176 | 176 | shipmentDetails = shipmentDetailService.getShipmentQtyLast7Days(); |
177 | 177 | } |
178 | - if(type.equals("2")){ | |
178 | + if("2".equals(type)){ | |
179 | 179 | receiptDetails =receiptDetailService.getWarehouseReceipt(); |
180 | 180 | shipmentDetails=shipmentDetailService.getWarehouseShipment(); |
181 | 181 | } |
182 | - if(type.equals("3")){ | |
182 | + if("3".equals(type)){ | |
183 | 183 | receiptDetails =receiptDetailService.getCompanyReceipt(); |
184 | 184 | shipmentDetails=shipmentDetailService.getCompanyShipment(); |
185 | 185 | } |
... | ... | @@ -193,7 +193,7 @@ public class HomeController extends BaseController { |
193 | 193 | @ResponseBody |
194 | 194 | public AjaxResult getInventoryProp(String type){ |
195 | 195 | List<Map<String, Object>> list=new ArrayList<>(); |
196 | - if(type.equals("1")) { | |
196 | + if("1".equals(type)) { | |
197 | 197 | Warehouse warehouse=new Warehouse(); |
198 | 198 | List<Warehouse> warehouseList=warehouseService.selectListEntityByEqual(warehouse); |
199 | 199 | for(Warehouse item:warehouseList) { |
... | ... |
src/main/java/com/huaheng/pc/system/user/controller/IndexController.java
... | ... | @@ -78,7 +78,7 @@ public class IndexController extends BaseController |
78 | 78 | for(LinkedHashMap<String, Object> item : results){ |
79 | 79 | ChartData chartData = new ChartData(); |
80 | 80 | for(Map.Entry<String, Object> entries : item.entrySet()){ |
81 | - if(entries.getKey().equals("状态")){ | |
81 | + if("状态".equals(entries.getKey())){ | |
82 | 82 | option.legend().getData().add(entries.getValue()); |
83 | 83 | chartData.setName(entries.getValue().toString()); |
84 | 84 | }else{ |
... | ... |
src/main/java/com/huaheng/pc/system/user/controller/UserController.java
... | ... | @@ -160,8 +160,9 @@ public class UserController extends BaseController |
160 | 160 | } |
161 | 161 | AjaxResult ajaxResult = toAjax(userService.updateUser(user)); |
162 | 162 | |
163 | - if (ShiroUtils.getLoginName().equals(user.getUserName())) | |
163 | + if (ShiroUtils.getLoginName().equals(user.getUserName())) { | |
164 | 164 | ShiroUtils.logout(); |
165 | + } | |
165 | 166 | |
166 | 167 | return ajaxResult; |
167 | 168 | } |
... | ... |
src/main/java/com/huaheng/pc/system/user/domain/User.java
src/main/java/com/huaheng/pc/system/user/service/UserServiceImpl.java
... | ... | @@ -417,7 +417,7 @@ public class UserServiceImpl implements IUserService |
417 | 417 | { |
418 | 418 | Integer userId = StringUtils.isNull(user.getId()) ? -1 : user.getId(); |
419 | 419 | User info = userMapper.checkPhoneUnique(user.getPhoneNumber()); |
420 | - if (StringUtils.isNotNull(info) && info.getId() != userId) | |
420 | + if (StringUtils.isNotNull(info) && !info.getId().equals(userId)) | |
421 | 421 | { |
422 | 422 | return UserConstants.USER_PHONE_NOT_UNIQUE; |
423 | 423 | } |
... | ... | @@ -435,7 +435,7 @@ public class UserServiceImpl implements IUserService |
435 | 435 | { |
436 | 436 | Integer userId = StringUtils.isNull(user.getId()) ? -1 : user.getId(); |
437 | 437 | User info = userMapper.checkEmailUnique(user.getEmail()); |
438 | - if (StringUtils.isNotNull(info) && info.getId() != userId) | |
438 | + if (StringUtils.isNotNull(info) && !info.getId().equals(userId)) | |
439 | 439 | { |
440 | 440 | return UserConstants.USER_EMAIL_NOT_UNIQUE; |
441 | 441 | } |
... | ... | @@ -502,8 +502,9 @@ public class UserServiceImpl implements IUserService |
502 | 502 | else |
503 | 503 | { |
504 | 504 | list = userMapper.getWarehouseByUserName(loginName); |
505 | - if (list.size()==1) | |
505 | + if (list.size()==1) { | |
506 | 506 | list=userMapper.getWarehouseByUserCode(loginName); |
507 | + } | |
507 | 508 | |
508 | 509 | |
509 | 510 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java
... | ... | @@ -108,8 +108,9 @@ public class TaskHeaderController extends BaseController { |
108 | 108 | @ResponseBody |
109 | 109 | public AjaxResult execute(String taskId) |
110 | 110 | { |
111 | - if (StringUtils.isEmpty(taskId)) | |
111 | + if (StringUtils.isEmpty(taskId)){ | |
112 | 112 | return AjaxResult.error("taskId不能为空"); |
113 | + } | |
113 | 114 | AjaxResult ajaxResult = taskHeaderService.sendTaskToWcs(Convert.toIntArray(taskId)); |
114 | 115 | return ajaxResult; |
115 | 116 | } |
... | ... | @@ -122,8 +123,9 @@ public class TaskHeaderController extends BaseController { |
122 | 123 | @PostMapping( "/completeTaskByWMS") |
123 | 124 | @ResponseBody |
124 | 125 | public AjaxResult completeTaskByWMS(String taskId){ |
125 | - if (StringUtils.isEmpty(taskId)) | |
126 | + if (StringUtils.isEmpty(taskId)){ | |
126 | 127 | return AjaxResult.error("taskId不能为空"); |
128 | + } | |
127 | 129 | return taskHeaderService.completeTaskByWMS(Convert.toIntArray(taskId), null); |
128 | 130 | } |
129 | 131 | |
... | ... | @@ -142,6 +144,23 @@ public class TaskHeaderController extends BaseController { |
142 | 144 | return taskHeaderService.cancelTask(Convert.toIntArray(ids)); |
143 | 145 | } |
144 | 146 | |
145 | - | |
147 | + /** | |
148 | + * 自动分配任务库位 | |
149 | + * WCS | |
150 | + * @param taskId | |
151 | + * @param high | |
152 | + * @return | |
153 | + */ | |
154 | + @PostMapping("/setLocationCode") | |
155 | + @ResponseBody | |
156 | + public AjaxResult setLocationCode( Integer taskId, Integer high){ | |
157 | + if (taskId == null){ | |
158 | + return AjaxResult.error("任务id不能为空"); | |
159 | + } | |
160 | + if (high == null){ | |
161 | + return AjaxResult.error("高库位标识不能为空"); | |
162 | + } | |
163 | + return taskHeaderService.setLocationCode(taskId, high); | |
164 | + } | |
146 | 165 | |
147 | 166 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java
... | ... | @@ -89,4 +89,11 @@ public interface TaskHeaderService extends IService<TaskHeader>{ |
89 | 89 | List<MobileTask> mobileFindTransferTask(String containerCode); |
90 | 90 | |
91 | 91 | AjaxResult completeEmptyOut(TaskHeader taskHeader); |
92 | + | |
93 | + AjaxResult createAutoEmptyOut(String warehouseCode); | |
94 | + | |
95 | + String getLocationCode(Integer taskId,String warehouseCode,String weight); | |
96 | + | |
97 | + AjaxResult setLocationCode(Integer taskId, Integer high); | |
98 | + | |
92 | 99 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -13,6 +13,7 @@ import com.huaheng.common.utils.DataUtils; |
13 | 13 | import com.huaheng.common.utils.StringUtils; |
14 | 14 | import com.huaheng.common.utils.security.ShiroUtils; |
15 | 15 | import com.huaheng.framework.web.domain.AjaxResult; |
16 | +import com.huaheng.mobile.download.Constant; | |
16 | 17 | import com.huaheng.pc.config.configWarning.service.ConfigWarningService; |
17 | 18 | import com.huaheng.pc.config.container.domain.Container; |
18 | 19 | import com.huaheng.pc.config.container.service.ContainerService; |
... | ... | @@ -55,6 +56,7 @@ import com.huaheng.pc.task.taskHeader.domain.MobileTask; |
55 | 56 | import com.huaheng.pc.task.taskHeader.domain.ShipmentTaskCreateModel; |
56 | 57 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
57 | 58 | import com.huaheng.pc.task.taskHeader.mapper.TaskHeaderMapper; |
59 | +import io.swagger.models.auth.In; | |
58 | 60 | import org.springframework.beans.factory.annotation.Autowired; |
59 | 61 | import org.springframework.stereotype.Service; |
60 | 62 | import org.springframework.transaction.annotation.Transactional; |
... | ... | @@ -122,7 +124,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
122 | 124 | * @param taskHeaderList |
123 | 125 | * @return |
124 | 126 | */ |
125 | - @Transactional | |
126 | 127 | @Override |
127 | 128 | public List<TaskHeader> preferenceRealize(List<TaskHeader> taskHeaderList) { |
128 | 129 | //盘点任务头,默认不显示库位,容器。 |
... | ... | @@ -149,7 +150,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
149 | 150 | * @throws Exception |
150 | 151 | */ |
151 | 152 | @Override |
152 | - public AjaxResult completeTask(String locationCode) throws Exception { | |
153 | + @Transactional(rollbackFor = Exception.class) | |
154 | + public AjaxResult completeTask(String locationCode) { | |
153 | 155 | LambdaQueryWrapper<TaskHeader> taskQueryWrapper = Wrappers.lambdaQuery(); |
154 | 156 | taskQueryWrapper.eq(TaskHeader::getToLocation, locationCode); |
155 | 157 | List<TaskHeader> list = this.list(taskQueryWrapper); |
... | ... | @@ -168,6 +170,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
168 | 170 | } |
169 | 171 | |
170 | 172 | @Override |
173 | + @Transactional(rollbackFor = Exception.class) | |
171 | 174 | public AjaxResult createReplenishTask(String containerCode, Short taskStatus) { |
172 | 175 | LambdaQueryWrapper<ReceiptContainerHeader> headerQueryWrapper = Wrappers.lambdaQuery(); |
173 | 176 | headerQueryWrapper.eq(ReceiptContainerHeader::getContainerCode, containerCode) |
... | ... | @@ -198,8 +201,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
198 | 201 | } |
199 | 202 | List<Integer> ids = new ArrayList<>(); |
200 | 203 | ids.add(containerHeader.getId()); |
201 | - createReceiptTask(ids); | |
202 | - return null; | |
204 | + this.createReceiptTask(ids); | |
205 | + return AjaxResult.success("成功!"); | |
203 | 206 | } |
204 | 207 | |
205 | 208 | /** |
... | ... | @@ -208,6 +211,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
208 | 211 | * @return |
209 | 212 | */ |
210 | 213 | @Override |
214 | + @Transactional(rollbackFor = Exception.class) | |
211 | 215 | public List<MobileTask> mobileFindTransferTask(String containerCode) { |
212 | 216 | /* 查询该容器未完成的盘点任务明细*/ |
213 | 217 | LambdaQueryWrapper<TaskDetail> detailLambdaQueryWrapper = Wrappers.lambdaQuery(); |
... | ... | @@ -247,7 +251,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
247 | 251 | * 取消任务 |
248 | 252 | */ |
249 | 253 | @Override |
250 | - @Transactional | |
254 | + @Transactional(rollbackFor = Exception.class) | |
251 | 255 | public AjaxResult cancelTask(Integer[] taskIds) { |
252 | 256 | for (int taskId : taskIds) { |
253 | 257 | TaskHeader taskHeader = taskHeaderService.getById(taskId); |
... | ... | @@ -287,7 +291,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
287 | 291 | shipmentContainerHeaderService.updateById(shipmentContainerHeader); |
288 | 292 | } |
289 | 293 | //盘点取消任务,恢复明细状态为1 |
290 | - if (taskHeader.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_CYCLECOUNT) { | |
294 | + if (taskHeader.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_CYCLECOUNT)) { | |
291 | 295 | |
292 | 296 | CycleCountDetail cycleCountDetail = new CycleCountDetail(); |
293 | 297 | cycleCountDetail.setCompanyCode(taskDetail.getCompanyCode()); |
... | ... | @@ -308,7 +312,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
308 | 312 | } |
309 | 313 | |
310 | 314 | } |
311 | - if (taskHeader.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_SHELF || taskHeader.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_PICKING) { | |
315 | + if (taskHeader.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_SHELF) || taskHeader.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_PICKING)) { | |
312 | 316 | if (taskHeader.getToLocation() != null) { |
313 | 317 | //更新托盘、库位状态 |
314 | 318 | locationService.updateStatus(taskHeader.getToLocation(), "empty"); |
... | ... | @@ -342,6 +346,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
342 | 346 | * @return |
343 | 347 | */ |
344 | 348 | @Override |
349 | + @Transactional(rollbackFor = Exception.class) | |
345 | 350 | public AjaxResult createQuickTask(String containerCode) { |
346 | 351 | LambdaQueryWrapper<ReceiptContainerHeader> queryWrapper = Wrappers.lambdaQuery(); |
347 | 352 | queryWrapper.eq(ReceiptContainerHeader::getContainerCode, containerCode) |
... | ... | @@ -360,33 +365,33 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
360 | 365 | if (containerDetailList.isEmpty()) { |
361 | 366 | throw new SecurityException("没有组盘明细,请先组盘"); |
362 | 367 | } |
363 | - if (receiptContainerHeader.getStatus().equals(QuantityConstant.RECEIPT_HEADER_BUILD)) { | |
368 | + if (receiptContainerHeader.getStatus() == QuantityConstant.RECEIPT_HEADER_BUILD.shortValue()) { | |
364 | 369 | String ids = String.valueOf(receiptContainerHeader.getId()); |
365 | 370 | if (StringUtils.isEmpty(ids)){ |
366 | 371 | return AjaxResult.error("id不能为空"); |
367 | 372 | } |
368 | 373 | List<Integer> idList = Arrays.asList(Convert.toIntArray(ids)); |
369 | - for (int i = 0; i<idList.size(); i++){ | |
370 | - LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); | |
371 | - lambda.eq(ReceiptContainerDetail::getReceiptContainerId, idList.get(i)); | |
372 | - List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); | |
373 | - for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails){ | |
374 | - receivingService.position(receiptContainerDetail); | |
375 | - } | |
376 | - | |
377 | - } | |
374 | +// for (int i = 0; i<idList.size(); i++){ | |
375 | +// LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); | |
376 | +// lambda.eq(ReceiptContainerDetail::getReceiptContainerId, idList.get(i)); | |
377 | +// List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); | |
378 | +// for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails){ | |
379 | +// receivingService.position(receiptContainerDetail); | |
380 | +// } | |
381 | +// | |
382 | +// } | |
378 | 383 | if (StringUtils.isEmpty(ids)){ |
379 | 384 | return AjaxResult.error("id不能为空"); |
380 | 385 | } |
381 | - for (int i = 0; i<idList.size(); i++){ | |
382 | - LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); | |
383 | - lambda.eq(ReceiptContainerDetail::getReceiptContainerId, idList.get(i)); | |
384 | - List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); | |
385 | - for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails){ | |
386 | - receivingService.position(receiptContainerDetail); | |
387 | - } | |
388 | - | |
389 | - } | |
386 | +// for (int i = 0; i<idList.size(); i++){ | |
387 | +// LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); | |
388 | +// lambda.eq(ReceiptContainerDetail::getReceiptContainerId, idList.get(i)); | |
389 | +// List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); | |
390 | +// for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails){ | |
391 | +// receivingService.position(receiptContainerDetail); | |
392 | +// } | |
393 | +// | |
394 | +// } | |
390 | 395 | |
391 | 396 | Integer maxId = idList.stream().max(Comparator.comparing(Integer::intValue)).orElse(null); |
392 | 397 | |
... | ... | @@ -396,7 +401,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
396 | 401 | .le(ReceiptContainerHeader::getId, maxId); |
397 | 402 | return taskHeaderService.createReceiptTask(idList); |
398 | 403 | } |
399 | - return null; | |
404 | + return AjaxResult.error("生成入库任务失败"); | |
400 | 405 | } |
401 | 406 | |
402 | 407 | /** |
... | ... | @@ -406,7 +411,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
406 | 411 | * @return |
407 | 412 | */ |
408 | 413 | @Override |
409 | - @Transactional | |
414 | + @Transactional(rollbackFor = Exception.class) | |
410 | 415 | public AjaxResult createTaskFromShipmentContainers(ShipmentTaskCreateModel shipmentTaskCreateModel) { |
411 | 416 | Boolean flag = true; |
412 | 417 | Integer shipmentContainerHeaderId = shipmentTaskCreateModel.getShipmentContainerHeaderIds(); |
... | ... | @@ -510,7 +515,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
510 | 515 | if (flag == false) { |
511 | 516 | throw new ServiceException("新建任务明细失败,sql报错"); |
512 | 517 | } |
513 | - | |
514 | 518 | shipmentContainerDetail.setStatus(QuantityConstant.SHIPMENT_CONTAINER_TASK); |
515 | 519 | } |
516 | 520 | //更新货位状态 |
... | ... | @@ -525,7 +529,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
525 | 529 | throw new ServiceException("修改组盘明细状态明细失败,sql报错"); |
526 | 530 | } |
527 | 531 | return AjaxResult.success(task.getId()); |
528 | - | |
529 | 532 | } |
530 | 533 | |
531 | 534 | /** |
... | ... | @@ -533,7 +536,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
533 | 536 | * 执行任务 |
534 | 537 | */ |
535 | 538 | @Override |
536 | - @Transactional | |
539 | + @Transactional(rollbackFor = Exception.class) | |
537 | 540 | public AjaxResult<TaskHeader> sendTaskToWcs(Integer[] taskIds) { |
538 | 541 | TaskHeader task = null; |
539 | 542 | for (Integer taskId : taskIds) { |
... | ... | @@ -620,30 +623,41 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
620 | 623 | } |
621 | 624 | |
622 | 625 | @Override |
623 | - @Transactional | |
624 | - public AjaxResult completeTaskByWMS(Integer[] taskIds, String[] weight) { | |
626 | + @Transactional(rollbackFor = Exception.class) | |
627 | + public AjaxResult completeTaskByWMS(Integer[] taskIds, String[] weightConvert) { | |
625 | 628 | for (int i = 0;i<taskIds.length;i++) { |
626 | 629 | TaskHeader task = taskHeaderService.getById(taskIds[i]); |
630 | + | |
627 | 631 | if (task == null) { |
628 | 632 | throw new ServiceException("任务" + taskIds[i] + "未找到,执行中止"); |
629 | 633 | } |
630 | - | |
634 | + //任务写入重量 | |
635 | + String weight = ""; | |
636 | + if (StringUtils.isNotNull(weightConvert)) { | |
637 | + weight = weightConvert[i]; | |
638 | + } | |
639 | + task.setWeight(weight); | |
631 | 640 | //如果已完成则不管 |
632 | 641 | if (task.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { |
633 | 642 | return AjaxResult.success("任务(" + taskIds[i] + ")任务已经是完成的!"); |
634 | 643 | |
635 | 644 | } |
645 | + //整盘入库,空托入库库位自动分配 | |
646 | + //整盘入库手动完成分配库位,已分配则略过 | |
647 | + if(task.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLERECEIPT) || task.getTaskType().equals(QuantityConstant.TASK_TYPE_EMPTYRECEIPT)){ | |
648 | + if(StringUtils.isEmpty(task.getToLocation())){ | |
649 | + //自动分配库位 | |
650 | + String result = this.getLocationCode(task.getId(),ShiroUtils.getWarehouseCode(),weight); | |
651 | + task.setToLocation(result); | |
652 | + } | |
653 | + } | |
636 | 654 | //如果没有库位不能完成 |
637 | -// if (StringUtils.isEmpty(task.getFromLocation())) { | |
638 | -// throw new ServiceException("任务" + taskId + "没有库位,执行中止"); | |
639 | -// } | |
640 | - if (StringUtils.isNotNull(weight)) { | |
641 | - task.setWeight(weight[i]); | |
655 | + if (StringUtils.isEmpty(task.getFromLocation()) && StringUtils.isEmpty(task.getToLocation())) { | |
656 | + throw new ServiceException("任务" + task.getId() + "没有库位,执行中止"); | |
642 | 657 | } |
643 | 658 | |
644 | 659 | this.completeTask(task); |
645 | 660 | } |
646 | - | |
647 | 661 | return AjaxResult.success("完成任务成功!"); |
648 | 662 | } |
649 | 663 | |
... | ... | @@ -652,6 +666,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
652 | 666 | * |
653 | 667 | * @param task |
654 | 668 | */ |
669 | + @Transactional(rollbackFor = Exception.class) | |
655 | 670 | public void completeTask(TaskHeader task) { |
656 | 671 | //区分任务类型 |
657 | 672 | if (task.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_SHELF) ) { |
... | ... | @@ -690,7 +705,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
690 | 705 | * 完成入库任务 |
691 | 706 | */ |
692 | 707 | @Override |
693 | - @Transactional | |
708 | + @Transactional(rollbackFor = Exception.class) | |
694 | 709 | public AjaxResult completeReceiptTask(TaskHeader task) { |
695 | 710 | List<Map<String, Object>> taskReceiptContainerDetail = taskHeaderMapper.getReceiptTask(task.getId()); |
696 | 711 | if (taskReceiptContainerDetail.size() < 1) { |
... | ... | @@ -711,8 +726,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
711 | 726 | header.setWarehouseCode(DataUtils.getString(map.get("warehouseCode")));//仓库 |
712 | 727 | header.setCompanyCode(task.getCompanyCode());//货主 |
713 | 728 | header.setContainerCode(DataUtils.getString(map.get("containerCode")));//容器号 |
729 | + header.setContainerStatus("some"); | |
714 | 730 | header.setLocationCode(task.getToLocation()); |
715 | - header.setTotalQty(DataUtils.getInteger(map.get("totalQty")));//总数量 | |
731 | + header.setTotalQty(DataUtils.getBigDecimal(map.get("totalQty")));//总数量 | |
716 | 732 | header.setLocking(1); |
717 | 733 | header.setEnable(1); |
718 | 734 | header.setTotalWeight(task.getWeight()); |
... | ... | @@ -743,6 +759,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
743 | 759 | // detail.setManufactureDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("manufactureDate").toString()));//生产日期 |
744 | 760 | // detail.setExpirationDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("expirationDate").toString()));//失效日期 |
745 | 761 | detail.setQty(DataUtils.getBigDecimal(map.get("qty")));//数量 |
762 | + detail.setLockedQty(DataUtils.getBigDecimal(0)); | |
746 | 763 | detail.setTaskQty(DataUtils.getBigDecimal(0)); |
747 | 764 | detail.setCreatedBy(ShiroUtils.getLoginName());//创建人 |
748 | 765 | detail.setLastUpdatedBy(ShiroUtils.getLoginName());//创建时间 |
... | ... | @@ -754,9 +771,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
754 | 771 | detail.setLastUpdatedBy(ShiroUtils.getLoginName()); |
755 | 772 | LambdaUpdateWrapper<InventoryDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
756 | 773 | lambdaUpdateWrapper.eq(InventoryDetail::getId, DataUtils.getInteger(map.get("receiptDetailId"))); |
757 | - if (!inventoryDetailService.update(detail, lambdaUpdateWrapper)) | |
774 | + if (!inventoryDetailService.update(detail, lambdaUpdateWrapper)){ | |
758 | 775 | throw new ServiceException("更新入库单明细失败"); |
759 | - | |
776 | + } | |
760 | 777 | } |
761 | 778 | //记录库存交易记录 |
762 | 779 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); |
... | ... | @@ -799,18 +816,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
799 | 816 | task.setLastUpdated(new Date()); |
800 | 817 | LambdaUpdateWrapper<TaskHeader> taskHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
801 | 818 | taskHeaderLambdaUpdateWrapper.eq(TaskHeader::getId, task.getId()); |
802 | - if (!taskHeaderService.update(task, taskHeaderLambdaUpdateWrapper)) | |
819 | + if (!taskHeaderService.update(task, taskHeaderLambdaUpdateWrapper)){ | |
803 | 820 | throw new ServiceException("更新任务主表失败"); |
804 | - | |
821 | + } | |
805 | 822 | //修改库位状态和对应的容器 |
806 | 823 | Location location = new Location(); |
807 | 824 | location.setContainerCode(task.getContainerCode()); |
808 | 825 | location.setStatus("empty"); |
809 | 826 | LambdaUpdateWrapper<Location> locationLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
810 | 827 | locationLambdaUpdateWrapper.eq(Location::getCode, task.getToLocation()); |
811 | - if (!locationService.update(location, locationLambdaUpdateWrapper)) | |
828 | + if (!locationService.update(location, locationLambdaUpdateWrapper)){ | |
812 | 829 | throw new ServiceException("更新库位失败"); |
813 | - | |
830 | + } | |
814 | 831 | //修改容器状态和对应的库位 |
815 | 832 | Container container = new Container(); |
816 | 833 | container.setLocationCode(task.getToLocation()); |
... | ... | @@ -828,9 +845,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
828 | 845 | receiptContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); |
829 | 846 | LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
830 | 847 | receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getReceiptId, DataUtils.getInteger(map.get("receiptId"))); |
831 | - if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)) | |
848 | + if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)){ | |
832 | 849 | throw new ServiceException("更新组盘状态失败"); |
833 | - | |
850 | + } | |
834 | 851 | |
835 | 852 | //修改入库组盘头表状态 |
836 | 853 | |
... | ... | @@ -868,6 +885,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
868 | 885 | * @return |
869 | 886 | */ |
870 | 887 | @Override |
888 | + @Transactional(rollbackFor = Exception.class) | |
871 | 889 | public AjaxResult mobileCreateReceiptTask(String containerCode, String sourceLocation) { |
872 | 890 | LambdaQueryWrapper<ReceiptContainerHeader> queryWrapper = Wrappers.lambdaQuery(); |
873 | 891 | queryWrapper.eq(ReceiptContainerHeader::getContainerCode, containerCode) |
... | ... | @@ -895,8 +913,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
895 | 913 | * 生成 |
896 | 914 | * 立库移库 |
897 | 915 | */ |
898 | - @Transactional | |
899 | 916 | @Override |
917 | + @Transactional(rollbackFor = Exception.class) | |
900 | 918 | public AjaxResult createTransferTask(String sourceLocation, String destinationLocation) { |
901 | 919 | |
902 | 920 | //源库位校验 |
... | ... | @@ -909,7 +927,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
909 | 927 | if (loc1 == null) { |
910 | 928 | return AjaxResult.error("源库位:" + sourceLocation + "未找到"); |
911 | 929 | } |
912 | - if (!loc1.getStatus().equals("empty")) { | |
930 | + if (!"empty".equals(loc1.getStatus())) { | |
913 | 931 | return AjaxResult.error("源库位:" + sourceLocation + "状态非空闲"); |
914 | 932 | } |
915 | 933 | if (StringUtils.isEmpty(loc1.getContainerCode())) { |
... | ... | @@ -934,7 +952,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
934 | 952 | if (loc2 == null) { |
935 | 953 | return AjaxResult.error("目标库位:" + destinationLocation + "未找到"); |
936 | 954 | } |
937 | - if (!loc2.getStatus().equals("empty")) { | |
955 | + if (!"empty".equals(loc2.getStatus())) { | |
938 | 956 | return AjaxResult.error("目标库位:" + destinationLocation + "状态非空闲"); |
939 | 957 | } |
940 | 958 | if (StringUtils.isNotEmpty(loc2.getContainerCode())) { |
... | ... | @@ -1115,7 +1133,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1115 | 1133 | * 任务 |
1116 | 1134 | */ |
1117 | 1135 | @Override |
1118 | - @Transactional | |
1136 | + @Transactional(rollbackFor = Exception.class) | |
1119 | 1137 | public AjaxResult createCheckOutTask(String[] ids) { |
1120 | 1138 | |
1121 | 1139 | for (String id : ids) { |
... | ... | @@ -1130,7 +1148,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1130 | 1148 | if (loc == null) { |
1131 | 1149 | throw new ServiceException("库存没有库位!"); |
1132 | 1150 | } |
1133 | - if (!loc.getStatus().equals("empty")) { | |
1151 | + if (!"empty".equals(loc.getStatus())) { | |
1134 | 1152 | throw new ServiceException(inventoryHeader.getLocationCode() + "状态非空闲,操作失败"); |
1135 | 1153 | } |
1136 | 1154 | if (StringUtils.isEmpty(loc.getContainerCode())) { |
... | ... | @@ -1195,8 +1213,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1195 | 1213 | * 出库查看 |
1196 | 1214 | * 更新状态,解锁库存 |
1197 | 1215 | */ |
1198 | - @Transactional | |
1199 | 1216 | @Override |
1217 | + @Transactional(rollbackFor = Exception.class) | |
1200 | 1218 | public AjaxResult completeSeeOutTask(TaskHeader taskHeader) { |
1201 | 1219 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
1202 | 1220 | taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户 |
... | ... | @@ -1240,8 +1258,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1240 | 1258 | * @param taskHeader |
1241 | 1259 | * @return |
1242 | 1260 | */ |
1243 | - @Transactional | |
1244 | 1261 | @Override |
1262 | + @Transactional(rollbackFor = Exception.class) | |
1245 | 1263 | public AjaxResult completeCycleCountTask(TaskHeader taskHeader) { |
1246 | 1264 | /*盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单, |
1247 | 1265 | 完成任务同时,修改盘点细单和主单的状态,完成后库存锁复位*/ |
... | ... | @@ -1293,7 +1311,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1293 | 1311 | * |
1294 | 1312 | * @param taskHeader |
1295 | 1313 | */ |
1296 | - @Transactional | |
1314 | + @Transactional(rollbackFor = Exception.class) | |
1297 | 1315 | public void completeEmptyIn(TaskHeader taskHeader) { |
1298 | 1316 | |
1299 | 1317 | //完成任务,修改主单和明细状态 |
... | ... | @@ -1322,6 +1340,30 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1322 | 1340 | //解锁库位,更新容器 |
1323 | 1341 | locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(), taskHeader.getContainerCode(), "empty"); |
1324 | 1342 | |
1343 | + //写入库存头表 | |
1344 | + InventoryHeader inventoryHeader = new InventoryHeader(); | |
1345 | + inventoryHeader.setWarehouseCode(taskHeader.getWarehouseCode()); | |
1346 | + inventoryHeader.setLocationCode(taskHeader.getToLocation()); | |
1347 | + inventoryHeader.setContainerCode(taskHeader.getContainerCode()); | |
1348 | + inventoryHeader.setContainerStatus("empty"); | |
1349 | + inventoryHeader.setCompanyCode(taskHeader.getCompanyCode()); | |
1350 | + inventoryHeader.setMaterialSkuQty("0"); | |
1351 | + inventoryHeader.setTotalWeight("0"); | |
1352 | + inventoryHeader.setTotalQty(new BigDecimal(0)); | |
1353 | + inventoryHeader.setTotalLines(0); | |
1354 | + inventoryHeader.setProjectNos(""); | |
1355 | + inventoryHeader.setBatchs(""); | |
1356 | + inventoryHeader.setLots(""); | |
1357 | + inventoryHeader.setLockRemark(""); | |
1358 | + inventoryHeader.setCreated(new Date()); | |
1359 | + inventoryHeader.setCreatedBy(ShiroUtils.getLoginName()); | |
1360 | + inventoryHeader.setLastUpdated(new Date()); | |
1361 | + inventoryHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
1362 | + Boolean j = inventoryHeaderService.save(inventoryHeader); | |
1363 | + if(!j){ | |
1364 | + throw new ServiceException("新增空托库存头失败!"); | |
1365 | + | |
1366 | + } | |
1325 | 1367 | } |
1326 | 1368 | |
1327 | 1369 | /** |
... | ... | @@ -1329,8 +1371,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1329 | 1371 | * |
1330 | 1372 | * @param taskHeader |
1331 | 1373 | */ |
1332 | - @Transactional | |
1333 | 1374 | @Override |
1375 | + @Transactional(rollbackFor = Exception.class) | |
1334 | 1376 | public AjaxResult completeEmptyOut(TaskHeader taskHeader) { |
1335 | 1377 | |
1336 | 1378 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
... | ... | @@ -1356,7 +1398,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1356 | 1398 | locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), "", "empty"); |
1357 | 1399 | //更新容器信息 |
1358 | 1400 | containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), "", "empty"); |
1359 | - return AjaxResult.success("完成"); | |
1401 | + //删除库存头表 | |
1402 | + InventoryHeader tmp = new InventoryHeader(); | |
1403 | + tmp.setContainerStatus("empty"); | |
1404 | + tmp.setContainerCode(taskHeader.getContainerCode()); | |
1405 | + tmp.setLocationCode(taskHeader.getFromLocation()); | |
1406 | + LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(tmp); | |
1407 | + Boolean j = inventoryHeaderService.remove(inventoryHeaderLambdaQueryWrapper); | |
1408 | + if(!j){ | |
1409 | + throw new ServiceException("空库位记录删除失败!"); | |
1410 | + } | |
1411 | + return AjaxResult.success("空托出库完成"); | |
1360 | 1412 | } |
1361 | 1413 | |
1362 | 1414 | /** |
... | ... | @@ -1366,7 +1418,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1366 | 1418 | * @return |
1367 | 1419 | */ |
1368 | 1420 | @Override |
1369 | - @Transactional | |
1421 | + @Transactional(rollbackFor = Exception.class) | |
1370 | 1422 | public AjaxResult createReceiptTask(List<Integer> ids) { |
1371 | 1423 | for (Integer id : ids) { |
1372 | 1424 | ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(id); |
... | ... | @@ -1378,7 +1430,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1378 | 1430 | throw new ServiceException("任务不在当前仓库!"); |
1379 | 1431 | } |
1380 | 1432 | |
1381 | - | |
1382 | 1433 | //锁定容器 |
1383 | 1434 | Container container = new Container(); |
1384 | 1435 | container.setStatus("lock"); |
... | ... | @@ -1481,7 +1532,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1481 | 1532 | } |
1482 | 1533 | } |
1483 | 1534 | } |
1484 | - return AjaxResult.success("生成上架任务成功!"); | |
1535 | + return AjaxResult.success("生成上架任务成功"); | |
1485 | 1536 | } |
1486 | 1537 | |
1487 | 1538 | /** |
... | ... | @@ -1512,7 +1563,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1512 | 1563 | BigDecimal orignalQty = inventoryDetail.getQty(); |
1513 | 1564 | //减扣库存单 |
1514 | 1565 | InventoryHeader inventoryHeader = inventoryHeaderService.getById(inventoryDetail.getInventoryHeaderId()); |
1515 | - inventoryHeader.setTotalQty(inventoryDetail.getQty().subtract(taskDetail.getQty()).intValue()); | |
1566 | + inventoryHeader.setTotalQty(inventoryDetail.getQty().subtract(taskDetail.getQty())); | |
1516 | 1567 | //扣减库存明细 |
1517 | 1568 | inventoryDetail.setTaskQty(inventoryDetail.getTaskQty().subtract(taskDetail.getQty())); |
1518 | 1569 | inventoryDetail.setQty(inventoryDetail.getQty().subtract(taskDetail.getQty())); |
... | ... | @@ -1561,9 +1612,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1561 | 1612 | // shipmentHeaderService.updateShipmentStatus(shipmentHeader.getId()); |
1562 | 1613 | } |
1563 | 1614 | /* 物料预警*/ |
1564 | - configWarningService.materialWarning(taskDetail.getMaterialCode(), taskDetail.getMaterialName()); | |
1565 | - /* 空库位剩余数量预警*/ | |
1566 | - configWarningService.emptyLocationWarning(); | |
1615 | +// configWarningService.materialWarning(taskDetail.getMaterialCode(), taskDetail.getMaterialName()); | |
1616 | +// /* 空库位剩余数量预警*/ | |
1617 | +// configWarningService.emptyLocationWarning(); | |
1567 | 1618 | } |
1568 | 1619 | //设置主任务为已执行 |
1569 | 1620 | task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
... | ... | @@ -1592,7 +1643,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1592 | 1643 | throw new ServiceException("系统无此容器"); |
1593 | 1644 | } |
1594 | 1645 | if (task.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLESHIPMENT)) { |
1595 | - if (ctn.getContainerType().equals("LS")) { | |
1646 | + if ("LS".equals(ctn.getContainerType())) { | |
1596 | 1647 | Boolean flag = containerService.removeById(ctn.getId()); |
1597 | 1648 | if (flag == false) { |
1598 | 1649 | throw new ServiceException("删除临时容器失败"); |
... | ... | @@ -1665,10 +1716,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1665 | 1716 | Map<String, Integer> status = shipmentDetailService.selectStatus(shipmentHeader.getId()); |
1666 | 1717 | Integer maxStatus = status.get("maxStatus"); |
1667 | 1718 | Integer minStatus = status.get("minStatus"); |
1668 | - if (maxStatus == QuantityConstant.SHIPMENT_HEADER_COMPLETED) { | |
1719 | + if (maxStatus.equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)) { | |
1669 | 1720 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); |
1670 | 1721 | } |
1671 | - if (minStatus == QuantityConstant.SHIPMENT_HEADER_COMPLETED) { | |
1722 | + if (minStatus.equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)) { | |
1672 | 1723 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); |
1673 | 1724 | } |
1674 | 1725 | shipmentHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); |
... | ... | @@ -1676,8 +1727,206 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1676 | 1727 | shipmentHeaderService.updateById(shipmentHeader); |
1677 | 1728 | } |
1678 | 1729 | } |
1730 | + } | |
1679 | 1731 | |
1732 | + /** | |
1733 | + * 自动空托出库 | |
1734 | + * */ | |
1735 | + @Override | |
1736 | + @Transactional(rollbackFor = Exception.class) | |
1737 | + public AjaxResult createAutoEmptyOut(String warehouseCode){ | |
1738 | + /*先查询容器表,选中空托盘,再查询库存核实*/ | |
1739 | + //该容器中有库位信息,并且状态是空 | |
1740 | + List<Location> locationsList = locationService.selectContainerEmpty(warehouseCode); | |
1741 | + if(locationsList.size() == 0){ | |
1742 | + throw new ServiceException("立库中没有空容器!"); | |
1743 | + } | |
1744 | + //根据入库顺序正序排列取第一个 | |
1745 | + Location location = locationsList.get(0); | |
1746 | + //反查库位 | |
1747 | + Container containerTmp = new Container(); | |
1748 | + containerTmp.setWarehouseCode(location.getWarehouseCode()); | |
1749 | + containerTmp.setCode(location.getContainerCode()); | |
1750 | + LambdaQueryWrapper<Container> containerLambda = Wrappers.lambdaQuery(containerTmp); | |
1751 | + Container container = containerService.getOne(containerLambda); | |
1752 | + if(container == null){ | |
1753 | + throw new ServiceException("选中的库位容器错误,请确认库位和容器!"); | |
1754 | + } | |
1755 | + //生成空容器出库任务 | |
1756 | + inventoryHeaderService.createEmptyOut(container.getCode(), location.getCode()); | |
1757 | + return AjaxResult.success("空容器出库任务已下发!",container.getCode()); | |
1680 | 1758 | } |
1681 | 1759 | |
1760 | + /** | |
1761 | + * 任务自动分配库位 | |
1762 | + * | |
1763 | + * */ | |
1764 | + @Override | |
1765 | + @Transactional(rollbackFor = Exception.class) | |
1766 | + public String getLocationCode(Integer taskId,String warehouseCode,String weight){ | |
1767 | + | |
1768 | + TaskHeader task = this.getById(taskId); | |
1769 | + if (task == null) { | |
1770 | + throw new ServiceException("找不到id为"+ taskId +"的任务"); | |
1771 | + } | |
1772 | + if (StringUtils.isNotEmpty(task.getToLocation())) { | |
1773 | + throw new ServiceException("任务已经有目的库位"); | |
1774 | + } | |
1775 | + if(!warehouseCode.equals(task.getWarehouseCode())){ | |
1776 | + throw new ServiceException("仓库错误!"); | |
1777 | + } | |
1778 | + /*if(task.getIsDoubleIn() != 1 ){ | |
1779 | + if(StringUtils.isNotEmpty(task.getToLocation())){ | |
1780 | + return AjaxResult.success("已经存在目的库位不再分配!"); | |
1781 | + } | |
1782 | + }*/ | |
1783 | + //查询容器,根据容器类型分配库位 | |
1784 | + Container tmp = new Container(); | |
1785 | + tmp.setCode(task.getContainerCode()); | |
1786 | + tmp.setWarehouseCode(warehouseCode); | |
1787 | + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(tmp); | |
1788 | + Container container = containerService.getOne(containerLambdaQueryWrapper); | |
1789 | + //库位筛选 | |
1790 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
1791 | + locationLambdaQueryWrapper.eq(Location::getWarehouseCode,task.getWarehouseCode()) | |
1792 | + .eq(Location::getContainerCode,"") | |
1793 | + .eq(Location::getStatus,"empty") | |
1794 | + .eq(Location::getDeleted,false); | |
1795 | + /*if(container.getContainerType().equals("L")){ | |
1796 | + locationLambdaQueryWrapper.eq(Location::getRoadway,"2") | |
1797 | + .le(Location::getIColumn,8); //小于等于 | |
1798 | + } | |
1799 | + else if(container.getContainerType().equals("M")) { | |
1800 | + locationLambdaQueryWrapper.eq(Location::getRoadway,"2") | |
1801 | + .gt(Location::getIColumn,8);//大于 | |
1802 | + } | |
1803 | + else if(container.getContainerType().equals("S")){ | |
1804 | + locationLambdaQueryWrapper.eq(Location::getRoadway,"1"); | |
1805 | + } | |
1806 | + else if(container.getContainerType().equals("D")){ | |
1807 | + return AjaxResult.success("地面库区不自动分配库位"); | |
1808 | + }*/ | |
1809 | + | |
1810 | + List<Location> locations = locationService.list(locationLambdaQueryWrapper); | |
1811 | + if (locations.size() == 0) { | |
1812 | + throw new ServiceException("没有空闲库位!"); | |
1813 | + } | |
1814 | + //随机取库位 | |
1815 | + Random rand = new Random(); | |
1816 | + Location location = locations.get(rand.nextInt(locations.size())); | |
1817 | + if (location == null) { | |
1818 | + throw new ServiceException("库位分配错误!"); | |
1819 | + } | |
1820 | + //锁定库位 | |
1821 | + locationService.updateStatus(location.getCode(),"lock"); | |
1822 | + //给组盘分配库位 | |
1823 | + ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); | |
1824 | + receiptContainerHeader.setId(task.getAllocationHeadId()); | |
1825 | + receiptContainerHeader.setToLocation(location.getCode()); | |
1826 | + receiptContainerHeader.setContainerCode(container.getCode()); | |
1827 | + receiptContainerHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
1828 | + receiptContainerHeader.setCreatedBy(ShiroUtils.getLoginName()); | |
1829 | + receiptContainerHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
1830 | + //LambdaQueryWrapper<ReceiptContainerHeader> rchlqw = Wrappers.lambdaQuery(receiptContainerHeader); | |
1831 | + receiptContainerHeaderService.saveOrUpdate(receiptContainerHeader); | |
1832 | + //组盘明细分配库位 | |
1833 | + ReceiptContainerDetail tmpe = new ReceiptContainerDetail(); | |
1834 | + tmpe.setReceiptContainerId(task.getAllocationHeadId()); | |
1835 | + tmpe.setWarehouseCode(task.getWarehouseCode()); | |
1836 | + LambdaQueryWrapper<ReceiptContainerDetail> receiptContainerDetailLambda = Wrappers.lambdaQuery(tmpe); | |
1837 | + List<ReceiptContainerDetail> receiptContainerDetailList = receiptContainerDetailService.list(receiptContainerDetailLambda); | |
1838 | + //stream修改库位 | |
1839 | + receiptContainerDetailList | |
1840 | + .stream() | |
1841 | + .forEach(r -> r.setLocationCode(receiptContainerHeader.getToLocation())); | |
1842 | + receiptContainerDetailService.updateBatchById(receiptContainerDetailList); | |
1843 | + //给子任务分配库位 | |
1844 | + TaskDetail tdtmp = new TaskDetail(); | |
1845 | + tdtmp.setTaskId(task.getId()); | |
1846 | + tdtmp.setWarehouseCode(task.getWarehouseCode()); | |
1847 | + tdtmp.setTaskType(task.getTaskType()); | |
1848 | + LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(tdtmp); | |
1849 | + List<TaskDetail> taskDetails = taskDetailService.list(taskDetailLambdaQueryWrapper); | |
1850 | + taskDetails.stream().forEach(t -> t.setToLocation(task.getToLocation())); | |
1851 | + taskDetailService.updateBatchById(taskDetails); | |
1852 | + //给任务分配库位 | |
1853 | + task.setToLocation(location.getCode()); | |
1854 | + task.setWeight(weight); | |
1855 | + //task.setFromLocation(location.getCode()); | |
1856 | + //LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(task); | |
1857 | + this.saveOrUpdate(task); | |
1858 | + return location.getCode(); | |
1859 | + } | |
1860 | + | |
1861 | + | |
1862 | + /** | |
1863 | + * 自动分配库位 | |
1864 | + * @param taskId 任务号 | |
1865 | + * @param high 1是高库位,否则低库位 | |
1866 | + * @return | |
1867 | + */ | |
1868 | + @Override | |
1869 | + @Transactional(rollbackFor = Exception.class) | |
1870 | + public AjaxResult setLocationCode(Integer taskId, Integer high) { | |
1871 | + TaskHeader taskHeader = this.getById(taskId); | |
1872 | + if (taskHeader == null) { | |
1873 | + throw new ServiceException("找不到id为"+ taskId +"的任务!"); | |
1874 | + } | |
1875 | + if (StringUtils.isNotEmpty(taskHeader.getToLocation())) { | |
1876 | + return AjaxResult.success("任务已经有目的库位,不需要再分配"); | |
1877 | + } | |
1878 | + Location location = new Location(); | |
1879 | + location.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
1880 | + | |
1881 | +// location.setRoadway(taskHeader.getr());//指定巷道 | |
1882 | + location.setContainerCode(""); | |
1883 | +// location.setZoneCode(taskHeader.getz()); | |
1884 | + location.setStatus("empty"); | |
1885 | + location.setDeleted(false); | |
1886 | + if("M".equals(taskHeader.getContainerCode().substring(0,1))){ | |
1887 | + if (high.intValue() == 1) { | |
1888 | + location.setILayer(5); | |
1889 | + } | |
1890 | + } | |
1891 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(location); | |
1892 | + location = locationService.getOne(locationLambdaQueryWrapper); | |
1893 | + if (location == null) { | |
1894 | + throw new ServiceException("没有对应库位可以分配给容器了!"); | |
1895 | + } | |
1896 | + //锁定库位 | |
1897 | + location.setStatus("lock"); | |
1898 | + locationService.update(location, locationLambdaQueryWrapper); | |
1899 | + //给组盘分配库位 | |
1900 | + | |
1901 | + int internalTaskType = taskHeader.getInternalTaskType(); | |
1902 | + if(internalTaskType == QuantityConstant.TASK_TYPE_WHOLERECEIPT.intValue() || internalTaskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT.intValue() ) { | |
1903 | + ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); | |
1904 | + receiptContainerHeader.setId(taskHeader.getAllocationHeadId()); | |
1905 | + receiptContainerHeader.setToLocation(location.getCode()); | |
1906 | + LambdaQueryWrapper<ReceiptContainerHeader> receiptContainerHeaderlLambdaQueryWrapper = Wrappers.lambdaQuery(receiptContainerHeader); | |
1907 | + receiptContainerHeaderService.update(receiptContainerHeader, receiptContainerHeaderlLambdaQueryWrapper); | |
1908 | + //给子任务分配库位 | |
1909 | + TaskDetail condition = new TaskDetail(); | |
1910 | + condition.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
1911 | + condition.setTaskId(taskHeader.getId()); | |
1912 | + LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(condition); | |
1913 | + TaskDetail taskDetail = taskDetailService.getOne(taskDetailLambdaQueryWrapper); | |
1914 | + if (taskDetail != null) { | |
1915 | + taskDetail.setToLocation(location.getCode()); | |
1916 | + taskDetailService.update(taskDetail, taskDetailLambdaQueryWrapper); | |
1917 | + } | |
1918 | + } | |
1919 | + //给任务分配库位 | |
1920 | + taskHeader.setToLocation(location.getCode()); | |
1921 | + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(taskHeader); | |
1922 | + this.update(taskHeader, taskHeaderLambdaQueryWrapper); | |
1923 | + return AjaxResult.success("生成库位成功",location.getCode()); | |
1924 | + | |
1925 | + } | |
1926 | + | |
1927 | + | |
1928 | + | |
1929 | + | |
1930 | + | |
1682 | 1931 | |
1683 | 1932 | } |
1684 | 1933 | \ No newline at end of file |
... | ... |
src/main/resources/application-druid.properties
... | ... | @@ -2,25 +2,25 @@ |
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 | |
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 | 6 | #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huahengExample?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
7 | -spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/xinyi_wms?characterEncoding=utf8&serverTimezone=GMT%2b8 | |
7 | +#spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms2.0?characterEncoding=utf8&serverTimezone=GMT%2b8 | |
8 | 8 | |
9 | -#spring.datasource.druid.master.username=softhuaheng | |
10 | -#spring.datasource.druid.master.password=HHrobot123. | |
11 | -spring.datasource.druid.master.username=root | |
12 | -spring.datasource.druid.master.password=123456 | |
9 | +spring.datasource.druid.master.username=softhuaheng | |
10 | +spring.datasource.druid.master.password=HHrobot123. | |
11 | +#spring.datasource.druid.master.username=root | |
12 | +#spring.datasource.druid.master.password=123456 | |
13 | 13 | # 从库 |
14 | 14 | spring.datasource.druid.slave.open = true |
15 | 15 | spring.datasource.druid.slave.url=jdbc:mysql://199.19.109.117:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false |
16 | 16 | #spring.datasource.druid.master.username=softhuaheng |
17 | 17 | #spring.datasource.druid.master.password=HHrobot123. |
18 | 18 | # 初始连接数 |
19 | -spring.datasource.druid.initial-size=10 | |
19 | +spring.datasource.druid.initial-size=4 | |
20 | 20 | # 最大连接池数量 |
21 | -spring.datasource.druid.max-active=100 | |
21 | +spring.datasource.druid.max-active=10 | |
22 | 22 | # 最小连接池数量 |
23 | -spring.datasource.druid.min-idle=10 | |
23 | +spring.datasource.druid.min-idle=4 | |
24 | 24 | # 配置获取连接等待超时的时间 |
25 | 25 | spring.datasource.druid.max-wait=60000 |
26 | 26 | # 打开PSCache,并且指定每个连接上PSCache的大小 |
... | ... |
src/main/resources/logback.xml
... | ... | @@ -215,22 +215,22 @@ |
215 | 215 | <!--</appender>--> |
216 | 216 | |
217 | 217 | <!--将日志传到数据库 表logging_event--> |
218 | - <appender name="DB" class="ch.qos.logback.classic.db.DBAppender"> | |
219 | - <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource"> | |
220 | - <dataSource class="${dataSource}"> | |
221 | - <driverClassName>${driverClassName}</driverClassName> | |
222 | - <url>${url}</url> | |
223 | - <username>${username}</username> | |
224 | - <password>${password}</password> | |
225 | - </dataSource> | |
226 | - </connectionSource> | |
218 | + <!--<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">--> | |
219 | + <!--<connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">--> | |
220 | + <!--<dataSource class="${dataSource}">--> | |
221 | + <!--<driverClassName>${driverClassName}</driverClassName>--> | |
222 | + <!--<url>${url}</url>--> | |
223 | + <!--<username>${username}</username>--> | |
224 | + <!--<password>${password}</password>--> | |
225 | + <!--</dataSource>--> | |
226 | + <!--</connectionSource>--> | |
227 | 227 | |
228 | - <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |
229 | - <level>ERROR</level> | |
230 | - <onMatch>ACCEPT</onMatch> | |
231 | - <onMismatch>DENY</onMismatch> | |
232 | - </filter> | |
233 | - </appender> | |
228 | + <!--<filter class="ch.qos.logback.classic.filter.LevelFilter">--> | |
229 | + <!--<level>ERROR</level>--> | |
230 | + <!--<onMatch>ACCEPT</onMatch>--> | |
231 | + <!--<onMismatch>DENY</onMismatch>--> | |
232 | + <!--</filter>--> | |
233 | + <!--</appender>--> | |
234 | 234 | |
235 | 235 | <!-- 显示形成的sql、使用的参数、结果集 --> |
236 | 236 | <!--<logger name="java.sql" level="DEBUG" >--> |
... | ... | @@ -254,7 +254,7 @@ |
254 | 254 | <appender-ref ref="file_info" /> |
255 | 255 | <appender-ref ref="file_warn"/> |
256 | 256 | <appender-ref ref="file_error"/> |
257 | - <appender-ref ref="DB"/> | |
257 | + <!--<appender-ref ref="DB"/>--> | |
258 | 258 | </root> |
259 | 259 | |
260 | 260 | |
... | ... |
src/main/resources/mybatis/config/CompanyMapper.xml
... | ... | @@ -54,8 +54,8 @@ |
54 | 54 | INNER JOIN warehouse_company wc ON wc.companyId=c.id AND wc.warehouseCode = #{warehouseCode} |
55 | 55 | </select> |
56 | 56 | <select id="selectByWarehouseCode" resultType="com.huaheng.pc.config.company.domain.Company"> |
57 | - select company.id from company INNER JOIN warehouse_company ON company.id = warehouse_company.companyId | |
58 | - where company.warehouseCode = #{warehouseCode} | |
57 | + select c.id, c.name ,c.code from company c INNER JOIN warehouse_company w ON c.id = w.companyId | |
58 | + where c.warehouseCode = #{warehouseCode} | |
59 | 59 | </select> |
60 | 60 | |
61 | 61 | <select id="selectListEntityByEqual" resultType="com.huaheng.pc.config.company.domain.Company"> |
... | ... |
src/main/resources/mybatis/config/ContainerMapper.xml
... | ... | @@ -35,10 +35,18 @@ |
35 | 35 | </sql> |
36 | 36 | |
37 | 37 | <select id="getEmptyContainerInLocation" resultType="com.huaheng.pc.config.location.domain.Location"> |
38 | - SELECT * FROM location t | |
38 | + SELECT t.id, t.code, t.warehouseCode, t.zoneCode, t.locationType, t.containerCode, t.iRow, t.iColumn, t.iLayer, | |
39 | + t.iGrid, t.roadway, t.status, t.`name`, t.lastCycleCountDate, t.created, t.createdBy, t.lastUpdated, t.lastUpdatedBy, | |
40 | + t.version, t.userDef1, t.userDef2, t.userDef3, t.userDef4, t.userDef5, t.userDef6, t.userDef7, t.userDef8, | |
41 | + t.systemCreated | |
42 | + FROM location t | |
39 | 43 | <where> |
40 | - t.zoneCode = 'L' AND t.warehouseCode = #{warehouseCode} AND t.status='empty' AND t.containerCode !='' AND t.containerCode is not NULL | |
41 | - AND t.`code` NOT in (SELECT b.locationCode FROM inventory_header b WHERE b.warehouseCode = #{warehouseCode} ) | |
44 | + t.locationType = 'LK' | |
45 | + AND t.warehouseCode = #{warehouseCode} | |
46 | + AND t.status='empty' | |
47 | + AND t.containerCode !='' | |
48 | + AND t.containerCode is not NULL | |
49 | + AND t.`code` NOT in (SELECT b.locationCode FROM inventory_detail b WHERE b.warehouseCode = #{warehouseCode} ) | |
42 | 50 | <if test="containerCode != null and containerCode !=''"> |
43 | 51 | and t.containerCode = #{containerCode} |
44 | 52 | </if> |
... | ... | @@ -48,6 +56,30 @@ |
48 | 56 | </where> |
49 | 57 | </select> |
50 | 58 | |
59 | +<!-- <select id="getEmptyContainerInLocation" resultType="com.huaheng.pc.config.location.domain.Location"> | |
60 | + SELECT t.id, t.code, t.warehouseCode, t.zoneCode, t.locationType, t.containerCode, t.iRow, t.iColumn, t.iLayer, | |
61 | + t.iGrid, t.roadway, t.status, t.`name`, t.lastCycleCountDate, t.created, t.createdBy, t.lastUpdated, t.lastUpdatedBy, | |
62 | + t.version, t.userDef1, t.userDef2, t.userDef3, t.userDef4, t.userDef5, t.userDef6, t.userDef7, t.userDef8, | |
63 | + t.systemCreated | |
64 | + FROM location t | |
65 | + INNER JOIN ( SELECT locationCode,containerCode FROM inventory_header WHERE containerStatus = 'empty' ) i | |
66 | + on i.containerCode = t.containerCode | |
67 | + AND i.locationCode = t.code | |
68 | + <where> | |
69 | + t.locationType = 'LK' | |
70 | + AND t.warehouseCode = #{warehouseCode} | |
71 | + AND t.status='empty' | |
72 | + AND t.containerCode !='' | |
73 | + AND t.containerCode is not NULL | |
74 | + <if test="containerCode != null and containerCode !=''"> | |
75 | + and t.containerCode = #{containerCode} | |
76 | + </if> | |
77 | + <if test="locationCode != null and locationCode !=''"> | |
78 | + and t.`code` = #{locationCode} | |
79 | + </if> | |
80 | + </where> | |
81 | + </select>--> | |
82 | + | |
51 | 83 | <update id="updateLocationCodeAndStatus"> |
52 | 84 | UPDATE container set `status`=#{status}, locationCode=#{locationCode} WHERE warehouseCode=#{warehouseCode} AND `code`=#{containerCode} |
53 | 85 | </update> |
... | ... |
src/main/resources/mybatis/config/LocationMapper.xml
... | ... | @@ -30,11 +30,12 @@ |
30 | 30 | <result column="userDef7" jdbcType="VARCHAR" property="userDef7" /> |
31 | 31 | <result column="userDef8" jdbcType="VARCHAR" property="userDef8" /> |
32 | 32 | <result column="systemCreated" jdbcType="INTEGER" property="systemCreated" /> |
33 | + <result column="deleted" jdbcType="BIT" property="deleted" /> | |
33 | 34 | </resultMap> |
34 | 35 | <sql id="Base_Column_List"> |
35 | 36 | <!--@mbg.generated--> |
36 | 37 | id, code, warehouseCode, zoneCode, locationType, containerCode, iRow, iColumn, iLayer, |
37 | - iGrid, roadway, `name`, `enable`, lastCycleCountDate, created, createdBy, lastUpdated, lastUpdatedBy, | |
38 | + iGrid, roadway, status, `name`, lastCycleCountDate, created, createdBy, lastUpdated, lastUpdatedBy, | |
38 | 39 | version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, |
39 | 40 | systemCreated |
40 | 41 | </sql> |
... | ... | @@ -96,7 +97,30 @@ |
96 | 97 | </select> |
97 | 98 | |
98 | 99 | <select id="pickLocation" resultType="com.huaheng.pc.config.location.domain.Location"> |
99 | - select * from location | |
100 | - where containerCode != '' and status = "empty" | |
100 | + select id, code, warehouseCode, zoneCode, locationType, containerCode, iRow, iColumn, iLayer, | |
101 | + iGrid, roadway, status, `name`, lastCycleCountDate, created, createdBy, lastUpdated, lastUpdatedBy, | |
102 | + version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, | |
103 | + systemCreated from location | |
104 | + where containerCode != '' and status = 'empty' | |
101 | 105 | </select> |
106 | + | |
107 | + <select id="selectContainerEmpty" resultType="com.huaheng.pc.config.location.domain.Location"> | |
108 | + SELECT id, code, warehouseCode, zoneCode, locationType, containerCode, iRow, iColumn, iLayer, | |
109 | + iGrid, roadway, `name`, `enable`, lastCycleCountDate, created, createdBy, lastUpdated, lastUpdatedBy, | |
110 | + version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, | |
111 | + systemCreated | |
112 | + FROM location t | |
113 | + <where> | |
114 | + t.warehouseCode = #{warehouseCode} | |
115 | + AND t.status='empty' | |
116 | + AND t.containerCode !='' | |
117 | + AND t.containerCode is not NULL | |
118 | + AND t.`code` NOT in | |
119 | + (SELECT b.locationCode FROM inventory_detail WHERE b.warehouseCode = #{warehouseCode}) | |
120 | + ORDER BY t.lastUpdated ASC | |
121 | + </where> | |
122 | + </select> | |
123 | + | |
124 | + | |
125 | + | |
102 | 126 | </mapper> |
103 | 127 | \ No newline at end of file |
... | ... |
src/main/resources/mybatis/shipment/ShipmentDetailMapper.xml
... | ... | @@ -57,10 +57,10 @@ |
57 | 57 | |
58 | 58 | |
59 | 59 | <select id="SelectFirstStatus" resultType="java.util.Map"> |
60 | - SELECT h.id, h.firstStatus | |
60 | + SELECT h.id, h.firstStatus, h.status | |
61 | 61 | FROM shipment_header h |
62 | 62 | INNER JOIN shipment_detail d ON h.id = d.shipmentId AND d.id IN (#{ids}) |
63 | - GROUP BY h.id,firstStatus | |
63 | + GROUP BY h.id,h.firstStatus | |
64 | 64 | </select> |
65 | 65 | |
66 | 66 | <delete id="batchDelete"> |
... | ... |
src/main/resources/templates/config/waveMaster/add.html
... | ... | @@ -65,30 +65,30 @@ |
65 | 65 | <input id="shipmentGroupSize" name="shipmentGroupSize" class="form-control" type="text"> |
66 | 66 | </div> |
67 | 67 | </div> |
68 | - <div class="form-group"> | |
69 | - <label class="col-sm-3 control-label">是否补货:</label> | |
70 | - <div class="col-sm-8"> | |
71 | - <div class="onoffswitch"> | |
72 | - <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="needReplenishment" name="needReplenishment"> | |
73 | - <label class="onoffswitch-label" for="needReplenishment"> | |
74 | - <span class="onoffswitch-inner"></span> | |
75 | - <span class="onoffswitch-switch"></span> | |
76 | - </label> | |
77 | - </div> | |
78 | - </div> | |
79 | - </div> | |
80 | - <div class="form-group"> | |
81 | - <label class="col-sm-3 control-label">取消波次时保留补货任务:</label> | |
82 | - <div class="col-sm-8"> | |
83 | - <div class="onoffswitch"> | |
84 | - <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="holdRplnTask" name="holdRplnTask"> | |
85 | - <label class="onoffswitch-label" for="holdRplnTask"> | |
86 | - <span class="onoffswitch-inner"></span> | |
87 | - <span class="onoffswitch-switch"></span> | |
88 | - </label> | |
89 | - </div> | |
90 | - </div> | |
91 | - </div> | |
68 | + <!--<div class="form-group">--> | |
69 | + <!--<label class="col-sm-3 control-label">是否补货:</label>--> | |
70 | + <!--<div class="col-sm-8">--> | |
71 | + <!--<div class="onoffswitch">--> | |
72 | + <!--<input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="needReplenishment" name="needReplenishment">--> | |
73 | + <!--<label class="onoffswitch-label" for="needReplenishment">--> | |
74 | + <!--<span class="onoffswitch-inner"></span>--> | |
75 | + <!--<span class="onoffswitch-switch"></span>--> | |
76 | + <!--</label>--> | |
77 | + <!--</div>--> | |
78 | + <!--</div>--> | |
79 | + <!--</div>--> | |
80 | + <!--<div class="form-group">--> | |
81 | + <!--<label class="col-sm-3 control-label">取消波次时保留补货任务:</label>--> | |
82 | + <!--<div class="col-sm-8">--> | |
83 | + <!--<div class="onoffswitch">--> | |
84 | + <!--<input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="holdRplnTask" name="holdRplnTask">--> | |
85 | + <!--<label class="onoffswitch-label" for="holdRplnTask">--> | |
86 | + <!--<span class="onoffswitch-inner"></span>--> | |
87 | + <!--<span class="onoffswitch-switch"></span>--> | |
88 | + <!--</label>--> | |
89 | + <!--</div>--> | |
90 | + <!--</div>--> | |
91 | + <!--</div>--> | |
92 | 92 | <!--<div class="form-group"> |
93 | 93 | <label class="col-sm-3 control-label">数据版本:</label> |
94 | 94 | <div class="col-sm-8"> |
... | ... | @@ -211,12 +211,12 @@ |
211 | 211 | shipmentGroupSize: { |
212 | 212 | required: true, |
213 | 213 | }, |
214 | - holdRplnTask: { | |
215 | - required: true, | |
216 | - }, | |
217 | - needReplenishment: { | |
218 | - required: true, | |
219 | - } | |
214 | + // holdRplnTask: { | |
215 | + // required: true, | |
216 | + // }, | |
217 | + // needReplenishment: { | |
218 | + // required: true, | |
219 | + // } | |
220 | 220 | }, |
221 | 221 | submitHandler: function(form) { |
222 | 222 | var tableValue = $.common.getTableValue("#form-waveMaster-add"); |
... | ... |