代码优化

master
erzhongxmu 2023-05-20 20:23:10 +08:00
parent ee0974abc4
commit d8a357e55b
2 changed files with 3014 additions and 3263 deletions

View File

@ -1,4 +1,5 @@
package com.zzjee.wm.controller;
import java.awt.image.BufferedImage;
import java.io.*;
import java.text.DecimalFormat;
@ -84,12 +85,11 @@ import com.zzjee.wmutil.wmUtil;
import static com.xiaoleilu.hutool.date.DateTime.now;
/**
* @author erzhongxmu
* @version V1.0
* @Title: Controller
* @Description:
* @author erzhongxmu
* @date 2017-08-15 23:18:59
* @version V1.0
*
*/
@Controller
@RequestMapping("/wmOmNoticeHController")
@ -115,6 +115,7 @@ public class WmOmNoticeHController extends BaseController {
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wmOmNoticeHList");
}
/**
*
*
@ -126,7 +127,6 @@ public class WmOmNoticeHController extends BaseController {
}
@RequestMapping(params = "datagriditem")
public void datagriditem(WmOmNoticeIEntity wmOmNoticeitem, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmOmNoticeIEntity.class, dataGrid);
@ -480,6 +480,7 @@ public class WmOmNoticeHController extends BaseController {
}
return new ModelAndView("com/zzjee/wm/print/jianhuorenwuzhuisu");
}
@RequestMapping(params = "showlist")
public ModelAndView showlist(String id, HttpServletRequest request) {
WmOmNoticeHEntity wmOmNoticeHEntity = wmOmNoticeHService.getEntity(WmOmNoticeHEntity.class, id);
@ -644,6 +645,7 @@ public class WmOmNoticeHController extends BaseController {
}
//
/**
* easyui AJAX
*
@ -690,6 +692,7 @@ public class WmOmNoticeHController extends BaseController {
dataGrid.setResults(resultnew);
TagUtil.datagrid(response, dataGrid);
}
@RequestMapping(params = "saveRows")
@ResponseBody
public AjaxJson saveRows(confrowpage page) {
@ -717,6 +720,7 @@ public class WmOmNoticeHController extends BaseController {
}
return j;
}
@RequestMapping(params = "datagridqt")
public void datagridqt(WmOmNoticeHEntity wmOmNoticeH, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmOmNoticeHEntity.class, dataGrid);
@ -748,12 +752,6 @@ public class WmOmNoticeHController extends BaseController {
cq.notEq("omSta", Constants.wm_sta4);
}
cq.like("omNoticeId", "QT%");
// Map<String,Object> map = new HashMap<String,Object>();
// map.put("omSta", "desc");
// cq.setOrder(map);
// Map<String,Object> map2 = new HashMap<String,Object>();
// map2.put("omSta", "asc");
// cq.setOrder(map2);
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc");
cq.setOrder(map1);
@ -762,6 +760,7 @@ public class WmOmNoticeHController extends BaseController {
this.wmOmNoticeHService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
@RequestMapping(params = "datagrid")
public void datagrid(WmOmNoticeHEntity wmOmNoticeH, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmOmNoticeHEntity.class, dataGrid);
@ -962,11 +961,6 @@ public class WmOmNoticeHController extends BaseController {
}
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class, "goodsId", goodsId);
// String date[]=wmImNoticeIEntity.getGoodsCode().split("-");
// wmImNoticeIEntity.setGoodsCode(mvgoods.getGoodsCode());
// wmImNoticeIEntity.setGoodsName(mvgoods.getShpMingCheng());
// String date[]=wmomNoticeIEntity.getGoodsId().split("-");
wmomNoticeIEntity.setGoodsId(mvgoods.getGoodsCode());
wmomNoticeIEntity.setGoodsName(mvgoods.getShpMingCheng());
} catch (Exception e) {
@ -987,7 +981,6 @@ public class WmOmNoticeHController extends BaseController {
wmOmNoticeHService.addMain(wmOmNoticeH, wmomNoticeIListnew);
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", wmOmNoticeH.getOmNoticeId());
try {
@ -1007,7 +1000,6 @@ public class WmOmNoticeHController extends BaseController {
}
/**
*
*
@ -1056,7 +1048,6 @@ public class WmOmNoticeHController extends BaseController {
patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
// 创建第一行
Row row = sheet.createRow((short) 0); //第一行空白
@ -1079,10 +1070,6 @@ public class WmOmNoticeHController extends BaseController {
f2.setFontHeightInPoints((short) 10);
f2.setColor(IndexedColors.BLACK.getIndex());
// Font f3=wb.createFont();
// f3.setFontHeightInPoints((short) 10);
// f3.setColor(IndexedColors.RED.getIndex());
// 设置第一种单元格的样式(用于列名)
cs.setFont(f);
cs.setBorderLeft(CellStyle.BORDER_NONE);
@ -1173,10 +1160,6 @@ public class WmOmNoticeHController extends BaseController {
CellRangeAddress c5 = new CellRangeAddress(4, 4, 5, 8);//第五行客户送货时间
CellRangeAddress c6 = new CellRangeAddress(5, 5, 0, 4);//第五行客户
CellRangeAddress c7 = new CellRangeAddress(5, 5, 5, 8);//第五行客户送货时间
// CellRangeAddress c4 = new CellRangeAddress(4, 4, 0, 1);
// CellRangeAddress c5 = new CellRangeAddress(4, 4, 2, 3);
// CellRangeAddress c6 = new CellRangeAddress(4, 4, 4, 5);
// CellRangeAddress c7 = new CellRangeAddress(4, 4, 6, 6);
sheet.addMergedRegion(c);
sheet.addMergedRegion(c0);
@ -1306,9 +1289,7 @@ public class WmOmNoticeHController extends BaseController {
sheet.setMargin(HSSFSheet.BottomMargin, 1.5);// 页边距(下)
sheet.setMargin(HSSFSheet.LeftMargin, 0.3);// 页边距(左)
sheet.setMargin(HSSFSheet.RightMargin, 0.0);// 页边距(右
// sheet.setDisplayGridlines(true);
//set print grid lines or not
// sheet.setPrintGridlines(true);
sheet.setColumnWidth(0, 5 * 256);
sheet.setColumnWidth(1, 15 * 256);
sheet.setColumnWidth(2, 25 * 256);
@ -1320,9 +1301,7 @@ public class WmOmNoticeHController extends BaseController {
sheet.setColumnWidth(8, 9 * 256);
sheet.setColumnWidth(9, 7 * 256);
sheet.setColumnWidth(10, 3 * 256);
// sheet.setColumnWidth(6, 8 * 256);
// sheet.setColumnWidth(7, 8 * 256);
// sheet.setColumnWidth(8, 8 * 256);
// 创建两种单元格格式
CellStyle cs = wb.createCellStyle();
@ -1424,9 +1403,6 @@ public class WmOmNoticeHController extends BaseController {
int page = 0;
int cerconNo = 1;
// String tsql = "SELECT wq.pro_data,wq.base_unit,wq.rec_deg, mg.goods_code, mg.goods_id,mg.shp_ming_cheng,cast(sum(wq.base_goodscount) as signed) as goods_count,cast(sum(wq.tin_tj) as signed) tin_tj ,cast(sum(wq.tin_zhl) as signed) 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";
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";
@ -1562,7 +1538,6 @@ public class WmOmNoticeHController extends BaseController {
String[] columnNames = {"序号", "商品编码", "商品名称", "生产日期", "品质", "箱数", "拆零数", "毛重/KG", "体积/cm³", "备注"};
try {
if ("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))) {
// String[] columnNames1 = { "序号", "商品编码", "商品名称", "生产日期", "品质","箱数", "拆零数", "毛重/KG","库存","备注" };
String[] columnNames1 = {"序号", "商品编码", "商品名称", "生产日期", "品质", "箱数", "拆零数", "毛重/KG", "库存", "备注"};
columnNames = columnNames1;
@ -1607,7 +1582,6 @@ public class WmOmNoticeHController extends BaseController {
Cell cell4 = rowColumnValue.createCell(3);// 生产日期
cell4.setCellValue(result.get(i).get("pro_data")
.toString());
@ -1667,17 +1641,6 @@ public class WmOmNoticeHController extends BaseController {
}
cell8.setCellStyle(cs5);
Cell cell9 = rowColumnValue.createCell(8);// 体积
// try {
// double tij = Double.parseDouble(result.get(i).get("tin_tj")
// .toString()) * Double.parseDouble(result.get(i).get("goods_count").toString());
//
//
// cell9.setCellValue(tij);
//
// } catch (Exception e) {
// // TODO: handle exception
// }
try {
if ("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))) {
cell9.setCellValue(wmUtil.getstock(result.get(i).get("goods_id").toString()));
@ -1909,17 +1872,12 @@ public class WmOmNoticeHController extends BaseController {
int page = 0;
int cerconNo = 1;
// String tsql = "SELECT wq.pro_data,wq.base_unit,wq.rec_deg, mg.goods_code, mg.goods_id,mg.shp_ming_cheng,cast(sum(wq.base_goodscount) as signed) as goods_count,cast(sum(wq.tin_tj) as signed) tin_tj ,cast(sum(wq.tin_zhl) as signed) 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";
String tsql = "SELECT wq.goods_pro_data as pro_data,wq.base_goodscount,wq.base_unit,mg.gao_dan_pin, mg.goods_code,mg.shp_gui_ge, 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_id 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,wq.base_goodscount, mg.goods_code,mg.shp_gui_ge,mg.gao_dan_pin, 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 "
@ -1984,8 +1942,6 @@ public class WmOmNoticeHController extends BaseController {
Cell cellTitle33 = row3.createCell(6);
cellTitle33.setCellValue("销售日期:");
cellTitle33.setCellStyle(cs1);
MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmOmNoticeH.getCusCode());
Row row4 = sheet.createRow((short) page * 20 + 3); // 第二行标题
//row4.setHeight((short) 700);
@ -1998,9 +1954,6 @@ public class WmOmNoticeHController extends BaseController {
Cell cellTitle43 = row4.createCell(6);
cellTitle43.setCellValue("送货日期:" + wmOmNoticeH.getDelvData() == null ? "" : DateUtils.date2Str(wmOmNoticeH.getDelvData(), DateUtils.date_sdf));
cellTitle43.setCellStyle(cs1);
//MdCusOtherEntity cusOther = systemService.findUniqueByProperty(MdCusOtherEntity.class,"keHuBianMa",wmOmNoticeH.getOcusCode());
Row row5 = sheet.createRow((short) page * 20 + 4); // 第二行标题
//row5.setHeight((short) 700);
Cell cellTitle51 = row5.createCell(0);
@ -2024,66 +1977,6 @@ public class WmOmNoticeHController extends BaseController {
Cell cellTitle71 = row7.createCell(0);
cellTitle71.setCellValue("备注:" + wmOmNoticeH.getOmBeizhu());
cellTitle71.setCellStyle(cs1);
// Cell cellTitle62 = row5.createCell(3);
// cellTitle62.setCellValue("cs1");
// cellTitle62.setCellStyle(cs);
//
// Row row1 = sheet.createRow((short) page*20+1); // 第二行标题
// row1.setHeight((short) 700);
// Cell cellTitle = row1.createCell(0);
// cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"出库单");
// cellTitle.setCellStyle(cs);
//
// Row rowHead1 = sheet.createRow((short) page*20+2); // 头部第一行
// Cell cellHead1 = rowHead1.createCell(0);
// cellHead1.setCellValue("公司地址:"+ResourceUtil.getConfigByName("comaddr") );
// cellHead1.setCellStyle(cs1);
//
// Row rowHead2 = sheet.createRow((short) page*20+3); // 头部第二行
// Cell cellHead2 = rowHead2.createCell(0);
// cellHead2.setCellValue("电话:"+ ResourceUtil.getConfigByName("comtel"));
// cellHead2.setCellStyle(cs1);
//
//
// Row rowHead4 = sheet.createRow((short) page*20+4); // 头部第二行
// Cell cellHead4 = rowHead4.createCell(0);
// cellHead4.setCellValue("出库日期: " +DateUtils.date2Str(wmOmNoticeH.getDelvData(), DateUtils.date_sdf) );
// cellHead4.setCellStyle(cs2);
//
// Cell cellHead42 = rowHead4.createCell(3);
// cellHead42.setCellValue("出库单号: " +wmOmNoticeH.getOmNoticeId());
// cellHead42.setCellStyle(cs2);
//
// Row rowHead5 = sheet.createRow((short) page*20+5); // 头部第二行
// Cell cellHead5 = rowHead5.createCell(0);
// cellHead5.setCellValue("客户单号: " );
// cellHead5.setCellStyle(cs2);
//
// Cell cellHead52 = rowHead5.createCell(3);
// cellHead52.setCellValue("车号: " +wmOmNoticeH.getReCarno());
// cellHead52.setCellStyle(cs2);
//
// Row rowHead6 = sheet.createRow((short) page*20+6); // 头部第二行
// Cell cellHead6 = rowHead6.createCell(0);
// MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmOmNoticeH.getCusCode());
//
// cellHead6.setCellValue("客户名称: " +wmOmNoticeH.getCusCode()+md.getZhongWenQch());
// cellHead6.setCellStyle(cs2);
//
// Cell cellHead62 = rowHead6.createCell(3);
// cellHead62.setCellValue("收货人: "+wmOmNoticeH.getDelvMember()+" 电话:"+wmOmNoticeH.getDelvMobile() );
// cellHead62.setCellStyle(cs2);
//
// Row rowHead7 = sheet.createRow((short) page*20+7); // 头部第二行
// Cell cellHead7 = rowHead7.createCell(0);
// cellHead7.setCellValue("收货地址: " +wmOmNoticeH.getDelvAddr());
// cellHead7.setCellStyle(cs2);
//
// Cell cellHead72 = rowHead7.createCell(5);
// cellHead72.setCellValue("打印时间: "+DateUtils.date2Str(DateUtils.getDate(), DateUtils.datetimeFormat) +" 第"+(page+1)+"页");
// cellHead72.setCellStyle(cs2);
// 合并单元格
CellRangeAddress c = new CellRangeAddress(page * 20 + 0, page * 20 + 0, 0, 9); // 第一行空白
CellRangeAddress c1 = new CellRangeAddress(page * 20 + 1, page * 20 + 1, 0, 2);// 第二行标题
@ -2095,7 +1988,6 @@ public class WmOmNoticeHController extends BaseController {
CellRangeAddress c3 = new CellRangeAddress(page * 20 + 3, page * 20 + 3, 0, 2);// 第四行电话
CellRangeAddress c31 = new CellRangeAddress(page * 20 + 3, page * 20 + 3, 3, 5);// 第四行电话
CellRangeAddress c32 = new CellRangeAddress(page * 20 + 3, page * 20 + 3, 6, 7);// 第四行电话
CellRangeAddress c4 = new CellRangeAddress(page * 20 + 4, page * 20 + 4, 0, 2);// 第5行 到货日期
CellRangeAddress c42 = new CellRangeAddress(page * 20 + 4, page * 20 + 4, 3, 5);// 第5行预约单号
CellRangeAddress c43 = new CellRangeAddress(page * 20 + 4, page * 20 + 4, 6, 9);// 第5行预约单号
@ -2103,10 +1995,6 @@ public class WmOmNoticeHController extends BaseController {
CellRangeAddress c52 = new CellRangeAddress(page * 20 + 5, page * 20 + 5, 3, 5);// 第6行月台
CellRangeAddress c53 = new CellRangeAddress(page * 20 + 5, page * 20 + 5, 6, 9);// 第6行月台
CellRangeAddress c6 = new CellRangeAddress(page * 20 + 6, page * 20 + 6, 0, 9);// 第7行客户名称
// CellRangeAddress c62 = new CellRangeAddress(page*20+6, page*20+6, 3, 5);// 第7行车号
// CellRangeAddress c63 = new CellRangeAddress(page*20+6, page*20+6, 6, 9);// 第7行车号
// CellRangeAddress c7 = new CellRangeAddress(page*20+7, page*20+7, 0, 4);//第7行客户电话
// CellRangeAddress c72 = new CellRangeAddress(page*20+7, page*20+7, 5, 9);//第7行打印时间
sheet.addMergedRegion(c);
sheet.addMergedRegion(c1);
sheet.addMergedRegion(c11);
@ -2122,18 +2010,11 @@ public class WmOmNoticeHController extends BaseController {
sheet.addMergedRegion(c5);
sheet.addMergedRegion(c53);
sheet.addMergedRegion(c6);
// sheet.addMergedRegion(c63);
// sheet.addMergedRegion(c7);
sheet.addMergedRegion(c42);
sheet.addMergedRegion(c52);
// sheet.addMergedRegion(c62);
// sheet.addMergedRegion(c72);
Cell cell73 = row.createCell(10);
cell73.setCellValue("①财务联 ②客户联 ③司机联 ④回单联");
cell73.setCellStyle(cs52);
CellRangeAddress c73 = new CellRangeAddress(page * 20, page * 20 + 16, 10, 10);//第7行打印时间
sheet.addMergedRegion(c73);
@ -2142,10 +2023,6 @@ public class WmOmNoticeHController extends BaseController {
String[] columnNames2 = {"物料", "物料名称", "单价", "批次", "规格", "数量", "重量", "体积", "库区", "备注"};
try {
if ("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))) {
// String[] columnNames1 = { "序号", "商品编码", "商品名称", "生产日期", "品质","箱数", "拆零数", "毛重/KG","库存","备注" };
// String[] columnNames1 = { "序号", "商品编码", "商品名称", "生产日期", "品质","箱数", "拆零数", "毛重/KG","库存","备注" };
//
// columnNames = columnNames1;
columnNames = columnNames2;
}
} catch (Exception e) {
@ -2173,26 +2050,18 @@ public class WmOmNoticeHController extends BaseController {
rowColumnValue.setHeight((short) 250);
Cell cell1 = rowColumnValue.createCell(0);
//cell1.setCellValue(cerconNo);
cell1.setCellValue(result.get(i).get("goods_id").toString());
cell1.setCellStyle(cs51);
Cell cell2 = rowColumnValue.createCell(1);
// cell2.setCellValue(result.get(i).get("goods_id")
// .toString());
cell2.setCellValue(result.get(i).get("shp_ming_cheng").toString());
cell2.setCellStyle(cs5);
Cell cell3 = rowColumnValue.createCell(2);
cell3.setCellValue(result.get(i).get("gao_dan_pin").toString());
// cell3.setCellValue("0");
cell3.setCellStyle(cs5);
try {
Cell cell4 = rowColumnValue.createCell(3);// 生产日期
// cell4.setCellValue(result.get(i).get("pro_data")
// .toString());
cell4.setCellValue("");
cell4.setCellStyle(cs5r);
} catch (Exception e) {
@ -2202,8 +2071,6 @@ public class WmOmNoticeHController extends BaseController {
try {
Cell cell5 = rowColumnValue.createCell(4);// 品质
// cell5.setCellValue("");
cell5.setCellValue(result.get(i).get("shp_gui_ge").toString());
cell5.setCellStyle(cs5);
} catch (Exception e) {
@ -2212,79 +2079,45 @@ public class WmOmNoticeHController extends BaseController {
}
try {
long xs = (long) Math.floor(Double.parseDouble(result.get(i).get("base_goodscount")
.toString()));
sumxs = sumxs + xs;
Cell cell6 = rowColumnValue.createCell(5);// 单位
// cell6.setCellValue(xs);
cell6.setCellValue(xs);
cell6.setCellStyle(cs5);
} 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;
double zhl = Double.parseDouble(result.get(i).get("tin_zhl")
.toString());
sumzl = sumzl + zhl;
Cell cell7 = rowColumnValue.createCell(6);// 数量
// cell7.setCellValue(bs);
cell7.setCellValue(zhl);
cell7.setCellStyle(cs5);
} catch (Exception e) {
// TODO: handle exception
logger.error(ExceptionUtil.getExceptionMessage(e));
}
Cell cell8 = rowColumnValue.createCell(7);// 毛重
try {
// double zhl = Double.parseDouble(result.get(i).get("tin_zhl")
// .toString()) * Double.parseDouble(result.get(i).get("goods_count").toString());
// sumzl = sumzl + zhl;
// cell8.setCellValue(zhl);
cell8.setCellValue("");
} catch (Exception e) {
// TODO: handle exception
logger.error(ExceptionUtil.getExceptionMessage(e));
}
cell8.setCellStyle(cs5);
Cell cell9 = rowColumnValue.createCell(8);// 体积
// try {
// double tij = Double.parseDouble(result.get(i).get("tin_tj")
// .toString()) * Double.parseDouble(result.get(i).get("goods_count").toString());
//
//
// cell9.setCellValue(tij);
//
// } catch (Exception e) {
// // TODO: handle exception
// }
try {
cell9.setCellValue("成品区");
if ("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))) {
// cell9.setCellValue(wmUtil.getstock(result.get(i).get("goods_id").toString()));
}
} catch (Exception e) {
logger.error(ExceptionUtil.getExceptionMessage(e));
}
cell9.setCellStyle(cs5);
Cell cell10 = rowColumnValue.createCell(9);// 备注
cell10.setCellStyle(cs5);
cerconNo++;
}
if (i == size) {
@ -2308,11 +2141,9 @@ public class WmOmNoticeHController extends BaseController {
Cell cell9 = rowColumnValue.createCell(9);//
cell9.setCellValue("");
cell9.setCellStyle(cs5);
// cell6.setCellStyle(cs5);
Cell cell0 = rowColumnValue.createCell(0);// 合计
cell0.setCellValue("合计:");
cell0.setCellStyle(cs5);
// cell0.setCellStyle(cs5);
CellRangeAddress c15 = new CellRangeAddress(cellsNum,
cellsNum, 0, 4);
sheet.addMergedRegion(c15);
@ -2320,10 +2151,7 @@ public class WmOmNoticeHController extends BaseController {
cerconNo++;
}
}
Row rowInfo1 = sheet.createRow((short) 1 + cellsNum); //头部第三行
Cell cellInfo1 = rowInfo1.createCell(0);
cellInfo1.setCellValue("收货人");
@ -2340,7 +2168,6 @@ public class WmOmNoticeHController extends BaseController {
Cell cellInfo5 = rowInfo1.createCell(6);
cellInfo5.setCellValue("意见栏:");
cellInfo5.setCellStyle(cs5);
Row rowInfo2 = sheet.createRow((short) 2 + cellsNum); //头部第三行
Cell cellInfo21 = rowInfo2.createCell(0);
cellInfo21.setCellValue("注意事项");
@ -2348,7 +2175,6 @@ public class WmOmNoticeHController extends BaseController {
Cell cellInfo22 = rowInfo2.createCell(1);
cellInfo22.setCellValue("");
cellInfo22.setCellStyle(cs5);
CellRangeAddress cInfo1 = new CellRangeAddress(1 + cellsNum,
2 + cellsNum, 3, 5);
sheet.addMergedRegion(cInfo1);
@ -2361,8 +2187,6 @@ public class WmOmNoticeHController extends BaseController {
2 + cellsNum, 1, 2);
sheet.addMergedRegion(cInfo3);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cInfo3, sheet, wb);
Row rowInfo3 = sheet.createRow((short) 3 + cellsNum); //头部第三行
rowInfo3.setHeight((short) 1000);
Cell cellInfo31 = rowInfo3.createCell(0);
@ -2372,9 +2196,6 @@ public class WmOmNoticeHController extends BaseController {
CellRangeAddress cInfo4 = new CellRangeAddress(3 + cellsNum,
3 + cellsNum, 0, 9);
sheet.addMergedRegion(cInfo4);
Row rowColumnInfo = sheet.createRow((short) 4 + cellsNum); // 列名
rowColumnInfo.setHeight((short) 250);
rowColumnInfo.createCell(0).setCellValue(
@ -2433,32 +2254,17 @@ public class WmOmNoticeHController extends BaseController {
PrintHeader printHeader = new PrintHeader();
WmOmNoticeHEntity wmOmNoticeH = systemService.getEntity(WmOmNoticeHEntity.class,
id);//获取抬头
printHeader.setHeader01("签收单");
printHeader.setHeader02("司机电话:");
printHeader.setHeader03("车牌号:");
printHeader.setHeader04("司机: ");
printHeader.setHeader05("出库单号: " + wmOmNoticeH.getOmNoticeId());
printHeader.setHeader06("订单号: " + wmOmNoticeH.getImCusCode());
printHeader.setHeader07("快递单号: ");
MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmOmNoticeH.getCusCode());
printHeader.setHeader08("客户名称: " + wmOmNoticeH.getCusCode() + md.getZhongWenQch());
printHeader.setHeader09("收件人: " + wmOmNoticeH.getDelvMember());
printHeader.setHeader10("发货地址: ");
printHeader.setHeader11("送货日期: " + (wmOmNoticeH.getDelvData() == null ? "" : DateUtils.date2Str(wmOmNoticeH.getDelvData(), DateUtils.date_sdf)));
printHeader.setHeader14("收货地址: " + wmOmNoticeH.getDelvAddr());
printHeader.setHeader15("发货方式: " + (StringUtils.isEmpty(wmOmNoticeH.getDelvMethod()) ? "" : wmOmNoticeH.getDelvMethod()));
@ -2467,7 +2273,6 @@ public class WmOmNoticeHController extends BaseController {
printHeader.setHeader18("运输方式: " + (StringUtils.isEmpty(wmOmNoticeH.getDelvMethod()) ? "" : wmOmNoticeH.getDelvMethod()));
printHeader.setHeader19("揽件人电话: ");
printHeader.setHeader20("收件人电话: " + wmOmNoticeH.getDelvMobile());
BaStoreEntity baStoreEntity = systemService.findUniqueByProperty(BaStoreEntity.class, "storeCode", wmOmNoticeH.getStoreCode());
if (baStoreEntity != null) {
printHeader.setHeader21("仓库: " + (StringUtils.isEmpty(baStoreEntity.getStoreName()) ? "" : baStoreEntity.getStoreName()));
@ -2478,7 +2283,9 @@ public class WmOmNoticeHController extends BaseController {
List<PrintItem> listitem = new ArrayList<>();
String tsql = "SELECT wq.goods_pro_data as pro_data,mg.sku,wq.base_goodscount,wq.base_unit,mg.gao_dan_pin, mg.goods_code,mg.shp_gui_ge, 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 "
String tsql = "SELECT wq.goods_pro_data as pro_data,mg.sku,wq.base_goodscount,wq.base_unit,mg.gao_dan_pin, " +
"mg.goods_code,mg.shp_gui_ge, 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.id in (?) "
+ " and wq.goods_id = mg.goods_id group by wq.order_id, mg.goods_code,wq.goods_pro_data";
@ -2488,7 +2295,9 @@ public class WmOmNoticeHController extends BaseController {
int size = result.size();
if (size < 1) {
tsql = "SELECT wq.pro_data,mg.sku,wq.base_unit,wq.base_goodscount,mg.shp_gui_ge,mg.gao_dan_pin, 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 "
tsql = "SELECT wq.pro_data,mg.sku,wq.base_unit,wq.base_goodscount,mg.shp_gui_ge,mg.gao_dan_pin, " +
"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_id group by wq.om_notice_id, mg.goods_code,wq.pro_data";
result = systemService
@ -2512,20 +2321,14 @@ public class WmOmNoticeHController extends BaseController {
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("base_goodscount")
.toString()));
sumxs = sumxs + xs;
printItem.setItem05(Long.toString(xs));
} catch (Exception e) {
// TODO: handle exception
logger.error(ExceptionUtil.getExceptionMessage(e));
}
@ -2535,7 +2338,6 @@ public class WmOmNoticeHController extends BaseController {
printItem.setItem06(result.get(i).get("goods_count")
.toString());
} catch (Exception e) {
// TODO: handle exception
logger.error(ExceptionUtil.getExceptionMessage(e));
}
try {
@ -2546,7 +2348,6 @@ public class WmOmNoticeHController extends BaseController {
printItem.setItem07("");
} catch (Exception e) {
// TODO: handle exception
logger.error(ExceptionUtil.getExceptionMessage(e));
}
try {
@ -2591,38 +2392,22 @@ public class WmOmNoticeHController extends BaseController {
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));
printHeader.setHeader14("备注: " + wmOmNoticeH.getOmBeizhu());
List<PrintItem> listitem = new ArrayList<>();
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 "
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_id group by wq.order_id, mg.goods_code,wq.goods_pro_data";
@ -2632,7 +2417,8 @@ public class WmOmNoticeHController extends BaseController {
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 "
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_id group by wq.om_notice_id, mg.goods_code,wq.pro_data";
result = systemService
@ -2656,42 +2442,32 @@ public class WmOmNoticeHController extends BaseController {
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 {
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
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 {
@ -2699,7 +2475,6 @@ public class WmOmNoticeHController extends BaseController {
.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"))) {
@ -2708,8 +2483,6 @@ public class WmOmNoticeHController extends BaseController {
} catch (Exception e) {
logger.error(ExceptionUtil.getExceptionMessage(e));
}
listitem.add(printItem);
}
@ -2721,7 +2494,6 @@ public class WmOmNoticeHController extends BaseController {
return new ModelAndView("com/zzjee/wm/print/imnoticeckd-print");
}
//打印的接口改造结束在线打印非EXCEL
/**
@ -2756,8 +2528,6 @@ public class WmOmNoticeHController extends BaseController {
}
}
}
wmOmNoticeHService.updateMain(wmOmNoticeH, wmOmNoticeIList, wmOmtmsIList);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
@ -2896,8 +2666,6 @@ public class WmOmNoticeHController extends BaseController {
}
/**
* excel
*
@ -2960,6 +2728,7 @@ public class WmOmNoticeHController extends BaseController {
/**
* excel
*
* @param request
* @param
* @return
@ -3003,11 +2772,6 @@ public class WmOmNoticeHController extends BaseController {
}
}
for (WmOmNoticeImpnewPage pageheader : listheader) {
// List<WmOmNoticeHEntity> wmomh = systemService.findByProperty(WmOmNoticeHEntity.class, "imCusCode", pageheader.getImCusCode());
// if(wmomh!=null&&wmomh.size()>0){
// continue;
// }
List<WmOmNoticeIEntity> wmomNoticeIListnew = new ArrayList<WmOmNoticeIEntity>();
for (WmOmNoticeImpnewPage page : list) {
if (pageheader.getImCusCode().equals(page.getImCusCode())) {
@ -3075,6 +2839,7 @@ public class WmOmNoticeHController extends BaseController {
/**
* excel
*
* @param request
* @param
* @return
@ -3102,7 +2867,6 @@ public class WmOmNoticeHController extends BaseController {
wmNoticeImpPage.setImBeizhu(t.getImBeizhu());//备注
try {
wmNoticeImpPage.setGoodsId(wmUtil.getGoodsId(t.getCusCode(), t.getGoodsId(), t.getGoodsUnit()).get("goodsCode"));
// wmNoticeImpPage.setCusCode(wmUtil.getGoodsId(t.getGoodsId(),t.getGoodsUnit()).get("cusCode"));
} catch (Exception e) {
}
@ -3116,7 +2880,6 @@ public class WmOmNoticeHController extends BaseController {
listheader.add(wmNoticeImpPage);
}
//第二类简单模板
String flag = "Y";
String message = "";
if (!"yes".equals(ResourceUtil.getConfigByName("nocheck"))) {
@ -3132,9 +2895,7 @@ public class WmOmNoticeHController extends BaseController {
j.setMsg(message + "不存在");
return j;
}
}
for (int i = 0; i < listheader.size() - 1; i++) {
for (int k = listheader.size() - 1; k > i; k--) {
if (listheader.get(k).getImCusCode().equals(listheader.get(i).getImCusCode())) {
@ -3143,11 +2904,6 @@ public class WmOmNoticeHController extends BaseController {
}
}
for (WmNoticeImpPage pageheader : listheader) {
// List<WmOmNoticeHEntity> wmomh = systemService.findByProperty(WmOmNoticeHEntity.class, "imCusCode", pageheader.getImCusCode());
// if(wmomh!=null&&wmomh.size()>0){
// continue;
// }
List<WmOmNoticeIEntity> wmomNoticeIListnew = new ArrayList<WmOmNoticeIEntity>();
for (WmNoticeImpPage page : list) {
if (pageheader.getImCusCode().equals(page.getImCusCode())) {
@ -3208,6 +2964,7 @@ public class WmOmNoticeHController extends BaseController {
}
return j;
}
/**
* excel 使
*/
@ -3220,6 +2977,7 @@ public class WmOmNoticeHController extends BaseController {
map.put(NormalExcelConstants.DATA_LIST, new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*/
@ -3232,6 +2990,7 @@ public class WmOmNoticeHController extends BaseController {
map.put(NormalExcelConstants.DATA_LIST, new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
*
*
@ -3255,10 +3014,6 @@ public class WmOmNoticeHController extends BaseController {
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public List<WmOmNoticeHEntity> list() {
@ -3385,7 +3140,6 @@ public class WmOmNoticeHController extends BaseController {
}
@RequestMapping(value = "/list/hehuo", method = RequestMethod.GET) //总订单
@ResponseBody
public ResponseEntity<?> list(@RequestParam(value = "username", required = false) String username,
@ -3393,9 +3147,7 @@ public class WmOmNoticeHController extends BaseController {
@RequestParam(value = "searchstr2", required = false) String searchstr2) {
ResultDO D0 = new ResultDO();
D0.setOK(true);
String hql = "from WmOmNoticeHEntity ";
List<WmOmNoticeHEntity> listWaveToDowns = new ArrayList<>();
List<WmOmNoticeHEntity> listWaveToDownsnew = new ArrayList<>();
if (StringUtil.isNotEmpty(searchstr) && !"null".equals(searchstr)) {
@ -3406,7 +3158,6 @@ public class WmOmNoticeHController extends BaseController {
listWaveToDowns = wmOmNoticeHService.findHql(hql, "复核完成", username);
}
// listWaveToDowns = wmOmNoticeHService.findHql(hql);
System.out.println("/list/hehuolistWaveToDowns===" + listWaveToDowns.toString() + listWaveToDowns.size());
for (WmOmNoticeHEntity t : listWaveToDowns) {
@ -3476,7 +3227,6 @@ public class WmOmNoticeHController extends BaseController {
}
}
tout.setPiMaster(dt2.getGoodsName());
// tout.setPiClass(dt2.getBaseGoodscount()+ "dt2.getBaseUnit()");
tout.setPiClass((int) Math.round(Double.parseDouble(dt2.getBaseGoodscount())) + "份");
listWaveToDownsnew.add(tout);
}
@ -3486,6 +3236,7 @@ public class WmOmNoticeHController extends BaseController {
return new ResponseEntity(D0, HttpStatus.OK);
}
@RequestMapping(value = "/listdetail/hehuo", method = RequestMethod.GET)//
@ResponseBody
public ResponseEntity<?> listdetail(
@ -3503,6 +3254,7 @@ public class WmOmNoticeHController extends BaseController {
return new ResponseEntity(D0, HttpStatus.OK);
}
@RequestMapping(value = "/update/hehuo", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> doupdate(
@ -3521,7 +3273,6 @@ public class WmOmNoticeHController extends BaseController {
}
List<WmOmNoticeIEntity> listWaveToDownsafter = new ArrayList<>();
hql = "from WmOmNoticeIEntity where omNoticeId = ? and omSta <> ? order by chpShuXing";
// listWaveToDowns = wmOmNoticeHService.findHql(hql);
listWaveToDownsafter = wmOmNoticeHService.findHql(hql, listWaveToDowns.get(0).getOmNoticeId(), "复核完成");
if (listWaveToDownsafter == null || (listWaveToDownsafter != null && listWaveToDownsafter.size() == 0)) {
String noticeid = listWaveToDowns.get(0).getOmNoticeId();