SRMController.java
3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package com.huaheng.api.srm.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.huaheng.api.srm.domain.ICSOrder;
import com.huaheng.api.srm.domain.SRMResult;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.framework.web.domain.ResultErp;
import com.huaheng.pc.srm.domain.ICSASN;
import com.huaheng.pc.srm.domain.ICSASNDetail;
import com.huaheng.pc.srm.domain.ICSITEMLot;
import com.huaheng.pc.srm.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
@Controller
@RequestMapping("/api/srm")
public class SRMController extends BaseController{
public static final Logger logger = LoggerFactory.getLogger(SRMController.class);
@Resource
private ICSASNService icsasnService;
@Resource
private ICSASNDetailService icsasnDetailService;
@Resource
private ICSITEMLotService icsitemLotService;
@Resource
private SrmHeaderService srmHeaderService;
/**
* 送货单接收接口
* @param map
* @return
*/
@PostMapping("/pushICSASNList")
@ResponseBody
@ApiLogger(apiName = "srm送货单接收接口", from = "SRM")
public SRMResult pushICSASNList(@RequestBody HashMap<String,Object> map) {
SRMResult ajaxResult = handleMultiProcessSrm("pushICSASNList", new BaseController.MultiProcessListenerSrm() {
@Override
public SRMResult doProcess() {
ICSASN icsasn = JSONObject.parseObject(JSON.toJSONString(map.get("icsasn")),ICSASN.class);
List<ICSASNDetail> icsasnDetails= JSONObject.parseArray(JSON.toJSONString(map.get("icsasnDetails")),ICSASNDetail.class);
ICSOrder icsOrder = new ICSOrder();
icsOrder.setIcsasn(icsasn);
icsOrder.setIcsasnDetailList(icsasnDetails);
String json = JSON.toJSONString(icsOrder);
logger.info("获取送货单:{}",json);
return icsasnService.saveASNAndDetail(icsOrder);
}
});
return ajaxResult;
}
@PostMapping("/delICSASNList")
@ResponseBody
@ApiLogger(apiName = "srm送货单删除接口", from = "SRM")
public AjaxResult delICSASNList(@RequestBody HashMap<String,Object> map){
logger.info("erp推送信息:" + map);
List<ICSASN> list = JSONObject.parseArray(JSON.toJSONString(map.get("icsasn")), ICSASN.class);
return icsasnService.delASNAndDetail(list);
}
/**
* 物料条码
* 接口废弃
* @param
* @return
*/
@PostMapping("/pushICSITEMLot1")
@ResponseBody
@ApiLogger(apiName = "srm物料条码", from = "SRM")
public SRMResult pushICSITEMLot1(@RequestBody String icsitemLotListMessage) {
List<ICSITEMLot> icsitemLotList = JSON.parseArray(icsitemLotListMessage, ICSITEMLot.class);
String json = JSON.toJSONString(icsitemLotList);
logger.info("获取物料条码:{}",json);
return icsitemLotService.saveICSItemLotList(icsitemLotList);
}
@PostMapping("/delICSITEMLot1")
@ResponseBody
@ApiLogger(apiName = "srm删除物料条码", from = "SRM")
public SRMResult delICSITEMLot(@RequestBody String icsitemLotListMessage){
List<ICSITEMLot> icsitemLotList = JSON.parseArray(icsitemLotListMessage, ICSITEMLot.class);
// String json = JSON.toJSONString(icsitemLotList);
// logger.info("获取物料条码:{}",json);
return icsitemLotService.delICSItemLotList(icsitemLotList);
}
}