Commit 7a9a3f5229e210a8cf3a0d5354f101c2c23018b3
1 parent
5c3b917e
删除信义接口
Showing
34 changed files
with
16 additions
and
2232 deletions
.idea/workspace.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <project version="4"> |
3 | 3 | <component name="ChangeListManager"> |
4 | - <list default="true" id="29079676-ace5-434e-89a2-76a325e744a5" name="Default Changelist" comment="" /> | |
4 | + <list default="true" id="29079676-ace5-434e-89a2-76a325e744a5" name="Default Changelist" comment="合并信义源码"> | |
5 | + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | |
6 | + </list> | |
5 | 7 | <option name="SHOW_DIALOG" value="false" /> |
6 | 8 | <option name="HIGHLIGHT_CONFLICTS" value="true" /> |
7 | 9 | <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> |
... | ... | @@ -150,6 +152,7 @@ |
150 | 152 | <workItem from="1565311988064" duration="7176000" /> |
151 | 153 | <workItem from="1565328536669" duration="797000" /> |
152 | 154 | <workItem from="1578550781950" duration="1941000" /> |
155 | + <workItem from="1578571901482" duration="717000" /> | |
153 | 156 | </task> |
154 | 157 | <task id="LOCAL-00001" summary="添加库位、库位类型增删改查接口"> |
155 | 158 | <created>1565226427512</created> |
... | ... | @@ -207,13 +210,21 @@ |
207 | 210 | <option name="LAST_COMMIT_MESSAGE" value="合并信义源码" /> |
208 | 211 | </component> |
209 | 212 | <component name="WindowStateProjectService"> |
210 | - <state x="550" y="111" key="CommitChangelistDialog2" timestamp="1578554207304"> | |
213 | + <state x="550" y="111" key="CommitChangelistDialog2" timestamp="1578572128713"> | |
211 | 214 | <screen x="0" y="0" width="1920" height="1040" /> |
212 | 215 | </state> |
213 | - <state x="550" y="111" key="CommitChangelistDialog2/0.0.1920.1040@0.0.1920.1040" timestamp="1578554207304" /> | |
214 | - <state x="552" y="253" key="Vcs.Push.Dialog.v2" timestamp="1578554217443"> | |
216 | + <state x="550" y="111" key="CommitChangelistDialog2/0.0.1920.1040@0.0.1920.1040" timestamp="1578572128713" /> | |
217 | + <state x="184" y="92" key="DiffContextDialog" timestamp="1578572140549"> | |
215 | 218 | <screen x="0" y="0" width="1920" height="1040" /> |
216 | 219 | </state> |
217 | - <state x="552" y="253" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1578554217443" /> | |
220 | + <state x="184" y="92" key="DiffContextDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1578572140549" /> | |
221 | + <state x="552" y="253" key="Vcs.Push.Dialog.v2" timestamp="1578572617942"> | |
222 | + <screen x="0" y="0" width="1920" height="1040" /> | |
223 | + </state> | |
224 | + <state x="552" y="253" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1578572617942" /> | |
225 | + <state x="647" y="310" key="git4idea.merge.GitPullDialog" timestamp="1578572305258"> | |
226 | + <screen x="0" y="0" width="1920" height="1040" /> | |
227 | + </state> | |
228 | + <state x="647" y="310" key="git4idea.merge.GitPullDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1578572305258" /> | |
218 | 229 | </component> |
219 | 230 | </project> |
220 | 231 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/api/xinyi/constant/ResultStatus.java deleted
1 | -package com.huaheng.api.xinyi.constant; | |
2 | - | |
3 | -/** | |
4 | - * 返回code状态 | |
5 | - * | |
6 | - * @author Enzo Cotter | |
7 | - * @date 2019/12/20 | |
8 | - */ | |
9 | -public class ResultStatus { | |
10 | - | |
11 | - | |
12 | - /** | |
13 | - * 成功 | |
14 | - */ | |
15 | - public static final String SUCCESS = "0"; | |
16 | - | |
17 | - /** | |
18 | - * token过期 | |
19 | - */ | |
20 | - public static final String EXPIRED = "401"; | |
21 | -} |
src/main/java/com/huaheng/api/xinyi/constant/XinYiConstant.java deleted
1 | -package com.huaheng.api.xinyi.constant; | |
2 | - | |
3 | - | |
4 | -/** | |
5 | - * 信义接口地址 | |
6 | - * @author Enzo Cotter | |
7 | - * @date 2019/12/20 | |
8 | - */ | |
9 | -public class XinYiConstant { | |
10 | - | |
11 | - public static final String XINYI_HOST = "http://erptest.xinyiglass.com:8000/"; | |
12 | - | |
13 | - public static final String PROJECT_NAME = "xygerp/ali"; | |
14 | -} |
src/main/java/com/huaheng/api/xinyi/controller/BaseDataController.java deleted
1 | -package com.huaheng.api.xinyi.controller; | |
2 | - | |
3 | -import com.huaheng.api.xinyi.service.BasisService; | |
4 | -import com.huaheng.framework.web.controller.BaseController; | |
5 | -import com.huaheng.framework.web.domain.AjaxResult; | |
6 | -import org.springframework.stereotype.Controller; | |
7 | -import org.springframework.web.bind.annotation.GetMapping; | |
8 | -import org.springframework.web.bind.annotation.RequestMapping; | |
9 | -import org.springframework.web.bind.annotation.ResponseBody; | |
10 | - | |
11 | -import javax.annotation.Resource; | |
12 | - | |
13 | -/** | |
14 | - * Created by Enzo Cotter on 2019/12/29. | |
15 | - */ | |
16 | -@Controller | |
17 | -@RequestMapping("/xinyi/base") | |
18 | -public class BaseDataController extends BaseController { | |
19 | - | |
20 | - @Resource | |
21 | - private BasisService basisService; | |
22 | - | |
23 | - @GetMapping("getInventories") | |
24 | - @ResponseBody | |
25 | - public AjaxResult getInventories(String organizationId, int bout){ | |
26 | - return AjaxResult.success(basisService.getInventories(organizationId, bout)); | |
27 | - } | |
28 | - | |
29 | - @GetMapping("getItems") | |
30 | - @ResponseBody | |
31 | - public AjaxResult getItems(String dateFrom, String dateTo, Integer pageNum, Integer pageSize, boolean count, int bout, String orderBy, String inventoryItemId){ | |
32 | - return AjaxResult.success(basisService.getItems(dateFrom, dateTo, pageNum, pageSize, count, bout, orderBy, inventoryItemId)); | |
33 | - } | |
34 | - | |
35 | - @GetMapping("getOperatingUnits") | |
36 | - @ResponseBody | |
37 | - public AjaxResult getOperatingUnits(int bout){ | |
38 | - return AjaxResult.success(basisService.getOperatingUnits(bout)); | |
39 | - } | |
40 | - | |
41 | - @GetMapping("getOrganization") | |
42 | - @ResponseBody | |
43 | - public AjaxResult getOrganization(int bout){ | |
44 | - return AjaxResult.success(basisService.getOrganization(bout)); | |
45 | - } | |
46 | - | |
47 | - @GetMapping("getUnitConversions") | |
48 | - @ResponseBody | |
49 | - public AjaxResult getUnitConversions(int bout, String fromUomCode, String toUomCode, String inventoryItemId){ | |
50 | - return AjaxResult.success(basisService.getUnitConversions(bout, fromUomCode, toUomCode, inventoryItemId)); | |
51 | - } | |
52 | - | |
53 | - @GetMapping("getUnits") | |
54 | - @ResponseBody | |
55 | - public AjaxResult getUnits(int bout){ | |
56 | - return AjaxResult.success(basisService.getOrganization(bout)); | |
57 | - } | |
58 | -} |
src/main/java/com/huaheng/api/xinyi/controller/BusinessController.java deleted
1 | -package com.huaheng.api.xinyi.controller; | |
2 | - | |
3 | -import com.huaheng.api.xinyi.service.BusinessService; | |
4 | -import com.huaheng.framework.web.controller.BaseController; | |
5 | -import com.huaheng.framework.web.domain.AjaxResult; | |
6 | -import org.springframework.stereotype.Controller; | |
7 | -import org.springframework.web.bind.annotation.GetMapping; | |
8 | -import org.springframework.web.bind.annotation.RequestMapping; | |
9 | -import org.springframework.web.bind.annotation.ResponseBody; | |
10 | - | |
11 | -import javax.annotation.Resource; | |
12 | - | |
13 | -/** | |
14 | - * Created by Enzo Cotter on 2020/1/7. | |
15 | - */ | |
16 | -@Controller | |
17 | -@RequestMapping("/xinyi/business") | |
18 | -public class BusinessController extends BaseController { | |
19 | - | |
20 | - @Resource | |
21 | - private BusinessService businessService; | |
22 | - | |
23 | - @GetMapping("getDeliverOrder") | |
24 | - @ResponseBody | |
25 | - public AjaxResult getDeliverOrder(String organizationId, String deliverHeaderId, int bout){ | |
26 | - return AjaxResult.success(businessService.getDeliverOrder(organizationId, deliverHeaderId, bout)); | |
27 | - } | |
28 | - | |
29 | - @GetMapping("getEslipStatus") | |
30 | - @ResponseBody | |
31 | - public AjaxResult getEslipStatus(String organizationId, String eslipNumber, int bout){ | |
32 | - return AjaxResult.success(businessService.getEslipStatus(organizationId, eslipNumber, bout)); | |
33 | - } | |
34 | - | |
35 | - @GetMapping("getEslipTransactions") | |
36 | - @ResponseBody | |
37 | - public AjaxResult getEslipTransactions(Integer organizationId, String actionType, String dateFrom, String dateTo, Integer headerId, int bout){ | |
38 | - return AjaxResult.success(businessService.getEslipTransactions(organizationId, actionType, dateFrom, dateTo, headerId, bout)); | |
39 | - } | |
40 | - | |
41 | - @GetMapping("getRcvShipment") | |
42 | - @ResponseBody | |
43 | - public AjaxResult getRcvShipment(String organizationId, String eslipNumber, int bout){ | |
44 | - return AjaxResult.success(businessService.getRcvShipment(organizationId, eslipNumber, bout)); | |
45 | - } | |
46 | - | |
47 | - @GetMapping("getPoOrder") | |
48 | - @ResponseBody | |
49 | - public AjaxResult getPoOrder(String organizationId, String eslipNumber, int bout){ | |
50 | - return AjaxResult.success(businessService.getPoOrder(organizationId, eslipNumber, bout)); | |
51 | - } | |
52 | - | |
53 | - @GetMapping("validateDeliver") | |
54 | - @ResponseBody | |
55 | - public AjaxResult validateDeliver(String organizationId, String eslipNumber, int bout){ | |
56 | - return AjaxResult.success(businessService.validateDeliver(organizationId, eslipNumber, bout)); | |
57 | - } | |
58 | - | |
59 | - @GetMapping("validatePo") | |
60 | - @ResponseBody | |
61 | - public AjaxResult validatePo(String organizationId, String eslipNumber, int bout){ | |
62 | - return AjaxResult.success(businessService.validatePo(organizationId, eslipNumber, bout)); | |
63 | - } | |
64 | - | |
65 | - @GetMapping("validateRcvShipment") | |
66 | - @ResponseBody | |
67 | - public AjaxResult validateRcvShipment(String organizationId, String eslipNumber, int bout){ | |
68 | - return AjaxResult.success(businessService.validateRcvShipment(organizationId, eslipNumber, bout)); | |
69 | - } | |
70 | -} |
src/main/java/com/huaheng/api/xinyi/controller/TokenController.java deleted
1 | -package com.huaheng.api.xinyi.controller; | |
2 | - | |
3 | -import com.huaheng.api.xinyi.service.ApiTokenService; | |
4 | -import com.huaheng.framework.web.controller.BaseController; | |
5 | -import com.huaheng.framework.web.domain.AjaxResult; | |
6 | -import org.springframework.stereotype.Controller; | |
7 | -import org.springframework.web.bind.annotation.GetMapping; | |
8 | -import org.springframework.web.bind.annotation.RequestMapping; | |
9 | -import springfox.documentation.annotations.Cacheable; | |
10 | - | |
11 | -import javax.annotation.Resource; | |
12 | - | |
13 | -/** | |
14 | - * token获取 | |
15 | - * @author Enzo Cotter | |
16 | - * @date 2019/12/31 | |
17 | - */ | |
18 | -@Controller | |
19 | -@RequestMapping("/xinyi/token") | |
20 | -public class TokenController extends BaseController { | |
21 | - @Resource | |
22 | - private ApiTokenService apiTokenService; | |
23 | - | |
24 | - @GetMapping("/token") | |
25 | - public AjaxResult getToken(){ | |
26 | - if ("success".equals(apiTokenService.apiToken())) { | |
27 | - return AjaxResult.success(""); | |
28 | - } else { | |
29 | - return AjaxResult.error(""); | |
30 | - } | |
31 | - } | |
32 | -} |
src/main/java/com/huaheng/api/xinyi/domian/AuthUser.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -import java.util.Date; | |
6 | - | |
7 | -/** | |
8 | - * 认证用户 | |
9 | - * @author Enzo Cotter | |
10 | - * @date 2019/12/20 | |
11 | - */ | |
12 | -@Data | |
13 | -public class AuthUser { | |
14 | - | |
15 | - private Integer userId; | |
16 | - | |
17 | - private String userName; | |
18 | - | |
19 | - private String emailAddress; | |
20 | - | |
21 | - private String employeeId; | |
22 | - | |
23 | - private String passwordDate; | |
24 | - | |
25 | - private Date startDate; | |
26 | - | |
27 | - private String endDate; | |
28 | - | |
29 | - private String employeeNumber; | |
30 | - | |
31 | - private String fullName; | |
32 | - | |
33 | - private String ipAddress; | |
34 | - | |
35 | - private String description; | |
36 | - | |
37 | - private long loginId; | |
38 | - | |
39 | - private String language; | |
40 | - | |
41 | - private String authorities; | |
42 | - | |
43 | - private boolean enabled; | |
44 | - | |
45 | - private String username; | |
46 | -} |
src/main/java/com/huaheng/api/xinyi/domian/DeliverOrder.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -/** | |
6 | - * 送货单 | |
7 | - * @author Enzo Cotter | |
8 | - * @date 2019/12/24 | |
9 | - */ | |
10 | -@Data | |
11 | -public class DeliverOrder { | |
12 | - | |
13 | - /** | |
14 | - * 送货行id | |
15 | - */ | |
16 | - private int deliverLineId; | |
17 | - | |
18 | - /** | |
19 | - * 送货头id | |
20 | - */ | |
21 | - private int deliverHeaderId; | |
22 | - | |
23 | - /** | |
24 | - * 送货单号 | |
25 | - */ | |
26 | - private String deliverNumber; | |
27 | - | |
28 | - /** | |
29 | - * 送货行号 | |
30 | - */ | |
31 | - private String deliverLineNumber; | |
32 | - | |
33 | - /** | |
34 | - * 采购行发运id | |
35 | - */ | |
36 | - private int lineLocationId; | |
37 | - | |
38 | - /** | |
39 | - * 采购行id | |
40 | - */ | |
41 | - private int poLineId; | |
42 | - | |
43 | - /** | |
44 | - * 采购头id | |
45 | - */ | |
46 | - private int poHeaderId; | |
47 | - | |
48 | - /** | |
49 | - * 采购单号 | |
50 | - */ | |
51 | - private String poNumber; | |
52 | - | |
53 | - /** | |
54 | - * 采购行号 | |
55 | - */ | |
56 | - private String poLineNum; | |
57 | - | |
58 | - /** | |
59 | - * 物料id | |
60 | - */ | |
61 | - private int inventoryItemId; | |
62 | - | |
63 | - /** | |
64 | - * 库存组织id | |
65 | - */ | |
66 | - private int organizationId; | |
67 | - | |
68 | - /** | |
69 | - * 物料编码 | |
70 | - */ | |
71 | - private String itemNumber; | |
72 | - | |
73 | - /** | |
74 | - * 物料描述 | |
75 | - */ | |
76 | - private String itemDesc; | |
77 | - | |
78 | - /** | |
79 | - * 单位 | |
80 | - */ | |
81 | - private String uomCode; | |
82 | - | |
83 | - /** | |
84 | - * quantity | |
85 | - */ | |
86 | - private int quantity; | |
87 | - | |
88 | - /** | |
89 | - * 可接受数量 | |
90 | - */ | |
91 | - private int availableQuantity; | |
92 | - | |
93 | - /** | |
94 | - * 接受方式id | |
95 | - */ | |
96 | - private int receivingRoutingId; | |
97 | - | |
98 | - /** | |
99 | - * 交易类型 | |
100 | - */ | |
101 | - private String transactionType; | |
102 | - | |
103 | - /** | |
104 | - * 目的地 | |
105 | - */ | |
106 | - private String destinationTypeCode; | |
107 | -} |
src/main/java/com/huaheng/api/xinyi/domian/EslipStatus.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -/** | |
6 | - * | |
7 | - * @author Enzo Cotter | |
8 | - * @date 2019/12/24 | |
9 | - */ | |
10 | -@Data | |
11 | -public class EslipStatus { | |
12 | - | |
13 | - private Integer headerId; | |
14 | - | |
15 | - private String organizationId; | |
16 | - | |
17 | - private String eslipNumber; | |
18 | - | |
19 | - private String statusFlag; | |
20 | - | |
21 | - private String statusFlagDesc; | |
22 | -} |
src/main/java/com/huaheng/api/xinyi/domian/EslipTransactions.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -/** | |
4 | - * | |
5 | - * @author Enzo Cotter | |
6 | - * @date 2019/12/24 | |
7 | - */ | |
8 | -public class EslipTransactions { | |
9 | - | |
10 | - /** | |
11 | - * 头id | |
12 | - */ | |
13 | - private Integer headerId; | |
14 | - | |
15 | - /** | |
16 | - * 组织id | |
17 | - */ | |
18 | - private String organizationId; | |
19 | - | |
20 | - /** | |
21 | - * 单据号码 | |
22 | - */ | |
23 | - private String eslipNumber; | |
24 | - | |
25 | - /** | |
26 | - * 状态 | |
27 | - */ | |
28 | - private String statusFlag; | |
29 | - | |
30 | - /** | |
31 | - * 状态描述 | |
32 | - */ | |
33 | - private String statusFlagDesc; | |
34 | -} |
src/main/java/com/huaheng/api/xinyi/domian/Inventories.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -/** | |
6 | - * 库存 | |
7 | - * @author Enzo Cotter | |
8 | - * @date 2019/12/19 | |
9 | - */ | |
10 | -@Data | |
11 | -public class Inventories { | |
12 | - | |
13 | - /** | |
14 | - * 物料ID | |
15 | - */ | |
16 | - private Integer inventoryItemId; | |
17 | - | |
18 | - /** | |
19 | - * 组织ID | |
20 | - */ | |
21 | - private Integer organizationId; | |
22 | - | |
23 | - /** | |
24 | - * 物料编码 | |
25 | - */ | |
26 | - private String itemNumber; | |
27 | - | |
28 | - /** | |
29 | - * 物料描述 | |
30 | - */ | |
31 | - private String itemDesc; | |
32 | - | |
33 | - /** | |
34 | - * 仓库代码 | |
35 | - */ | |
36 | - private String subinventoryCode; | |
37 | - | |
38 | - /** | |
39 | - * 货位ID | |
40 | - */ | |
41 | - private Integer locatorId; | |
42 | - | |
43 | - /** | |
44 | - * 货位编码 | |
45 | - */ | |
46 | - private String locatorCode; | |
47 | - | |
48 | - /** | |
49 | - * 主单位 | |
50 | - */ | |
51 | - private String primaryUnitOfMeasure; | |
52 | - | |
53 | - /** | |
54 | - * 主单位code | |
55 | - */ | |
56 | - private String primaryUomCode; | |
57 | - | |
58 | - /** | |
59 | - * 主单位数量 | |
60 | - */ | |
61 | - private Number primaryTransactionQuantity; | |
62 | -} |
src/main/java/com/huaheng/api/xinyi/domian/MaterialXinyi.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -import java.io.Serializable; | |
6 | - | |
7 | -/** | |
8 | - * w | |
9 | - * @author Enzo Cotter | |
10 | - * @date 2019/12/20 | |
11 | - */ | |
12 | -@Data | |
13 | -public class MaterialXinyi implements Serializable { | |
14 | - /** | |
15 | - * 库存组织ID | |
16 | - */ | |
17 | - private int organizationId; | |
18 | - | |
19 | - /** | |
20 | - * 物料ID | |
21 | - */ | |
22 | - private int inventoryItemId; | |
23 | - | |
24 | - /** | |
25 | - * 物料编号 | |
26 | - */ | |
27 | - private String itemNumber; | |
28 | - | |
29 | - /** | |
30 | - * 物料描述 | |
31 | - */ | |
32 | - private String itemDesc; | |
33 | - | |
34 | - /** | |
35 | - * 主单位CODE | |
36 | - */ | |
37 | - private String uomCode; | |
38 | - | |
39 | - /** | |
40 | - * 主单位 | |
41 | - */ | |
42 | - private String primaryUnitOfMeasure; | |
43 | - | |
44 | - /** | |
45 | - * 物料类别 | |
46 | - */ | |
47 | - private String itemType; | |
48 | - | |
49 | - /** | |
50 | - * 制造或采购 | |
51 | - */ | |
52 | - private String planningMakeBuyCode; | |
53 | - | |
54 | - /** | |
55 | - * 状态 | |
56 | - */ | |
57 | - private String itemStatus; | |
58 | - | |
59 | - /** | |
60 | - * 最后更新日期 | |
61 | - */ | |
62 | - private String lastUpdateDate; | |
63 | - | |
64 | - /** | |
65 | - * 有效 | |
66 | - */ | |
67 | - private String status; | |
68 | -} |
src/main/java/com/huaheng/api/xinyi/domian/OperatingUnits.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -import java.io.Serializable; | |
6 | - | |
7 | -/** | |
8 | - * 业务实体 | |
9 | - * @author Enzo Cotter | |
10 | - * @date 2019/12/20 | |
11 | - */ | |
12 | -@Data | |
13 | -public class OperatingUnits implements Serializable { | |
14 | - | |
15 | - /** | |
16 | - * 业务实体id | |
17 | - */ | |
18 | - private Integer organizationId; | |
19 | - | |
20 | - /** | |
21 | - * 业务实体Code | |
22 | - */ | |
23 | - private String shortCode; | |
24 | - | |
25 | - /** | |
26 | - * 业务实体名称 | |
27 | - */ | |
28 | - private String name; | |
29 | -} |
src/main/java/com/huaheng/api/xinyi/domian/Organization.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -import java.io.Serializable; | |
6 | - | |
7 | -/** | |
8 | - * 库存组织 | |
9 | - * @author Enzo Cotter | |
10 | - * @date 2019/12/20 | |
11 | - */ | |
12 | -@Data | |
13 | -public class Organization implements Serializable { | |
14 | - /** | |
15 | - * 库存组织ID | |
16 | - */ | |
17 | - private Integer organizationId; | |
18 | - | |
19 | - /** | |
20 | - * 库存组织编码 | |
21 | - */ | |
22 | - private String organizationCode; | |
23 | - | |
24 | - /** | |
25 | - * 库存组织名称 | |
26 | - */ | |
27 | - private String organizationName; | |
28 | - | |
29 | -} |
src/main/java/com/huaheng/api/xinyi/domian/OrganizationTransferIn.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -/** | |
4 | - * 组织间调拨接收 | |
5 | - * @author Enzo Cotter | |
6 | - * @date 2019/12/24 | |
7 | - */ | |
8 | -public class OrganizationTransferIn { | |
9 | - | |
10 | - /** | |
11 | - * 接收行id | |
12 | - */ | |
13 | - private int shipmentLineId; | |
14 | - /** | |
15 | - * 接收头id | |
16 | - */ | |
17 | - private int shipmentHeaderId; | |
18 | - /** | |
19 | - * 库存组织id | |
20 | - */ | |
21 | - private String organizationId; | |
22 | - /** | |
23 | - * 发运单号 | |
24 | - */ | |
25 | - private String shipmentNum; | |
26 | - /** | |
27 | - * 物料id | |
28 | - */ | |
29 | - private int itemId; | |
30 | - /** | |
31 | - * 行号 | |
32 | - */ | |
33 | - private int lineNum; | |
34 | - /** | |
35 | - * 物料编码 | |
36 | - */ | |
37 | - private int itemNumber; | |
38 | - | |
39 | - /** | |
40 | - * 物料描述 | |
41 | - */ | |
42 | - private String itemDesc; | |
43 | - | |
44 | - /** | |
45 | - * 批次 | |
46 | - */ | |
47 | - private String lotNum; | |
48 | - | |
49 | - /** | |
50 | - * 单位 | |
51 | - */ | |
52 | - private String uomCode; | |
53 | - | |
54 | - /** | |
55 | - * 可接收数 | |
56 | - */ | |
57 | - private String availableQuantity; | |
58 | - | |
59 | - /** | |
60 | - * 接收方式id | |
61 | - */ | |
62 | - private int routingHeaderId; | |
63 | - | |
64 | - /** | |
65 | - * 来源code | |
66 | - */ | |
67 | - private String sourceDocumentCode; | |
68 | -} |
src/main/java/com/huaheng/api/xinyi/domian/OrganizationTransferOut.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -/** | |
4 | - * | |
5 | - * @author Enzo Cotter | |
6 | - * @date 2019/12/25 | |
7 | - */ | |
8 | -public class OrganizationTransferOut { | |
9 | - /** | |
10 | - * 交易id | |
11 | - */ | |
12 | - private int transactionId; | |
13 | - /** | |
14 | - * 组织id | |
15 | - */ | |
16 | - private int organizationId; | |
17 | - /** | |
18 | - * 发运单号 | |
19 | - */ | |
20 | - private String shipmentNumber; | |
21 | - /** | |
22 | - * 交易日期 | |
23 | - */ | |
24 | - private String transactionDate; | |
25 | - /** | |
26 | - * 交易类型id | |
27 | - */ | |
28 | - private int transactionTypeId; | |
29 | - /** | |
30 | - * 交易类型 | |
31 | - */ | |
32 | - private int transactionTypeName; | |
33 | - /** | |
34 | - * 对方组织id | |
35 | - */ | |
36 | - private int transferOrganizationId; | |
37 | - /** | |
38 | - * 对方组织名称 | |
39 | - */ | |
40 | - private String transferOrganizationName; | |
41 | - /** | |
42 | - * 物料id | |
43 | - */ | |
44 | - private String inventoryItemId; | |
45 | - /** | |
46 | - * 物料编码 | |
47 | - */ | |
48 | - private String itemNumber; | |
49 | - /** | |
50 | - * 物料描述 | |
51 | - */ | |
52 | - private String itemDesc; | |
53 | - | |
54 | - /** | |
55 | - * 批次 | |
56 | - */ | |
57 | - private int lotNumber; | |
58 | - /** | |
59 | - * 交易单位 | |
60 | - */ | |
61 | - private String transactionUom; | |
62 | - /** | |
63 | - * 交易数量 | |
64 | - */ | |
65 | - private int transactionQuantity; | |
66 | - /** | |
67 | - * 主单位 | |
68 | - */ | |
69 | - private String primaryUomCode; | |
70 | - /** | |
71 | - * 主数量 | |
72 | - */ | |
73 | - private int primaryQuantity; | |
74 | - /** | |
75 | - * 货位code | |
76 | - */ | |
77 | - private String locatorCode; | |
78 | - /** | |
79 | - * 仓库 | |
80 | - */ | |
81 | - private String subinventoryCode; | |
82 | -} |
src/main/java/com/huaheng/api/xinyi/domian/PoOrder.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -/** | |
4 | - * | |
5 | - * @author Enzo Cotter | |
6 | - * @date 2019/12/25 | |
7 | - */ | |
8 | -public class PoOrder { | |
9 | - /** | |
10 | - * 行发运id | |
11 | - */ | |
12 | - private int lineLocationId; | |
13 | - /** | |
14 | - * 行id | |
15 | - */ | |
16 | - private int poLineId; | |
17 | - /** | |
18 | - * 头id | |
19 | - */ | |
20 | - private int poHeaderId; | |
21 | - /** | |
22 | - * 采购单号 | |
23 | - */ | |
24 | - private String poNumber; | |
25 | - /** | |
26 | - * 采购单行 | |
27 | - */ | |
28 | - private String poLineNum; | |
29 | - /** | |
30 | - * 物料id | |
31 | - */ | |
32 | - private int inventoryItemId; | |
33 | - /** | |
34 | - * 库存组织id | |
35 | - */ | |
36 | - private int organizationId; | |
37 | - /** | |
38 | - * 物料编码 | |
39 | - */ | |
40 | - private String itemNumber; | |
41 | - /** | |
42 | - * 物料描述 | |
43 | - */ | |
44 | - private String itemDesc; | |
45 | - /** | |
46 | - * 单位 | |
47 | - */ | |
48 | - private String uomCode; | |
49 | - /** | |
50 | - * 采购单数量 | |
51 | - */ | |
52 | - private int quantity; | |
53 | - /** | |
54 | - * 可接受数量 | |
55 | - */ | |
56 | - private int availableQuantity; | |
57 | - /** | |
58 | - * 接收方式id | |
59 | - */ | |
60 | - private int receivingRoutingId; | |
61 | - /** | |
62 | - * 交易类型 | |
63 | - */ | |
64 | - private String transactionType; | |
65 | - /** | |
66 | - * 目的地 | |
67 | - */ | |
68 | - private String destinationTypeCode; | |
69 | -} |
src/main/java/com/huaheng/api/xinyi/domian/PurchasingReturns.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -/** | |
4 | - * 采购退货的查询(抓退货至接收的状态) | |
5 | - * @author Enzo Cotter | |
6 | - * @date 2019/12/25 | |
7 | - */ | |
8 | -public class PurchasingReturns { | |
9 | - /** | |
10 | - * 交易id | |
11 | - */ | |
12 | - private int transactionId; | |
13 | - /** | |
14 | - * 库存组织id | |
15 | - */ | |
16 | - private int organizationId; | |
17 | - /** | |
18 | - * 接收单 | |
19 | - */ | |
20 | - private String receiptNum; | |
21 | - /** | |
22 | - * 交易日期 | |
23 | - */ | |
24 | - private String transactionDate; | |
25 | - /** | |
26 | - * 交易类型 | |
27 | - */ | |
28 | - private String transactionType; | |
29 | - /** | |
30 | - * 采购单 | |
31 | - */ | |
32 | - private String poNum; | |
33 | - /** | |
34 | - * 物料编码 | |
35 | - */ | |
36 | - private String itemNumber; | |
37 | - /** | |
38 | - * 物料描述 | |
39 | - */ | |
40 | - private String itemDesc; | |
41 | - /** | |
42 | - * 批次 | |
43 | - */ | |
44 | - private String lotNum; | |
45 | - /** | |
46 | - * 单位 | |
47 | - */ | |
48 | - private String uomCode; | |
49 | - /** | |
50 | - * 数量 | |
51 | - */ | |
52 | - private int quantity; | |
53 | - /** | |
54 | - * 主单位 | |
55 | - */ | |
56 | - private String primaryUomCode; | |
57 | - /** | |
58 | - * 主数量 | |
59 | - */ | |
60 | - private int primaryQuantity; | |
61 | - /** | |
62 | - * 仓库 | |
63 | - */ | |
64 | - private String fromSubinventory; | |
65 | - /** | |
66 | - * 货位id | |
67 | - */ | |
68 | - private int fromLocatorId; | |
69 | - /** | |
70 | - * 货位code | |
71 | - */ | |
72 | - private String fromLocatorCode; | |
73 | -} |
src/main/java/com/huaheng/api/xinyi/domian/RcvShipment.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -/** | |
4 | - * 采购接收单查询接口 | |
5 | - * @author Enzo Cotter | |
6 | - * @date 2019/12/25 | |
7 | - */ | |
8 | -public class RcvShipment { | |
9 | - /** | |
10 | - * 采购发运行id | |
11 | - */ | |
12 | - private int lineLocationId; | |
13 | - | |
14 | - /** | |
15 | - * 采购行id | |
16 | - */ | |
17 | - private int poLineId; | |
18 | - | |
19 | - /** | |
20 | - * 采购头id | |
21 | - */ | |
22 | - private int poHeaderId; | |
23 | - | |
24 | - /** | |
25 | - * 送货头id | |
26 | - */ | |
27 | - private int deliverHeaderId; | |
28 | - | |
29 | - /** | |
30 | - * 送货行id | |
31 | - */ | |
32 | - private int deliverLineId; | |
33 | - | |
34 | - /** | |
35 | - * 采购单号 | |
36 | - */ | |
37 | - private String poNumber; | |
38 | - | |
39 | - /** | |
40 | - * 采购行号 | |
41 | - */ | |
42 | - private String poLineNum; | |
43 | - | |
44 | - /** | |
45 | - * 物料id | |
46 | - */ | |
47 | - private int inventoryItemId; | |
48 | - | |
49 | - /** | |
50 | - * 库存组织id | |
51 | - */ | |
52 | - private int organizationId; | |
53 | - | |
54 | - /** | |
55 | - * 物料编码 | |
56 | - */ | |
57 | - private String itemNumber; | |
58 | - | |
59 | - /** | |
60 | - * 物料描述 | |
61 | - */ | |
62 | - private String itemDesc; | |
63 | - | |
64 | - /** | |
65 | - * 单位 | |
66 | - */ | |
67 | - private String uomCode; | |
68 | - | |
69 | - /** | |
70 | - * 送货单数量 | |
71 | - */ | |
72 | - private int quantity; | |
73 | - | |
74 | - /** | |
75 | - * 可接受数 | |
76 | - */ | |
77 | - private int availableQuantity; | |
78 | - | |
79 | - /** | |
80 | - * 接收方式id | |
81 | - */ | |
82 | - private int receivingRoutingId; | |
83 | - | |
84 | - /** | |
85 | - * 父交易id | |
86 | - */ | |
87 | - private int parentRcvTransactionId; | |
88 | - | |
89 | - /** | |
90 | - * 父交易类型 | |
91 | - */ | |
92 | - private String parentTransactionType; | |
93 | - | |
94 | - /** | |
95 | - * 交易类型 | |
96 | - */ | |
97 | - private String transactionType; | |
98 | - | |
99 | - /** | |
100 | - * 目的地 | |
101 | - */ | |
102 | - private String destinationTypeCode; | |
103 | -} |
src/main/java/com/huaheng/api/xinyi/domian/ResultEntity.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -/** | |
6 | - * 返回实体 | |
7 | - * @author Enzo Cotter | |
8 | - * @date 2019/12/19 | |
9 | - */ | |
10 | -@Data | |
11 | -public class ResultEntity<T> { | |
12 | - private Boolean ok; | |
13 | - private String param1; | |
14 | - private String param2; | |
15 | - private String param3; | |
16 | - private String param4; | |
17 | - private String param5; | |
18 | - /** | |
19 | - * 状态码,0表示成功 其他表示失败 | |
20 | - */ | |
21 | - private String code; | |
22 | - | |
23 | - /** | |
24 | - * 返回结果 | |
25 | - */ | |
26 | - private String message; | |
27 | - | |
28 | - /** | |
29 | - * 返回结果描述 | |
30 | - */ | |
31 | - private String description; | |
32 | - | |
33 | - private String status; | |
34 | - | |
35 | - private T data; | |
36 | -} |
src/main/java/com/huaheng/api/xinyi/domian/ResultEntityList.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | -import org.apache.poi.ss.formula.functions.T; | |
5 | - | |
6 | -import java.util.List; | |
7 | - | |
8 | -/** | |
9 | - * 返回列表实体 | |
10 | - * | |
11 | - * @author Enzo Cotter | |
12 | - * @date 2019/12/20 | |
13 | - */ | |
14 | -@Data | |
15 | -public class ResultEntityList<T> { | |
16 | - | |
17 | - private Boolean ok; | |
18 | - private String param1; | |
19 | - private String param2; | |
20 | - private String param3; | |
21 | - private String param4; | |
22 | - private String param5; | |
23 | - /** | |
24 | - * 状态码,0表示成功 其他表示失败 | |
25 | - */ | |
26 | - private String code; | |
27 | - | |
28 | - /** | |
29 | - * 返回结果 | |
30 | - */ | |
31 | - private String message; | |
32 | - | |
33 | - /** | |
34 | - * 返回结果描述 | |
35 | - */ | |
36 | - private String description; | |
37 | - | |
38 | - private String status; | |
39 | - | |
40 | - private List<T> data; | |
41 | -} |
src/main/java/com/huaheng/api/xinyi/domian/TokenEntity.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.IdType; | |
4 | -import com.baomidou.mybatisplus.annotation.TableField; | |
5 | -import com.baomidou.mybatisplus.annotation.TableId; | |
6 | -import com.baomidou.mybatisplus.annotation.TableName; | |
7 | -import lombok.Data; | |
8 | - | |
9 | -import java.io.Serializable; | |
10 | - | |
11 | -/** | |
12 | - * token实体 | |
13 | - * @author Enzo Cotter | |
14 | - * @date 2019/12/20 | |
15 | - */ | |
16 | -@Data | |
17 | -@TableName(value = "token_entity") | |
18 | -public class TokenEntity implements Serializable { | |
19 | - | |
20 | - @TableId(value = "id", type = IdType.AUTO) | |
21 | - private Integer id; | |
22 | - | |
23 | - @TableField(value = "access_token") | |
24 | - private String access_token; | |
25 | - | |
26 | - @TableField(value = "token_type") | |
27 | - private String token_type; | |
28 | - | |
29 | -// private AuthUser authUser; | |
30 | -} |
src/main/java/com/huaheng/api/xinyi/domian/UnitConversions.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -import java.io.Serializable; | |
6 | - | |
7 | -/** | |
8 | - * 单位转换 | |
9 | - * Created by Enzo Cotter on 2019/12/20. | |
10 | - */ | |
11 | -@Data | |
12 | -public class UnitConversions implements Serializable { | |
13 | - | |
14 | - /** | |
15 | - * 转换比例 | |
16 | - */ | |
17 | - private String conversionRate; | |
18 | -} |
src/main/java/com/huaheng/api/xinyi/domian/Units.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -/** | |
6 | - * 单位查询 | |
7 | - * @author Enzo Cotter | |
8 | - * @date 2019/12/20 | |
9 | - */ | |
10 | -@Data | |
11 | -public class Units { | |
12 | - | |
13 | - /** | |
14 | - * 单位CODE | |
15 | - */ | |
16 | - private String uomCode; | |
17 | - /** | |
18 | - * 单位 | |
19 | - */ | |
20 | - private String unitOfMeasure; | |
21 | - | |
22 | - /** | |
23 | - * 单位分类 | |
24 | - */ | |
25 | - private String uomClass; | |
26 | -} |
src/main/java/com/huaheng/api/xinyi/domian/ValidateDeliver.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -/** | |
6 | - * 送货单验证 | |
7 | - * @author Enzo Cotter | |
8 | - * @date 2019/12/25 | |
9 | - */ | |
10 | -@Data | |
11 | -public class ValidateDeliver { | |
12 | - | |
13 | - /** | |
14 | - * 业务实体id | |
15 | - */ | |
16 | - private Integer orgId; | |
17 | - | |
18 | - /** | |
19 | - * 送货单id | |
20 | - */ | |
21 | - private Integer deliverHeaderId; | |
22 | - | |
23 | - /** | |
24 | - * 送货单号 | |
25 | - */ | |
26 | - private String deliverNumber; | |
27 | - | |
28 | - /** | |
29 | - * 送货单状态 | |
30 | - */ | |
31 | - private String deliverStatus; | |
32 | - | |
33 | - /** | |
34 | - * 供应商id | |
35 | - */ | |
36 | - private Integer vendorId; | |
37 | - | |
38 | - /** | |
39 | - * 供应商地点id | |
40 | - */ | |
41 | - private Integer vendorSiteId; | |
42 | -} |
src/main/java/com/huaheng/api/xinyi/domian/ValidatePo.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -/** | |
6 | - * 采购单验证 | |
7 | - * @author Enzo Cotter | |
8 | - * @date 2019/12/25 | |
9 | - */ | |
10 | -@Data | |
11 | -public class ValidatePo { | |
12 | - | |
13 | - /** | |
14 | - * 业务实体id | |
15 | - */ | |
16 | - private Integer orgId; | |
17 | - | |
18 | - /** | |
19 | - * 采购单id | |
20 | - */ | |
21 | - private Integer poHeaderdId; | |
22 | - | |
23 | - /** | |
24 | - * 采购单号 | |
25 | - */ | |
26 | - private String poNumber; | |
27 | - | |
28 | - /** | |
29 | - * 关闭状态(closedCode为CLOSED的状态不允许接收,但允许退货) | |
30 | - */ | |
31 | - private String closedCode; | |
32 | - | |
33 | - /** | |
34 | - * 供应商id | |
35 | - */ | |
36 | - private Integer vendorId; | |
37 | - | |
38 | - /** | |
39 | - * 供应商地点id | |
40 | - */ | |
41 | - private Integer vendorSiteId; | |
42 | -} |
src/main/java/com/huaheng/api/xinyi/domian/ValidateRcvShipment.java deleted
1 | -package com.huaheng.api.xinyi.domian; | |
2 | - | |
3 | -/** | |
4 | - * 接收单验证 | |
5 | - * @author Enzo Cotter | |
6 | - * @date 2019/12/25 | |
7 | - */ | |
8 | -public class ValidateRcvShipment { | |
9 | - | |
10 | - private Integer organizationId; | |
11 | - | |
12 | - private Integer shipmentHeaderId; | |
13 | - | |
14 | - private String receiptNum; | |
15 | - | |
16 | - private String vendorId; | |
17 | - | |
18 | - private Integer vendorSiteId; | |
19 | -} |
src/main/java/com/huaheng/api/xinyi/mapper/TokenMapper.java deleted
1 | -package com.huaheng.api.xinyi.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.huaheng.api.xinyi.domian.TokenEntity; | |
5 | - | |
6 | -/** | |
7 | - * Created by Enzo Cotter on 2019/12/20. | |
8 | - */ | |
9 | -public interface TokenMapper extends BaseMapper<TokenEntity>{ | |
10 | - | |
11 | - TokenEntity findOneByAll(); | |
12 | - | |
13 | - int insertSelective(TokenEntity tokenEntity); | |
14 | -} |
src/main/java/com/huaheng/api/xinyi/service/ApiTokenService.java deleted
1 | -package com.huaheng.api.xinyi.service; | |
2 | - | |
3 | -import com.alibaba.fastjson.JSON; | |
4 | -import com.alibaba.fastjson.TypeReference; | |
5 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
6 | -import com.huaheng.api.xinyi.constant.XinYiConstant; | |
7 | -import com.huaheng.api.xinyi.domian.ResultEntity; | |
8 | -import com.huaheng.api.xinyi.domian.TokenEntity; | |
9 | -import com.huaheng.common.exception.BusinessException; | |
10 | -import com.huaheng.common.exception.service.ServiceException; | |
11 | -import com.huaheng.common.utils.http.HttpUtils; | |
12 | -import org.springframework.stereotype.Service; | |
13 | - | |
14 | -import javax.annotation.Resource; | |
15 | -import java.util.HashMap; | |
16 | -import java.util.Map; | |
17 | - | |
18 | -/** | |
19 | - * 获取API访问的身份认证Token信息 | |
20 | - * @author Enzo Cotter | |
21 | - * @date 2019/12/20 | |
22 | - */ | |
23 | -@Service | |
24 | -public class ApiTokenService { | |
25 | - | |
26 | - @Resource | |
27 | - private TokenService tokenService; | |
28 | - | |
29 | - public String apiToken(){ | |
30 | - | |
31 | - /* 清空token表*/ | |
32 | - QueryWrapper<TokenEntity> queryWrapper = new QueryWrapper<>(); | |
33 | - tokenService.remove(queryWrapper); | |
34 | - String url = XinYiConstant.XINYI_HOST+"xygerp/ald/auth/token"; | |
35 | - Map<String, Object> map = new HashMap<>(); | |
36 | - map.put("userName", "XYG_ALIWMS"); | |
37 | - map.put("password", "xinyiboli868"); | |
38 | - map.put("language", "ZHS"); | |
39 | - map.put("wxLoginCode", ""); | |
40 | - String result = HttpUtils.sendJsonPost(JSON.toJSONString(map), url); | |
41 | - System.out.println(result); | |
42 | - ResultEntity<TokenEntity> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntity<TokenEntity>>(){}); | |
43 | - if(!resultEntity.getOk() ){ | |
44 | - throw new ServiceException("服务器处理失败"); | |
45 | - } else if (!"0".equals(resultEntity.getCode())) { | |
46 | - throw new ServiceException("服务器响应错误"); | |
47 | - } else if (!tokenService.insertSelective(resultEntity.getData())){ | |
48 | - throw new BusinessException("保存失败"); | |
49 | - } | |
50 | - return "success"; | |
51 | - } | |
52 | -} |
src/main/java/com/huaheng/api/xinyi/service/BasisService.java deleted
1 | -package com.huaheng.api.xinyi.service; | |
2 | - | |
3 | -import com.alibaba.fastjson.JSON; | |
4 | -import com.alibaba.fastjson.TypeReference; | |
5 | -import com.huaheng.api.xinyi.constant.ResultStatus; | |
6 | -import com.huaheng.api.xinyi.constant.XinYiConstant; | |
7 | -import com.huaheng.api.xinyi.domian.*; | |
8 | -import com.huaheng.common.exception.BusinessException; | |
9 | -import com.huaheng.common.exception.service.ServiceException; | |
10 | -import com.huaheng.common.utils.DataUtils; | |
11 | -import com.huaheng.common.utils.http.HttpUtils; | |
12 | -import org.springframework.stereotype.Service; | |
13 | - | |
14 | -import javax.annotation.Resource; | |
15 | -import java.util.HashMap; | |
16 | -import java.util.List; | |
17 | -import java.util.Map; | |
18 | - | |
19 | -/** | |
20 | - * 信义基础数据库 | |
21 | - * | |
22 | - * @author Enzo Cotter | |
23 | - * @date 2019/12/20 | |
24 | - */ | |
25 | -@Service | |
26 | -public class BasisService { | |
27 | - | |
28 | - @Resource | |
29 | - private TokenService tokenService; | |
30 | - @Resource | |
31 | - private ApiTokenService apiTokenService; | |
32 | - | |
33 | - /** | |
34 | - * 库存查询接口 | |
35 | - * 第二次查询,token过期不重试 | |
36 | - * @param organizationId 库存组织ID | |
37 | - * @param bout 查询次数 | |
38 | - * @return | |
39 | - */ | |
40 | - public List<Inventories> getInventories(String organizationId, int bout){ | |
41 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
42 | - | |
43 | - Map<String, Object> map = new HashMap<>(); | |
44 | - map.put("organizationId", organizationId); | |
45 | - map.put("wmsCode", "BH_HH01"); | |
46 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBasicData/getInventories"; | |
47 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
48 | - ResultEntityList<Inventories> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<Inventories>>(){}); | |
49 | - if (ResultStatus.EXPIRED.equals(resultEntity.getStatus())){ | |
50 | - if (bout != 1) { | |
51 | - apiTokenService.apiToken(); | |
52 | - bout = 1; | |
53 | - this.getInventories(organizationId, bout); | |
54 | - } else { | |
55 | - throw new BusinessException("token过期,重新请求token失败"); | |
56 | - } | |
57 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
58 | - throw new ServiceException("服务器处理失败"+resultEntity.getStatus()); | |
59 | - } else if (!resultEntity.getOk()) { | |
60 | - throw new ServiceException("服务器响应错误"); | |
61 | - } else { | |
62 | - return resultEntity.getData(); | |
63 | - } | |
64 | - return null; | |
65 | - } | |
66 | - | |
67 | - /** | |
68 | - * 物料查询 | |
69 | - * @param dateFrom 最后更新日期从(YYYY-MM-DD) | |
70 | - * @param dateTo 最后更新日期至(YYYY-MM-DD) | |
71 | - * @param pageNum 当前页 | |
72 | - * @param pageSize 每页行数 | |
73 | - * @param count 查询总行数标识 | |
74 | - * @param bout 查询次数 | |
75 | - * @param inventoryItemId 物料id | |
76 | - * @param organizationId 库存组织id | |
77 | - * @return | |
78 | - */ | |
79 | - public List<MaterialXinyi> getItems(String dateFrom, String dateTo, Integer pageNum, Integer pageSize, boolean count, int bout, String inventoryItemId, String organizationId){ | |
80 | - /* 获取数据库中token,如果为空重新获取token*/ | |
81 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
82 | - | |
83 | - Map<String, Object> map = new HashMap<>(); | |
84 | - map.put("wmsCode", "BH_HH01"); | |
85 | - map.put("inventoryItemId", inventoryItemId); | |
86 | - map.put("dateFrom", dateFrom); | |
87 | - map.put("dateto", dateTo); | |
88 | - map.put("pageNum", pageNum); | |
89 | - map.put("pageSize", pageSize); | |
90 | - map.put("count", count); | |
91 | - map.put("orderBy", "inventory_Item_Id"); | |
92 | - map.put("organizationId", organizationId); | |
93 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBasicData/getItems"; | |
94 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
95 | - ResultEntityList<MaterialXinyi> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<MaterialXinyi>>(){}); | |
96 | - /* 如果token过期,重新获取token后,执行this方法*/ | |
97 | - if (ResultStatus.EXPIRED.equals(resultEntity.getStatus())){ | |
98 | - if (bout != 1) { | |
99 | - apiTokenService.apiToken(); | |
100 | - bout = 1; | |
101 | - this.getItems(dateFrom, dateTo, pageNum, pageSize, count, bout, inventoryItemId, organizationId); | |
102 | - } else { | |
103 | - throw new BusinessException("token过期,重新请求token失败"); | |
104 | - } | |
105 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
106 | - throw new ServiceException("服务器处理失败"+resultEntity.getStatus()); | |
107 | - } else if (!resultEntity.getOk()) { | |
108 | - throw new ServiceException("服务器响应错误"); | |
109 | - } else { | |
110 | - return resultEntity.getData(); | |
111 | - } | |
112 | - return null; | |
113 | - } | |
114 | - | |
115 | - | |
116 | - /** | |
117 | - * 业务实体查询 | |
118 | - * @param bout 查询次数 | |
119 | - * @return | |
120 | - */ | |
121 | - public List<OperatingUnits> getOperatingUnits(int bout){ | |
122 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
123 | - | |
124 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBasicData/getOperatingUnits"; | |
125 | - Map<String, Object> map = new HashMap<>(); | |
126 | - map.put("wmsCode", "BH_HH01"); | |
127 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
128 | - ResultEntityList<OperatingUnits> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<OperatingUnits>>(){}); | |
129 | - if (ResultStatus.EXPIRED.equals(resultEntity.getStatus())){ | |
130 | - if (bout != 1) { | |
131 | - apiTokenService.apiToken(); | |
132 | - bout = 1; | |
133 | - this.getOperatingUnits(bout); | |
134 | - } else { | |
135 | - throw new BusinessException("token过期,重新请求token失败"); | |
136 | - } | |
137 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
138 | - throw new ServiceException("服务器处理失败"+resultEntity.getStatus()); | |
139 | - } else if (!resultEntity.getOk()) { | |
140 | - throw new ServiceException("服务器响应错误"); | |
141 | - } else { | |
142 | - return resultEntity.getData(); | |
143 | - } | |
144 | - return null; | |
145 | - | |
146 | - } | |
147 | - | |
148 | - /** | |
149 | - * 库存组织查查 | |
150 | - * @param bout 次数 | |
151 | - * @return | |
152 | - */ | |
153 | - public List<Organization> getOrganization(int bout) { | |
154 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
155 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBasicData/getOrganization"; | |
156 | - Map<String, Object> map = new HashMap<>(); | |
157 | - map.put("wmsCode", "BH_HH01"); | |
158 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
159 | - ResultEntityList<Organization> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<Organization>>(){}); | |
160 | - if (ResultStatus.EXPIRED.equals(resultEntity.getStatus())){ | |
161 | - if (bout != 1) { | |
162 | - apiTokenService.apiToken(); | |
163 | - bout = 1; | |
164 | - this.getOperatingUnits(bout); | |
165 | - } else { | |
166 | - throw new BusinessException("token过期,重新请求token失败"); | |
167 | - } | |
168 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
169 | - throw new ServiceException("服务器处理失败"+resultEntity.getStatus()); | |
170 | - } else if (!resultEntity.getOk()) { | |
171 | - throw new ServiceException("服务器响应错误"); | |
172 | - } else { | |
173 | - return resultEntity.getData(); | |
174 | - } | |
175 | - return null; | |
176 | - } | |
177 | - | |
178 | - /** | |
179 | - * 查询单位转换 | |
180 | - * @param bout 查询次数 | |
181 | - * @param fromUomCode 单位(从) | |
182 | - * @param toUomCode 单位(片) | |
183 | - * @param inventoryItemId 物料ID | |
184 | - * @return | |
185 | - */ | |
186 | - public UnitConversions getUnitConversions(int bout, String fromUomCode, String toUomCode, String inventoryItemId){ | |
187 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
188 | - Map<String, Object> map = new HashMap<>(); | |
189 | - map.put("wmsCode", "BH_HH01"); | |
190 | - map.put("fromUomCode", fromUomCode); | |
191 | - map.put("toUomCode", toUomCode); | |
192 | - map.put("inventoryItemId", inventoryItemId); | |
193 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBasicData/getUnitConversions"; | |
194 | - String result = HttpUtils.sendGet(url, tokenEntity ,DataUtils.sendGetFormat(map)); | |
195 | - ResultEntity<UnitConversions> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntity<UnitConversions>>(){}); | |
196 | - if (ResultStatus.EXPIRED.equals(resultEntity.getStatus())){ | |
197 | - if (bout != 1) { | |
198 | - apiTokenService.apiToken(); | |
199 | - bout = 1; | |
200 | - this.getOperatingUnits(bout); | |
201 | - } else { | |
202 | - throw new BusinessException("token过期,重新请求token失败"); | |
203 | - } | |
204 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
205 | - throw new ServiceException("服务器处理失败"+resultEntity.getStatus()); | |
206 | - } else if (!resultEntity.getOk()) { | |
207 | - throw new ServiceException("服务器响应错误"); | |
208 | - } else { | |
209 | - return resultEntity.getData(); | |
210 | - } | |
211 | - return null; | |
212 | - } | |
213 | - | |
214 | - /** | |
215 | - * 查询单位 | |
216 | - * @param bout 查询次数 | |
217 | - * @return | |
218 | - */ | |
219 | - public List<Units> getUnits(int bout) { | |
220 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
221 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBasicData/getUnits"; | |
222 | - Map<String, Object> map = new HashMap<>(); | |
223 | - map.put("wmsCode", "BH_HH01"); | |
224 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
225 | - ResultEntityList<Units> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<Units>>(){}); | |
226 | - if (ResultStatus.EXPIRED.equals(resultEntity.getStatus())){ | |
227 | - if (bout != 1) { | |
228 | - apiTokenService.apiToken(); | |
229 | - bout = 1; | |
230 | - this.getOperatingUnits(bout); | |
231 | - } else { | |
232 | - throw new BusinessException("token过期,重新请求token失败"); | |
233 | - } | |
234 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
235 | - throw new ServiceException("服务器处理失败"+resultEntity.getStatus()); | |
236 | - } else if (!resultEntity.getOk()) { | |
237 | - throw new ServiceException("服务器响应错误"); | |
238 | - } else { | |
239 | - return resultEntity.getData(); | |
240 | - } | |
241 | - return null; | |
242 | - } | |
243 | -} |
src/main/java/com/huaheng/api/xinyi/service/BusinessService.java deleted
1 | -package com.huaheng.api.xinyi.service; | |
2 | - | |
3 | -import com.alibaba.fastjson.JSON; | |
4 | -import com.alibaba.fastjson.TypeReference; | |
5 | -import com.huaheng.api.xinyi.constant.ResultStatus; | |
6 | -import com.huaheng.api.xinyi.constant.XinYiConstant; | |
7 | -import com.huaheng.api.xinyi.domian.*; | |
8 | -import com.huaheng.common.exception.BusinessException; | |
9 | -import com.huaheng.common.exception.service.ServiceException; | |
10 | -import com.huaheng.common.utils.DataUtils; | |
11 | -import com.huaheng.common.utils.StringUtils; | |
12 | -import com.huaheng.common.utils.http.HttpUtils; | |
13 | -import org.springframework.stereotype.Service; | |
14 | - | |
15 | -import javax.annotation.Resource; | |
16 | -import javax.xml.crypto.Data; | |
17 | -import java.util.HashMap; | |
18 | -import java.util.List; | |
19 | -import java.util.Map; | |
20 | - | |
21 | -/** | |
22 | - * 信义ERP业务数据接口 | |
23 | - * @author Enzo Cotter | |
24 | - * @date 2019/12/24 | |
25 | - */ | |
26 | -@Service | |
27 | -public class BusinessService { | |
28 | - | |
29 | - @Resource | |
30 | - private TokenService tokenService; | |
31 | - @Resource | |
32 | - private ApiTokenService apiTokenService; | |
33 | - | |
34 | - /** | |
35 | - * 送货单查询接口 | |
36 | - * @param organizationId 组织id | |
37 | - * @param deliverHeaderId 送货单Id | |
38 | - * @param bout 查询次数 | |
39 | - * @return | |
40 | - */ | |
41 | - public List<DeliverOrder> getDeliverOrder(String organizationId, String deliverHeaderId, int bout){ | |
42 | - TokenEntity tokenEntity = tokenService.findOneByAll(); | |
43 | - Map<String, Object> map = new HashMap<>(); | |
44 | - map.put("organizationId", organizationId); | |
45 | - map.put("deliverHeaderId", deliverHeaderId); | |
46 | - map.put("wmsCode", "BH_HH01"); | |
47 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/getDeliverOrder"; | |
48 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
49 | - ResultEntityList<DeliverOrder> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<DeliverOrder>>(){}); | |
50 | - if (ResultStatus.EXPIRED.equals(resultEntity.getStatus())){ | |
51 | - if (bout != 1) { | |
52 | - apiTokenService.apiToken(); | |
53 | - bout = 1; | |
54 | - this.getDeliverOrder(organizationId, deliverHeaderId, bout); | |
55 | - } else { | |
56 | - throw new BusinessException("token过期,重新请求token失败"); | |
57 | - } | |
58 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
59 | - throw new ServiceException("服务器处理失败"); | |
60 | - } else if (!resultEntity.getOk()) { | |
61 | - throw new ServiceException("服务器响应错误"); | |
62 | - } else { | |
63 | - return resultEntity.getData(); | |
64 | - } | |
65 | - return null; | |
66 | - } | |
67 | - | |
68 | - /** | |
69 | - * 电子单据验证接口 | |
70 | - * @param organizationId 组织id | |
71 | - * @param eslipNumber 单据号码 | |
72 | - * @param bout 查询次数 | |
73 | - * @return | |
74 | - */ | |
75 | - public List<EslipStatus> getEslipStatus(String organizationId, String eslipNumber, int bout){ | |
76 | - TokenEntity tokenEntity = tokenService.findOneByAll(); | |
77 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/getEslipStatus/"+organizationId+"/"+eslipNumber; | |
78 | - String result = HttpUtils.sendGet(url, tokenEntity, null); | |
79 | - ResultEntityList<EslipStatus> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<EslipStatus>>(){}); | |
80 | - if (ResultStatus.EXPIRED.equals(resultEntity.getStatus())){ | |
81 | - if (bout != 1) { | |
82 | - apiTokenService.apiToken(); | |
83 | - bout = 1; | |
84 | - this.getEslipStatus(organizationId, eslipNumber, bout); | |
85 | - } else { | |
86 | - throw new BusinessException("token过期,重新请求token失败"); | |
87 | - } | |
88 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
89 | - throw new ServiceException("服务器处理失败"); | |
90 | - } else if (!resultEntity.getOk()) { | |
91 | - throw new ServiceException("服务器响应错误"); | |
92 | - } else { | |
93 | - return resultEntity.getData(); | |
94 | - } | |
95 | - return null; | |
96 | - } | |
97 | - | |
98 | - /** | |
99 | - * 电子单据出入库查询接口 | |
100 | - * @param organizationId 组织id | |
101 | - * @param actionType 类型 IN或OUT | |
102 | - * @param dateFrom 最后更新日期从(YYYY-MM-DD) | |
103 | - * @param dateTo 最后更新日期至(YYYY-MM-DD) | |
104 | - * @param headerId 单据id | |
105 | - * @param bout 查询次数 | |
106 | - * @return | |
107 | - */ | |
108 | - public List<EslipTransactions> getEslipTransactions(Integer organizationId, String actionType, String dateFrom, String dateTo, Integer headerId, int bout) { | |
109 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
110 | - Map<String, Object> map = new HashMap<>(); | |
111 | - map.put("organizationId", organizationId); | |
112 | - map.put("actionType",actionType); | |
113 | - if (StringUtils.isNotNull(dateFrom)){ | |
114 | - map.put("dateFrom", dateFrom); | |
115 | - } | |
116 | - if (StringUtils.isNotNull(dateTo)) { | |
117 | - map.put("dateTo", dateTo); | |
118 | - } | |
119 | - map.put("headerId", headerId); | |
120 | - map.put("wmsCode", "BH_HH01"); | |
121 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/getEslipTransactions"; | |
122 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
123 | - ResultEntityList<EslipTransactions> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<EslipTransactions>>(){}); | |
124 | - if (ResultStatus.EXPIRED.equals(resultEntity.getStatus())){ | |
125 | - if (bout != 1) { | |
126 | - apiTokenService.apiToken(); | |
127 | - bout = 1; | |
128 | - this.getEslipTransactions(organizationId, actionType, dateFrom, dateTo, headerId, bout); | |
129 | - } else { | |
130 | - throw new BusinessException("token过期,重新请求token失败"); | |
131 | - } | |
132 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
133 | - throw new ServiceException("服务器处理失败"); | |
134 | - } else if (!resultEntity.getOk()) { | |
135 | - throw new ServiceException("服务器响应错误"); | |
136 | - } else { | |
137 | - return resultEntity.getData(); | |
138 | - } | |
139 | - return null; | |
140 | - } | |
141 | - | |
142 | - /** | |
143 | - * 组织间调拨接收 | |
144 | - * @param organizationId 组织id | |
145 | - * @param shipmentNumber 发运单号 | |
146 | - * @param orderBy 数据排序 | |
147 | - * @param pageNum 当前页 | |
148 | - * @param pageSize 每页行数 | |
149 | - * @param count 查询总行数标识 | |
150 | - * @param bout 查询次数 | |
151 | - * @return | |
152 | - */ | |
153 | - public List<OrganizationTransferIn> getOrganizationTransferIn(String organizationId, String shipmentNumber, String orderBy, Integer pageNum, Integer pageSize, boolean count, int bout){ | |
154 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
155 | - Map<String, Object> map = new HashMap<>(); | |
156 | - map.put("organizationId", organizationId); | |
157 | - map.put("shipmentNumber",shipmentNumber); | |
158 | - map.put("orderBy", orderBy); | |
159 | - map.put("pageNum", pageNum); | |
160 | - map.put("pageSize", pageSize); | |
161 | - map.put("count", count); | |
162 | - map.put("wmsCode", "BH_HH01"); | |
163 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/getOrganizationTransferIn"; | |
164 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
165 | - ResultEntityList<OrganizationTransferIn> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<OrganizationTransferIn>>(){}); | |
166 | - if (ResultStatus.EXPIRED.equals(resultEntity.getCode())){ | |
167 | - if (bout != 1) { | |
168 | - apiTokenService.apiToken(); | |
169 | - bout = 1; | |
170 | - this.getOrganizationTransferIn(organizationId, shipmentNumber, orderBy, pageNum, pageSize, count, bout); | |
171 | - } else { | |
172 | - throw new BusinessException("token过期,重新请求token失败"); | |
173 | - } | |
174 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
175 | - throw new ServiceException("服务器处理失败"); | |
176 | - } else if (!resultEntity.getOk()) { | |
177 | - throw new ServiceException("服务器响应错误"); | |
178 | - } else { | |
179 | - return resultEntity.getData(); | |
180 | - } | |
181 | - return null; | |
182 | - } | |
183 | - | |
184 | - /** | |
185 | - * 组织间调拨发出 | |
186 | - * @param organizationId 组织id | |
187 | - * @param shipmentNumber 发运单号 | |
188 | - * @param dateFrom 起始日期 | |
189 | - * @param dateTo 结束日期 | |
190 | - * @param orderBy 数据排序 | |
191 | - * @param pageNum 当前页 | |
192 | - * @param pageSize 每页行数 | |
193 | - * @param count 查询总行数标识 | |
194 | - * @param bout 查询次数 | |
195 | - * @return | |
196 | - */ | |
197 | - public List<OrganizationTransferOut> getOrganizationTransferOut(String organizationId, String shipmentNumber, | |
198 | - String dateFrom, String dateTo, String orderBy, Integer pageNum, Integer pageSize, boolean count, int bout){ | |
199 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
200 | - Map<String, Object> map = new HashMap<>(); | |
201 | - map.put("organizationId", organizationId); | |
202 | - map.put("shipmentNumber",shipmentNumber); | |
203 | - map.put("dateFrom", dateFrom); | |
204 | - map.put("dateTo", dateTo); | |
205 | - map.put("orderBy", orderBy); | |
206 | - map.put("pageNum", pageNum); | |
207 | - map.put("pageSize", pageSize); | |
208 | - map.put("count", count); | |
209 | - map.put("wmsCode", "BH_HH01"); | |
210 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/getOrganizationTransferOut"; | |
211 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
212 | - ResultEntityList<OrganizationTransferOut> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<OrganizationTransferOut>>(){}); | |
213 | - if (ResultStatus.EXPIRED.equals(resultEntity.getCode())){ | |
214 | - if (bout != 1) { | |
215 | - apiTokenService.apiToken(); | |
216 | - bout = 1; | |
217 | - this.getOrganizationTransferOut(organizationId, shipmentNumber, dateFrom, dateTo, orderBy, pageNum, pageSize, count, bout); | |
218 | - } else { | |
219 | - throw new BusinessException("token过期,重新请求token失败"); | |
220 | - } | |
221 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
222 | - throw new ServiceException("服务器处理失败"); | |
223 | - } else if (!resultEntity.getOk()) { | |
224 | - throw new ServiceException("服务器响应错误"); | |
225 | - } else { | |
226 | - return resultEntity.getData(); | |
227 | - } | |
228 | - return null; | |
229 | - } | |
230 | - | |
231 | - /** | |
232 | - * 采购单查询接口 | |
233 | - * @param organizationId 组织id | |
234 | - * @param poHeaderId 采购单id | |
235 | - * @param bout 查询次数 | |
236 | - * @return | |
237 | - */ | |
238 | - public List<PoOrder> getPoOrder(String organizationId, String poHeaderId, int bout){ | |
239 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
240 | - Map<String, Object> map = new HashMap<>(); | |
241 | - map.put("organizationId", organizationId); | |
242 | - map.put("poHeaderId", poHeaderId); | |
243 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/getPoOrder"; | |
244 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
245 | - ResultEntityList<PoOrder> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<PoOrder>>(){}); | |
246 | - if (ResultStatus.EXPIRED.equals(resultEntity.getCode())){ | |
247 | - if (bout != 1) { | |
248 | - apiTokenService.apiToken(); | |
249 | - bout = 1; | |
250 | - this.getPoOrder(organizationId, poHeaderId, bout); | |
251 | - } else { | |
252 | - throw new BusinessException("token过期,重新请求token失败"); | |
253 | - } | |
254 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
255 | - throw new ServiceException("服务器处理失败"); | |
256 | - } else if (!resultEntity.getOk()) { | |
257 | - throw new ServiceException("服务器响应错误"); | |
258 | - } else { | |
259 | - return resultEntity.getData(); | |
260 | - } | |
261 | - return null; | |
262 | - } | |
263 | - | |
264 | - /** | |
265 | - * 采购退货的查询(抓退货至接收的状态) | |
266 | - * @param organizationId 组织id | |
267 | - * @param poHeaderId 采购单id | |
268 | - * @param shipmentHeaderId 接收单id | |
269 | - * @param dateFrom 起始日期 | |
270 | - * @param dateTo 结束日期 | |
271 | - * @param orderBy 数据排序 | |
272 | - * @param pageNum 当前页 | |
273 | - * @param pageSize 每页行数 | |
274 | - * @param count 查询总行数标识 | |
275 | - * @param bout 查询次数 | |
276 | - * @return | |
277 | - */ | |
278 | - public List<PurchasingReturns> getPurchasingReturns(String organizationId, String poHeaderId, String shipmentHeaderId, | |
279 | - String dateFrom, String dateTo, String orderBy, String pageNum, String pageSize, boolean count, int bout){ | |
280 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
281 | - Map<String, Object> map = new HashMap<>(); | |
282 | - map.put("organizationId", organizationId); | |
283 | - map.put("poHeaderId", poHeaderId); | |
284 | - map.put("shipmentHeaderId", shipmentHeaderId); | |
285 | - map.put("dateFrom", dateFrom); | |
286 | - map.put("dateTo", dateTo); | |
287 | - map.put("orderBy", orderBy); | |
288 | - map.put("pageNum", pageNum); | |
289 | - map.put("pageSize", pageSize); | |
290 | - map.put("count", count); | |
291 | - map.put("wmsCode", "BH_HH01"); | |
292 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/getPurchasingReturns"; | |
293 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
294 | - ResultEntityList<PurchasingReturns> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<PurchasingReturns>>(){}); | |
295 | - if (ResultStatus.EXPIRED.equals(resultEntity.getCode())){ | |
296 | - if (bout != 1) { | |
297 | - apiTokenService.apiToken(); | |
298 | - bout = 1; | |
299 | - this.getPurchasingReturns(organizationId, poHeaderId, shipmentHeaderId, dateFrom, dateTo, orderBy, pageNum, pageSize, count, bout); | |
300 | - } else { | |
301 | - throw new BusinessException("token过期,重新请求token失败"); | |
302 | - } | |
303 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
304 | - throw new ServiceException("服务器处理失败"); | |
305 | - } else if (!resultEntity.getOk()) { | |
306 | - throw new ServiceException("服务器响应错误"); | |
307 | - } else { | |
308 | - return resultEntity.getData(); | |
309 | - } | |
310 | - return null; | |
311 | - } | |
312 | - | |
313 | - /** | |
314 | - * 采购接收单查询接口 | |
315 | - * @param organizationId 库存组织id | |
316 | - * @param shipmentHeaderId 送货单头id | |
317 | - * @param bout 查询次数 | |
318 | - * @return | |
319 | - */ | |
320 | - public List<RcvShipment> getRcvShipment(String organizationId, String shipmentHeaderId, int bout){ | |
321 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
322 | - Map<String, Object> map = new HashMap<>(); | |
323 | - map.put("organizationId", organizationId); | |
324 | - map.put("shipmentHeaderId", shipmentHeaderId); | |
325 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/getRcvShipment"; | |
326 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
327 | - ResultEntityList<RcvShipment> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<RcvShipment>>(){}); | |
328 | - if (ResultStatus.EXPIRED.equals(resultEntity.getCode())){ | |
329 | - if (bout != 1) { | |
330 | - apiTokenService.apiToken(); | |
331 | - bout = 1; | |
332 | - this.getRcvShipment(organizationId, shipmentHeaderId, bout); | |
333 | - } else { | |
334 | - throw new BusinessException("token过期,重新请求token失败"); | |
335 | - } | |
336 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
337 | - throw new ServiceException("服务器处理失败"); | |
338 | - } else if (!resultEntity.getOk()) { | |
339 | - throw new ServiceException("服务器响应错误"); | |
340 | - } else { | |
341 | - return resultEntity.getData(); | |
342 | - } | |
343 | - return null; | |
344 | - } | |
345 | - | |
346 | - /** | |
347 | - * 送货验证接口 | |
348 | - * @param organizationId 库存组织id | |
349 | - * @param deliverNumber 采购单号 | |
350 | - * @param bout 查询次数 | |
351 | - * @return | |
352 | - */ | |
353 | - public List<ValidateDeliver> validateDeliver(String organizationId, String deliverNumber, int bout){ | |
354 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
355 | - Map<String, Object> map = new HashMap<>(); | |
356 | - map.put("organizationId", organizationId); | |
357 | - map.put("deliverNumber", deliverNumber); | |
358 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/validateDeliver"; | |
359 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
360 | - ResultEntityList<ValidateDeliver> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<ValidateDeliver>>(){}); | |
361 | - if (ResultStatus.EXPIRED.equals(resultEntity.getCode())){ | |
362 | - if (bout != 1) { | |
363 | - apiTokenService.apiToken(); | |
364 | - bout = 1; | |
365 | - this.validateDeliver(organizationId, deliverNumber, bout); | |
366 | - } else { | |
367 | - throw new BusinessException("token过期,重新请求token失败"); | |
368 | - } | |
369 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
370 | - throw new ServiceException("服务器处理失败"); | |
371 | - } else if (!resultEntity.getOk()) { | |
372 | - throw new ServiceException("服务器响应错误"); | |
373 | - } else { | |
374 | - return resultEntity.getData(); | |
375 | - } | |
376 | - return null; | |
377 | - } | |
378 | - | |
379 | - /** | |
380 | - * 采购单验证接口 | |
381 | - * @param organizationId 库存组织id | |
382 | - * @param poNumber 采购单号 | |
383 | - * @param bout 查询次数 | |
384 | - * @return | |
385 | - */ | |
386 | - public List<ValidatePo> validatePo(String organizationId, String poNumber, int bout){ | |
387 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
388 | - Map<String, Object> map = new HashMap<>(); | |
389 | - map.put("organizationId", organizationId); | |
390 | - map.put("poNumber", poNumber); | |
391 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/validatePo"; | |
392 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
393 | - ResultEntityList<ValidatePo> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<ValidatePo>>(){}); | |
394 | - if (ResultStatus.EXPIRED.equals(resultEntity.getCode())){ | |
395 | - if (bout != 1) { | |
396 | - apiTokenService.apiToken(); | |
397 | - bout = 1; | |
398 | - this.validatePo(organizationId, poNumber, bout); | |
399 | - } else { | |
400 | - throw new BusinessException("token过期,重新请求token失败"); | |
401 | - } | |
402 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
403 | - throw new ServiceException("服务器处理失败"); | |
404 | - } else if (!resultEntity.getOk()) { | |
405 | - throw new ServiceException("服务器响应错误"); | |
406 | - } else { | |
407 | - return resultEntity.getData(); | |
408 | - } | |
409 | - return null; | |
410 | - } | |
411 | - | |
412 | - /** | |
413 | - * 接收单验证接口 | |
414 | - * @param organizationId 库存组织id | |
415 | - * @param receiptNum 接收单号 | |
416 | - * @param bout 查询次数 | |
417 | - * @return | |
418 | - */ | |
419 | - public List<ValidateRcvShipment> validateRcvShipment(String organizationId, String receiptNum, int bout){ | |
420 | - TokenEntity tokenEntity = tokenService.getTokenEntity(); | |
421 | - Map<String, Object> map = new HashMap<>(); | |
422 | - map.put("organizationId", organizationId); | |
423 | - map.put("receiptNum", receiptNum); | |
424 | - map.put("wmsCode", "BH_HH01"); | |
425 | - String url = XinYiConstant.XINYI_HOST+XinYiConstant.PROJECT_NAME+"/aliWmsBusinessData/validateRcvShipment"; | |
426 | - String result = HttpUtils.sendGet(url, tokenEntity, DataUtils.sendGetFormat(map)); | |
427 | - ResultEntityList<ValidateRcvShipment> resultEntity = JSON.parseObject(result, new TypeReference<ResultEntityList<ValidateRcvShipment>>(){}); | |
428 | - if (ResultStatus.EXPIRED.equals(resultEntity.getCode())){ | |
429 | - if (bout != 1) { | |
430 | - apiTokenService.apiToken(); | |
431 | - bout = 1; | |
432 | - this.validateRcvShipment(organizationId, receiptNum, bout); | |
433 | - } else { | |
434 | - throw new BusinessException("token过期,重新请求token失败"); | |
435 | - } | |
436 | - } else if(!ResultStatus.SUCCESS.equals(resultEntity.getCode())){ | |
437 | - throw new ServiceException("服务器处理失败"); | |
438 | - } else if (!resultEntity.getOk()) { | |
439 | - throw new ServiceException("服务器响应错误"); | |
440 | - } else { | |
441 | - return resultEntity.getData(); | |
442 | - } | |
443 | - return null; | |
444 | - } | |
445 | -} | |
446 | 0 | \ No newline at end of file |
src/main/java/com/huaheng/api/xinyi/service/TokenService.java deleted
1 | -package com.huaheng.api.xinyi.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.huaheng.api.xinyi.domian.TokenEntity; | |
5 | - | |
6 | -/** | |
7 | - * | |
8 | - * @author Enzo Cotter | |
9 | - * @date 2019/12/20 | |
10 | - */ | |
11 | -public interface TokenService extends IService<TokenEntity>{ | |
12 | - | |
13 | - TokenEntity findOneByAll(); | |
14 | - | |
15 | - boolean insertSelective(TokenEntity tokenEntity); | |
16 | - | |
17 | - /** | |
18 | - * 获取数据库中token,如果为空重新获取token | |
19 | - * @return | |
20 | - */ | |
21 | - TokenEntity getTokenEntity(); | |
22 | -} |
src/main/java/com/huaheng/api/xinyi/service/TokenServiceImpl.java deleted
1 | -package com.huaheng.api.xinyi.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | -import com.huaheng.api.xinyi.domian.TokenEntity; | |
5 | -import com.huaheng.api.xinyi.mapper.TokenMapper; | |
6 | -import jdk.nashorn.internal.parser.Token; | |
7 | -import org.springframework.stereotype.Service; | |
8 | - | |
9 | -import javax.annotation.Resource; | |
10 | - | |
11 | -/** | |
12 | - * Created by Enzo Cotter on 2019/12/20. | |
13 | - */ | |
14 | -@Service | |
15 | -public class TokenServiceImpl extends ServiceImpl<TokenMapper, TokenEntity> implements TokenService { | |
16 | - | |
17 | - @Resource | |
18 | - private TokenMapper tokenMapper; | |
19 | - @Resource | |
20 | - private ApiTokenService apiTokenService; | |
21 | - | |
22 | - @Override | |
23 | - public TokenEntity findOneByAll() { | |
24 | - return tokenMapper.findOneByAll(); | |
25 | - } | |
26 | - | |
27 | - @Override | |
28 | - public boolean insertSelective(TokenEntity tokenEntity) { | |
29 | - return tokenMapper.insertSelective(tokenEntity)==1; | |
30 | - } | |
31 | - | |
32 | - @Override | |
33 | - public TokenEntity getTokenEntity() { | |
34 | - TokenEntity tokenEntity = findOneByAll(); | |
35 | - if (tokenEntity == null){ | |
36 | - if ("success".equals(apiTokenService.apiToken())){ | |
37 | - tokenEntity = findOneByAll(); | |
38 | - } | |
39 | - } | |
40 | - return tokenEntity; | |
41 | - } | |
42 | -} |
src/main/java/com/huaheng/pc/receipt/receiptHeader/service/ReceiptHeaderService.java
... | ... | @@ -2,16 +2,8 @@ package com.huaheng.pc.receipt.receiptHeader.service; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | -import com.baomidou.mybatisplus.extension.api.R; | |
6 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | -import com.huaheng.api.general.domain.Receipt; | |
8 | -import com.huaheng.api.xinyi.domian.DeliverOrder; | |
9 | -import com.huaheng.api.xinyi.domian.ValidateDeliver; | |
10 | -import com.huaheng.api.xinyi.domian.ValidatePo; | |
11 | -import com.huaheng.api.xinyi.service.BasisService; | |
12 | -import com.huaheng.api.xinyi.service.BusinessService; | |
13 | 6 | import com.huaheng.common.constant.QuantityConstant; |
14 | -import com.huaheng.common.exception.BusinessException; | |
15 | 7 | import com.huaheng.common.exception.service.ServiceException; |
16 | 8 | import com.huaheng.common.support.Convert; |
17 | 9 | import com.huaheng.common.utils.StringUtils; |
... | ... | @@ -21,9 +13,7 @@ import com.huaheng.pc.check.checkDetail.domain.CheckDetail; |
21 | 13 | import com.huaheng.pc.check.checkDetail.service.CheckDetailService; |
22 | 14 | import com.huaheng.pc.check.checkHeader.domain.CheckHeader; |
23 | 15 | import com.huaheng.pc.check.checkHeader.service.CheckHeaderService; |
24 | -import com.huaheng.pc.config.company.domain.Company; | |
25 | 16 | import com.huaheng.pc.config.company.service.CompanyService; |
26 | -import com.huaheng.pc.config.material.domain.Material; | |
27 | 17 | import com.huaheng.pc.config.material.service.MaterialService; |
28 | 18 | import com.huaheng.pc.config.receiptType.domain.ReceiptType; |
29 | 19 | import com.huaheng.pc.config.receiptType.service.ReceiptTypeService; |
... | ... | @@ -33,12 +23,10 @@ import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
33 | 23 | import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; |
34 | 24 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
35 | 25 | import com.huaheng.pc.receipt.receiptHeader.mapper.ReceiptHeaderMapper; |
36 | -import org.springframework.boot.autoconfigure.validation.ValidatorAdapter; | |
37 | 26 | import org.springframework.stereotype.Service; |
38 | 27 | import org.springframework.transaction.annotation.Transactional; |
39 | 28 | |
40 | 29 | import javax.annotation.Resource; |
41 | -import java.math.BigDecimal; | |
42 | 30 | import java.text.SimpleDateFormat; |
43 | 31 | import java.util.Arrays; |
44 | 32 | import java.util.Date; |
... | ... | @@ -60,13 +48,9 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
60 | 48 | @Resource |
61 | 49 | private ReceiptHeaderMapper receiptHeaderMapper; |
62 | 50 | @Resource |
63 | - private BusinessService businessService; | |
64 | - @Resource | |
65 | 51 | private CompanyService companyService; |
66 | 52 | @Resource |
67 | 53 | private MaterialService materialService; |
68 | - @Resource | |
69 | - private BasisService basisService; | |
70 | 54 | |
71 | 55 | /** |
72 | 56 | * 保存入库单 |
... | ... | @@ -326,156 +310,4 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei |
326 | 310 | return receiptHeaderMapper.selectListByCreated(); |
327 | 311 | } |
328 | 312 | |
329 | - /** | |
330 | - * 拉取单据 | |
331 | - * @param companyId 库存组织id | |
332 | - * @param referType 单据类型 | |
333 | - * @param referCode 单据号 | |
334 | - * @return | |
335 | - */ | |
336 | - public AjaxResult findErpReceipt(String companyId,String referType, String referCode){ | |
337 | - if (referType.equals("DE")) { | |
338 | - addDeliverOrder(companyId, referCode); | |
339 | - } else if (referType.equals("")){ | |
340 | - | |
341 | - } | |
342 | - return AjaxResult.success(""); | |
343 | - } | |
344 | - | |
345 | - /** | |
346 | - * 送货单 | |
347 | - * @param companyId 货主id | |
348 | - * @param referCode 上游系统单号 | |
349 | - * @return | |
350 | - */ | |
351 | - @Transactional(rollbackFor = Exception.class) | |
352 | - public AjaxResult addDeliverOrder(String companyId, String referCode){ | |
353 | - List<ValidateDeliver> validateDeliverList = businessService.validateDeliver(companyId, referCode, 0); | |
354 | - if (validateDeliverList.isEmpty() || validateDeliverList.get(0).getDeliverStatus().equals("S")) { | |
355 | - return AjaxResult.success("单据状态失败或单据状态不为确认"); | |
356 | - } else { | |
357 | - /* 添加入库主表*/ | |
358 | - ValidateDeliver validateDeliver = validateDeliverList.get(0); | |
359 | - ReceiptHeader receiptHeader = new ReceiptHeader(); | |
360 | - receiptHeader.setWarehouseCode("XY0001"); | |
361 | - | |
362 | - /* 根据id获取货主*/ | |
363 | - Company company = companyService.getById(companyId); | |
364 | - if (StringUtils.isNotNull(company)) { | |
365 | - return AjaxResult.error("库存组织不存在,请先同步库存组织"); | |
366 | - } | |
367 | - receiptHeader.setCompanyCode(company.getCode()); | |
368 | - receiptHeader.setCode(createCode("DE")); | |
369 | - receiptHeader.setReceiptType("Delivery"); | |
370 | - receiptHeader.setFirstStatus(200); | |
371 | - receiptHeader.setLastStatus(200); | |
372 | - receiptHeader.setReferCode(validateDeliver.getDeliverNumber()); | |
373 | - receiptHeader.setReferId(validateDeliver.getDeliverHeaderId()); | |
374 | - receiptHeader.setReferType("DE"); | |
375 | - receiptHeader.setCreated(new Date()); | |
376 | - receiptHeader.setCreatedBy("erp"); | |
377 | - receiptHeader.setLastUpdated(new Date()); | |
378 | - receiptHeader.setLastUpdatedBy("erp"); | |
379 | - if (!save(receiptHeader)) { | |
380 | - throw new BusinessException("保存入库单失败"); | |
381 | - } else { | |
382 | - List<DeliverOrder> deliverOrderList = businessService.getDeliverOrder(companyId, String.valueOf(validateDeliver.getDeliverHeaderId()), 0); | |
383 | - LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
384 | - receiptHeaderLambdaQueryWrapper.eq(ReceiptHeader::getCode, receiptHeader.getCode()); | |
385 | - receiptHeader = getOne(receiptHeaderLambdaQueryWrapper); | |
386 | - /* 总数量*/ | |
387 | - int qty = 0; | |
388 | - /* 遍历添加入库单明细*/ | |
389 | - for (DeliverOrder deliverOrder : deliverOrderList) { | |
390 | - ReceiptDetail receiptDetail = new ReceiptDetail(); | |
391 | - receiptDetail.setReceiptId(receiptHeader.getId()); | |
392 | - receiptDetail.setReceiptCode(receiptHeader.getCode()); | |
393 | - receiptDetail.setWarehouseCode("XY0001"); | |
394 | - receiptDetail.setCompanyCode(company.getCode()); | |
395 | - | |
396 | - /* 查询物料信息*/ | |
397 | - LambdaQueryWrapper<Material> materialLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
398 | - materialLambdaQueryWrapper.eq(Material::getCode, deliverOrder.getItemNumber()); | |
399 | - Material material = materialService.getOne(materialLambdaQueryWrapper); | |
400 | - if (StringUtils.isNotNull(material)) { | |
401 | - materialService.addErpMaterial(null, null, 1, 10, true, | |
402 | - String.valueOf(deliverOrder.getInventoryItemId()), String.valueOf(deliverOrder.getOrganizationId())); | |
403 | - material = materialService.getOne(materialLambdaQueryWrapper); | |
404 | - if (material == null){ | |
405 | - throw new ServiceException("同步物料失败"); | |
406 | - } | |
407 | - } | |
408 | - | |
409 | - receiptDetail.setMaterialCode(material.getCode()); | |
410 | - receiptDetail.setMaterialName(material.getName()); | |
411 | - receiptDetail.setMaterialSpec(material.getSpec()); | |
412 | - receiptDetail.setMaterialUnit(material.getUnit()); | |
413 | - receiptDetail.setTotalQty(BigDecimal.valueOf(deliverOrder.getQuantity())); | |
414 | - receiptDetail.setOpenQty(BigDecimal.valueOf(deliverOrder.getAvailableQuantity())); | |
415 | - receiptDetail.setReferCode(deliverOrder.getDeliverNumber()); | |
416 | - receiptDetail.setReferId(deliverOrder.getDeliverHeaderId()); | |
417 | - receiptDetail.setReferLineNum(String.valueOf(deliverOrder.getDeliverLineId())); | |
418 | - receiptDetail.setCreated(new Date()); | |
419 | - receiptDetail.setCreatedBy("erp"); | |
420 | - receiptDetail.setLastUpdated(new Date()); | |
421 | - receiptDetail.setLastUpdatedBy("erp"); | |
422 | - receiptDetail.setStatusFlowCode("200"); | |
423 | - qty += deliverOrder.getQuantity(); | |
424 | - if (!receiptDetailService.save(receiptDetail)) { | |
425 | - throw new BusinessException("添加入库明细失败"); | |
426 | - } | |
427 | - } | |
428 | - | |
429 | - /* 更新入库主表总数量和总行数*/ | |
430 | - receiptHeader.setTotalQty(BigDecimal.valueOf(qty)); | |
431 | - receiptHeader.setTotalLines(deliverOrderList.size()); | |
432 | - if (!updateById(receiptHeader)){ | |
433 | - throw new BusinessException("更新入库主表失败"); | |
434 | - } | |
435 | - } | |
436 | - return AjaxResult.success("成功"); | |
437 | - } | |
438 | - } | |
439 | - | |
440 | - /** | |
441 | - * 采购单 | |
442 | - * @param companyId 货主id | |
443 | - * @param referCode 上游系统单号 | |
444 | - * @return | |
445 | - */ | |
446 | - public AjaxResult addPurchase(String companyId, String referCode) { | |
447 | - List<ValidatePo> validatePoList = businessService.validatePo(companyId, referCode, 0); | |
448 | - /* 当验证接口不为空,且closed为空是可以接收*/ | |
449 | - if (validatePoList.isEmpty() || StringUtils.isNotNull(validatePoList.get(0).getClosedCode())) { | |
450 | - return AjaxResult.success("单据验证失败或单据已被关闭"); | |
451 | - } else { | |
452 | - /* 添加入库主表*/ | |
453 | - ValidatePo validatePo = validatePoList.get(0); | |
454 | - ReceiptHeader receiptHeader = new ReceiptHeader(); | |
455 | - receiptHeader.setWarehouseCode("XY0001"); | |
456 | - | |
457 | - /* 根据id获取货主*/ | |
458 | - Company company = companyService.getById(companyId); | |
459 | - if (StringUtils.isNotNull(company)) { | |
460 | - return AjaxResult.error("库存组织不存在,请先同步库存组织"); | |
461 | - } | |
462 | - receiptHeader.setCompanyCode(company.getCode()); | |
463 | - receiptHeader.setCode(createCode("DE")); | |
464 | - receiptHeader.setReceiptType("CG"); | |
465 | - receiptHeader.setFirstStatus(200); | |
466 | - receiptHeader.setLastStatus(200); | |
467 | - receiptHeader.setReferCode(validatePo.getPoNumber()); | |
468 | - receiptHeader.setReferId(validatePo.getPoHeaderdId()); | |
469 | - receiptHeader.setReferType("CG"); | |
470 | - if (!save(receiptHeader)) { | |
471 | - throw new BusinessException("保存入库单失败"); | |
472 | - } else { | |
473 | - | |
474 | - } | |
475 | - | |
476 | - | |
477 | - | |
478 | - } | |
479 | - return AjaxResult.success(""); | |
480 | - } | |
481 | 313 | } |
... | ... |