SRMController.java
2.52 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
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.web.domain.AjaxResult;
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 {
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;
@Resource
private FinishedProductService finishedProductService;
/**
* 送货单接收接口
* @param map
* @return
*/
@PostMapping("/pushICSASNList")
@ResponseBody
public SRMResult pushICSASNList(@RequestBody HashMap<String,Object> map) {
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);
}
/**
* 物料条码
*
* @param
* @return
*/
@PostMapping("/pushICSITEMLot")
@ResponseBody
public SRMResult pushICSITEMLot(@RequestBody String icsitemLotListMessage) {
List<ICSITEMLot> icsitemLotList = JSON.parseArray(icsitemLotListMessage, ICSITEMLot.class);
String json = JSON.toJSONString(icsitemLotList);
logger.info("获取物料条码:{}",json);
return icsitemLotService.saveICSItemLotList(icsitemLotList);
}
}