Administrator
2023-04-19 40ec16bbb7c9d23df625aa31ae42ac36e901749d
提交 | 用户 | 时间
58d006 1 package com.mandi.fendan.controller;
A 2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import javax.annotation.Resource;
7 import javax.servlet.http.HttpServletRequest;
8 import javax.servlet.http.HttpServletResponse;
9
10 import org.apache.commons.lang3.StringUtils;
11 import org.apache.log4j.Logger;
12 import org.springframework.stereotype.Controller;
13 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RequestMethod;
15 import org.springframework.web.bind.annotation.ResponseBody;
16
17 import com.google.gson.Gson;
18 import com.google.gson.JsonObject;
19 import com.mandi.common.Jacksonmethod;
20 import com.mandi.common.RequestParam;
21 import com.mandi.common.SessionMethod;
22 import com.mandi.common.Wxhtmethod;
23 import com.mandi.dao.common.ObjectResult;
24 import com.mandi.fendan.mapper.Fd_BsheetMapper;
25 import com.mandi.fendan.mapper.fd_errsheetMapper;
26 import com.mandi.fendan.persist.ErrSheet;
27 import com.mandi.fendan.service.IErpService;
28 import com.mandi.fendan.util.Contants;
29 import com.mandi.fendan.util.persist.Scxt_zcInfo;
30 import com.mandi.fendan.util.persist.SheetType;
31
32
33 @Controller("yktbusinesscon")
34 public class YktBusinessCon {
35     private Logger log=Logger.getLogger(YktBusinessCon.class);
36     @Resource
37     private Fd_BsheetMapper bsper;
38     @Resource
39     private IErpService erpser;
40     @Resource
41     private fd_errsheetMapper errsper;
42     
43     @RequestMapping(value="/business/common/resend.htm",method={RequestMethod.POST})
44     @ResponseBody
45     public String resend(HttpServletRequest r,HttpServletResponse re){
46         Gson g=new Gson(); 
47         JsonObject jo=new JsonObject();
48         jo.addProperty("code", 1);
49         jo.addProperty("errmsg", "该接口未实现!");
50         String str=g.toJson(jo);
51         SessionMethod.writeresp(re, str);
52         return null;
53     }
54     
55     
56     
57     @RequestMapping(value="/business/common/getcheckItem.htm",method={RequestMethod.POST})
58     @ResponseBody
59     public String getcheckItem(HttpServletRequest r,HttpServletResponse re){
60         String id=RequestParam.getSqlString(r, "id");
61         if(StringUtils.isEmpty(id))
62             id=RequestParam.getSqlString(r, "bussinessNo");
63         String url=Contants.yktLocalAdd+"/business/common/getcheckItem.htm";
64         Map<String, String> mp=new HashMap<String, String>();
65         mp.put("id", id);
66         mp.put("bussinessNo", id);
67         JsonObject jo=Wxhtmethod.postJson(url, mp);
68         Gson g=new Gson(); 
69         String str=g.toJson(jo);
70         SessionMethod.writeresp(re, str);
71         return null;
72     }
73     
74     @RequestMapping(value="/activiti/bussiness/busi/tasklist.htm",method={RequestMethod.POST})
75     @ResponseBody
76     public String tasklist(HttpServletRequest r,HttpServletResponse re){
77         String busiNo=RequestParam.getSqlString(r, "businessNo");
78 //        String sheetType=RequestParam.getSqlString(r, "sheetType");//车辆运输单
79         String url=Contants.yktLocalAdd+"/activiti/bussiness/busi/tasklist.htm";
80         Map<String, String> mp=new HashMap<String, String>();
81         mp.put("businessNo", busiNo);
82         mp.put("sheetType", SheetType.车辆运输单.toString());
83         JsonObject jo=Wxhtmethod.postJson(url, mp);
84         Gson g=new Gson(); 
85         String str=g.toJson(jo);
86         SessionMethod.writeresp(re, str);
87         return null;
88     }
89     @RequestMapping(value="/business/search/getAuditList.htm",method={RequestMethod.POST})
90     @ResponseBody
91     public String getAuditList(HttpServletRequest r,HttpServletResponse re){
92         String businessNo=RequestParam.getSqlString(r, "bussinessNo");
93         String url=Contants.yktLocalAdd+"/business/search/getAuditList.htm";
94         Map<String, String> mp=new HashMap<String, String>();
95         mp.put("bussinessNo", businessNo);
96         log.info(url);
97         JsonObject jo=Wxhtmethod.postJson(url, mp);
98         Gson g=new Gson(); 
99         String str=g.toJson(jo);
100         SessionMethod.writeresp(re, str);
101         return null;
102     }
103     @RequestMapping(value="/business/search/getWeightDocList.htm",method={RequestMethod.POST})
104     @ResponseBody
105     public String getWeightDocList(HttpServletRequest r,HttpServletResponse re){
106         String businessNo=RequestParam.getSqlString(r, "bussinessNo");
107         String url=Contants.yktLocalAdd+"/business/search/getWeightDocList.htm";
108         Map<String, String> mp=new HashMap<String, String>();
109         mp.put("bussinessNo", businessNo);
110         JsonObject jo=Wxhtmethod.postJson(url, mp);
111         Gson g=new Gson(); 
112         String str=g.toJson(jo);
113         SessionMethod.writeresp(re, str);
114         return null;
115     }
116     @RequestMapping(value="/biz/weightDoc/getItemDetails.htm",method={RequestMethod.POST})
117     @ResponseBody
118     public String getItemDetails(HttpServletRequest r,HttpServletResponse re){
119         String poundNo =RequestParam.getSqlString(r, "poundNo");
120         String url=Contants.yktLocalAdd+"/biz/weightDoc/getItemDetails.htm";
121         Map<String, String> mp=new HashMap<String, String>();
122         mp.put("poundNo", poundNo);
123         JsonObject jo=Wxhtmethod.postJson(url, mp);
124         Gson g=new Gson(); 
125         String str=g.toJson(jo);
126         SessionMethod.writeresp(re, str);
127         return null;
128     }
129     
130     
131     
132     /**
133      * 生产系统批量添加装车明细
134      * @param r
135      * @param re
136      * @return
137      */
138     @RequestMapping(value="/api/scxt/batchsubZcInfo.htm",method={RequestMethod.POST})
139     @ResponseBody
140     public String savebatchZcInfo(HttpServletRequest r,HttpServletResponse re){
141         String products =RequestParam.getString(r, "products");//装车信息
142 //        log.info("batchsave::::::"+products);
143         ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
144         try {
145             orr=erpser.batchSaveZcInfo(products);
146         } catch (Exception e) {
147             e.printStackTrace();
148             orr.setCode(1);
149             orr.setErrmsg(StringUtils.isEmpty(e.getMessage())?"产品销售扫码装车失败":e.getMessage());
150         }
151         String str=Jacksonmethod.tojson(orr, false);
152 //        log.info("batchsave:::return:::::"+str);
153         SessionMethod.writeresp(re, str);
154         return null;
155     }
156     
157     /**
158      * 生产系统批量删除装车明细
159      * @param r
160      * @param re
161      * @return
162      */
163     @RequestMapping(value="/api/scxt/batchdelZcInfo.htm",method={RequestMethod.POST})
164     @ResponseBody
165     public String batchdelZcInfo(HttpServletRequest r,HttpServletResponse re){
166         String products =RequestParam.getString(r, "products");//装车信息
167         ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
168 //        log.info("batchdel::::::"+products);
169         try {
170             orr=erpser.batchdelZcInfo(products);
171         } catch (Exception e) {
172             e.printStackTrace();
173             orr.setCode(1);
174             orr.setErrmsg(StringUtils.isEmpty(e.getMessage())?"产品销售扫码装车失败":e.getMessage());
175         }
176         String str=Jacksonmethod.tojson(orr, false);
177 //        log.info("batchdel:::return:::::"+str);
178         SessionMethod.writeresp(re, str);
179         return null;
180     }
181
182     /**
183      * 生产系统添加装车明细
184      * @param r
185      * @param re
186      * @return
187      */
188     @RequestMapping(value="/api/scxt/subZcInfo.htm",method={RequestMethod.POST})
189     @ResponseBody
190     public String subZcInfo(HttpServletRequest r,HttpServletResponse re){
191 //        String pch =RequestParam.getSqlString(r, "pch");//批次号
192 //        String ggxh =RequestParam.getSqlString(r, "ggxh");//规格型号
193 //        String jz =RequestParam.getSqlString(r, "jz");//净重
194 //        String mz =RequestParam.getSqlString(r, "mz");//毛重
195 //        String pz =RequestParam.getSqlString(r, "pz");//皮重
196 //        String czy =RequestParam.getSqlString(r, "czy");//操作员
197 //        String tdbh =RequestParam.getSqlString(r, "tdbh");//提单编号
198 //        String cph =RequestParam.getSqlString(r, "cph");//车牌号
199 //        String yktkh =RequestParam.getSqlString(r, "yktkh");//一卡通卡号
200         Scxt_zcInfo zc=new Scxt_zcInfo();
201         zc=RequestParam.getobj(r, zc);
202         ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
203         try {
204             orr=erpser.saveZcInfo(zc);
205         } catch (Exception e) {
206             e.printStackTrace();
207             orr.setCode(1);
208             orr.setErrmsg(StringUtils.isEmpty(e.getMessage())?"产品销售扫码装车失败":e.getMessage());
209         }
210         String str=Jacksonmethod.tojson(orr, false);
211         SessionMethod.writeresp(re, str);
212         return null;
213     }
214     
215     
216     /**
217      * 生产系统删除装车明细
218      * @param r
219      * @param re
220      * @return
221      */
222     @RequestMapping(value="/api/scxt/delZcInfo.htm",method={RequestMethod.POST,RequestMethod.GET})
223     @ResponseBody
224     public String delZcInfo(HttpServletRequest r,HttpServletResponse re){
225         String tmh =RequestParam.getSqlString(r, "tmh");//条码号
226         String cph =RequestParam.getSqlString(r, "cph");//车牌号
227         String yktkh =RequestParam.getSqlString(r, "yktkh");//一卡通卡号
228         Scxt_zcInfo zc=new Scxt_zcInfo();
229         zc=RequestParam.getobj(r, zc);
230         zc.setTmh(tmh);
231         zc.setCph(cph);
232         zc.setYktkh(yktkh);
233         ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
234         try {
235             orr=erpser.delZcInfo(zc);
236         } catch (Exception e) {
237             e.printStackTrace();
238             orr.setCode(1);
239             orr.setErrmsg(StringUtils.isEmpty(e.getMessage())?"产品销售扫码装车失败":e.getMessage());
240         }
241         String str=Jacksonmethod.tojson(orr, false);
242         SessionMethod.writeresp(re, str);
243         return null;
244     }
245     
246     /**
247      * 生产系统获取车辆信息
248      * @param r
249      * @param re
250      * @return
251      */
252     @RequestMapping(value="/api/scxt/getClInfo.htm",method={RequestMethod.POST,RequestMethod.GET})
253     @ResponseBody
254     public String getvehicleInfo(HttpServletRequest r,HttpServletResponse re){
255         String cardno =RequestParam.getSqlString(r, "yktkh");//一卡通卡号
256 //        log.info("getClInfo::::::::"+cardno);
257         Scxt_zcInfo zc=new Scxt_zcInfo();
258         zc=RequestParam.getobj(r, zc);
259         Map<String, Object> mp=erpser.getClInfo(cardno);
260 //        log.info("getClInfo::return::::::"+cardno);
261         String str=Jacksonmethod.tojson(mp, false);
262         SessionMethod.writeresp(re, str);
263         return null;
264     }
265     
266     /**
267      * 成品销售出厂
268      * @param r
269      * @param re
270      * @return
271      */
272     @RequestMapping(value="/api/xscccheck.htm",method={RequestMethod.POST,RequestMethod.GET})
273     @ResponseBody
274     public String xscccheck(HttpServletRequest r,HttpServletResponse re){
275         String bsNo =RequestParam.getSqlString(r, "bsNo");//业务单号
276         
277         String vehicleId =RequestParam.getSqlString(r, "vehicleId");//车牌号
278         String zz =RequestParam.getSqlString(r, "ZZ");//是否终止
279         Scxt_zcInfo zc=new Scxt_zcInfo();
280         zc=RequestParam.getobj(r, zc);
281         ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
282         try {
283             orr = erpser.sxccCheck(bsNo, vehicleId,zz);
284         } catch (Exception e) {
285             ErrSheet es=new ErrSheet();
286             es.setBsNo(bsNo);
287             es.setVehicleId(vehicleId);
288             es.setZZ(zz);
289             es.setErrmsg(e.getMessage());
290             this.errsper.insert(es);
291             orr.setCode(1);
292             orr.setErrmsg(e.getMessage());
293         }
294         String str=Jacksonmethod.tojson(orr, false);
295         SessionMethod.writeresp(re, str);
296         return null;
297     }
298     /**
299      * 成品销售进厂  
300      * @param r
301      * @param re
302      * @return
303      */
304     @RequestMapping(value="/api/xsincheck.htm",method={RequestMethod.POST,RequestMethod.GET})
305     @ResponseBody
306     public String xsincheck(HttpServletRequest r,HttpServletResponse re){
307         String bsNo =RequestParam.getSqlString(r, "bsNo");//业务单号
308         String vehicleId =RequestParam.getSqlString(r, "vehicleId");//车牌号
309         Scxt_zcInfo zc=new Scxt_zcInfo();
310         zc=RequestParam.getobj(r, zc);
311         ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
312         try {
313 //            orr = erpser.sxinCheck(bsNo, vehicleId);
314         } catch (Exception e) {
315             e.printStackTrace();
316             orr.setCode(1);
317             orr.setErrmsg(e.getMessage());
318         }
319         String str=Jacksonmethod.tojson(orr, false);
320         SessionMethod.writeresp(re, str);
321         return null;
322     }
323     
324
325 }