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