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;
|
}
|
|
|
}
|