Commit 79d10fb64a509f58f774213a9fafc43660aaa7bd
1 parent
dddeae2b
1. 增加ERP、MES 的接口处理
Showing
22 changed files
with
623 additions
and
57 deletions
jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js
@@ -167,6 +167,10 @@ export const listShipmentByShipmentDetailId = (params)=>postAction('/shipment/sh | @@ -167,6 +167,10 @@ export const listShipmentByShipmentDetailId = (params)=>postAction('/shipment/sh | ||
167 | export const getInventoryFromShipmentDetail = (params)=>postAction('/shipment/shipmentCombination/getInventoryFromShipmentDetail', params); | 167 | export const getInventoryFromShipmentDetail = (params)=>postAction('/shipment/shipmentCombination/getInventoryFromShipmentDetail', params); |
168 | //配盘 | 168 | //配盘 |
169 | export const combination = (params)=>postAction('/shipment/shipmentCombination/combination', params); | 169 | export const combination = (params)=>postAction('/shipment/shipmentCombination/combination', params); |
170 | +//回传入库单 | ||
171 | +export const backErpReceipt = (params)=>postAction('/receipt/receiptHeader/backErpReceipt', params); | ||
172 | +//回传出库单 | ||
173 | +export const backErpShipment = (params)=>postAction('/shipment/shipmentHeader/backErpShipment', params); | ||
170 | 174 | ||
171 | // 中转HTTP请求 | 175 | // 中转HTTP请求 |
172 | export const transitRESTful = { | 176 | export const transitRESTful = { |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/MaterialList.vue
@@ -164,11 +164,6 @@ | @@ -164,11 +164,6 @@ | ||
164 | dataIndex: 'name' | 164 | dataIndex: 'name' |
165 | }, | 165 | }, |
166 | { | 166 | { |
167 | - title:'货主编码', | ||
168 | - align:"center", | ||
169 | - dataIndex: 'companyCode' | ||
170 | - }, | ||
171 | - { | ||
172 | title:'规格', | 167 | title:'规格', |
173 | align:"center", | 168 | align:"center", |
174 | dataIndex: 'spec' | 169 | dataIndex: 'spec' |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue
@@ -161,13 +161,17 @@ | @@ -161,13 +161,17 @@ | ||
161 | </template> | 161 | </template> |
162 | 162 | ||
163 | <span slot="action" slot-scope="text, record"> | 163 | <span slot="action" slot-scope="text, record"> |
164 | - <a v-has="'receiptHeader:edit'" @click="handleEdit(record)">编辑</a> | ||
165 | - <a-divider type="vertical" /> | 164 | + <a-popconfirm v-has="'receiptHeader:back'" v-if="record.lastStatus == 800" title="确定回传吗?" @confirm="() => hanleBack(record)"> |
165 | + <a>回传</a> | ||
166 | + </a-popconfirm> | ||
166 | <a v-if="record.lastStatus < 800" @click="receive(record)">组盘</a> | 167 | <a v-if="record.lastStatus < 800" @click="receive(record)">组盘</a> |
167 | <a-divider type="vertical" /> | 168 | <a-divider type="vertical" /> |
168 | <a-dropdown> | 169 | <a-dropdown> |
169 | <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | 170 | <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> |
170 | <a-menu slot="overlay"> | 171 | <a-menu slot="overlay"> |
172 | + <a-menu-item v-has="'receiptHeader:edit'"> | ||
173 | + <a @click="handleEdit(record)">编辑</a> | ||
174 | + </a-menu-item> | ||
171 | <a-menu-item v-has="'receiptHeader:delete'"> | 175 | <a-menu-item v-has="'receiptHeader:delete'"> |
172 | <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | 176 | <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
173 | <a>删除</a> | 177 | <a>删除</a> |
@@ -201,7 +205,7 @@ | @@ -201,7 +205,7 @@ | ||
201 | import '@/assets/less/TableExpand.less' | 205 | import '@/assets/less/TableExpand.less' |
202 | import {getCompanyList} from '@/api/api' | 206 | import {getCompanyList} from '@/api/api' |
203 | import {getReceiptTypeList} from '@/api/api' | 207 | import {getReceiptTypeList} from '@/api/api' |
204 | - import {getSupplierList} from '@/api/api' | 208 | + import {getSupplierList, backErpReceipt} from '@/api/api' |
205 | import ReceiveModal from "./modules/ReceiveModal"; | 209 | import ReceiveModal from "./modules/ReceiveModal"; |
206 | 210 | ||
207 | 211 | ||
@@ -414,6 +418,16 @@ | @@ -414,6 +418,16 @@ | ||
414 | fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) | 418 | fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) |
415 | this.superFieldList = fieldList | 419 | this.superFieldList = fieldList |
416 | }, | 420 | }, |
421 | + hanleBack(record) { | ||
422 | + backErpReceipt(record).then((res) => { | ||
423 | + if (res.success) { | ||
424 | + this.$message.success(res.message); | ||
425 | + } else { | ||
426 | + that.$message.warning(res.message); | ||
427 | + } | ||
428 | + this.searchQuery(); | ||
429 | + }); | ||
430 | + }, | ||
417 | loadFrom() { | 431 | loadFrom() { |
418 | getCompanyList().then((res) => { | 432 | getCompanyList().then((res) => { |
419 | if (res.success) { | 433 | if (res.success) { |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue
@@ -166,7 +166,9 @@ | @@ -166,7 +166,9 @@ | ||
166 | </template> | 166 | </template> |
167 | 167 | ||
168 | <span slot="action" slot-scope="text, record"> | 168 | <span slot="action" slot-scope="text, record"> |
169 | - <a-divider type="vertical" /> | 169 | + <a-popconfirm v-has="'shipmentHeader:back'" v-if="record.lastStatus == 800" title="确定回传吗?" @confirm="() => hanleBack(record)"> |
170 | + <a>回传</a> | ||
171 | + </a-popconfirm> | ||
170 | <a v-if="record.lastStatus < 800" @click="autoShipmentCombine(record)">自动配盘</a> | 172 | <a v-if="record.lastStatus < 800" @click="autoShipmentCombine(record)">自动配盘</a> |
171 | <a-divider type="vertical" /> | 173 | <a-divider type="vertical" /> |
172 | <a v-has="'shipmentHeader:edit'" @click="handleEdit(record)">编辑</a> | 174 | <a v-has="'shipmentHeader:edit'" @click="handleEdit(record)">编辑</a> |
@@ -205,7 +207,7 @@ | @@ -205,7 +207,7 @@ | ||
205 | import ShipmentDetailList from './ShipmentDetailList' | 207 | import ShipmentDetailList from './ShipmentDetailList' |
206 | import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil' | 208 | import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
207 | import '@/assets/less/TableExpand.less' | 209 | import '@/assets/less/TableExpand.less' |
208 | - import {getCompanyList} from '@/api/api' | 210 | + import {getCompanyList, backErpShipment} from '@/api/api' |
209 | import {getShipmentTypeList} from '@/api/api' | 211 | import {getShipmentTypeList} from '@/api/api' |
210 | import {getCustomerList} from '@/api/api' | 212 | import {getCustomerList} from '@/api/api' |
211 | import {autoCombination} from '@/api/api' | 213 | import {autoCombination} from '@/api/api' |
@@ -373,6 +375,16 @@ | @@ -373,6 +375,16 @@ | ||
373 | this.selectedRowKeys = selectedRowKeys; | 375 | this.selectedRowKeys = selectedRowKeys; |
374 | this.selectionRows = selectionRows; | 376 | this.selectionRows = selectionRows; |
375 | }, | 377 | }, |
378 | + hanleBack(record) { | ||
379 | + backErpShipment(record).then((res) => { | ||
380 | + if (res.success) { | ||
381 | + this.$message.success(res.message); | ||
382 | + } else { | ||
383 | + that.$message.warning(res.message); | ||
384 | + } | ||
385 | + this.searchQuery(); | ||
386 | + }); | ||
387 | + }, | ||
376 | loadFrom() { | 388 | loadFrom() { |
377 | getCompanyList().then((res) => { | 389 | getCompanyList().then((res) => { |
378 | if (res.success) { | 390 | if (res.success) { |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/quartz/entity/QuartzJob.java
@@ -24,9 +24,9 @@ import lombok.Data; | @@ -24,9 +24,9 @@ import lombok.Data; | ||
24 | @TableName("sys_quartz_job") | 24 | @TableName("sys_quartz_job") |
25 | public class QuartzJob implements Serializable { | 25 | public class QuartzJob implements Serializable { |
26 | private static final long serialVersionUID = 1L; | 26 | private static final long serialVersionUID = 1L; |
27 | - | 27 | + |
28 | /**id*/ | 28 | /**id*/ |
29 | - @TableId(type = IdType.ASSIGN_ID) | 29 | + @TableId(type = IdType.AUTO) |
30 | private java.lang.String id; | 30 | private java.lang.String id; |
31 | /**创建人*/ | 31 | /**创建人*/ |
32 | private java.lang.String createBy; | 32 | private java.lang.String createBy; |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/controller/ErpController.java
@@ -9,12 +9,10 @@ import org.jeecg.common.api.vo.Result; | @@ -9,12 +9,10 @@ import org.jeecg.common.api.vo.Result; | ||
9 | import org.jeecg.common.aspect.annotation.AutoLog; | 9 | import org.jeecg.common.aspect.annotation.AutoLog; |
10 | import org.jeecg.common.system.base.controller.JeecgController; | 10 | import org.jeecg.common.system.base.controller.JeecgController; |
11 | import org.jeecg.common.system.util.JwtUtil; | 11 | import org.jeecg.common.system.util.JwtUtil; |
12 | -import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; | ||
13 | -import org.jeecg.modules.wms.api.erp.entity.ErpReceiptDetail; | ||
14 | -import org.jeecg.modules.wms.api.erp.entity.ErpReceiptHeader; | ||
15 | -import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | 12 | +import org.jeecg.modules.wms.api.erp.entity.*; |
16 | import org.jeecg.modules.wms.api.erp.service.IErpService; | 13 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
17 | import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; | 14 | import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; |
15 | +import org.jeecg.modules.wms.config.material.entity.Material; | ||
18 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | 16 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; |
19 | import org.jeecg.modules.wms.framework.controller.BaseController; | 17 | import org.jeecg.modules.wms.framework.controller.BaseController; |
20 | import org.jeecg.utils.StringUtils; | 18 | import org.jeecg.utils.StringUtils; |
@@ -41,13 +39,7 @@ public class ErpController extends BaseController { | @@ -41,13 +39,7 @@ public class ErpController extends BaseController { | ||
41 | @ApiLogger(apiName = "入库单下发", from="ERP") | 39 | @ApiLogger(apiName = "入库单下发", from="ERP") |
42 | public Result receipt(@RequestBody ErpReceipt erpReceipt, HttpServletRequest req) { | 40 | public Result receipt(@RequestBody ErpReceipt erpReceipt, HttpServletRequest req) { |
43 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | 41 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
44 | - Result result = handleMultiProcess("receipt", new JeecgController.MultiProcessListener() { | ||
45 | - @Override | ||
46 | - public Result doProcess() { | ||
47 | - return erpService.receipt(erpReceipt, warehouseCode); | ||
48 | - } | ||
49 | - }); | ||
50 | - return result; | 42 | + return erpService.receipt(erpReceipt, warehouseCode); |
51 | } | 43 | } |
52 | 44 | ||
53 | @PostMapping("/cancelReceipt") | 45 | @PostMapping("/cancelReceipt") |
@@ -56,13 +48,7 @@ public class ErpController extends BaseController { | @@ -56,13 +48,7 @@ public class ErpController extends BaseController { | ||
56 | public Result cancelReceipt(@RequestBody Map<String, String> param, HttpServletRequest req) { | 48 | public Result cancelReceipt(@RequestBody Map<String, String> param, HttpServletRequest req) { |
57 | String referCode = param.get("referCode"); | 49 | String referCode = param.get("referCode"); |
58 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | 50 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
59 | - Result result = handleMultiProcess("cancelReceipt", new JeecgController.MultiProcessListener() { | ||
60 | - @Override | ||
61 | - public Result doProcess() { | ||
62 | - return erpService.cancelReceipt(referCode, warehouseCode); | ||
63 | - } | ||
64 | - }); | ||
65 | - return result; | 51 | + return erpService.cancelReceipt(referCode, warehouseCode); |
66 | } | 52 | } |
67 | 53 | ||
68 | 54 | ||
@@ -95,4 +81,27 @@ public class ErpController extends BaseController { | @@ -95,4 +81,27 @@ public class ErpController extends BaseController { | ||
95 | }); | 81 | }); |
96 | return result; | 82 | return result; |
97 | } | 83 | } |
84 | + | ||
85 | + @PostMapping("/searchInventory") | ||
86 | + @ResponseBody | ||
87 | + @ApiLogger(apiName = "查询库存", from="ERP") | ||
88 | + public Result searchInventory(@RequestBody InventoryQueryParam inventoryQueryParam, HttpServletRequest req) { | ||
89 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
90 | + Result result = erpService.searchInventory(inventoryQueryParam); | ||
91 | + return result; | ||
92 | + } | ||
93 | + | ||
94 | + @PostMapping("/addMaterial") | ||
95 | + @ResponseBody | ||
96 | + @ApiLogger(apiName = "增加物料", from="ERP") | ||
97 | + public Result addMaterial(@RequestBody Material material, HttpServletRequest req) { | ||
98 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
99 | + Result result = handleMultiProcess("addMaterial", new JeecgController.MultiProcessListener() { | ||
100 | + @Override | ||
101 | + public Result doProcess() { | ||
102 | + return erpService.addMaterial(material, warehouseCode); | ||
103 | + } | ||
104 | + }); | ||
105 | + return result; | ||
106 | + } | ||
98 | } | 107 | } |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/entity/ErpBackReceipt.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.erp.entity; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | ||
5 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author 游杰 | ||
11 | + */ | ||
12 | +@Data | ||
13 | +public class ErpBackReceipt { | ||
14 | + | ||
15 | + private ReceiptHeader receiptHeader; | ||
16 | + private List<ReceiptDetail> receiptDetailList; | ||
17 | + | ||
18 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/entity/ErpBackShipment.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.erp.entity; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | ||
5 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +@Data | ||
10 | +public class ErpBackShipment { | ||
11 | + | ||
12 | + private ShipmentHeader shipmentHeader; | ||
13 | + private List<ShipmentDetail> shipmentDetailList; | ||
14 | + | ||
15 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/entity/ErpReceiptDetail.java
@@ -16,6 +16,22 @@ public class ErpReceiptDetail { | @@ -16,6 +16,22 @@ public class ErpReceiptDetail { | ||
16 | private String materialCode; | 16 | private String materialCode; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | + * 物料名称 | ||
20 | + */ | ||
21 | + private String materialName; | ||
22 | + | ||
23 | + /** | ||
24 | + * 物料规格 | ||
25 | + */ | ||
26 | + private String materialSpec; | ||
27 | + | ||
28 | + /** | ||
29 | + * 物料单位 | ||
30 | + */ | ||
31 | + private String materialUnit; | ||
32 | + | ||
33 | + | ||
34 | + /** | ||
19 | * 单据数量 | 35 | * 单据数量 |
20 | */ | 36 | */ |
21 | private BigDecimal qty; | 37 | private BigDecimal qty; |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/entity/InventorySummary.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.erp.entity; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +import java.math.BigDecimal; | ||
6 | + | ||
7 | +@Data | ||
8 | +public class InventorySummary { | ||
9 | + | ||
10 | + /** | ||
11 | + * 物料编码 | ||
12 | + */ | ||
13 | + private String materialCode; | ||
14 | + /** | ||
15 | + * 仓库 | ||
16 | + */ | ||
17 | + private String warehouseCode; | ||
18 | + /** | ||
19 | + * 货主 | ||
20 | + */ | ||
21 | + private String companyCode; | ||
22 | + /** | ||
23 | + * 数量 | ||
24 | + */ | ||
25 | + private BigDecimal qty; | ||
26 | + /** | ||
27 | + * 锁定数量 | ||
28 | + */ | ||
29 | + private BigDecimal taskQty; | ||
30 | + /** | ||
31 | + * 可用数量 | ||
32 | + */ | ||
33 | + private BigDecimal availQty; | ||
34 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/service/IErpService.java
@@ -4,16 +4,49 @@ import org.jeecg.common.api.vo.Result; | @@ -4,16 +4,49 @@ import org.jeecg.common.api.vo.Result; | ||
4 | import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; | 4 | import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; |
5 | import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | 5 | import org.jeecg.modules.wms.api.erp.entity.ErpShipment; |
6 | import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; | 6 | import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; |
7 | +import org.jeecg.modules.wms.config.material.entity.Material; | ||
8 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | ||
9 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | ||
7 | 10 | ||
8 | public interface IErpService { | 11 | public interface IErpService { |
9 | 12 | ||
13 | + /** | ||
14 | + * 下发入库单 | ||
15 | + */ | ||
10 | public Result receipt(ErpReceipt erpReceipt, String warehouseCode); | 16 | public Result receipt(ErpReceipt erpReceipt, String warehouseCode); |
11 | 17 | ||
18 | + /** | ||
19 | + * 取消入库单 | ||
20 | + */ | ||
12 | public Result cancelReceipt(String referCode, String warehouseCode); | 21 | public Result cancelReceipt(String referCode, String warehouseCode); |
13 | 22 | ||
23 | + /** | ||
24 | + * 取消出库单 | ||
25 | + */ | ||
14 | public Result shipment(ErpShipment erpShipment, String warehouseCode); | 26 | public Result shipment(ErpShipment erpShipment, String warehouseCode); |
15 | 27 | ||
28 | + /** | ||
29 | + * 取消出库单 | ||
30 | + */ | ||
16 | public Result cancelShipment(String referCode, String warehouseCode); | 31 | public Result cancelShipment(String referCode, String warehouseCode); |
17 | 32 | ||
33 | + /** | ||
34 | + * 查询库存 | ||
35 | + */ | ||
18 | public Result searchInventory(InventoryQueryParam inventoryQueryParam); | 36 | public Result searchInventory(InventoryQueryParam inventoryQueryParam); |
37 | + | ||
38 | + /** | ||
39 | + * 增加物料信息 | ||
40 | + */ | ||
41 | + public Result addMaterial(Material material, String warehouseCode); | ||
42 | + | ||
43 | + /** | ||
44 | + * 回传入库单 | ||
45 | + */ | ||
46 | + public Result backReceipt(ReceiptHeader receiptHeader); | ||
47 | + | ||
48 | + /** | ||
49 | + * 回传出库单 | ||
50 | + */ | ||
51 | + public Result backShipment(ShipmentHeader shipmentHeader); | ||
19 | } | 52 | } |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/service/impl/ErpServiceImpl.java
1 | package org.jeecg.modules.wms.api.erp.service.impl; | 1 | package org.jeecg.modules.wms.api.erp.service.impl; |
2 | 2 | ||
3 | +import com.alibaba.fastjson.JSON; | ||
3 | import com.aliyun.oss.ServiceException; | 4 | import com.aliyun.oss.ServiceException; |
4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
6 | import org.jeecg.common.api.vo.Result; | 7 | import org.jeecg.common.api.vo.Result; |
7 | import org.jeecg.modules.wms.api.erp.entity.*; | 8 | import org.jeecg.modules.wms.api.erp.entity.*; |
8 | import org.jeecg.modules.wms.api.erp.service.IErpService; | 9 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
10 | +import org.jeecg.modules.wms.config.address.service.IAddressService; | ||
9 | import org.jeecg.modules.wms.config.company.entity.Company; | 11 | import org.jeecg.modules.wms.config.company.entity.Company; |
10 | import org.jeecg.modules.wms.config.company.service.ICompanyService; | 12 | import org.jeecg.modules.wms.config.company.service.ICompanyService; |
11 | import org.jeecg.modules.wms.config.material.entity.Material; | 13 | import org.jeecg.modules.wms.config.material.entity.Material; |
@@ -24,12 +26,17 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailServ | @@ -24,12 +26,17 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailServ | ||
24 | import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; | 26 | import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; |
25 | import org.jeecg.utils.StringUtils; | 27 | import org.jeecg.utils.StringUtils; |
26 | import org.jeecg.utils.constant.QuantityConstant; | 28 | import org.jeecg.utils.constant.QuantityConstant; |
29 | +import org.jeecg.utils.http.OkHttpUtils; | ||
27 | import org.springframework.stereotype.Service; | 30 | import org.springframework.stereotype.Service; |
28 | import org.springframework.transaction.annotation.Transactional; | 31 | import org.springframework.transaction.annotation.Transactional; |
29 | 32 | ||
30 | import javax.annotation.Resource; | 33 | import javax.annotation.Resource; |
31 | import java.math.BigDecimal; | 34 | import java.math.BigDecimal; |
35 | +import java.util.ArrayList; | ||
36 | +import java.util.Comparator; | ||
32 | import java.util.List; | 37 | import java.util.List; |
38 | +import java.util.TreeSet; | ||
39 | +import java.util.stream.Collectors; | ||
33 | 40 | ||
34 | /** | 41 | /** |
35 | * @author 游杰 | 42 | * @author 游杰 |
@@ -53,10 +60,13 @@ public class ErpServiceImpl implements IErpService { | @@ -53,10 +60,13 @@ public class ErpServiceImpl implements IErpService { | ||
53 | private IShipmentDetailService shipmentDetailService; | 60 | private IShipmentDetailService shipmentDetailService; |
54 | @Resource | 61 | @Resource |
55 | private IInventoryDetailService inventoryDetailService; | 62 | private IInventoryDetailService inventoryDetailService; |
63 | + @Resource | ||
64 | + private IAddressService addressService; | ||
56 | 65 | ||
57 | @Override | 66 | @Override |
58 | @Transactional(rollbackFor = Exception.class) | 67 | @Transactional(rollbackFor = Exception.class) |
59 | public Result receipt(ErpReceipt erpReceipt, String warehouseCode) { | 68 | public Result receipt(ErpReceipt erpReceipt, String warehouseCode) { |
69 | + boolean success = false; | ||
60 | if(StringUtils.isEmpty(warehouseCode)) { | 70 | if(StringUtils.isEmpty(warehouseCode)) { |
61 | return Result.error("入库单下发,仓库编码为空"); | 71 | return Result.error("入库单下发,仓库编码为空"); |
62 | } | 72 | } |
@@ -112,6 +122,9 @@ public class ErpServiceImpl implements IErpService { | @@ -112,6 +122,9 @@ public class ErpServiceImpl implements IErpService { | ||
112 | for(ErpReceiptDetail erpReceiptDetail : erpReceiptDetailList) { | 122 | for(ErpReceiptDetail erpReceiptDetail : erpReceiptDetailList) { |
113 | BigDecimal qty = erpReceiptDetail.getQty(); | 123 | BigDecimal qty = erpReceiptDetail.getQty(); |
114 | String materialCode = erpReceiptDetail.getMaterialCode(); | 124 | String materialCode = erpReceiptDetail.getMaterialCode(); |
125 | + String materialName = erpReceiptDetail.getMaterialName(); | ||
126 | + String materialSpec = erpReceiptDetail.getMaterialSpec(); | ||
127 | + String materialUnit = erpReceiptDetail.getMaterialUnit(); | ||
115 | String inventoryStatus = erpReceiptDetail.getInventoryStatus(); | 128 | String inventoryStatus = erpReceiptDetail.getInventoryStatus(); |
116 | String batch = erpReceiptDetail.getBatch(); | 129 | String batch = erpReceiptDetail.getBatch(); |
117 | String lot = erpReceiptDetail.getLot(); | 130 | String lot = erpReceiptDetail.getLot(); |
@@ -134,7 +147,17 @@ public class ErpServiceImpl implements IErpService { | @@ -134,7 +147,17 @@ public class ErpServiceImpl implements IErpService { | ||
134 | receiptDetail.setQty(qty); | 147 | receiptDetail.setQty(qty); |
135 | Material material = materialService.getMaterialByCode(materialCode); | 148 | Material material = materialService.getMaterialByCode(materialCode); |
136 | if(material == null) { | 149 | if(material == null) { |
137 | - throw new ServiceException("入库单下发, 没有找到物料信息" + materialCode); | 150 | + material = new Material(); |
151 | + material.setCode(materialCode); | ||
152 | + material.setName(materialName); | ||
153 | + material.setWarehouseCode(warehouseCode); | ||
154 | + material.setSpec(materialSpec); | ||
155 | + material.setUnit(materialUnit); | ||
156 | + material.setEnable(QuantityConstant.STATUS_ENABLE); | ||
157 | + success = materialService.save(material); | ||
158 | + if(!success) { | ||
159 | + throw new ServiceException("入库单下发, 保存物料失败"); | ||
160 | + } | ||
138 | } | 161 | } |
139 | receiptDetail.setInventoryStatus(inventoryStatus); | 162 | receiptDetail.setInventoryStatus(inventoryStatus); |
140 | receiptDetail.setMaterialCode(materialCode); | 163 | receiptDetail.setMaterialCode(materialCode); |
@@ -144,12 +167,12 @@ public class ErpServiceImpl implements IErpService { | @@ -144,12 +167,12 @@ public class ErpServiceImpl implements IErpService { | ||
144 | receiptDetail.setBatch(batch); | 167 | receiptDetail.setBatch(batch); |
145 | receiptDetail.setLot(lot); | 168 | receiptDetail.setLot(lot); |
146 | receiptDetail.setProject(project); | 169 | receiptDetail.setProject(project); |
147 | - boolean success = receiptDetailService.save(receiptDetail); | 170 | + success = receiptDetailService.save(receiptDetail); |
148 | if(!success) { | 171 | if(!success) { |
149 | throw new ServiceException("入库单下发, 保存入库单详情失败"); | 172 | throw new ServiceException("入库单下发, 保存入库单详情失败"); |
150 | } | 173 | } |
151 | } | 174 | } |
152 | - boolean success = receiptHeaderService.updateReceiptHeader(receiptHeader.getId()); | 175 | + success = receiptHeaderService.updateReceiptHeader(receiptHeader.getId()); |
153 | if(!success) { | 176 | if(!success) { |
154 | throw new ServiceException("入库单下发, 更新入库单失败"); | 177 | throw new ServiceException("入库单下发, 更新入库单失败"); |
155 | } | 178 | } |
@@ -177,6 +200,7 @@ public class ErpServiceImpl implements IErpService { | @@ -177,6 +200,7 @@ public class ErpServiceImpl implements IErpService { | ||
177 | } | 200 | } |
178 | 201 | ||
179 | @Override | 202 | @Override |
203 | + @Transactional(rollbackFor = Exception.class) | ||
180 | public Result shipment(ErpShipment erpShipment, String warehouseCode) { | 204 | public Result shipment(ErpShipment erpShipment, String warehouseCode) { |
181 | if(StringUtils.isEmpty(warehouseCode)) { | 205 | if(StringUtils.isEmpty(warehouseCode)) { |
182 | return Result.error("出库单下发,仓库编码为空"); | 206 | return Result.error("出库单下发,仓库编码为空"); |
@@ -317,7 +341,137 @@ public class ErpServiceImpl implements IErpService { | @@ -317,7 +341,137 @@ public class ErpServiceImpl implements IErpService { | ||
317 | if(inventoryDetailList.size() == 0) { | 341 | if(inventoryDetailList.size() == 0) { |
318 | return Result.error("没有找到对应库存"); | 342 | return Result.error("没有找到对应库存"); |
319 | } | 343 | } |
320 | - return Result.ok(inventoryDetailList); | 344 | + for(InventoryDetail inventoryDetail: inventoryDetailList){ |
345 | + BigDecimal numQty = BigDecimal.ZERO; | ||
346 | + BigDecimal numTaskQty = BigDecimal.ZERO; | ||
347 | + for (InventoryDetail t:inventoryDetailList){ | ||
348 | + if(inventoryDetail.getWarehouseCode().equals(t.getWarehouseCode()) && | ||
349 | + inventoryDetail.getCompanyCode().equals(t.getCompanyCode()) && | ||
350 | + inventoryDetail.getMaterialCode().equals(t.getMaterialCode())){ | ||
351 | + numQty = numQty.add(t.getQty()); | ||
352 | + numTaskQty = numTaskQty.add(t.getTaskQty()); | ||
353 | + inventoryDetail.setQty(numQty); | ||
354 | + inventoryDetail.setTaskQty(numTaskQty); | ||
355 | + } | ||
356 | + } | ||
357 | + } | ||
358 | + List<InventoryDetail> materialSummaryList = new ArrayList<>(); | ||
359 | + inventoryDetailList.stream().collect(Collectors.collectingAndThen( | ||
360 | + Collectors.toCollection(() -> new TreeSet<>( | ||
361 | + Comparator.comparing( | ||
362 | + inventoryMaterialSummary -> | ||
363 | + inventoryMaterialSummary.getCompanyCode() + ";" + inventoryMaterialSummary.getMaterialCode() + ";" + inventoryMaterialSummary.getWarehouseCode()))), | ||
364 | + ArrayList::new)) | ||
365 | + .forEach(list -> materialSummaryList.add(list)); | ||
366 | + List<InventorySummary> inventorySummaryList = new ArrayList<>(); | ||
367 | + for(InventoryDetail inventoryDetail : materialSummaryList) { | ||
368 | + InventorySummary inventorySummary = new InventorySummary(); | ||
369 | + inventorySummary.setWarehouseCode(inventoryDetail.getWarehouseCode()); | ||
370 | + inventorySummary.setCompanyCode(inventoryDetail.getCompanyCode()); | ||
371 | + inventorySummary.setMaterialCode(inventoryDetail.getMaterialCode()); | ||
372 | + BigDecimal availQty = inventoryDetail.getQty().subtract(inventoryDetail.getTaskQty()); | ||
373 | + inventorySummary.setQty(inventoryDetail.getQty()); | ||
374 | + inventorySummary.setTaskQty(inventoryDetail.getTaskQty()); | ||
375 | + inventorySummary.setAvailQty(availQty); | ||
376 | + inventorySummaryList.add(inventorySummary); | ||
377 | + } | ||
378 | + return Result.ok(inventorySummaryList); | ||
379 | + } | ||
380 | + | ||
381 | + @Override | ||
382 | + @Transactional(rollbackFor = Exception.class) | ||
383 | + public Result addMaterial(Material material, String warehouseCode) { | ||
384 | + if(StringUtils.isEmpty(material.getCode())){ | ||
385 | + return Result.error("增加物料失败, 物料编码不能为空!!"); | ||
386 | + } | ||
387 | + if(StringUtils.isEmpty(material.getName())){ | ||
388 | + return Result.error("增加物料失败, 物料名称不能为空!!"); | ||
389 | + } | ||
390 | + if(StringUtils.isEmpty(warehouseCode)){ | ||
391 | + return Result.error("增加物料失败, 仓库编码不能为空!!"); | ||
392 | + } | ||
393 | + | ||
394 | + Warehouse warehouse = warehouseService.getWarehouseByCode(warehouseCode); | ||
395 | + if(warehouse == null) { | ||
396 | + return Result.error("增加物料失败, 仓库为空!!"); | ||
397 | + } | ||
398 | + material.setWarehouseCode(warehouseCode); | ||
399 | + material.setEnable(QuantityConstant.STATUS_ENABLE); | ||
400 | + Material material1 = materialService.getMaterialByCode(material.getCode()); | ||
401 | + if(material1 != null) { | ||
402 | + return Result.error("增加物料失败, 物料已经存在!!"); | ||
403 | + } | ||
404 | + boolean success = materialService.save(material); | ||
405 | + if(!success) { | ||
406 | + throw new ServiceException("增加物料失败, 保存时报错"); | ||
407 | + } | ||
408 | + return Result.error("增加物料成功"); | ||
409 | + } | ||
410 | + | ||
411 | + @Override | ||
412 | + public Result backReceipt(ReceiptHeader receiptHeader) { | ||
413 | + if(receiptHeader == null) { | ||
414 | + return Result.error("回传入库单, 入库单为空!!"); | ||
415 | + } | ||
416 | + List<ReceiptDetail> receiptDetailList = receiptDetailService. | ||
417 | + selectByMainId(String.valueOf(receiptHeader.getId())); | ||
418 | + if(receiptDetailList.size() == 0) { | ||
419 | + return Result.error("回传入库单, 入库单详情为空!!"); | ||
420 | + } | ||
421 | + String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_ERP_BACK_RECEIPT); | ||
422 | + ErpBackReceipt erpBackReceipt = new ErpBackReceipt(); | ||
423 | + erpBackReceipt.setReceiptHeader(receiptHeader); | ||
424 | + erpBackReceipt.setReceiptDetailList(receiptDetailList); | ||
425 | + String jsonParam = JSON.toJSONString(erpBackReceipt); | ||
426 | + System.out.println(jsonParam); | ||
427 | + String body = OkHttpUtils.bodypost(url, jsonParam); | ||
428 | + if(StringUtils.isEmpty(body)) { | ||
429 | + throw new ServiceException("接口地址错误或返回为空"); | ||
430 | + } | ||
431 | + Result result = JSON.parseObject(body, Result.class); | ||
432 | + if(result.getCode() != QuantityConstant.HTTP_OK) { | ||
433 | + return Result.error(result.getMsg()); | ||
434 | + } | ||
435 | + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_RETURN); | ||
436 | + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_RETURN); | ||
437 | + boolean success = receiptHeaderService.updateById(receiptHeader); | ||
438 | + if(!success) { | ||
439 | + throw new ServiceException("回传入库单失败, 更新入库单头失败"); | ||
440 | + } | ||
441 | + return Result.ok("回传入库单成功"); | ||
442 | + } | ||
443 | + | ||
444 | + @Override | ||
445 | + public Result backShipment(ShipmentHeader shipmentHeader) { | ||
446 | + if(shipmentHeader == null) { | ||
447 | + return Result.error("回传出库单, 出库单为空!!"); | ||
448 | + } | ||
449 | + List<ShipmentDetail> shipmentDetailList = shipmentDetailService. | ||
450 | + selectByMainId(String.valueOf(shipmentHeader.getId())); | ||
451 | + if(shipmentDetailList.size() == 0) { | ||
452 | + return Result.error("回传出库单, 出库单详情为空!!"); | ||
453 | + } | ||
454 | + String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_ERP_BACK_SHIPMENT); | ||
455 | + ErpBackShipment erpBackShipment = new ErpBackShipment(); | ||
456 | + erpBackShipment.setShipmentHeader(shipmentHeader); | ||
457 | + erpBackShipment.setShipmentDetailList(shipmentDetailList); | ||
458 | + String jsonParam = JSON.toJSONString(erpBackShipment); | ||
459 | + System.out.println(jsonParam); | ||
460 | + String body = OkHttpUtils.bodypost(url, jsonParam); | ||
461 | + if(StringUtils.isEmpty(body)) { | ||
462 | + throw new ServiceException("接口地址错误或返回为空"); | ||
463 | + } | ||
464 | + Result result = JSON.parseObject(body, Result.class); | ||
465 | + if(result.getCode() != QuantityConstant.HTTP_OK) { | ||
466 | + return Result.error(result.getMsg()); | ||
467 | + } | ||
468 | + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_RETURN); | ||
469 | + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_RETURN); | ||
470 | + boolean success = shipmentHeaderService.updateById(shipmentHeader); | ||
471 | + if(!success) { | ||
472 | + throw new ServiceException("回传出库单失败, 更新出库单头失败"); | ||
473 | + } | ||
474 | + return Result.ok("回传出库单成功"); | ||
321 | } | 475 | } |
322 | 476 | ||
323 | 477 |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/controller/MesController.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mes.controller; | ||
2 | + | ||
3 | +import org.jeecg.common.api.vo.Result; | ||
4 | +import org.jeecg.common.system.base.controller.JeecgController; | ||
5 | +import org.jeecg.common.system.util.JwtUtil; | ||
6 | +import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; | ||
7 | +import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | ||
8 | +import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; | ||
9 | +import org.jeecg.modules.wms.api.erp.service.IErpService; | ||
10 | +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | ||
11 | +import org.jeecg.modules.wms.framework.controller.BaseController; | ||
12 | +import org.springframework.web.bind.annotation.*; | ||
13 | + | ||
14 | +import javax.annotation.Resource; | ||
15 | +import javax.servlet.http.HttpServletRequest; | ||
16 | +import java.util.Map; | ||
17 | + | ||
18 | +/** | ||
19 | + * @author 游杰 | ||
20 | + */ | ||
21 | +@RestController | ||
22 | +@RequestMapping("/API/WMS/mes") | ||
23 | +public class MesController extends BaseController { | ||
24 | + | ||
25 | + @Resource | ||
26 | + private IErpService erpService; | ||
27 | + | ||
28 | + @PostMapping("/receipt") | ||
29 | + @ResponseBody | ||
30 | + @ApiLogger(apiName = "入库单下发", from="ERP") | ||
31 | + public Result receipt(@RequestBody ErpReceipt erpReceipt, HttpServletRequest req) { | ||
32 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
33 | + return erpService.receipt(erpReceipt, warehouseCode); | ||
34 | + } | ||
35 | + | ||
36 | + @PostMapping("/cancelReceipt") | ||
37 | + @ResponseBody | ||
38 | + @ApiLogger(apiName = "取消入库单", from="ERP") | ||
39 | + public Result cancelReceipt(@RequestBody Map<String, String> param, HttpServletRequest req) { | ||
40 | + String referCode = param.get("referCode"); | ||
41 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
42 | + return erpService.cancelReceipt(referCode, warehouseCode); | ||
43 | + } | ||
44 | + | ||
45 | + | ||
46 | + @PostMapping("/shipment") | ||
47 | + @ResponseBody | ||
48 | + @ApiLogger(apiName = "出库单下发", from="ERP") | ||
49 | + public Result shipment(@RequestBody ErpShipment erpShipment, HttpServletRequest req) { | ||
50 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
51 | + Result result = handleMultiProcess("shipment", new JeecgController.MultiProcessListener() { | ||
52 | + @Override | ||
53 | + public Result doProcess() { | ||
54 | + return erpService.shipment(erpShipment, warehouseCode); | ||
55 | + } | ||
56 | + }); | ||
57 | + return result; | ||
58 | + } | ||
59 | + | ||
60 | + | ||
61 | + @PostMapping("/cancelShipment") | ||
62 | + @ResponseBody | ||
63 | + @ApiLogger(apiName = "取消出库单", from="ERP") | ||
64 | + public Result cancelShipment(@RequestBody Map<String, String> param, HttpServletRequest req) { | ||
65 | + String referCode = param.get("referCode"); | ||
66 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
67 | + Result result = handleMultiProcess("cancelShipment", new JeecgController.MultiProcessListener() { | ||
68 | + @Override | ||
69 | + public Result doProcess() { | ||
70 | + return erpService.cancelShipment(referCode, warehouseCode); | ||
71 | + } | ||
72 | + }); | ||
73 | + return result; | ||
74 | + } | ||
75 | + | ||
76 | + @PostMapping("/searchInventory") | ||
77 | + @ResponseBody | ||
78 | + @ApiLogger(apiName = "查询库存", from="ERP") | ||
79 | + public Result searchInventory(@RequestBody InventoryQueryParam inventoryQueryParam, HttpServletRequest req) { | ||
80 | + Result result = erpService.searchInventory(inventoryQueryParam); | ||
81 | + return result; | ||
82 | + } | ||
83 | + | ||
84 | + | ||
85 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesMaterial.java
0 → 100644
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
@@ -368,18 +368,12 @@ public class WcsServiceImpl implements WcsService { | @@ -368,18 +368,12 @@ public class WcsServiceImpl implements WcsService { | ||
368 | throw new ServiceException("下发任务时,容器没有找到"); | 368 | throw new ServiceException("下发任务时,容器没有找到"); |
369 | } | 369 | } |
370 | 370 | ||
371 | -// String zoneCode = container.getZoneCode(); | ||
372 | -// if(StringUtils.isEmpty(zoneCode)) { | ||
373 | -// throw new ServiceException("下发任务时,库区编码为空"); | ||
374 | -// } | ||
375 | String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_CONNECT_WCS); | 371 | String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_CONNECT_WCS); |
376 | if(StringUtils.isEmpty(value)) { | 372 | if(StringUtils.isEmpty(value)) { |
377 | throw new ServiceException("下发任务时,没有找到连接WCS的数据配置"); | 373 | throw new ServiceException("下发任务时,没有找到连接WCS的数据配置"); |
378 | } | 374 | } |
379 | int connectWCS = Integer.parseInt(value); | 375 | int connectWCS = Integer.parseInt(value); |
380 | if (connectWCS == QuantityConstant.RULE_WCS_CONNECT) { | 376 | if (connectWCS == QuantityConstant.RULE_WCS_CONNECT) { |
381 | -// String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_TASK_ASSIGN, | ||
382 | -// warehouseCode, zoneCode); | ||
383 | String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_TASK_ASSIGN); | 377 | String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_TASK_ASSIGN); |
384 | wcsTask = switchTaskTypeToWcs(wcsTask); | 378 | wcsTask = switchTaskTypeToWcs(wcsTask); |
385 | String jsonParam = JSON.toJSONString(wcsTask); | 379 | String jsonParam = JSON.toJSONString(wcsTask); |
@@ -389,7 +383,7 @@ public class WcsServiceImpl implements WcsService { | @@ -389,7 +383,7 @@ public class WcsServiceImpl implements WcsService { | ||
389 | throw new ServiceException("接口地址错误或返回为空"); | 383 | throw new ServiceException("接口地址错误或返回为空"); |
390 | } | 384 | } |
391 | Result result = JSON.parseObject(body, Result.class); | 385 | Result result = JSON.parseObject(body, Result.class); |
392 | - if(result.getCode() == QuantityConstant.HTTP_OK) { | 386 | + if(result.getCode() != QuantityConstant.HTTP_OK) { |
393 | return Result.error(result.getMsg()); | 387 | return Result.error(result.getMsg()); |
394 | } | 388 | } |
395 | } | 389 | } |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/material/entity/Material.java
@@ -111,7 +111,7 @@ public class Material implements Serializable { | @@ -111,7 +111,7 @@ public class Material implements Serializable { | ||
111 | @Excel(name = "可用状态", width = 15, dicCode = "enable_status") | 111 | @Excel(name = "可用状态", width = 15, dicCode = "enable_status") |
112 | @Dict(dicCode = "enable_status") | 112 | @Dict(dicCode = "enable_status") |
113 | @ApiModelProperty(value = "可用状态") | 113 | @ApiModelProperty(value = "可用状态") |
114 | - private String enable; | 114 | + private Integer enable; |
115 | /**创建人*/ | 115 | /**创建人*/ |
116 | @ApiModelProperty(value = "创建人") | 116 | @ApiModelProperty(value = "创建人") |
117 | private String createBy; | 117 | private String createBy; |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/job/ErpTask.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.job; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||
4 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
6 | +import lombok.extern.slf4j.Slf4j; | ||
7 | +import org.apache.commons.collections.MapUtils; | ||
8 | +import org.jeecg.modules.wms.api.erp.service.IErpService; | ||
9 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | ||
10 | +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; | ||
11 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | ||
12 | +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; | ||
13 | +import org.jeecg.utils.constant.QuantityConstant; | ||
14 | +import org.quartz.Job; | ||
15 | +import org.quartz.JobExecutionContext; | ||
16 | +import org.quartz.JobExecutionException; | ||
17 | + | ||
18 | +import javax.annotation.Resource; | ||
19 | +import java.util.HashMap; | ||
20 | +import java.util.List; | ||
21 | +import java.util.Map; | ||
22 | + | ||
23 | +/** | ||
24 | + * 定时回传ERP | ||
25 | + * @author 游杰 | ||
26 | + */ | ||
27 | + | ||
28 | +@Slf4j | ||
29 | +public class ErpTask implements Job { | ||
30 | + | ||
31 | + @Resource | ||
32 | + private IReceiptHeaderService receiptHeaderService; | ||
33 | + @Resource | ||
34 | + private IShipmentHeaderService shipmentHeaderService; | ||
35 | + @Resource | ||
36 | + private IErpService erpService; | ||
37 | + //并发控制 | ||
38 | + Map<String, Boolean> runningTaskMap = new HashMap<>(); | ||
39 | + | ||
40 | + @Override | ||
41 | + public void execute(JobExecutionContext context) throws JobExecutionException { | ||
42 | + String taskKey = "erpBack"; | ||
43 | + if(MapUtils.getBoolean(runningTaskMap, taskKey, false)) { | ||
44 | + return; | ||
45 | + } | ||
46 | + try { | ||
47 | + runningTaskMap.put(taskKey, true); | ||
48 | + LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
49 | + receiptHeaderLambdaQueryWrapper.eq(ReceiptHeader::getFirstStatus, QuantityConstant.RECEIPT_HEADER_COMPLETED) | ||
50 | + .eq(ReceiptHeader::getLastStatus, QuantityConstant.RECEIPT_HEADER_COMPLETED); | ||
51 | + List<ReceiptHeader> receiptHeaderList = receiptHeaderService.list(receiptHeaderLambdaQueryWrapper); | ||
52 | + for (ReceiptHeader receiptHeader : receiptHeaderList) { | ||
53 | + try { | ||
54 | + erpService.backReceipt(receiptHeader); | ||
55 | + } catch (Exception e) { | ||
56 | + e.printStackTrace(); | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + LambdaQueryWrapper<ShipmentHeader> shipmentHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
61 | + shipmentHeaderLambdaQueryWrapper.eq(ShipmentHeader::getFirstStatus, QuantityConstant.RECEIPT_HEADER_COMPLETED) | ||
62 | + .eq(ShipmentHeader::getLastStatus, QuantityConstant.RECEIPT_HEADER_COMPLETED); | ||
63 | + List<ShipmentHeader> shipmentHeaderList = shipmentHeaderService.list(shipmentHeaderLambdaQueryWrapper); | ||
64 | + for (ShipmentHeader shipmentHeader : shipmentHeaderList) { | ||
65 | + try { | ||
66 | + erpService.backShipment(shipmentHeader); | ||
67 | + } catch (Exception e) { | ||
68 | + e.printStackTrace(); | ||
69 | + } | ||
70 | + } | ||
71 | + } catch (Exception e) { | ||
72 | + e.printStackTrace(); | ||
73 | + } finally { | ||
74 | + runningTaskMap.put(taskKey, false); | ||
75 | + } | ||
76 | + } | ||
77 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/job/RyTask.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.job; | ||
2 | + | ||
3 | + | ||
4 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
6 | +import lombok.extern.slf4j.Slf4j; | ||
7 | +import org.apache.commons.collections.MapUtils; | ||
8 | +import org.jeecg.common.util.DateUtils; | ||
9 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | ||
10 | +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; | ||
11 | +import org.jeecg.utils.constant.QuantityConstant; | ||
12 | +import org.quartz.Job; | ||
13 | +import org.quartz.JobExecutionContext; | ||
14 | +import org.quartz.JobExecutionException; | ||
15 | + | ||
16 | +import javax.annotation.Resource; | ||
17 | +import java.util.HashMap; | ||
18 | +import java.util.List; | ||
19 | +import java.util.Map; | ||
20 | + | ||
21 | +/** | ||
22 | + * 定时任务 | ||
23 | + */ | ||
24 | + | ||
25 | +@Slf4j | ||
26 | +public class RyTask implements Job { | ||
27 | + | ||
28 | + //并发控制 | ||
29 | + Map<String, Boolean> runningTaskMap = new HashMap<>(); | ||
30 | + @Resource | ||
31 | + private ITaskHeaderService taskHeaderService; | ||
32 | + | ||
33 | + @Override | ||
34 | + public void execute(JobExecutionContext context) throws JobExecutionException { | ||
35 | + log.info(String.format(" Jeecg-Boot 执行任务! 时间:" + DateUtils.getTimestamp())); | ||
36 | + String taskKey = "executeTask"; | ||
37 | + if(MapUtils.getBoolean(runningTaskMap, taskKey, false)) { | ||
38 | + return; | ||
39 | + } | ||
40 | + try { | ||
41 | + runningTaskMap.put(taskKey, true); | ||
42 | + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
43 | + taskHeaderLambdaQueryWrapper.eq(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_BUILD); | ||
44 | + List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | ||
45 | + for(TaskHeader taskHeader : taskHeaderList) { | ||
46 | + try { | ||
47 | + taskHeaderService.sendTaskToWcs(taskHeader.getId()); | ||
48 | + } catch (Exception e) { | ||
49 | + e.printStackTrace(); | ||
50 | + } | ||
51 | + } | ||
52 | + } catch (Exception e) { | ||
53 | + e.printStackTrace(); | ||
54 | + } finally { | ||
55 | + runningTaskMap.put(taskKey, false); | ||
56 | + } | ||
57 | + } | ||
58 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/controller/ReceiptHeaderController.java
@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j; | @@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j; | ||
10 | import org.jeecg.common.system.base.controller.JeecgController; | 10 | import org.jeecg.common.system.base.controller.JeecgController; |
11 | import org.jeecg.common.api.vo.Result; | 11 | import org.jeecg.common.api.vo.Result; |
12 | import org.jeecg.common.system.util.JwtUtil; | 12 | import org.jeecg.common.system.util.JwtUtil; |
13 | +import org.jeecg.modules.wms.api.erp.service.IErpService; | ||
13 | import org.jeecg.modules.wms.config.material.entity.Material; | 14 | import org.jeecg.modules.wms.config.material.entity.Material; |
14 | import org.jeecg.modules.wms.config.material.service.IMaterialService; | 15 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
15 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | 16 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; |
@@ -67,6 +68,8 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | @@ -67,6 +68,8 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | ||
67 | private IReceiptDetailService receiptDetailService; | 68 | private IReceiptDetailService receiptDetailService; |
68 | @Resource | 69 | @Resource |
69 | private IMaterialService materialService; | 70 | private IMaterialService materialService; |
71 | + @Resource | ||
72 | + private IErpService erpService; | ||
70 | 73 | ||
71 | 74 | ||
72 | /*---------------------------------主表处理-begin-------------------------------------*/ | 75 | /*---------------------------------主表处理-begin-------------------------------------*/ |
@@ -335,5 +338,17 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | @@ -335,5 +338,17 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | ||
335 | 338 | ||
336 | /*--------------------------------子表处理-入库单详情-end----------------------------------------------*/ | 339 | /*--------------------------------子表处理-入库单详情-end----------------------------------------------*/ |
337 | 340 | ||
338 | - | 341 | + /** |
342 | + * 回传入库单 | ||
343 | + * @param receiptHeader | ||
344 | + * @return | ||
345 | + */ | ||
346 | + @AutoLog(value = "回传入库单") | ||
347 | + @ApiOperation(value="回传入库单", notes="回传入库单") | ||
348 | + @RequiresPermissions("receiptHeader:back") | ||
349 | + @RequestMapping(value = "/backErpReceipt", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
350 | + public Result<String> backErpReceipt(@RequestBody ReceiptHeader receiptHeader) { | ||
351 | + Result result = erpService.backReceipt(receiptHeader); | ||
352 | + return result; | ||
353 | + } | ||
339 | } | 354 | } |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java
@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j; | @@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j; | ||
10 | import org.jeecg.common.system.base.controller.JeecgController; | 10 | import org.jeecg.common.system.base.controller.JeecgController; |
11 | import org.jeecg.common.api.vo.Result; | 11 | import org.jeecg.common.api.vo.Result; |
12 | import org.jeecg.common.system.util.JwtUtil; | 12 | import org.jeecg.common.system.util.JwtUtil; |
13 | +import org.jeecg.modules.wms.api.erp.service.IErpService; | ||
13 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | 14 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; |
14 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | 15 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
15 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | 16 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
@@ -20,6 +21,8 @@ import org.jeecg.utils.StringUtils; | @@ -20,6 +21,8 @@ import org.jeecg.utils.StringUtils; | ||
20 | import org.jeecg.utils.constant.QuantityConstant; | 21 | import org.jeecg.utils.constant.QuantityConstant; |
21 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
22 | import org.springframework.web.bind.annotation.*; | 23 | import org.springframework.web.bind.annotation.*; |
24 | + | ||
25 | +import javax.annotation.Resource; | ||
23 | import javax.servlet.http.HttpServletRequest; | 26 | import javax.servlet.http.HttpServletRequest; |
24 | import javax.servlet.http.HttpServletResponse; | 27 | import javax.servlet.http.HttpServletResponse; |
25 | import org.springframework.web.servlet.ModelAndView; | 28 | import org.springframework.web.servlet.ModelAndView; |
@@ -59,6 +62,8 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | @@ -59,6 +62,8 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | ||
59 | 62 | ||
60 | @Autowired | 63 | @Autowired |
61 | private IShipmentDetailService shipmentDetailService; | 64 | private IShipmentDetailService shipmentDetailService; |
65 | + @Resource | ||
66 | + private IErpService erpService; | ||
62 | 67 | ||
63 | 68 | ||
64 | /*---------------------------------主表处理-begin-------------------------------------*/ | 69 | /*---------------------------------主表处理-begin-------------------------------------*/ |
@@ -327,5 +332,17 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | @@ -327,5 +332,17 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | ||
327 | 332 | ||
328 | 333 | ||
329 | 334 | ||
330 | - | 335 | + /** |
336 | + * 回传出库单 | ||
337 | + * @param shipmentHeader | ||
338 | + * @return | ||
339 | + */ | ||
340 | + @AutoLog(value = "回传出库单") | ||
341 | + @ApiOperation(value="回传出库单", notes="回传出库单") | ||
342 | + @RequiresPermissions("shipmentHeader:back") | ||
343 | + @RequestMapping(value = "/backErpShipment", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
344 | + public Result<String> backErpShipment(@RequestBody ShipmentHeader shipmentHeader) { | ||
345 | + Result result = erpService.backShipment(shipmentHeader); | ||
346 | + return result; | ||
347 | + } | ||
331 | } | 348 | } |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java
@@ -382,20 +382,18 @@ public class TaskHeaderController extends JeecgController<TaskHeader, ITaskHeade | @@ -382,20 +382,18 @@ public class TaskHeaderController extends JeecgController<TaskHeader, ITaskHeade | ||
382 | @PostMapping( "/execute") | 382 | @PostMapping( "/execute") |
383 | @RequiresPermissions("taskHeader:executeTask") | 383 | @RequiresPermissions("taskHeader:executeTask") |
384 | public Result execute(@RequestBody TaskHeader taskHeader) { | 384 | public Result execute(@RequestBody TaskHeader taskHeader) { |
385 | - { | ||
386 | - if (taskHeader == null) { | ||
387 | - return Result.error("taskHeader不能为空"); | ||
388 | - } | ||
389 | - Integer taskId = taskHeader.getId(); | ||
390 | - Result result = handleMultiProcess("execute", new MultiProcessListener() { | ||
391 | - @Override | ||
392 | - public Result doProcess() { | ||
393 | - Result result = taskHeaderService.sendTaskToWcs(taskId); | ||
394 | - return result; | ||
395 | - } | ||
396 | - }); | ||
397 | - return result; | 385 | + if (taskHeader == null) { |
386 | + return Result.error("taskHeader不能为空"); | ||
398 | } | 387 | } |
388 | + Integer taskId = taskHeader.getId(); | ||
389 | + Result result = handleMultiProcess("execute", new MultiProcessListener() { | ||
390 | + @Override | ||
391 | + public Result doProcess() { | ||
392 | + Result result = taskHeaderService.sendTaskToWcs(taskId); | ||
393 | + return result; | ||
394 | + } | ||
395 | + }); | ||
396 | + return result; | ||
399 | } | 397 | } |
400 | 398 | ||
401 | /** | 399 | /** |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java
@@ -426,6 +426,13 @@ public class QuantityConstant { | @@ -426,6 +426,13 @@ public class QuantityConstant { | ||
426 | public static final String ADDRESS_AGV_TASK_UPDATE = "AGV_TASK_UPDATE"; | 426 | public static final String ADDRESS_AGV_TASK_UPDATE = "AGV_TASK_UPDATE"; |
427 | 427 | ||
428 | //ERP | 428 | //ERP |
429 | + | ||
430 | + //回传ERP入库单 | ||
431 | + public static final String ADDRESS_ERP_BACK_RECEIPT = "ERP_BACK_RECEIPT"; | ||
432 | + //回传ERP出库单 | ||
433 | + public static final String ADDRESS_ERP_BACK_SHIPMENT = "ERP_BACK_SHIPMENT"; | ||
434 | + | ||
435 | + | ||
429 | public static final String PLATFORM_CODING = "赋码系统"; | 436 | public static final String PLATFORM_CODING = "赋码系统"; |
430 | public static final String PLATFORM_ERP = "ERP"; | 437 | public static final String PLATFORM_ERP = "ERP"; |
431 | public static final String PLATFORM_WMS = "WMS"; | 438 | public static final String PLATFORM_WMS = "WMS"; |