提交 | 用户 | 时间
|
58d006
|
1 |
package com.mandi.fendan.controller; |
A |
2 |
|
|
3 |
|
|
4 |
|
|
5 |
import java.util.List; |
|
6 |
import java.util.Map; |
|
7 |
|
|
8 |
import javax.annotation.Resource; |
|
9 |
import javax.servlet.http.HttpServletRequest; |
|
10 |
import javax.servlet.http.HttpServletResponse; |
|
11 |
|
|
12 |
import org.apache.commons.lang3.StringUtils; |
|
13 |
import org.springframework.stereotype.Controller; |
|
14 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
15 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
16 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
17 |
|
|
18 |
import com.mandi.basicconfig.mapper.FdRepertoryNexusMapper; |
|
19 |
import com.mandi.basicconfig.persist.FdRepertoryNexus; |
|
20 |
import com.mandi.common.Jacksonmethod; |
|
21 |
import com.mandi.common.RequestParam; |
|
22 |
import com.mandi.common.SessionMethod; |
|
23 |
import com.mandi.dao.common.ObjectResult; |
|
24 |
import com.mandi.dao.common.PageResult; |
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
@Controller("fd_repertorynexus_con") |
|
29 |
@RequestMapping(value="/repertorynexus",method={RequestMethod.POST}) |
|
30 |
public class Fd_RepertoryNexusController { |
|
31 |
|
|
32 |
@Resource |
|
33 |
private FdRepertoryNexusMapper rnper; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* 成品库 |
|
38 |
* @param r |
|
39 |
* @param re |
|
40 |
* @return |
|
41 |
*/ |
|
42 |
|
|
43 |
@RequestMapping(value = "/getallCkList.htm", method = {RequestMethod.POST }) |
|
44 |
@ResponseBody |
|
45 |
public String getList(HttpServletRequest r,HttpServletResponse re){ |
ffffbd
|
46 |
// 此处需要改成可以配置的,可以配置的厂区仓库 |
58d006
|
47 |
List<Map<String, Object>> ckList = rnper.getAllCk(); |
A |
48 |
PageResult<Map<String, Object>> prr=new PageResult<Map<String,Object>>(); |
|
49 |
prr.setCode(0); |
|
50 |
prr.setList(ckList); |
|
51 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(prr, false)); |
|
52 |
return null; |
|
53 |
} |
|
54 |
/** |
|
55 |
* 选择的成品库 |
|
56 |
* @param r |
|
57 |
* @param re |
|
58 |
* @return |
|
59 |
*/ |
|
60 |
@RequestMapping(value = "/getChooseList.htm", method = {RequestMethod.POST }) |
|
61 |
@ResponseBody |
|
62 |
public String getChooseList(HttpServletRequest r,HttpServletResponse re){ |
|
63 |
|
|
64 |
|
|
65 |
String sdepartNo=RequestParam.getSqlString(r, "sdepartNo"); |
|
66 |
|
|
67 |
List<FdRepertoryNexus> choosedCkList = rnper.getBySdepartNo(sdepartNo); |
|
68 |
PageResult<FdRepertoryNexus> prr=new PageResult<FdRepertoryNexus>(); |
|
69 |
prr.setCode(0); |
|
70 |
prr.setList(choosedCkList); |
|
71 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(prr, false)); |
|
72 |
return null; |
|
73 |
} |
|
74 |
|
|
75 |
|
|
76 |
/** |
|
77 |
* 保存成品库 |
|
78 |
* @param r |
|
79 |
* @param re |
|
80 |
* @return |
|
81 |
*/ |
|
82 |
@RequestMapping(value = "/saveItem.htm", method = {RequestMethod.POST }) |
|
83 |
@ResponseBody |
|
84 |
public String saveItem(HttpServletRequest r,HttpServletResponse re){ |
|
85 |
|
|
86 |
String sdepartNo=RequestParam.getSqlString(r, "code"); |
|
87 |
String ckNos=RequestParam.getString(r, "ckNos"); |
|
88 |
if(StringUtils.isNotBlank(sdepartNo)) { |
|
89 |
rnper.delRepertoryNexusBySdepartNo(sdepartNo); |
|
90 |
if(StringUtils.isNotBlank(ckNos)) { |
|
91 |
String[] ja=ckNos.split(","); |
|
92 |
for (String str : ja) { |
|
93 |
String ywdyNo=str.split("_")[0]; |
|
94 |
String ckNo=str.split("_")[1]; |
|
95 |
FdRepertoryNexus fdn=rnper.getbyckNoAndYwdyNo(ckNo, ywdyNo); |
|
96 |
if(fdn!=null) { |
|
97 |
if(!fdn.getSdepartNo().equals(sdepartNo)) { |
|
98 |
fdn.setSdepartNo(sdepartNo); |
|
99 |
rnper.updateRepertoryNexus(fdn); |
|
100 |
} |
|
101 |
}else { |
|
102 |
fdn=new FdRepertoryNexus(); |
|
103 |
fdn.setCkNo(ckNo); |
|
104 |
fdn.setSdepartNo(sdepartNo); |
|
105 |
fdn.setYwdyNo(ywdyNo); |
|
106 |
rnper.insertRepertoryNexus(fdn); |
|
107 |
} |
|
108 |
} |
|
109 |
} |
|
110 |
} |
|
111 |
ObjectResult<Boolean> orr=new ObjectResult<Boolean>(); |
|
112 |
orr.setCode(0); |
|
113 |
orr.setItem(true); |
|
114 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false)); |
|
115 |
return null; |
|
116 |
} |
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
} |