Commit 2478b27df4ef8eb015ae2c5ee70c7be90e6ad845

Authored by 肖超群
2 parents 486e732b e49b2c5e

Merge branch 'develop' of http://git.huahengcloud.com/wms/wms4 into develop

Showing 22 changed files with 449 additions and 43 deletions
ant-design-vue-jeecg/src/views/dashboard/Analysis.vue
... ... @@ -3,7 +3,7 @@
3 3 <a-row :gutter="24">
4 4  
5 5 <div class="col-sm-2" style="padding:5px;">
6   - <a class="menuItem" href="/wms/inventory/inventoryTransaction">
  6 + <a class="menuItem" @click="clickInventoryTransactionList()">
7 7  
8 8 <div class="total_box ys01">
9 9 <h1>{{ s1 }}</h1>
... ... @@ -12,7 +12,7 @@
12 12 </a>
13 13 </div>
14 14 <div class="col-sm-2" style="padding:5px;">
15   - <a class="menuItem" href="/wms/receipt/receiptHeader/900/0">
  15 + <a class="menuItem" @click="clickInventoryTransactionList()">
16 16 <div class="total_box ys02">
17 17 <h1>{{ s2 }}</h1>
18 18 <p>今日入库量</p>
... ... @@ -20,7 +20,7 @@
20 20 </a>
21 21 </div>
22 22 <div class="col-sm-2" style="padding:5px;">
23   - <a class="menuItem" href="/wms/shipment/shipmentHeader">
  23 + <a class="menuItem" @click="clickInventoryTransactionList()">
24 24 <div class="total_box ys03">
25 25 <h1>{{ s3 }}</h1>
26 26 <p>今日出库量</p>
... ... @@ -28,7 +28,7 @@
28 28 </a>
29 29 </div>
30 30 <div class="col-sm-2" style="padding:5px;">
31   - <a class="menuItem" href="/wms/inventory/inventoryHeader">
  31 + <a class="menuItem" @click="clickInventoryMaterialSummaryList()">
32 32 <div class="total_box ys04">
33 33 <h1>{{ s4 }}</h1>
34 34 <p>库存总量</p>
... ... @@ -36,7 +36,7 @@
36 36 </a>
37 37 </div>
38 38 <div class="col-sm-2" style="padding:5px;">
39   - <a class="menuItem" href="/wms/inventory/inventoryMaterialSummary">
  39 + <a class="menuItem" @click="clickInventoryMaterialSummaryList()">
40 40 <div class="total_box ys05">
41 41 <h1>{{ s5 }}</h1>
42 42 <p>库内物料品数</p>
... ... @@ -44,7 +44,7 @@
44 44 </a>
45 45 </div>
46 46 <div class="col-sm-2" style="padding:5px;">
47   - <a class="menuItem" href="/wms/task/taskHeader?InternalTaskType=100">
  47 + <a class="menuItem" @click="clickAllTasks()" >
48 48 <div class="total_box ys06">
49 49 <h1>{{ s6 }}</h1>
50 50 <p>待执行任务数</p>
... ... @@ -167,6 +167,15 @@ export default {
167 167 }
168 168 })
169 169  
  170 + },
  171 + clickAllTasks() {
  172 + this.$router.push({path: '/system/task/AllTaskHeaderList'})
  173 + },
  174 + clickInventoryTransactionList() {
  175 + this.$router.push({path: '/system/inventory/InventoryTransactionList'})
  176 + },
  177 + clickInventoryMaterialSummaryList() {
  178 + this.$router.push({path: '/system/inventory/InventoryMaterialSummaryList'})
170 179 }
171 180 }
172 181 }
... ...
ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue
... ... @@ -107,6 +107,12 @@
107 107 <a-upload v-has="'receiptHeader:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
108 108 <a-button type="primary" icon="import">导入</a-button>
109 109 </a-upload>
  110 + <a-upload v-has="'receiptHeader:importReceipt'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrlReceipt" @change="handleImportExcel">
  111 + <a-button type="primary" icon="import">导入入库单</a-button>
  112 + </a-upload>
  113 + <a-button v-has="'receiptHeader:exportReceipt'" type="primary" icon="download" @click="downWord">
  114 + 入库单模板下载
  115 + </a-button>
110 116 <a-button v-has="'receiptHeader:print'" @click="batchPrint()" type="primary">打印</a-button>
111 117 <j-super-query :fieldList="superFieldList" v-has="'receiptHeader:superQuery'" @handleSuperQuery="handleSuperQuery"/>
112 118  
... ... @@ -232,7 +238,7 @@
232 238 import {JeecgListMixin} from '@/mixins/JeecgListMixin'
233 239 import ReceiptHeaderModal from './modules/ReceiptHeaderModal'
234 240 import ReceiptAuditModal from "./modules/ReceiptAuditModal";
235   -import {getAction} from '@/api/manage'
  241 +import {downFile, getAction} from '@/api/manage'
236 242 import ReceiptDetailList from './ReceiptDetailList'
237 243 import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil'
238 244 import '@/assets/less/TableExpand.less'
... ... @@ -373,6 +379,8 @@ export default {
373 379 deleteBatch: "/receipt/receiptHeader/deleteBatch",
374 380 exportXlsUrl: "/receipt/receiptHeader/exportXls",
375 381 importExcelUrl: "receipt/receiptHeader/importExcel",
  382 + importExcelUrlReceipt: "receipt/receiptHeader/importReceipt",
  383 + downLoadReceipt: '/sys/common/downLoadReceipt'
376 384 },
377 385 dictOptions: {
378 386 firstStatus: [],
... ... @@ -405,6 +413,9 @@ export default {
405 413 computed: {
406 414 importExcelUrl: function () {
407 415 return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  416 + },
  417 + importExcelUrlReceipt: function () {
  418 + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrlReceipt}`;
408 419 }
409 420 },
410 421 mounted() {
... ... @@ -617,6 +628,29 @@ export default {
617 628 })
618 629 return actions.join('')
619 630 },
  631 + downWord() {
  632 + var fileName = '入库单模板.xls'
  633 + return downFile(this.url.downLoadReceipt, fileName).then(data => {
  634 + this.$message.info('入库单模板开始下载....')
  635 + if (!data || data.size === 0) {
  636 + this.$message.error('文件下载失败')
  637 + return
  638 + }
  639 + if (typeof window.navigator.msSaveBlob !== 'undefined') {
  640 + window.navigator.msSaveBlob(new Blob([data]), fileName)
  641 + } else {
  642 + let url = window.URL.createObjectURL(new Blob([data]))
  643 + let link = document.createElement('a')
  644 + link.style.display = 'none'
  645 + link.href = url
  646 + link.setAttribute('downLoad', fileName)
  647 + document.body.appendChild(link)
  648 + link.click()
  649 + document.body.removeChild(link) //下载完成移除元素
  650 + window.URL.revokeObjectURL(url) //释放掉blob对象
  651 + }
  652 + })
  653 + },
620 654 }
621 655 }
622 656 </script>
... ...
ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue
... ... @@ -124,6 +124,12 @@
124 124 <a-upload v-has="'shipmentHeader:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
125 125 <a-button type="primary" icon="import">导入</a-button>
126 126 </a-upload>
  127 + <a-upload v-has="'shipmentHeader:importShipment'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrlShipment" @change="handleImportExcel">
  128 + <a-button type="primary" icon="import">导入出库单</a-button>
  129 + </a-upload>
  130 + <a-button v-has="'shipmentHeader:exportShipment'" type="primary" icon="download" @click="downWord">
  131 + 出库单模板下载
  132 + </a-button>
127 133 <a-button v-has="'shipmentHeader:print'" @click="batchPrint()" type="primary">打印</a-button>
128 134 <j-super-query :fieldList="superFieldList" v-has="'shipmentHeader:superQuery'" @handleSuperQuery="handleSuperQuery"/>
129 135 </div>
... ... @@ -256,7 +262,7 @@
256 262  
257 263 import {JeecgListMixin} from '@/mixins/JeecgListMixin'
258 264 import ShipmentHeaderModal from './modules/ShipmentHeaderModal'
259   -import {getAction} from '@/api/manage'
  265 +import {downFile, getAction} from '@/api/manage'
260 266 import ShipmentDetailList from './ShipmentDetailList'
261 267 import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil'
262 268 import '@/assets/less/TableExpand.less'
... ... @@ -409,6 +415,8 @@ export default {
409 415 deleteBatch: "/shipment/shipmentHeader/deleteBatch",
410 416 exportXlsUrl: "/shipment/shipmentHeader/exportXls",
411 417 importExcelUrl: "shipment/shipmentHeader/importExcel",
  418 + importShipment: "/shipment/shipmentHeader/importShipment",
  419 + downLoadShipment: '/sys/common/downLoadShipment'
412 420 },
413 421 dictOptions: {
414 422 firstStatus: [],
... ... @@ -454,10 +462,12 @@ export default {
454 462 computed: {
455 463 importExcelUrl: function () {
456 464 return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  465 + },
  466 + importExcelUrlShipment: function () {
  467 + return `${window._CONFIG['domianURL']}/${this.url.importShipment}`;
457 468 }
458 469 },
459 470 methods: {
460   - autoShipmentAdvice,
461 471 mergeShipment() {
462 472 if (this.selectedRowKeys.length <= 1) {
463 473 this.$message.warning('至少选择两条记录!')
... ... @@ -722,7 +732,30 @@ export default {
722 732 fieldList.push({type: 'string', value: 'updateBy', text: '更新人', dictCode: ''})
723 733 fieldList.push({type: 'datetime', value: 'updateTime', text: '更新日期'})
724 734 this.superFieldList = fieldList
725   - }
  735 + },
  736 + downWord() {
  737 + var fileName = '出库单模板.xls'
  738 + return downFile(this.url.downLoadShipment, fileName).then(data => {
  739 + this.$message.info('出库单模板开始下载....')
  740 + if (!data || data.size === 0) {
  741 + this.$message.error('文件下载失败')
  742 + return
  743 + }
  744 + if (typeof window.navigator.msSaveBlob !== 'undefined') {
  745 + window.navigator.msSaveBlob(new Blob([data]), fileName)
  746 + } else {
  747 + let url = window.URL.createObjectURL(new Blob([data]))
  748 + let link = document.createElement('a')
  749 + link.style.display = 'none'
  750 + link.href = url
  751 + link.setAttribute('downLoad', fileName)
  752 + document.body.appendChild(link)
  753 + link.click()
  754 + document.body.removeChild(link) //下载完成移除元素
  755 + window.URL.revokeObjectURL(url) //释放掉blob对象
  756 + }
  757 + })
  758 + },
726 759 }
727 760 }
728 761 </script>
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/CommonController.java
... ... @@ -464,4 +464,92 @@ public class CommonController {
464 464 return;
465 465 }
466 466  
  467 + @RequestMapping("/downLoadReceipt")
  468 + public void downloadFileReceipt(HttpServletResponse response) {
  469 + String fileName = "入库单模板.xls";
  470 + String docPath = "/file/" + fileName;
  471 + ServletOutputStream out = null;
  472 + InputStream ips = null;
  473 + try {
  474 + // 获取文件存放的路径
  475 + ips = getClass().getResourceAsStream(docPath);
  476 + if (ips == null) {
  477 + // 如果文件不存在就跳出
  478 + return;
  479 + }
  480 + response.setContentType("multipart/form-data");
  481 + response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO8859-1") + "\"");
  482 + out = response.getOutputStream();
  483 + // 读取文件流
  484 + int len = 0;
  485 + byte[] buffer = new byte[1024 * 10];
  486 + while ((len = ips.read(buffer)) != -1) {
  487 + out.write(buffer, 0, len);
  488 + }
  489 + out.flush();
  490 + } catch (Exception e) {
  491 + log.error("入库单模板下载异常", e);
  492 + } finally {
  493 + try {
  494 + if (out != null) {
  495 + out.close();
  496 + }
  497 + } catch (IOException e) {
  498 + log.error("关闭流出现异常", e);
  499 + }
  500 + try {
  501 + if (ips != null) {
  502 + ips.close();
  503 + }
  504 + } catch (IOException e) {
  505 + log.error("关闭流出现异常", e);
  506 + }
  507 + }
  508 + return;
  509 + }
  510 +
  511 + @RequestMapping("/downLoadShipment")
  512 + public void downloadFilehipment(HttpServletResponse response) {
  513 + String fileName = "出库单模板.xls";
  514 + String docPath = "/file/" + fileName;
  515 + ServletOutputStream out = null;
  516 + InputStream ips = null;
  517 + try {
  518 + // 获取文件存放的路径
  519 + ips = getClass().getResourceAsStream(docPath);
  520 + if (ips == null) {
  521 + // 如果文件不存在就跳出
  522 + return;
  523 + }
  524 + response.setContentType("multipart/form-data");
  525 + response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO8859-1") + "\"");
  526 + out = response.getOutputStream();
  527 + // 读取文件流
  528 + int len = 0;
  529 + byte[] buffer = new byte[1024 * 10];
  530 + while ((len = ips.read(buffer)) != -1) {
  531 + out.write(buffer, 0, len);
  532 + }
  533 + out.flush();
  534 + } catch (Exception e) {
  535 + log.error("出库单模板下载异常", e);
  536 + } finally {
  537 + try {
  538 + if (out != null) {
  539 + out.close();
  540 + }
  541 + } catch (IOException e) {
  542 + log.error("关闭流出现异常", e);
  543 + }
  544 + try {
  545 + if (ips != null) {
  546 + ips.close();
  547 + }
  548 + } catch (IOException e) {
  549 + log.error("关闭流出现异常", e);
  550 + }
  551 + }
  552 + return;
  553 + }
  554 +
467 555 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/impl/AcsServiceImpl.java
... ... @@ -246,7 +246,7 @@ public class AcsServiceImpl implements IAcsService {
246 246 return Result.error("分配库位时,高度不匹配,WCS给的高度值" + highHeight + "不在WMS系统配置范围内");
247 247 }
248 248 int high = locationHigh.getHigh();
249   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_ALLOCATION, zoneCode);
  249 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_ALLOCATION, zoneCode);
250 250 if (StringUtils.isEmpty(value)) {
251 251 return Result.error("分配库位时, 未绑定定位规则");
252 252 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mobile/service/impl/MobileService.java
... ... @@ -74,7 +74,7 @@ public class MobileService implements IMobileService {
74 74  
75 75 String fromLocationCode = container.getLocationCode();
76 76 String toLocationCode = QuantityConstant.EMPTY_STRING;
77   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
  77 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
78 78 int taskLocationRule = Integer.parseInt(value);
79 79 if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) {
80 80 toLocationCode = fromLocationCode;
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... ... @@ -206,7 +206,7 @@ public class WcsServiceImpl implements WcsService {
206 206 return Result.error("分配库位时,高度不匹配,WCS给的高度值" + highHeight + "不在WMS系统配置范围内");
207 207 }
208 208 int high = locationHigh.getHigh();
209   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_ALLOCATION, zoneCode);
  209 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_ALLOCATION, zoneCode);
210 210 if (StringUtils.isEmpty(value)) {
211 211 return Result.error("分配库位时, 未绑定定位规则");
212 212 }
... ... @@ -521,7 +521,7 @@ public class WcsServiceImpl implements WcsService {
521 521 throw new JeecgBootException("任务下发,容器没有找到");
522 522 }
523 523  
524   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_CONNECT_WCS, container.getZoneCode());
  524 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_CONNECT_WCS, container.getZoneCode());
525 525 if (StringUtils.isEmpty(value)) {
526 526 throw new JeecgBootException("任务下发,没有找到连接WCS的数据配置");
527 527 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wms/service/WmsServiceImpl.java
... ... @@ -230,7 +230,7 @@ public class WmsServiceImpl implements WmsService {
230 230 }
231 231 }
232 232 if (wmsEntity.getTaskType() == QuantityConstant.TASK_TYPE_WHOLERECEIPT) {
233   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.START_LOCKING_STATION, zoneCode);
  233 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.START_LOCKING_STATION, zoneCode);
234 234 if (StringUtils.isNotEmpty(value)) {
235 235 int lockStation = Integer.parseInt(value);
236 236 if (lockStation == QuantityConstant.START_LOCK_STATION) {
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/parameterConfiguration/service/IParameterConfigurationService.java
... ... @@ -14,7 +14,9 @@ public interface IParameterConfigurationService extends IService&lt;ParameterConfig
14 14  
15 15 String getValueByCode(String code);
16 16  
17   - String getValueByCode(String code, String zoneCode);
  17 + String getValueByZoneCode(String code, String zoneCode);
18 18  
19   - int getValueIntByCode(String code);
  19 + int getIntValueByCode(String code);
  20 +
  21 + String getValueByCode(String code, String defaultValue);
20 22 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/parameterConfiguration/service/impl/ParameterConfigurationServiceImpl.java
... ... @@ -9,6 +9,7 @@ import org.jeecg.utils.constant.QuantityConstant;
9 9 import org.springframework.cache.annotation.Cacheable;
10 10 import org.springframework.stereotype.Service;
11 11  
  12 +import com.aliyuncs.utils.StringUtils;
12 13 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
13 14 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
14 15 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
... ... @@ -20,8 +21,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
20 21 * @Version: V1.0
21 22 */
22 23 @Service
23   -public class ParameterConfigurationServiceImpl extends ServiceImpl<ParameterConfigurationMapper, ParameterConfiguration>
24   - implements IParameterConfigurationService {
  24 +public class ParameterConfigurationServiceImpl extends ServiceImpl<ParameterConfigurationMapper, ParameterConfiguration> implements IParameterConfigurationService {
25 25  
26 26 @Resource
27 27 IParameterConfigurationService parameterConfigurationService;
... ... @@ -30,32 +30,45 @@ public class ParameterConfigurationServiceImpl extends ServiceImpl&lt;ParameterConf
30 30 @Cacheable(value = "parameterConfigurationService#3600", key = "#root.methodName + '_' + #code", unless = "#result == null")
31 31 public String getValueByCode(String code) {
32 32 LambdaQueryWrapper<ParameterConfiguration> parameterConfigurationLambdaQueryWrapper = Wrappers.lambdaQuery();
33   - parameterConfigurationLambdaQueryWrapper.eq(ParameterConfiguration::getCode, code).eq(ParameterConfiguration::getZoneCode,
34   - QuantityConstant.EMPTY_STRING);
  33 + parameterConfigurationLambdaQueryWrapper.eq(ParameterConfiguration::getCode, code).eq(ParameterConfiguration::getZoneCode, QuantityConstant.EMPTY_STRING);
35 34 ParameterConfiguration parameterConfiguration = getOne(parameterConfigurationLambdaQueryWrapper);
36 35 if (parameterConfiguration == null) {
37 36 return null;
38 37 }
  38 + return parameterConfiguration.getValue();
  39 + }
  40 +
  41 + @Override
  42 + @Cacheable(value = "parameterConfigurationService#3600", key = "#root.methodName + '_' + #code", unless = "#result == null")
  43 + public String getValueByCode(String code, String defaultValue) {
  44 + LambdaQueryWrapper<ParameterConfiguration> parameterConfigurationLambdaQueryWrapper = Wrappers.lambdaQuery();
  45 + parameterConfigurationLambdaQueryWrapper.eq(ParameterConfiguration::getCode, code).eq(ParameterConfiguration::getZoneCode, QuantityConstant.EMPTY_STRING);
  46 + ParameterConfiguration parameterConfiguration = getOne(parameterConfigurationLambdaQueryWrapper);
  47 + if (parameterConfiguration == null) {
  48 + return defaultValue;
  49 + }
39 50 String value = parameterConfiguration.getValue();
40   - return value;
  51 + if (StringUtils.isEmpty(value)) {
  52 + return defaultValue;
  53 + }
  54 + return parameterConfiguration.getValue();
41 55 }
42 56  
43 57 @Override
44 58 @Cacheable(value = "parameterConfigurationService#3600", key = "#root.methodName + '_' + #code + '_' + #zoneCode", unless = "#result == null")
45   - public String getValueByCode(String code, String zoneCode) {
  59 + public String getValueByZoneCode(String code, String zoneCode) {
46 60 LambdaQueryWrapper<ParameterConfiguration> parameterConfigurationLambdaQueryWrapper = Wrappers.lambdaQuery();
47 61 parameterConfigurationLambdaQueryWrapper.eq(ParameterConfiguration::getCode, code).eq(ParameterConfiguration::getZoneCode, zoneCode);
48 62 ParameterConfiguration parameterConfiguration = getOne(parameterConfigurationLambdaQueryWrapper);
49 63 if (parameterConfiguration == null) {
50 64 return parameterConfigurationService.getValueByCode(code);
51 65 }
52   - String value = parameterConfiguration.getValue();
53   - return value;
  66 + return parameterConfiguration.getValue();
54 67 }
55 68  
56 69 @Override
57 70 @Cacheable(value = "parameterConfigurationService#3600", key = "#root.methodName + '_' + #code + '_int'", unless = "#result == null")
58   - public int getValueIntByCode(String code) {
  71 + public int getIntValueByCode(String code) {
59 72 LambdaQueryWrapper<ParameterConfiguration> parameterConfigurationLambdaQueryWrapper = Wrappers.lambdaQuery();
60 73 parameterConfigurationLambdaQueryWrapper.eq(ParameterConfiguration::getCode, code);
61 74 ParameterConfiguration parameterConfiguration = getOne(parameterConfigurationLambdaQueryWrapper);
... ... @@ -63,7 +76,9 @@ public class ParameterConfigurationServiceImpl extends ServiceImpl&lt;ParameterConf
63 76 return 0;
64 77 }
65 78 String value = parameterConfiguration.getValue();
66   - int valueInt = Integer.parseInt(value);
67   - return valueInt;
  79 + if (StringUtils.isEmpty(value)) {
  80 + return 0;
  81 + }
  82 + return Integer.parseInt(value);
68 83 }
69 84 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
... ... @@ -274,7 +274,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
274 274 throw new JeecgBootException("创建入库任务, 更新入库单明细失败");
275 275 }
276 276 }
277   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.START_LOCKING_STATION, zoneCode);
  277 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.START_LOCKING_STATION, zoneCode);
278 278 if (StringUtils.isNotEmpty(value)) {
279 279 int lockStation = Integer.parseInt(value);
280 280 if (lockStation == QuantityConstant.START_LOCK_STATION) {
... ... @@ -383,7 +383,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
383 383 if (container == null) {
384 384 throw new JeecgBootException("取消入库任务时, 容器为空");
385 385 }
386   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_CANCEL_TASK, container.getZoneCode());
  386 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_CANCEL_TASK, container.getZoneCode());
387 387 if (StringUtils.isEmpty(value)) {
388 388 throw new JeecgBootException("取消入库任务时, 没有获取到配置属性");
389 389 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/controller/ReceiptHeaderController.java
1 1 package org.jeecg.modules.wms.receipt.receiptHeader.controller;
2 2  
3 3 import java.io.IOException;
4   -import java.util.Arrays;
5   -import java.util.Collections;
6   -import java.util.List;
7   -import java.util.Map;
  4 +import java.util.*;
8 5 import java.util.stream.Collectors;
9 6  
10 7 import javax.annotation.Resource;
11 8 import javax.servlet.http.HttpServletRequest;
12 9 import javax.servlet.http.HttpServletResponse;
13 10  
  11 +import cn.hutool.core.util.StrUtil;
14 12 import org.apache.shiro.SecurityUtils;
15 13 import org.apache.shiro.authz.annotation.RequiresPermissions;
16 14 import org.jeecg.common.api.vo.Result;
17 15 import org.jeecg.common.aspect.annotation.AutoLog;
  16 +import org.jeecg.common.exception.JeecgBootException;
18 17 import org.jeecg.common.system.base.controller.JeecgController;
19 18 import org.jeecg.common.system.query.QueryGenerator;
  19 +import org.jeecg.common.system.vo.DictModel;
20 20 import org.jeecg.common.system.vo.LoginUser;
21 21 import org.jeecg.common.util.oConvertUtils;
22 22 import org.jeecg.modules.wms.api.erp.service.IErpService;
... ... @@ -29,6 +29,7 @@ import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail;
29 29 import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader;
30 30 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService;
31 31 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService;
  32 +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
32 33 import org.jeecg.utils.HuahengJwtUtil;
33 34 import org.jeecg.utils.StringUtils;
34 35 import org.jeecg.utils.constant.QuantityConstant;
... ... @@ -191,6 +192,52 @@ public class ReceiptHeaderController extends JeecgController&lt;ReceiptHeader, IRec
191 192 public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
192 193 return super.importExcel(request, response, ReceiptHeader.class);
193 194 }
  195 +
  196 + /**
  197 + * 导入入库单
  198 + * @return
  199 + */
  200 + @RequestMapping(value = "/importReceipt")
  201 + public Result<?> importFinishedProduct(HttpServletRequest request, HttpServletResponse response) throws Exception {
  202 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
  203 + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
  204 + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
  205 + MultipartFile file = entity.getValue();// 获取上传文件对象
  206 + ImportParams params = new ImportParams();
  207 + params.setTitleRows(2);
  208 + params.setHeadRows(1);
  209 + params.setNeedSave(true);
  210 + List<ReceiptDetail> list = ExcelImportUtil.importExcel(file.getInputStream(), ReceiptDetail.class, params);
  211 +// List<ReceiptDetail> removeList = new ArrayList<>();
  212 +// for (ReceiptDetail receiptDetail : list) {
  213 +// String materialCode = receiptDetail.getMaterialCode();
  214 +// if (StringUtils.isEmpty(materialCode)) {
  215 +// removeList.add(receiptDetail);
  216 +// }
  217 +// }
  218 +// list.removeAll(removeList);
  219 + receiptDetailService.importFinishedProduct(list);
  220 +// Map<String, List<ReceiptDetail>> receiptDetailMap = list.stream().collect(Collectors.groupingBy(ReceiptDetail::getReferCode));
  221 +// for (ReceiptDetail receiptDetail : list) {
  222 +// try {
  223 +// receiptDetailService.importFinishedProduct(receiptDetail);
  224 +// } catch (Exception e) {
  225 +// log.error(e.getMessage(), e);
  226 +// return Result.error("文件导入失败:" + e.getMessage());
  227 +// }
  228 +// }
  229 +// for (Map.Entry<String, List<ReceiptDetail>> shipmentDetailEntry : receiptDetailMap.entrySet()) {
  230 +// try {
  231 +// receiptHeaderService.importFinishedProduct(shipmentDetailEntry);
  232 +// } catch (Exception e) {
  233 +// log.error(e.getMessage(), e);
  234 +// return Result.error("文件导入失败:" + e.getMessage());
  235 +// }
  236 +// }
  237 + file.getInputStream().close();
  238 + }
  239 + return Result.OK("文件导入成功!");
  240 + }
194 241 /*---------------------------------主表处理-end-------------------------------------*/
195 242  
196 243 /*--------------------------------子表处理-入库单详情-begin----------------------------------------------*/
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/IReceiptDetailService.java
1 1 package org.jeecg.modules.wms.receipt.receiptHeader.service;
2 2  
3 3 import java.util.List;
  4 +import java.util.Map;
4 5  
5 6 import org.jeecg.common.api.vo.Result;
6 7 import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail;
7 8  
8 9 import com.baomidou.mybatisplus.extension.service.IService;
  10 +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
9 11  
10 12 /**
11 13 * @Description: 入库单详情
... ... @@ -24,4 +26,6 @@ public interface IReceiptDetailService extends IService&lt;ReceiptDetail&gt; {
24 26 public Result removeDetailListById(List<String> idList);
25 27  
26 28 boolean batchSave(List<ReceiptDetail> receiptDetailList);
  29 +
  30 + public void importFinishedProduct(List<ReceiptDetail> receiptDetailList);
27 31 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptDetailServiceImpl.java
1 1 package org.jeecg.modules.wms.receipt.receiptHeader.service.impl;
2 2  
3 3 import java.math.BigDecimal;
  4 +import java.util.ArrayList;
4 5 import java.util.Collections;
5 6 import java.util.List;
  7 +import java.util.Map;
6 8  
7 9 import javax.annotation.Resource;
8 10 import javax.validation.Valid;
9 11  
  12 +import cn.hutool.core.util.StrUtil;
10 13 import org.jeecg.common.api.vo.Result;
11 14 import org.jeecg.common.exception.JeecgBootException;
12 15 import org.jeecg.modules.wms.config.material.entity.Material;
... ... @@ -16,6 +19,7 @@ import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader;
16 19 import org.jeecg.modules.wms.receipt.receiptHeader.mapper.ReceiptDetailMapper;
17 20 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService;
18 21 import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService;
  22 +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
19 23 import org.jeecg.utils.StringUtils;
20 24 import org.jeecg.utils.constant.QuantityConstant;
21 25 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -27,6 +31,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
27 31  
28 32 import cn.monitor4all.logRecord.annotation.OperationLog;
29 33 import cn.monitor4all.logRecord.context.LogRecordContext;
  34 +import org.springframework.util.CollectionUtils;
30 35  
31 36 /**
32 37 * @Description: 入库单详情
... ... @@ -148,4 +153,55 @@ public class ReceiptDetailServiceImpl extends ServiceImpl&lt;ReceiptDetailMapper, R
148 153 public boolean batchSave(List<ReceiptDetail> receiptDetailList) {
149 154 return this.saveBatch(receiptDetailList);
150 155 }
  156 +
  157 + @Override
  158 + @Transactional(rollbackFor = Exception.class)
  159 + public void importFinishedProduct(List<ReceiptDetail> receiptDetailList) {
  160 + if (CollectionUtils.isEmpty(receiptDetailList)) {
  161 + throw new JeecgBootException("导入信息为空");
  162 + }
  163 + BigDecimal totalQty = receiptDetailList.stream().map(i -> i.getQty()).reduce(BigDecimal.ZERO, BigDecimal::add);
  164 + ReceiptHeader receiptHeader = new ReceiptHeader();
  165 + receiptHeader.setType(QuantityConstant.RECEIPT_BILL_TYPE_QTR);
  166 + receiptHeader.setCompanyCode(QuantityConstant.DEFAULT_COMPANY);
  167 + receiptHeader.setWarehouseCode(QuantityConstant.DEFAULT_WAREHOUSE);
  168 + receiptHeader.setTotallines(receiptDetailList.size());
  169 + receiptHeader.setTotalqty(totalQty);
  170 + Result<ReceiptHeader> rs1 = receiptHeaderService.saveReceiptHeader(receiptHeader);
  171 + if (rs1.isSuccess()) {
  172 + receiptHeader = rs1.getResult();
  173 + } else {
  174 + throw new JeecgBootException(rs1.getMessage());
  175 + }
  176 + List<ReceiptDetail> addReceiptDetailList = new ArrayList<>();
  177 + for (ReceiptDetail receiptDetail : receiptDetailList) {
  178 + if (receiptDetail.getQty().compareTo(BigDecimal.ZERO) <= 0) {
  179 + throw new JeecgBootException("数量能不能为空或0");
  180 + }
  181 + if (StringUtils.isEmpty(receiptDetail.getMaterialCode())) {
  182 + throw new JeecgBootException("物料编码不能为空");
  183 + }
  184 + Material material = materialService.getMaterialByCode(receiptDetail.getMaterialCode());
  185 + if (StringUtils.isNull(material)) {
  186 + throw new JeecgBootException("创建入库单明细失败,根据物料编码:" + receiptDetail.getMaterialCode() + "没有找到物料信息");
  187 + }
  188 + ReceiptDetail receiptDetails = new ReceiptDetail();
  189 + receiptDetails.setWarehouseCode(receiptHeader.getWarehouseCode());
  190 + receiptDetails.setCompanyCode(receiptHeader.getCompanyCode());
  191 + receiptDetails.setReferCode(receiptHeader.getReferCode());
  192 + receiptDetails.setReceiptCode(receiptHeader.getCode());
  193 + receiptDetails.setReceiptId(receiptHeader.getId());
  194 + receiptDetails.setStatus(QuantityConstant.RECEIPT_HEADER_BUILD);
  195 + receiptDetails.setQty(receiptDetail.getQty());
  196 + receiptDetails.setInventoryStatus(QuantityConstant.QUALITY_GOOD);
  197 + receiptDetails.setMaterialCode(receiptDetail.getMaterialCode());
  198 + receiptDetails.setMaterialName(material.getName());
  199 + receiptDetails.setMaterialSpec(material.getSpec());
  200 + receiptDetails.setMaterialUnit(material.getUnit());
  201 + addReceiptDetailList.add(receiptDetails);
  202 + }
  203 + if (!receiptDetailService.saveBatch(addReceiptDetailList)) {
  204 + throw new JeecgBootException("导入入库单, 保存入库单详情失败");
  205 + }
  206 + }
151 207 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java
... ... @@ -210,7 +210,7 @@ public class ReceiveServiceImpl extends ServiceImpl&lt;ReceiveMapper, Receive&gt; impl
210 210 receiptContainerHeader.setTaskType(taskType);
211 211 receiptContainerHeader.setFromLocationCode(fromLocationCode);
212 212 if (taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) {
213   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
  213 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
214 214 int taskLocationRule = Integer.parseInt(value);
215 215 if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) {
216 216 receiptContainerHeader.setToLocationCode(fromLocationCode);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
... ... @@ -674,7 +674,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
674 674 }
675 675 }
676 676 } else {
677   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
  677 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
678 678 if (StringUtils.isEmpty(value)) {
679 679 throw new JeecgBootException("新增出库配盘头失败, 没有获取到配置属性");
680 680 }
... ... @@ -1365,7 +1365,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
1365 1365 } else if (inventoryTotal.compareTo(shipmentTotal) > 0) {
1366 1366 taskType = QuantityConstant.TASK_TYPE_SORTINGSHIPMENT;
1367 1367 }
1368   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_SHIPMENT_TASK, container.getZoneCode());
  1368 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_SHIPMENT_TASK, container.getZoneCode());
1369 1369 int shipmentTaskRule = Integer.parseInt(value);
1370 1370 if (shipmentTaskRule == QuantityConstant.RULE_TASK_PICK_SHIPMENT) {
1371 1371 taskType = QuantityConstant.TASK_TYPE_SORTINGSHIPMENT;
... ... @@ -1445,7 +1445,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
1445 1445 if (!success) {
1446 1446 throw new JeecgBootException("生成出库任务时, 创建任务详情失败");
1447 1447 }
1448   - value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
  1448 + value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
1449 1449 int taskLocationRule = Integer.parseInt(value);
1450 1450 int shipmentContainerHeaderId = shipmentContainerHeader.getId();
1451 1451 shipmentContainerHeader = new ShipmentContainerHeader();
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java
... ... @@ -25,6 +25,7 @@ import org.jeecg.modules.wms.api.mobile.service.IMobileService;
25 25 import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService;
26 26 import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail;
27 27 import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService;
  28 +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail;
28 29 import org.jeecg.modules.wms.shipment.shipmentCombination.entity.FlatShipment;
29 30 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
30 31 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader;
... ... @@ -359,6 +360,52 @@ public class ShipmentHeaderController extends JeecgController&lt;ShipmentHeader, IS
359 360 return Result.error("文件导入失败!");
360 361 }
361 362  
  363 + /**
  364 + * 导入出库单
  365 + * @return
  366 + */
  367 + @RequestMapping(value = "/importShipment")
  368 + public Result<?> importFinishedProduct(HttpServletRequest request, HttpServletResponse response) throws Exception {
  369 + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
  370 + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
  371 + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
  372 + MultipartFile file = entity.getValue();// 获取上传文件对象
  373 + ImportParams params = new ImportParams();
  374 + params.setTitleRows(2);
  375 + params.setHeadRows(1);
  376 + params.setNeedSave(true);
  377 + List<ShipmentDetail> list = ExcelImportUtil.importExcel(file.getInputStream(), ShipmentDetail.class, params);
  378 +// List<ReceiptDetail> removeList = new ArrayList<>();
  379 +// for (ReceiptDetail receiptDetail : list) {
  380 +// String materialCode = receiptDetail.getMaterialCode();
  381 +// if (StringUtils.isEmpty(materialCode)) {
  382 +// removeList.add(receiptDetail);
  383 +// }
  384 +// }
  385 +// list.removeAll(removeList);
  386 + shipmentDetailService.importFinishedProduct(list);
  387 +// Map<String, List<ReceiptDetail>> receiptDetailMap = list.stream().collect(Collectors.groupingBy(ReceiptDetail::getReferCode));
  388 +// for (ReceiptDetail receiptDetail : list) {
  389 +// try {
  390 +// receiptDetailService.importFinishedProduct(receiptDetail);
  391 +// } catch (Exception e) {
  392 +// log.error(e.getMessage(), e);
  393 +// return Result.error("文件导入失败:" + e.getMessage());
  394 +// }
  395 +// }
  396 +// for (Map.Entry<String, List<ReceiptDetail>> shipmentDetailEntry : receiptDetailMap.entrySet()) {
  397 +// try {
  398 +// receiptHeaderService.importFinishedProduct(shipmentDetailEntry);
  399 +// } catch (Exception e) {
  400 +// log.error(e.getMessage(), e);
  401 +// return Result.error("文件导入失败:" + e.getMessage());
  402 +// }
  403 +// }
  404 + file.getInputStream().close();
  405 + }
  406 + return Result.OK("文件导入成功!");
  407 + }
  408 +
362 409 /*--------------------------------子表处理-出库单详情-end----------------------------------------------*/
363 410  
364 411 /**
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentDetailService.java
... ... @@ -4,6 +4,7 @@ import java.math.BigDecimal;
4 4 import java.util.List;
5 5  
6 6 import org.jeecg.common.api.vo.Result;
  7 +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail;
7 8 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
8 9  
9 10 import com.baomidou.mybatisplus.extension.service.IService;
... ... @@ -31,4 +32,6 @@ public interface IShipmentDetailService extends IService&lt;ShipmentDetail&gt; {
31 32 boolean updateTaskQtyById(BigDecimal taskQty, int id);
32 33  
33 34 boolean updateStatusById(int status, int id);
  35 +
  36 + public void importFinishedProduct(List<ShipmentDetail> shipmentDetailList);
34 37 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentDetailServiceImpl.java
1 1 package org.jeecg.modules.wms.shipment.shipmentHeader.service.impl;
2 2  
3 3 import java.math.BigDecimal;
  4 +import java.util.ArrayList;
4 5 import java.util.Collections;
5 6 import java.util.List;
  7 +import java.util.stream.Collectors;
6 8  
7 9 import javax.annotation.Resource;
8 10  
... ... @@ -10,6 +12,9 @@ import org.jeecg.common.api.vo.Result;
10 12 import org.jeecg.common.exception.JeecgBootException;
11 13 import org.jeecg.modules.wms.config.material.entity.Material;
12 14 import org.jeecg.modules.wms.config.material.service.IMaterialService;
  15 +import org.jeecg.modules.wms.config.zone.entity.Zone;
  16 +import org.jeecg.modules.wms.config.zone.service.IZoneService;
  17 +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail;
13 18 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
14 19 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader;
15 20 import org.jeecg.modules.wms.shipment.shipmentHeader.mapper.ShipmentDetailMapper;
... ... @@ -28,6 +33,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
28 33  
29 34 import cn.monitor4all.logRecord.annotation.OperationLog;
30 35 import cn.monitor4all.logRecord.context.LogRecordContext;
  36 +import org.springframework.util.CollectionUtils;
31 37  
32 38 /**
33 39 * @Description: 出库单详情
... ... @@ -46,6 +52,8 @@ public class ShipmentDetailServiceImpl extends ServiceImpl&lt;ShipmentDetailMapper,
46 52 private IMaterialService materialService;
47 53 @Resource
48 54 private IShipmentDetailService shipmentDetailService;
  55 + @Resource
  56 + private IZoneService zoneService;
49 57  
50 58 @Override
51 59 public List<ShipmentDetail> selectByMainId(String mainId) {
... ... @@ -149,4 +157,64 @@ public class ShipmentDetailServiceImpl extends ServiceImpl&lt;ShipmentDetailMapper,
149 157 return success;
150 158 }
151 159  
  160 + @Override
  161 + @Transactional(rollbackFor = Exception.class)
  162 + public void importFinishedProduct(List<ShipmentDetail> shipmentDetailList) {
  163 + if (CollectionUtils.isEmpty(shipmentDetailList)) {
  164 + throw new JeecgBootException("导入信息为空");
  165 + }
  166 + List<String> zoneCodeList = shipmentDetailList.stream().map(i -> i.getZoneCode()).distinct().collect(Collectors.toList());
  167 + if (CollectionUtils.isEmpty(zoneCodeList)) {
  168 + throw new JeecgBootException("出库单导入失败,库区没有填写");
  169 + }
  170 + if (zoneCodeList.size() > 1) {
  171 + throw new JeecgBootException("出库单导入失败,只允许导入一个库区");
  172 + }
  173 + Zone zoneByCode = zoneService.getZoneByCode(zoneCodeList.get(0), QuantityConstant.DEFAULT_WAREHOUSE);
  174 + if (zoneByCode == null) {
  175 + throw new JeecgBootException("库区:" + zoneCodeList.get(0) + "不存在");
  176 + }
  177 + BigDecimal totalQty = shipmentDetailList.stream().map(i -> i.getQty()).reduce(BigDecimal.ZERO, BigDecimal::add);
  178 + ShipmentHeader shipmentHeader = new ShipmentHeader();
  179 + shipmentHeader.setWarehouseCode(QuantityConstant.DEFAULT_WAREHOUSE);
  180 + shipmentHeader.setCompanyCode(QuantityConstant.DEFAULT_COMPANY);
  181 + shipmentHeader.setZoneCode(zoneCodeList.get(0));
  182 + shipmentHeader.setType(QuantityConstant.SHIPMENT_BILL_TYPE_QTC);
  183 + shipmentHeader.setTotalQty(totalQty);
  184 + shipmentHeader.setTotalLines(shipmentDetailList.size());
  185 + Result result = shipmentHeaderService.saveShipmentHeader(shipmentHeader);
  186 + if (!result.isSuccess()) {
  187 + throw new JeecgBootException("导入出库单失败,保存出库单失败");
  188 + }
  189 + List<ShipmentDetail> addShipmentDetailList = new ArrayList<>();
  190 + for (ShipmentDetail shipmentDetail : shipmentDetailList) {
  191 + if (shipmentDetail.getQty().compareTo(BigDecimal.ZERO) <= 0) {
  192 + throw new JeecgBootException("数量能不能为空或0");
  193 + }
  194 + if (StringUtils.isEmpty(shipmentDetail.getMaterialCode())) {
  195 + throw new JeecgBootException("物料编码不能为空");
  196 + }
  197 + Material material = materialService.getMaterialByCode(shipmentDetail.getMaterialCode());
  198 + if (StringUtils.isNull(material)) {
  199 + throw new JeecgBootException("创建出库单明细失败,根据物料编码:" + shipmentDetail.getMaterialCode() + "没有找到物料信息");
  200 + }
  201 + ShipmentDetail shipmentDetails = new ShipmentDetail();
  202 + shipmentDetails.setWarehouseCode(shipmentHeader.getWarehouseCode());
  203 + shipmentDetails.setCompanyCode(shipmentHeader.getCompanyCode());
  204 + shipmentDetails.setReferCode(shipmentHeader.getReferCode());
  205 + shipmentDetails.setShipmentCode(shipmentHeader.getCode());
  206 + shipmentDetails.setShipmentId(shipmentHeader.getId());
  207 + shipmentDetails.setStatus(QuantityConstant.RECEIPT_HEADER_BUILD);
  208 + shipmentDetails.setQty(shipmentDetail.getQty());
  209 + shipmentDetails.setInventoryStatus(QuantityConstant.QUALITY_GOOD);
  210 + shipmentDetails.setMaterialCode(shipmentDetail.getMaterialCode());
  211 + shipmentDetails.setMaterialName(material.getName());
  212 + shipmentDetails.setMaterialSpec(material.getSpec());
  213 + shipmentDetails.setMaterialUnit(material.getUnit());
  214 + addShipmentDetailList.add(shipmentDetails);
  215 + }
  216 + if (!shipmentDetailService.saveBatch(addShipmentDetailList)) {
  217 + throw new JeecgBootException("导入出库单, 保存出库单详情失败");
  218 + }
  219 + }
152 220 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... ... @@ -398,7 +398,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
398 398 }
399 399 String fromLocationCode = container.getLocationCode();
400 400 String toLocationCode = QuantityConstant.EMPTY_STRING;
401   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
  401 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
402 402 int taskLocationRule = Integer.parseInt(value);
403 403 if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) {
404 404 toLocationCode = fromLocationCode;
... ... @@ -460,7 +460,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
460 460 }
461 461 String fromLocationCode = container.getLocationCode();
462 462 String toLocationCode = QuantityConstant.EMPTY_STRING;
463   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
  463 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_TASK_LOCATION, container.getZoneCode());
464 464 int taskLocationRule = Integer.parseInt(value);
465 465 if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) {
466 466 toLocationCode = fromLocationCode;
... ... @@ -1407,7 +1407,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1407 1407 return Result.ok("入库任务(" + taskHeader.getId() + ")已经是完成的!");
1408 1408 }
1409 1409 if (taskDetailList.isEmpty()) {
1410   - int allow = parameterConfigurationService.getValueIntByCode(QuantityConstant.RULE_CALL_BOX_ALLOW_EMPTY);
  1410 + int allow = parameterConfigurationService.getIntValueByCode(QuantityConstant.RULE_CALL_BOX_ALLOW_EMPTY);
1411 1411 if (allow == QuantityConstant.RULE_ALLOW_EMPTY) {
1412 1412 Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode,
1413 1413 fromLocationCode, toLocationCode, warehouseCode);
... ... @@ -1603,7 +1603,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1603 1603 }
1604 1604 // 如果任务详情为空,那么就是呼叫料盒,但是又没入库进去。
1605 1605 if (taskDetailList.isEmpty()) {
1606   - int allow = parameterConfigurationService.getValueIntByCode(QuantityConstant.RULE_CALL_BOX_ALLOW_EMPTY);
  1606 + int allow = parameterConfigurationService.getIntValueByCode(QuantityConstant.RULE_CALL_BOX_ALLOW_EMPTY);
1607 1607 if (allow == QuantityConstant.RULE_ALLOW_EMPTY) {
1608 1608 List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode);
1609 1609 if (CollectionUtils.isNotEmpty(inventoryDetailList)) {
... ... @@ -3556,7 +3556,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
3556 3556 WcsTask wcsTask = new WcsTask();
3557 3557 wcsTask.setTaskNo(id);
3558 3558 wcsTask.setPriority(Integer.valueOf(priority));
3559   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_CONNECT_WCS, task.getZoneCode());
  3559 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_CONNECT_WCS, task.getZoneCode());
3560 3560 if (StringUtils.isEmpty(value)) {
3561 3561 throw new JeecgBootException("任务下发,没有找到连接WCS的数据配置");
3562 3562 }
... ...
huaheng-wms-core/src/main/resources/file/入库单模板.xls 0 → 100644
No preview for this file type
huaheng-wms-core/src/main/resources/file/出库单模板.xls 0 → 100644
No preview for this file type