打印数据整理

master
erzhongxmu 2020-07-28 07:57:18 +08:00
parent ab303cf751
commit f54386cc66
3 changed files with 253 additions and 5 deletions

View File

@ -2046,6 +2046,121 @@ public class WmImNoticeHController extends BaseController {
}
//打印的接口改造开始 在线打印非EXCEL
@RequestMapping(params = "doPrintpagerkd")
public ModelAndView doPrintpagerkd(String id,HttpServletRequest request) {
PrintHeader printHeader = new PrintHeader();
WmImNoticeHEntity wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class,
id);// 获取抬头
if(wmImNoticeH.getOrderTypeCode().equals("03")){
printHeader.setHeader01(ResourceUtil.getConfigByName("comname")+"退货入库单");
}else if(wmImNoticeH.getOrderTypeCode().equals("01")){
printHeader.setHeader01(ResourceUtil.getConfigByName("comname")+"收货入库单");
}else if(wmImNoticeH.getOrderTypeCode().equals("04")){
printHeader.setHeader01(ResourceUtil.getConfigByName("comname")+"越库单");
}else if(wmImNoticeH.getOrderTypeCode().equals("09")){
printHeader.setHeader01(ResourceUtil.getConfigByName("comname")+"收货入库单");
}
printHeader.setHeader02("公司地址:"+ ResourceUtil.getConfigByName("comaddr") );
printHeader.setHeader03("电话:"+ ResourceUtil.getConfigByName("comtel") );
printHeader.setHeader04("到货日期: " + DateUtils.date2Str(wmImNoticeH.getImData(), DateUtils.date_sdf) );
printHeader.setHeader05("预约单号: " +wmImNoticeH.getNoticeId());
printHeader.setHeader06("客户采购单号: "+wmImNoticeH.getImCusCode() );
printHeader.setHeader07("月台: " +wmImNoticeH.getPlatformCode());
MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmImNoticeH.getCusCode());
printHeader.setHeader08("客户名称: " +wmImNoticeH.getCusCode()+md.getZhongWenQch());
printHeader.setHeader09("供应商: "+wmImNoticeH.getSupCode()+ wmImNoticeH.getSupName());
printHeader.setHeader10("客户电话: " +md.getDianHua());
printHeader.setHeader11("打印时间: "+ DateUtils.date2Str(DateUtils.getDate(), DateUtils.datetimeFormat) );
request.setAttribute("printHeader", printHeader);
List<PrintItem> listitem = new ArrayList<>();
request.setAttribute("listitem", listitem);
String tsql = "SELECT wq.goods_pro_data as pro_data,wq.goods_unit, (select wmi.rec_deg from wm_in_qm_i wmi where wmi.im_notice_id = wq.order_id and wmi.goods_id = wq.goods_id limit 1) as rec_deg, mg.goods_code, mg.goods_id,mg.shp_ming_cheng,"
+ " cast(sum(wq.goods_qua) as signed) as goods_count,truncate(sum(wq.goods_qua*mg.ti_ji_cm),2) tin_tj ,truncate(sum(wq.goods_qua*mg.zhl_kg),2) as tin_zhl,count(*) as tuopan "
+ "FROM wm_to_up_goods wq,mv_goods mg where wq.order_id = ? and wq.goods_id = mg.goods_code group by wq.order_id, mg.goods_code,wq.goods_pro_data";
List<Map<String, Object>> result = systemService
.findForJdbc(tsql, wmImNoticeH.getNoticeId());
Double sum =0.00;
Double sumzl = 0.00;
for (int i = 0; i < result.size(); i++) {
PrintItem printItem = new PrintItem();
printItem.setItem01(result.get(i).get("goods_id")
.toString());
printItem.setItem02(result.get(i).get("shp_ming_cheng")
.toString());
try {
printItem.setItem03(result.get(i).get("pro_data")
.toString());
} catch (Exception e) {
// TODO: handle exception
}
try {
printItem.setItem04(result.get(i)
.get("rec_deg").toString());
} catch (Exception e) {
// TODO: handle exception
}
try {
printItem.setItem05(result.get(i).get("goods_unit")
.toString());
} catch (Exception e) {
// TODO: handle exception
}
try {
sum = sum + Double.parseDouble(result.get(i).get("goods_count")
.toString());
printItem.setItem06(result.get(i).get("goods_count")
.toString());
} catch (Exception e) {
// TODO: handle exception
}
try {
sumzl = sumzl + Double.parseDouble(result.get(i).get("tin_zhl")
.toString());
printItem.setItem07(result.get(i).get("tin_zhl")
.toString());
} catch (Exception e) {
// TODO: handle exception
}
try {
if(ResourceUtil.getConfigByName("systuopan").equals("yes")){
printItem.setItem08(result.get(i).get("tuopan")
.toString());
}else{
printItem.setItem08(result.get(i).get("tin_tj")
.toString());
}
} catch (Exception e) {
// TODO: handle exception
}
listitem.add(printItem);
}
printHeader.setHeader12(sum.toString());
printHeader.setHeader13(sumzl.toString());
return new ModelAndView("com/zzjee/wm/print/imnoticerkd-print");
}
//打印的接口改造结束在线打印非EXCEL
/**
*

View File

@ -1853,8 +1853,141 @@ public class WmOmNoticeHController extends BaseController {
}
}
//打印的接口改造开始 在线打印非EXCEL
@RequestMapping(params = "doPrintpageckd")
public ModelAndView doPrintpageckd(String id,HttpServletRequest request) {
PrintHeader printHeader = new PrintHeader();
WmOmNoticeHEntity wmOmNoticeH = systemService.getEntity(WmOmNoticeHEntity.class,
id);//获取抬头
printHeader.setHeader01(ResourceUtil.getConfigByName("comname")+"出库单");
printHeader.setHeader02("公司地址:"+ResourceUtil.getConfigByName("comaddr") );
printHeader.setHeader03("电话:"+ ResourceUtil.getConfigByName("comtel"));
printHeader.setHeader04("出库日期: " +DateUtils.date2Str(wmOmNoticeH.getDelvData(), DateUtils.date_sdf) );
printHeader.setHeader05("出库单号: " +wmOmNoticeH.getOmNoticeId());
printHeader.setHeader06("客户单号: " +wmOmNoticeH.getImCusCode());
printHeader.setHeader07("车号: " +wmOmNoticeH.getReCarno());
MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmOmNoticeH.getCusCode());
printHeader.setHeader08("客户名称: " +wmOmNoticeH.getCusCode()+md.getZhongWenQch());
printHeader.setHeader09("收货人: "+wmOmNoticeH.getDelvMember()+" 电话:"+wmOmNoticeH.getDelvMobile() );
printHeader.setHeader10("收货地址: " +wmOmNoticeH.getDelvAddr());
printHeader.setHeader11("打印时间: "+DateUtils.date2Str(DateUtils.getDate(), DateUtils.datetimeFormat) );
request.setAttribute("printHeader", printHeader);
List<PrintItem> listitem = new ArrayList<>();
request.setAttribute("listitem", listitem);
String tsql = "SELECT wq.goods_pro_data as pro_data,wq.base_unit, mg.goods_code, mg.goods_id,mg.shp_ming_cheng,cast(sum(wq.base_goodscount) as signed) as goods_count,mg.chl_shl,cast(mg.ti_ji_cm/mg.chl_shl as signed) tin_tj ,(mg.zhl_kg/mg.chl_shl ) as tin_zhl "
+" FROM wm_to_down_goods wq,mv_goods mg where wq.order_id = ? "
+" and wq.goods_id = mg.goods_code group by wq.order_id, mg.goods_code,wq.goods_pro_data";
List<Map<String, Object>> result = systemService
.findForJdbc(tsql, wmOmNoticeH.getOmNoticeId());
int size = result.size();
if(size<1){
tsql = "SELECT wq.pro_data,wq.base_unit, mg.goods_code, mg.goods_id,mg.shp_ming_cheng,cast(sum(wq.base_goodscount) as signed) as goods_count,mg.chl_shl,cast(mg.ti_ji_cm/mg.chl_shl as signed) tin_tj , (mg.zhl_kg/mg.chl_shl) as tin_zhl "
+" FROM wm_om_qm_i wq,mv_goods mg where wq.om_notice_id = ? "
+" and wq.goods_id = mg.goods_code group by wq.om_notice_id, mg.goods_code,wq.pro_data";
result = systemService
.findForJdbc(tsql, wmOmNoticeH.getOmNoticeId());
size = result.size();
}
long sumxs=0;
Double sum =0.00;
Double sumzl = 0.00;
for (int i = 0; i < result.size(); i++) {
PrintItem printItem = new PrintItem();
printItem.setItem01(result.get(i).get("goods_id")
.toString());
printItem.setItem02(result.get(i).get("shp_ming_cheng")
.toString());
try {
printItem.setItem03(result.get(i).get("pro_data")
.toString());
} catch (Exception e) {
// TODO: handle exception
logger.error(ExceptionUtil.getExceptionMessage(e));
}
try {
long xs = (long) Math.floor(Double.parseDouble(result.get(i).get("goods_count")
.toString()) / Double.parseDouble(result.get(i).get("chl_shl")
.toString()));
sumxs = sumxs + xs;
printItem.setItem05(Long.toString(xs));
} catch (Exception e) {
// TODO: handle exception
logger.error(ExceptionUtil.getExceptionMessage(e));
}
try {
double bs = Double.parseDouble(result.get(i).get("goods_count")
.toString()) % Double.parseDouble(result.get(i).get("chl_shl")
.toString());
sum = sum + bs;
printItem.setItem06(Double.toString(bs));
} catch (Exception e) {
// TODO: handle exception
logger.error(ExceptionUtil.getExceptionMessage(e));
}
try {
double zhl = Double.parseDouble(result.get(i).get("tin_zhl")
.toString()) * Double.parseDouble(result.get(i).get("goods_count").toString());
sumzl = sumzl + zhl;
printItem.setItem07(Double.toString(zhl));
} catch (Exception e) {
// TODO: handle exception
logger.error(ExceptionUtil.getExceptionMessage(e));
}
try {
double tij = Double.parseDouble(result.get(i).get("tin_tj")
.toString()) * Double.parseDouble(result.get(i).get("goods_count").toString());
printItem.setItem08(Double.toString(tij));
} catch (Exception e) {
// TODO: handle exception
}
try{
if("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))) {
printItem.setItem09(wmUtil.getstock(result.get(i).get("goods_id").toString()));
}
}catch (Exception e){
logger.error(ExceptionUtil.getExceptionMessage(e));
}
listitem.add(printItem);
}
printHeader.setHeader12(sum.toString());
printHeader.setHeader13(sumzl.toString());
return new ModelAndView("com/zzjee/wm/print/imnoticeckd-print");
}
//打印的接口改造结束在线打印非EXCEL
/**

View File

@ -4,7 +4,7 @@ public class PrintItem {
private String item01;
private String item02;
private String item03;
private String hitem04;
private String item04;
private String item05;
private String item06;
private String item07;
@ -46,12 +46,12 @@ public class PrintItem {
this.item03 = item03;
}
public String getHitem04() {
return hitem04;
public String getItem04() {
return item04;
}
public void setHitem04(String hitem04) {
this.hitem04 = hitem04;
public void setItem04(String item04) {
this.item04 = item04;
}
public String getItem05() {