From 6753f3e80a337f3640386247dda2e3356c1da089 Mon Sep 17 00:00:00 2001 From: e Date: Tue, 18 Sep 2018 22:10:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=BA=93=E9=80=9A=E7=9F=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wm/controller/WmOmNoticeHController.java | 1712 +++++++++-------- .../com/zzjee/wm/page/wmomnoticeipage.java | 20 + .../webpage/com/zzjee/wm/wmImNoticeIList.jsp | 16 +- .../com/zzjee/wm/wmOmNoticeH-update.jsp | 4 +- .../webpage/com/zzjee/wm/wmOmNoticeIList.jsp | 15 +- .../com/zzjee/wm/wmOmNoticeitemList.jsp | 112 ++ 6 files changed, 1044 insertions(+), 835 deletions(-) create mode 100644 src/main/java/com/zzjee/wm/page/wmomnoticeipage.java create mode 100644 src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeitemList.jsp diff --git a/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java b/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java index f8feb887..c94a012e 100644 --- a/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java +++ b/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java @@ -2,11 +2,8 @@ package com.zzjee.wm.controller; import com.zzjee.api.ResultDO; import com.zzjee.md.entity.*; import com.zzjee.wm.entity.*; -import com.zzjee.wm.page.WmNoticeImpPage; +import com.zzjee.wm.page.*; import com.zzjee.wm.service.WmOmNoticeHServiceI; -import com.zzjee.wm.page.Delrowpage; -import com.zzjee.wm.page.WmOmNoticeHPage; -import com.zzjee.wm.page.confrowpage; import java.util.ArrayList; import java.util.Calendar; @@ -102,12 +99,12 @@ import jdk.nashorn.internal.ir.TryNode; import org.springframework.http.MediaType; import org.springframework.web.util.UriComponentsBuilder; -/** +/** * @Title: Controller * @Description: 出货通知 * @author erzhongxmu * @date 2017-08-15 23:18:59 - * @version V1.0 + * @version V1.0 * */ @Controller @@ -127,84 +124,151 @@ public class WmOmNoticeHController extends BaseController { /** * 出货通知列表 页面跳转 - * + * * @return */ @RequestMapping(params = "list") public ModelAndView list(HttpServletRequest request) { return new ModelAndView("com/zzjee/wm/wmOmNoticeHList"); } - + /** + * 出货通知列表 页面跳转 + * + * @return + */ + @RequestMapping(params = "listitem") + public ModelAndView listitem(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/wmOmNoticeitemList"); + } + + + + @RequestMapping(params = "datagriditem") + public void datagriditem(WmOmNoticeIEntity wmOmNoticeitem,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { + CriteriaQuery cq = new CriteriaQuery(WmOmNoticeIEntity.class, dataGrid); + //查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmNoticeitem); + + try { + // 自定义追加查询条件 + + } catch (Exception e) { + throw new BusinessException(e.getMessage()); + } + + if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ + cq.eq("cusCode", wmUtil.getCusCode()); + + } + + Map map1 = new HashMap(); + map1.put("omNoticeId", "desc"); + cq.setOrder(map1); + cq.add(); + this.wmOmNoticeHService.getDataGridReturn(cq, true); + TagUtil.datagrid(response, dataGrid); + } + + + @RequestMapping(params = "saveOmnotice") + @ResponseBody + public AjaxJson saveOmnotice(wmomnoticeipage page){ + String message = null; + List demos=page.getWmomnoticeirows(); + AjaxJson j = new AjaxJson(); + if(CollectionUtils.isNotEmpty(demos)){ + for(WmOmNoticeIEntity jeecgDemo:demos){ + if (StringUtil.isNotEmpty(jeecgDemo.getId())) { + WmOmNoticeIEntity t =systemService.get(WmOmNoticeIEntity.class, jeecgDemo.getId()); + try { + message = "保存成功"; + t.setBinId(jeecgDemo.getBinId()); + t.setPlanSta(jeecgDemo.getPlanSta()); + t.setGoodsProData(jeecgDemo.getGoodsProData()); + t.setBaseGoodscount(jeecgDemo.getBaseGoodscount()); + t.setGoodsQua(jeecgDemo.getGoodsQua()); + systemService.updateEntitie(t); + systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + return j; + } + + @RequestMapping(params = "listqt") public ModelAndView listqt(HttpServletRequest request) { return new ModelAndView("com/zzjee/wm/wmOmqtNoticeHList"); } - + @RequestMapping(params = "cuslist") public ModelAndView cuslist(HttpServletRequest request) { return new ModelAndView("com/zzjee/wm/cuswmOmNoticeHList"); } - + @RequestMapping(params = "batchconflist") public ModelAndView batchconf_rowedtior(HttpServletRequest request) { return new ModelAndView("com/zzjee/wm/batchconf_rowedtior"); } - @RequestMapping(params = "doPrintpage") - public ModelAndView doPrint(String id,HttpServletRequest request) { - WmOmNoticeHEntity wmOmNoticeHEntity = wmOmNoticeHService.getEntity(WmOmNoticeHEntity.class, id); + @RequestMapping(params = "doPrintpage") + public ModelAndView doPrint(String id,HttpServletRequest request) { + WmOmNoticeHEntity wmOmNoticeHEntity = wmOmNoticeHService.getEntity(WmOmNoticeHEntity.class, id); wmOmNoticeHEntity.setPrintStatus("已打印"); systemService.updateEntitie(wmOmNoticeHEntity); - request.setAttribute("wmOmNoticeHPage", wmOmNoticeHEntity); - request.setAttribute("kprq",DateUtils.date2Str(wmOmNoticeHEntity.getCreateDate(),DateUtils.date_sdf)); - request.setAttribute("comname", ResourceUtil.getConfigByName("comname")); + request.setAttribute("wmOmNoticeHPage", wmOmNoticeHEntity); + request.setAttribute("kprq",DateUtils.date2Str(wmOmNoticeHEntity.getCreateDate(),DateUtils.date_sdf)); + request.setAttribute("comname", ResourceUtil.getConfigByName("comname")); - if(StringUtil.isNotEmpty(wmOmNoticeHEntity.getImCusCode())){ + if(StringUtil.isNotEmpty(wmOmNoticeHEntity.getImCusCode())){ request.setAttribute("noticeid", wmOmNoticeHEntity.getImCusCode()); }else{ request.setAttribute("noticeid", wmOmNoticeHEntity.getOmNoticeId()); } - try{ - MdCusEntity mdcus = systemService.findUniqueByProperty(MdCusEntity.class,"keHuBianMa",wmOmNoticeHEntity.getCusCode()); - MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class,"keHuBianMa",wmOmNoticeHEntity.getOcusCode()); - request.setAttribute("cusname",wmOmNoticeHEntity.getCusCode()+"-"+ mdcus.getZhongWenQch()); + try{ + MdCusEntity mdcus = systemService.findUniqueByProperty(MdCusEntity.class,"keHuBianMa",wmOmNoticeHEntity.getCusCode()); + MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class,"keHuBianMa",wmOmNoticeHEntity.getOcusCode()); + request.setAttribute("cusname",wmOmNoticeHEntity.getCusCode()+"-"+ mdcus.getZhongWenQch()); request.setAttribute("ocusname",wmOmNoticeHEntity.getOcusCode()+"-"+ mdcusother.getZhongWenQch()); }catch (Exception e){ - } - //获取参数 - Object id0 = wmOmNoticeHEntity.getOmNoticeId(); - //=================================================================================== - //查询-产品 - String hql0 = "from WmOmQmIEntity where 1 = 1 AND omNoticeId = ? order by binId"; - try{ - List wmOmQmIEntityList = systemService.findHql(hql0, id0);//获取行项目 - request.setAttribute("wmOmQmIList", wmOmQmIEntityList); - }catch (Exception e){ + } + //获取参数 + Object id0 = wmOmNoticeHEntity.getOmNoticeId(); + //=================================================================================== + //查询-产品 + String hql0 = "from WmOmQmIEntity where 1 = 1 AND omNoticeId = ? order by binId"; + try{ + List wmOmQmIEntityList = systemService.findHql(hql0, id0);//获取行项目 + request.setAttribute("wmOmQmIList", wmOmQmIEntityList); + }catch (Exception e){ - } - return new ModelAndView("com/zzjee/wm/print/jianhuorenwu-print"); - } + } + return new ModelAndView("com/zzjee/wm/print/jianhuorenwu-print"); + } // /** * easyui AJAX请求数据 - * + * * @param request * @param response * @param dataGrid */ - + @RequestMapping(params = "datagridbatchconf") public void datagridbatchconf(WmOmNoticeHEntity wmOmNoticeH,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { CriteriaQuery cq = new CriteriaQuery(WmOmNoticeHEntity.class, dataGrid); //查询条件组装器 org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmNoticeH); - + try { // 自定义追加查询条件 String query_imData_begin = request.getParameter("delvData_begin1"); @@ -213,11 +277,11 @@ public class WmOmNoticeHController extends BaseController { if (StringUtil.isNotEmpty(query_imData_begin)) { cq.ge("delvData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") .parse(query_imData_begin)); - } + } if (StringUtil.isNotEmpty(query_imData_end)) { cq.le("delvData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") .parse(query_imData_end)); - } + } } catch (Exception e) { throw new BusinessException(e.getMessage()); } @@ -236,7 +300,7 @@ public class WmOmNoticeHController extends BaseController { for (WmOmNoticeHEntity WmOmNoticeH : resultold) { WmOmNoticeH.setDelvData(null); resultnew.add(WmOmNoticeH); - + } dataGrid.setResults(resultnew); TagUtil.datagrid(response, dataGrid); @@ -273,7 +337,7 @@ public class WmOmNoticeHController extends BaseController { CriteriaQuery cq = new CriteriaQuery(WmOmNoticeHEntity.class, dataGrid); //查询条件组装器 org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmNoticeH); - + try { // 自定义追加查询条件 String query_imData_begin = request.getParameter("delvData_begin1"); @@ -282,11 +346,11 @@ public class WmOmNoticeHController extends BaseController { if (StringUtil.isNotEmpty(query_imData_begin)) { cq.ge("delvData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") .parse(query_imData_begin)); - } + } if (StringUtil.isNotEmpty(query_imData_end)) { cq.le("delvData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") .parse(query_imData_end)); - } + } } catch (Exception e) { throw new BusinessException(e.getMessage()); } @@ -299,16 +363,16 @@ public class WmOmNoticeHController extends BaseController { cq.notEq("omSta", Constants.wm_sta4); } cq.like("omNoticeId", "QT%"); -// Map map = new HashMap(); -// map.put("omSta", "desc"); -// cq.setOrder(map); -// Map map2 = new HashMap(); -// map2.put("omSta", "asc"); -// cq.setOrder(map2); - Map map1 = new HashMap(); - map1.put("omNoticeId", "desc"); - cq.setOrder(map1); - +// Map map = new HashMap(); +// map.put("omSta", "desc"); +// cq.setOrder(map); +// Map map2 = new HashMap(); +// map2.put("omSta", "asc"); +// cq.setOrder(map2); + Map map1 = new HashMap(); + map1.put("omNoticeId", "desc"); + cq.setOrder(map1); + cq.add(); this.wmOmNoticeHService.getDataGridReturn(cq, true); TagUtil.datagrid(response, dataGrid); @@ -318,7 +382,7 @@ public class WmOmNoticeHController extends BaseController { CriteriaQuery cq = new CriteriaQuery(WmOmNoticeHEntity.class, dataGrid); //查询条件组装器 org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmNoticeH); - + try { // 自定义追加查询条件 String query_imData_begin = request.getParameter("delvData_begin1"); @@ -327,11 +391,11 @@ public class WmOmNoticeHController extends BaseController { if (StringUtil.isNotEmpty(query_imData_begin)) { cq.ge("delvData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") .parse(query_imData_begin)); - } + } if (StringUtil.isNotEmpty(query_imData_end)) { cq.le("delvData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") .parse(query_imData_end)); - } + } } catch (Exception e) { throw new BusinessException(e.getMessage()); } @@ -343,22 +407,22 @@ public class WmOmNoticeHController extends BaseController { if (wmOmNoticeH.getOmSta() == null) { cq.notEq("omSta", Constants.wm_sta4); } -// Map map = new HashMap(); -// map.put("omSta", "desc"); -// cq.setOrder(map); -// Map map2 = new HashMap(); -// map2.put("omSta", "asc"); -// cq.setOrder(map2); - Map map1 = new HashMap(); - map1.put("omNoticeId", "desc"); - cq.setOrder(map1); +// Map map = new HashMap(); +// map.put("omSta", "desc"); +// cq.setOrder(map); +// Map map2 = new HashMap(); +// map2.put("omSta", "asc"); +// cq.setOrder(map2); + Map map1 = new HashMap(); + map1.put("omNoticeId", "desc"); + cq.setOrder(map1); // cq.like("omNoticeId", "CK%"); cq.add(); this.wmOmNoticeHService.getDataGridReturn(cq, true); TagUtil.datagrid(response, dataGrid); } - + @RequestMapping(params = "docheck") @ResponseBody public AjaxJson docheck(HttpServletRequest request) { @@ -366,31 +430,31 @@ public class WmOmNoticeHController extends BaseController { AjaxJson j = new AjaxJson(); message = "成功"; try { - + String goods = null; String goodsid = request.getParameter("goodscode").toString(); - if(!StringUtil.isEmpty(goodsid)){ - if(goodsid.endsWith("l")){ - goods = goodsid.substring(0,goodsid.length() - 1); - System.out.print("11111111I"+goods); - }else{ - goods = goodsid; - System.out.print("22222"+goods); + if(!StringUtil.isEmpty(goodsid)){ + if(goodsid.endsWith("l")){ + goods = goodsid.substring(0,goodsid.length() - 1); + System.out.print("11111111I"+goods); + }else{ + goods = goodsid; + System.out.print("22222"+goods); - } - - } - String sql = "select sum(base_goodscount) as qua from wv_stock t where t.goods_id = '" - + goods + "'"; - Map binMap = systemService.findOneForJdbc(sql); - if(binMap!=null){ - if(Long.parseLong(binMap.get("qua").toString())< Long.parseLong(request.getParameter("goodsqua").toString())){ - j.setSuccess(false); - message = request.getParameter("goodscode").toString() +"库存为"+binMap.get("qua").toString(); - j.setMsg(message); - return j; - } } + + } + String sql = "select sum(base_goodscount) as qua from wv_stock t where t.goods_id = '" + + goods + "'"; + Map binMap = systemService.findOneForJdbc(sql); + if(binMap!=null){ + if(Long.parseLong(binMap.get("qua").toString())< Long.parseLong(request.getParameter("goodsqua").toString())){ + j.setSuccess(false); + message = request.getParameter("goodscode").toString() +"库存为"+binMap.get("qua").toString(); + j.setMsg(message); + return j; + } + } } catch (Exception e) { j.setSuccess(false); message = request.getParameter("goodscode").toString() +"库存为0"; @@ -400,11 +464,11 @@ public class WmOmNoticeHController extends BaseController { j.setMsg(message); return j; } - - + + /** * 删除出货通知 - * + * * @return */ @RequestMapping(params = "doDel") @@ -418,12 +482,12 @@ public class WmOmNoticeHController extends BaseController { Object id0 = wmOmNoticeH.getOmNoticeId(); //=================================================================================== //1.查询出数据库的明细数据-出货商品明细 - String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND oM_NOTICE_ID = ? "; - List wmOmNoticeIOldList = systemService.findHql(hql0,id0); - for (WmOmNoticeIEntity wmOmNoticeIEntity : wmOmNoticeIOldList) { - wmOmNoticeIEntity.setOmSta("已删除"); - wmOmNoticeIEntity.setPlanSta("Y"); - systemService.saveOrUpdate(wmOmNoticeIEntity); + String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND oM_NOTICE_ID = ? "; + List wmOmNoticeIOldList = systemService.findHql(hql0,id0); + for (WmOmNoticeIEntity wmOmNoticeIEntity : wmOmNoticeIOldList) { + wmOmNoticeIEntity.setOmSta("已删除"); + wmOmNoticeIEntity.setPlanSta("Y"); + systemService.saveOrUpdate(wmOmNoticeIEntity); } wmOmNoticeHService.saveOrUpdate(wmOmNoticeH); systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); @@ -438,10 +502,10 @@ public class WmOmNoticeHController extends BaseController { /** * 批量删除出货通知 - * + * * @return */ - @RequestMapping(params = "doBatchDel") + @RequestMapping(params = "doBatchDel") @ResponseBody public AjaxJson doBatchDel(String ids,HttpServletRequest request){ AjaxJson j = new AjaxJson(); @@ -449,7 +513,7 @@ public class WmOmNoticeHController extends BaseController { try{ for(String id:ids.split(",")){ WmOmNoticeHEntity wmOmNoticeH = systemService.getEntity(WmOmNoticeHEntity.class, - id + id ); wmOmNoticeHService.delMain(wmOmNoticeH); systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); @@ -465,7 +529,7 @@ public class WmOmNoticeHController extends BaseController { /** * 添加出货通知 - * + * * @param request * @return */ @@ -484,18 +548,18 @@ public class WmOmNoticeHController extends BaseController { + DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd) + "-" + StringUtil.leftPad( - ((Long) countMap.get("count")).intValue(), 4, - '0'); + ((Long) countMap.get("count")).intValue(), 4, + '0'); }else { noticeid = "CK" + DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd) + "-" + StringUtil.leftPad( - ((Long) countMap.get("count")).intValue(), 4, - '0'); + ((Long) countMap.get("count")).intValue(), 4, + '0'); } - - + + WmPlatIoEntity wmPlatIo = new WmPlatIoEntity(); wmPlatIo.setCarno(wmOmNoticeH.getReCarno()); wmPlatIo.setDocId(noticeid); @@ -507,8 +571,8 @@ public class WmOmNoticeHController extends BaseController { systemService.save(wmPlatIo); wmOmNoticeH.setOmNoticeId(noticeid); wmOmNoticeH.setOmSta(Constants.wm_sta1); - - + + if(wmOmNoticeH.getCusCode()==null){ if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ wmOmNoticeH.setCusCode(wmUtil.getCusCode()); @@ -520,7 +584,7 @@ public class WmOmNoticeHController extends BaseController { for (WmOmNoticeIEntity wmomNoticeIEntity : wmOmNoticeIList) { if(!StringUtil.isEmpty(wmomNoticeIEntity.getGoodsId())){ try { - String date[]=wmomNoticeIEntity.getGoodsId().split("-"); + String date[]=wmomNoticeIEntity.getGoodsId().split("-"); wmomNoticeIEntity.setGoodsId(date[0]); wmomNoticeIEntity.setGoodsName(date[1]); } catch (Exception e) { @@ -529,18 +593,14 @@ public class WmOmNoticeHController extends BaseController { wmomNoticeIListnew.add(wmomNoticeIEntity); } - + } if(StringUtil.isNotEmpty( wmOmNoticeH.getOcusCode())){ String datecuso[]= wmOmNoticeH.getOcusCode().split("-"); MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class, "keHuBianMa", datecuso[0]); if (mdcusother != null) { - wmOmNoticeH.setOcusCode(datecuso[0]); wmOmNoticeH.setOcusName(mdcusother.getZhongWenQch()); - }else{ - wmOmNoticeH.setOcusName(wmOmNoticeH.getOcusCode()); - } } @@ -553,7 +613,7 @@ public class WmOmNoticeHController extends BaseController { } catch (Exception e) { // TODO: handle exception } - + systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); }catch(Exception e){ @@ -570,84 +630,84 @@ public class WmOmNoticeHController extends BaseController { String message = null; AjaxJson j = new AjaxJson(); message = "读取成功"; - String masterbill[] = {"XKN_TEST","XKN_TEST"}; - for(int m =0;m paramMap = new HashMap(); - paramMap.put("lastUpdateTime", formDate); - paramMap.put("pi_class", billclass[i]); - paramMap.put("master", master); + try { + if (StringUtil.isEmpty(formDate)) { + formDate = "2011-01-01"; + } + String master = masterbill[m]; + String billclass[] = {"出货单", "采购退货单", "拨出单", "其它出库单", "其它采购出库单"}; + for (int i = 0; i < billclass.length; i++) { + Map paramMap = new HashMap(); + paramMap.put("lastUpdateTime", formDate); + paramMap.put("pi_class", billclass[i]); + paramMap.put("master", master); sdresult billResult = wmIntUtil.getsdBillin(paramMap); - for (int s = 0; s < billResult.getData().size(); s++) { - String imcuscode = billResult.getData().get(s).getPiInoutno(); - if (StringUtil.isNotEmpty(imcuscode)) { - WmOmNoticeHEntity wmimh = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "imCusCode", imcuscode); - if (wmimh == null) { - WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity(); - List wmomNoticeIListnew = new ArrayList(); - Map countMap = systemService - .findOneForJdbc("SELECT count(*)+1 as count FROM wm_om_notice_h t where TO_DAYS(t.create_date) = TO_DAYS(NOW());"); - String noticeid = null; + for (int s = 0; s < billResult.getData().size(); s++) { + String imcuscode = billResult.getData().get(s).getPiInoutno(); + if (StringUtil.isNotEmpty(imcuscode)) { + WmOmNoticeHEntity wmimh = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "imCusCode", imcuscode); + if (wmimh == null) { + WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity(); + List wmomNoticeIListnew = new ArrayList(); + Map countMap = systemService + .findOneForJdbc("SELECT count(*)+1 as count FROM wm_om_notice_h t where TO_DAYS(t.create_date) = TO_DAYS(NOW());"); + String noticeid = null; - if (countMap != null) { - noticeid = "CK" - + DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd) - + "-" - + StringUtil.leftPad( - ((Long) countMap.get("count")).intValue(), 4, - '0'); - } - wmOmNoticeH.setOmPlatNo(Integer.toString(billResult.getData().get(s).getPiId())); - wmOmNoticeH.setOrderTypeCode("11"); - wmOmNoticeH.setCusCode(ResourceUtil.getConfigByName("uas.cuscode")); - wmOmNoticeH.setOmNoticeId(noticeid); - wmOmNoticeH.setPiClass(billResult.getData().get(s).getPiClass()); - wmOmNoticeH.setPiMaster(master); - wmOmNoticeH.setOcusCode(billResult.getData().get(s).getPiCardcode()); - MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class, "keHuBianMa", wmOmNoticeH.getOcusCode()); - if (mdcusother != null) { - wmOmNoticeH.setOcusName(mdcusother.getZhongWenQch()); - } - wmOmNoticeH.setImCusCode(imcuscode); - for (int k = 0; k < billResult.getData().get(s).getDetail().size(); k++) { - WmOmNoticeIEntity wmi = new WmOmNoticeIEntity(); - wmi.setGoodsId(billResult.getData().get(s).getDetail().get(k).getPdProdcode()); - MvGoodsEntity mvgoods = systemService.findUniqueByProperty( - MvGoodsEntity.class, "goodsCode", wmi.getGoodsId()); - if (mvgoods != null) { - wmi.setGoodsName(mvgoods.getGoodsName()); - wmi.setGoodsUnit(mvgoods.getShlDanWei()); - } - wmi.setGoodsProData( DateUtils.str2Date(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate(),DateUtils.date_sdf)); - wmi.setGoodsQua(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPurcoutqty())); + if (countMap != null) { + noticeid = "CK" + + DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd) + + "-" + + StringUtil.leftPad( + ((Long) countMap.get("count")).intValue(), 4, + '0'); + } + wmOmNoticeH.setOmPlatNo(Integer.toString(billResult.getData().get(s).getPiId())); + wmOmNoticeH.setOrderTypeCode("11"); + wmOmNoticeH.setCusCode(ResourceUtil.getConfigByName("uas.cuscode")); + wmOmNoticeH.setOmNoticeId(noticeid); + wmOmNoticeH.setPiClass(billResult.getData().get(s).getPiClass()); + wmOmNoticeH.setPiMaster(master); + wmOmNoticeH.setOcusCode(billResult.getData().get(s).getPiCardcode()); + MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class, "keHuBianMa", wmOmNoticeH.getOcusCode()); + if (mdcusother != null) { + wmOmNoticeH.setOcusName(mdcusother.getZhongWenQch()); + } + wmOmNoticeH.setImCusCode(imcuscode); + for (int k = 0; k < billResult.getData().get(s).getDetail().size(); k++) { + WmOmNoticeIEntity wmi = new WmOmNoticeIEntity(); + wmi.setGoodsId(billResult.getData().get(s).getDetail().get(k).getPdProdcode()); + MvGoodsEntity mvgoods = systemService.findUniqueByProperty( + MvGoodsEntity.class, "goodsCode", wmi.getGoodsId()); + if (mvgoods != null) { + wmi.setGoodsName(mvgoods.getGoodsName()); + wmi.setGoodsUnit(mvgoods.getShlDanWei()); + } + wmi.setGoodsProData( DateUtils.str2Date(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate(),DateUtils.date_sdf)); + wmi.setGoodsQua(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPurcoutqty())); // wmi.setGoodsPrdData(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate2User()); - wmi.setOtherId(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPdno())); + wmi.setOtherId(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPdno())); - wmomNoticeIListnew.add(wmi); - } - wmOmNoticeHService.addMain(wmOmNoticeH, wmomNoticeIListnew); - } - } else { - continue; - } - } - } - systemService.addLog(message, Globals.Log_Type_UPDATE, - Globals.Log_Leavel_INFO); - } catch (Exception e) { - e.printStackTrace(); - message = "读取失败"; - throw new BusinessException(e.getMessage()); - } - } + wmomNoticeIListnew.add(wmi); + } + wmOmNoticeHService.addMain(wmOmNoticeH, wmomNoticeIListnew); + } + } else { + continue; + } + } + } + systemService.addLog(message, Globals.Log_Type_UPDATE, + Globals.Log_Leavel_INFO); + } catch (Exception e) { + e.printStackTrace(); + message = "读取失败"; + throw new BusinessException(e.getMessage()); + } + } j.setMsg(message); return j; } @@ -668,10 +728,10 @@ public class WmOmNoticeHController extends BaseController { //=================================================================================== //查询-产品 String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND omNoticeId = ? "; - try{ - List wmOmNoticeIEntityList = systemService - .findHql(hql0, id0);//获取行项目 - List> list = new ArrayList>(); + try{ + List wmOmNoticeIEntityList = systemService + .findHql(hql0, id0);//获取行项目 + List> list = new ArrayList>(); for(WmOmNoticeIEntity t:wmOmNoticeIEntityList){ Map map = new HashMap(); // [{"pd_pdno":1,"pd_outqty":"100","pi_class":"出货单","pi_id":50765226,"pi_inoutno":"JRS180800008"}] @@ -684,8 +744,8 @@ public class WmOmNoticeHController extends BaseController { } String jsonStr = JSONArray.fromObject(list).toString(); JSONArray ja = JSONArray.fromObject(jsonStr); - resResult resResult = wmIntUtil.postBill(ja.toString(),wmOmNoticeHEntity.getPiMaster()); - j.setMsg(resResult.getDetailedMessage()); + resResult resResult = wmIntUtil.postBill(ja.toString(),wmOmNoticeHEntity.getPiMaster()); + j.setMsg(resResult.getDetailedMessage()); }catch (Exception e){ } @@ -699,7 +759,7 @@ public class WmOmNoticeHController extends BaseController { /** * 打印出货通知 - * + * * @return */ @@ -707,279 +767,279 @@ public class WmOmNoticeHController extends BaseController { @RequestMapping(params = "doPrint") @ResponseBody public void downReceiveExcel(WmOmNoticeHEntity wmOmNoticeH,HttpServletRequest request,HttpServletResponse response){ - OutputStream fileOut = null; - BufferedImage bufferImg = null; - String codedFileName = null; - wmOmNoticeH = systemService.getEntity(WmOmNoticeHEntity.class, - wmOmNoticeH.getId());//获取抬头 - String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND omNoticeId = ? "; + OutputStream fileOut = null; + BufferedImage bufferImg = null; + String codedFileName = null; + wmOmNoticeH = systemService.getEntity(WmOmNoticeHEntity.class, + wmOmNoticeH.getId());//获取抬头 + String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND omNoticeId = ? "; List wmOmNoticeIEntityList = systemService .findHql(hql0, wmOmNoticeH.getOmNoticeId());//获取行项目 - //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray - try { - StringBuffer sber=new StringBuffer(); - - - - ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); - bufferImg = ImageIO.read(BarcodeUtil.generateToStream(wmOmNoticeH.getOmNoticeId())); - // 进行转码,使其支持中文文件名 - codedFileName = java.net.URLEncoder.encode("中文", "UTF-8"); - response.setHeader("content-disposition", "attachment;filename="+wmOmNoticeH.getOmNoticeId()+".xls"); - ImageIO.write(bufferImg, "jpg", byteArrayOut); - - HSSFWorkbook wb = new HSSFWorkbook(); - HSSFSheet sheet = wb.createSheet("出货通知"); - sheet.setColumnWidth(0, 5 * 256); - sheet.setColumnWidth(1, 10 * 256); - sheet.setColumnWidth(2, 10 * 200); - sheet.setColumnWidth(3, 8 * 256); - sheet.setColumnWidth(4, 8 * 256); - sheet.setColumnWidth(5, 8 * 256); - sheet.setColumnWidth(6, 8 * 256); - sheet.setColumnWidth(7, 8 * 256); - sheet.setColumnWidth(8, 25 * 256); - //画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) - HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); - //anchor主要用于设置图片的属性 - HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0,(short)7, 1, (short)9, 3); - anchor.setAnchorType(3); - //插入图片 - patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG)); - - + //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray + try { + StringBuffer sber=new StringBuffer(); - // 创建第一行 - Row row = sheet.createRow((short) 0); //第一行空白 - - - // 创建两种单元格格式 - CellStyle cs = wb.createCellStyle(); - CellStyle cs2 = wb.createCellStyle(); - CellStyle cs3 = wb.createCellStyle(); - CellStyle cs4 = wb.createCellStyle(); - // 创建两种字体 - Font f = wb.createFont(); - Font f2 = wb.createFont(); - - // 创建第一种字体样式(用于列名) - f.setFontHeightInPoints((short) 16); - f.setColor(IndexedColors.BLACK.getIndex()); - f.setBoldweight(Font.BOLDWEIGHT_BOLD); - - // 创建第二种字体样式(用于值) - f2.setFontHeightInPoints((short) 10); - f2.setColor(IndexedColors.BLACK.getIndex()); - + + ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); + bufferImg = ImageIO.read(BarcodeUtil.generateToStream(wmOmNoticeH.getOmNoticeId())); + // 进行转码,使其支持中文文件名 + codedFileName = java.net.URLEncoder.encode("中文", "UTF-8"); + response.setHeader("content-disposition", "attachment;filename="+wmOmNoticeH.getOmNoticeId()+".xls"); + ImageIO.write(bufferImg, "jpg", byteArrayOut); + + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet sheet = wb.createSheet("出货通知"); + sheet.setColumnWidth(0, 5 * 256); + sheet.setColumnWidth(1, 10 * 256); + sheet.setColumnWidth(2, 10 * 200); + sheet.setColumnWidth(3, 8 * 256); + sheet.setColumnWidth(4, 8 * 256); + sheet.setColumnWidth(5, 8 * 256); + sheet.setColumnWidth(6, 8 * 256); + sheet.setColumnWidth(7, 8 * 256); + sheet.setColumnWidth(8, 25 * 256); + //画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) + HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); + //anchor主要用于设置图片的属性 + HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0,(short)7, 1, (short)9, 3); + anchor.setAnchorType(3); + //插入图片 + patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG)); + + + + + // 创建第一行 + Row row = sheet.createRow((short) 0); //第一行空白 + + + // 创建两种单元格格式 + CellStyle cs = wb.createCellStyle(); + CellStyle cs2 = wb.createCellStyle(); + CellStyle cs3 = wb.createCellStyle(); + CellStyle cs4 = wb.createCellStyle(); + // 创建两种字体 + Font f = wb.createFont(); + Font f2 = wb.createFont(); + + // 创建第一种字体样式(用于列名) + f.setFontHeightInPoints((short) 16); + f.setColor(IndexedColors.BLACK.getIndex()); + f.setBoldweight(Font.BOLDWEIGHT_BOLD); + + // 创建第二种字体样式(用于值) + 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); - cs.setBorderRight(CellStyle.BORDER_NONE); - cs.setBorderTop(CellStyle.BORDER_NONE); - cs.setBorderBottom(CellStyle.BORDER_NONE); - cs.setAlignment(HSSFCellStyle.ALIGN_CENTER); - // 设置第二种单元格的样式(用于值) - cs2.setFont(f2); - cs2.setBorderLeft(CellStyle.BORDER_NONE); - cs2.setBorderRight(CellStyle.BORDER_NONE); - cs2.setBorderTop(CellStyle.BORDER_NONE); - cs2.setBorderBottom(CellStyle.BORDER_NONE); - cs2.setWrapText(true); + + // 设置第一种单元格的样式(用于列名) + cs.setFont(f); + cs.setBorderLeft(CellStyle.BORDER_NONE); + cs.setBorderRight(CellStyle.BORDER_NONE); + cs.setBorderTop(CellStyle.BORDER_NONE); + cs.setBorderBottom(CellStyle.BORDER_NONE); + cs.setAlignment(HSSFCellStyle.ALIGN_CENTER); + // 设置第二种单元格的样式(用于值) + cs2.setFont(f2); + cs2.setBorderLeft(CellStyle.BORDER_NONE); + cs2.setBorderRight(CellStyle.BORDER_NONE); + cs2.setBorderTop(CellStyle.BORDER_NONE); + cs2.setBorderBottom(CellStyle.BORDER_NONE); + cs2.setWrapText(true); // cs2.setAlignment(CellStyle.BORDER_NONE); - - - cs3.setFont(f2); - cs3.setBorderLeft(CellStyle.BORDER_MEDIUM); - cs3.setBorderRight(CellStyle.BORDER_MEDIUM); - cs3.setBorderTop(CellStyle.BORDER_MEDIUM); - cs3.setBorderBottom(CellStyle.BORDER_MEDIUM); + + + cs3.setFont(f2); + cs3.setBorderLeft(CellStyle.BORDER_MEDIUM); + cs3.setBorderRight(CellStyle.BORDER_MEDIUM); + cs3.setBorderTop(CellStyle.BORDER_MEDIUM); + cs3.setBorderBottom(CellStyle.BORDER_MEDIUM); // cs3.setAlignment(CellStyle.BORDER_HAIR); - cs4.setFont(f2); - cs4.setBorderTop(CellStyle.BORDER_MEDIUM); - cs4.setBorderBottom(CellStyle.BORDER_MEDIUM); - Row row1 = sheet.createRow((short) 1); //第二行标题 - row1.setHeight((short)700); - Cell cellTitle = row1.createCell(0); - cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"出货通知"); - cellTitle.setCellStyle(cs); - - - Row rowHead1=sheet.createRow((short) 2); //头部第一行 - Cell cellHead11 = rowHead1.createCell(0); - cellHead11.setCellValue("通知单号:"+wmOmNoticeH.getOmNoticeId()); - cellHead11.setCellStyle(cs2); - - - Row rowHead2=sheet.createRow((short) 3); //头部第二行 - Cell cellHead21 = rowHead2.createCell(0); - try{ - MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmOmNoticeH.getCusCode()); - if(md!=null){ - cellHead21.setCellValue("客户:"+wmOmNoticeH.getCusCode()+"/"+md.getZhongWenQch()); - }else{ - cellHead21.setCellValue("客户:"+wmOmNoticeH.getCusCode()); - } - }finally{ - - } - - cellHead21.setCellStyle(cs2); - - Cell cellHead23 = rowHead2.createCell(5); - cellHead23.setCellValue(" 计划出货时间:"+wmOmNoticeH.getDelvData()); - cellHead23.setCellStyle(cs2); - - - Row rowHead3=sheet.createRow((short) 4); //头部第三行 - Cell cellHead31 = rowHead3.createCell(0); - cellHead31.setCellValue("司机:"+wmOmNoticeH.getReMember()+" 司机电话:"+wmOmNoticeH.getReMobile()); - cellHead31.setCellStyle(cs2); - + cs4.setFont(f2); + cs4.setBorderTop(CellStyle.BORDER_MEDIUM); + cs4.setBorderBottom(CellStyle.BORDER_MEDIUM); + Row row1 = sheet.createRow((short) 1); //第二行标题 + row1.setHeight((short)700); + Cell cellTitle = row1.createCell(0); + cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"出货通知"); + cellTitle.setCellStyle(cs); - Cell cellHead35 = rowHead3.createCell(5); - cellHead35.setCellValue("车号:"+wmOmNoticeH.getReCarno()+" 备注:"+wmOmNoticeH.getOmBeizhu()); - cellHead35.setCellStyle(cs2); - - Row rowHead4=sheet.createRow((short) 5); //头部第三行 - Cell cellHead41 = rowHead4.createCell(0); - cellHead41.setCellValue("收货人:"+wmOmNoticeH.getDelvMember()+" 电话:"+wmOmNoticeH.getDelvMobile()); - cellHead31.setCellStyle(cs2); - - Cell cellHead45 = rowHead4.createCell(5); - cellHead45.setCellValue("收货地址:"+wmOmNoticeH.getDelvAddr()); - cellHead45.setCellStyle(cs2); - - //合并单元格 - CellRangeAddress c = new CellRangeAddress(0, 0, 0, 8); //第一行空白 - CellRangeAddress c0 = new CellRangeAddress(1, 1, 0, 8);//第二行标题 - CellRangeAddress c1 = new CellRangeAddress(2, 2, 0, 8);//第三行通知单号 - CellRangeAddress c2 = new CellRangeAddress(3, 3, 0, 4);//第四行客户 - CellRangeAddress c3 = new CellRangeAddress(3, 3, 5, 8);//第四行客户送货时间 - CellRangeAddress c4 = new CellRangeAddress(4, 4, 0, 4);//第五行客户 - CellRangeAddress c5 = new CellRangeAddress(4, 4, 5, 8);//第五行客户送货时间 - CellRangeAddress c6 = new CellRangeAddress(5, 5, 0, 4);//第五行客户 - CellRangeAddress c7 = new CellRangeAddress(5, 5, 5, 8);//第五行客户送货时间 + Row rowHead1=sheet.createRow((short) 2); //头部第一行 + Cell cellHead11 = rowHead1.createCell(0); + cellHead11.setCellValue("通知单号:"+wmOmNoticeH.getOmNoticeId()); + cellHead11.setCellStyle(cs2); + + + Row rowHead2=sheet.createRow((short) 3); //头部第二行 + Cell cellHead21 = rowHead2.createCell(0); + try{ + MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmOmNoticeH.getCusCode()); + if(md!=null){ + cellHead21.setCellValue("客户:"+wmOmNoticeH.getCusCode()+"/"+md.getZhongWenQch()); + }else{ + cellHead21.setCellValue("客户:"+wmOmNoticeH.getCusCode()); + } + }finally{ + + } + + cellHead21.setCellStyle(cs2); + + Cell cellHead23 = rowHead2.createCell(5); + cellHead23.setCellValue(" 计划出货时间:"+wmOmNoticeH.getDelvData()); + cellHead23.setCellStyle(cs2); + + + Row rowHead3=sheet.createRow((short) 4); //头部第三行 + Cell cellHead31 = rowHead3.createCell(0); + cellHead31.setCellValue("司机:"+wmOmNoticeH.getReMember()+" 司机电话:"+wmOmNoticeH.getReMobile()); + cellHead31.setCellStyle(cs2); + + + Cell cellHead35 = rowHead3.createCell(5); + cellHead35.setCellValue("车号:"+wmOmNoticeH.getReCarno()+" 备注:"+wmOmNoticeH.getOmBeizhu()); + cellHead35.setCellStyle(cs2); + + Row rowHead4=sheet.createRow((short) 5); //头部第三行 + Cell cellHead41 = rowHead4.createCell(0); + cellHead41.setCellValue("收货人:"+wmOmNoticeH.getDelvMember()+" 电话:"+wmOmNoticeH.getDelvMobile()); + cellHead31.setCellStyle(cs2); + + + Cell cellHead45 = rowHead4.createCell(5); + cellHead45.setCellValue("收货地址:"+wmOmNoticeH.getDelvAddr()); + cellHead45.setCellStyle(cs2); + + //合并单元格 + CellRangeAddress c = new CellRangeAddress(0, 0, 0, 8); //第一行空白 + CellRangeAddress c0 = new CellRangeAddress(1, 1, 0, 8);//第二行标题 + CellRangeAddress c1 = new CellRangeAddress(2, 2, 0, 8);//第三行通知单号 + CellRangeAddress c2 = new CellRangeAddress(3, 3, 0, 4);//第四行客户 + CellRangeAddress c3 = new CellRangeAddress(3, 3, 5, 8);//第四行客户送货时间 + CellRangeAddress c4 = new CellRangeAddress(4, 4, 0, 4);//第五行客户 + 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); - sheet.addMergedRegion(c1); - sheet.addMergedRegion(c2); - sheet.addMergedRegion(c3); - sheet.addMergedRegion(c4); - sheet.addMergedRegion(c5); - sheet.addMergedRegion(c6); - sheet.addMergedRegion(c7); - - Row rowColumnName=sheet.createRow((short) 6); //列名 - String [] columnNames={"序号","商品编码","商品描述","数量","单位","生产日期","实收数量"," ","条码"}; - - for(int i=0;i wmOmNoticeIEntityList = systemService.findHql(hql0,id0); + String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND oM_NOTICE_ID = ? "; + try{ + List wmOmNoticeIEntityList = systemService.findHql(hql0,id0); req.setAttribute("wmOmNoticeIList", wmOmNoticeIEntityList); }catch(Exception e){ logger.info(e.getMessage()); @@ -1554,67 +1614,67 @@ public class WmOmNoticeHController extends BaseController { return new ModelAndView("com/zzjee/wm/wmOmNoticeIList"); } - /** - * 导出excel - * - * @param request - * @param response - */ - @RequestMapping(params = "exportXls") - public String exportXls(WmOmNoticeHEntity wmOmNoticeH,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) { - CriteriaQuery cq = new CriteriaQuery(WmOmNoticeHEntity.class, dataGrid); - //查询条件组装器 - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmNoticeH); - try{ - - TSUser user = ResourceUtil.getSessionUserName(); - String roles = ""; - if (user != null) { - List rUsers = systemService.findByProperty(TSRoleUser.class, "TSUser.id", user.getId()); - for (TSRoleUser ru : rUsers) { - TSRole role = ru.getTSRole(); - roles += role.getRoleCode() + ","; - } - if (roles.length() > 0) { - roles = roles.substring(0, roles.length() - 1); - } - if(roles.equals("CUS")){ - cq.eq("cusCode", user.getUserName()); - - } - } - - //自定义追加查询条件 - }catch (Exception e) { - throw new BusinessException(e.getMessage()); - } - cq.add(); - List list=this.wmOmNoticeHService.getListByCriteriaQuery(cq, false); - List pageList=new ArrayList(); - if(list!=null&&list.size()>0){ - for(WmOmNoticeHEntity entity:list){ - try{ - WmOmNoticeHPage page=new WmOmNoticeHPage(); - MyBeanUtils.copyBeanNotNull2Bean(entity,page); - Object id0 = entity.getOmNoticeId(); - String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND oM_NOTICE_ID = ? "; - List wmOmNoticeIEntityList = systemService.findHql(hql0,id0); - page.setWmOmNoticeIList(wmOmNoticeIEntityList); - pageList.add(page); - }catch(Exception e){ - logger.info(e.getMessage()); - } - } - } - map.put(NormalExcelConstants.FILE_NAME,"出货通知"); - map.put(NormalExcelConstants.CLASS,WmOmNoticeHPage.class); - map.put(NormalExcelConstants.PARAMS,new ExportParams("出货通知列表", "导出人:admin", - "导出信息")); - map.put(NormalExcelConstants.DATA_LIST,pageList); - return NormalExcelConstants.JEECG_EXCEL_VIEW; + /** + * 导出excel + * + * @param request + * @param response + */ + @RequestMapping(params = "exportXls") + public String exportXls(WmOmNoticeHEntity wmOmNoticeH,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) { + CriteriaQuery cq = new CriteriaQuery(WmOmNoticeHEntity.class, dataGrid); + //查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmNoticeH); + try{ + + TSUser user = ResourceUtil.getSessionUserName(); + String roles = ""; + if (user != null) { + List rUsers = systemService.findByProperty(TSRoleUser.class, "TSUser.id", user.getId()); + for (TSRoleUser ru : rUsers) { + TSRole role = ru.getTSRole(); + roles += role.getRoleCode() + ","; + } + if (roles.length() > 0) { + roles = roles.substring(0, roles.length() - 1); + } + if(roles.equals("CUS")){ + cq.eq("cusCode", user.getUserName()); + + } + } + + //自定义追加查询条件 + }catch (Exception e) { + throw new BusinessException(e.getMessage()); + } + cq.add(); + List list=this.wmOmNoticeHService.getListByCriteriaQuery(cq, false); + List pageList=new ArrayList(); + if(list!=null&&list.size()>0){ + for(WmOmNoticeHEntity entity:list){ + try{ + WmOmNoticeHPage page=new WmOmNoticeHPage(); + MyBeanUtils.copyBeanNotNull2Bean(entity,page); + Object id0 = entity.getOmNoticeId(); + String hql0 = "from WmOmNoticeIEntity where 1 = 1 AND oM_NOTICE_ID = ? "; + List wmOmNoticeIEntityList = systemService.findHql(hql0,id0); + page.setWmOmNoticeIList(wmOmNoticeIEntityList); + pageList.add(page); + }catch(Exception e){ + logger.info(e.getMessage()); + } + } + } + map.put(NormalExcelConstants.FILE_NAME,"出货通知"); + map.put(NormalExcelConstants.CLASS,WmOmNoticeHPage.class); + map.put(NormalExcelConstants.PARAMS,new ExportParams("出货通知列表", "导出人:admin", + "导出信息")); + map.put(NormalExcelConstants.DATA_LIST,pageList); + return NormalExcelConstants.JEECG_EXCEL_VIEW; } - /** + /** * 通过excel导入数据 * @param request * @param @@ -1715,40 +1775,40 @@ public class WmOmNoticeHController extends BaseController { e.printStackTrace(); } } - } - return j; + } + return j; } /** - * 导出excel 使模板 - */ + * 导出excel 使模板 + */ @RequestMapping(params = "exportXlsByT") public String exportXlsByT(ModelMap map) { map.put(NormalExcelConstants.FILE_NAME,"出货通知"); map.put(NormalExcelConstants.CLASS,WmNoticeImpPage.class); map.put(NormalExcelConstants.PARAMS,new ExportParams("出货通知", "导出人:"+ ResourceUtil.getSessionUserName().getRealName(), - "导出信息")); + "导出信息")); map.put(NormalExcelConstants.DATA_LIST,new ArrayList()); return NormalExcelConstants.JEECG_EXCEL_VIEW; } /** - * 导入功能跳转 - * - * @return - */ + * 导入功能跳转 + * + * @return + */ @RequestMapping(params = "upload") public ModelAndView upload(HttpServletRequest req) { req.setAttribute("controller_name", "wmOmNoticeHController"); return new ModelAndView("common/upload/pub_excel_upload"); } - - @RequestMapping(method = RequestMethod.GET) + + @RequestMapping(method = RequestMethod.GET) @ResponseBody public List list() { List listWmOmNoticeHs=wmOmNoticeHService.getList(WmOmNoticeHEntity.class); return listWmOmNoticeHs; } - + @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseBody public ResponseEntity get(@PathVariable("id") String id) { @@ -1758,8 +1818,8 @@ public class WmOmNoticeHController extends BaseController { } return new ResponseEntity(task, HttpStatus.OK); } - - @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) + + @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public ResponseEntity create(@RequestBody WmOmNoticeHPage wmOmNoticeHPage, UriComponentsBuilder uriBuilder) { //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. @@ -1771,20 +1831,20 @@ public class WmOmNoticeHController extends BaseController { //保存 List wmOmNoticeIList = wmOmNoticeHPage.getWmOmNoticeIList(); - + WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity(); try{ MyBeanUtils.copyBeanNotNull2Bean(wmOmNoticeH,wmOmNoticeHPage); }catch(Exception e){ - logger.info(e.getMessage()); - } + logger.info(e.getMessage()); + } wmOmNoticeHService.addMain(wmOmNoticeH, wmOmNoticeIList); D0.setOK(true); //按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象. return new ResponseEntity(D0, HttpStatus.OK); } - + @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity update(@RequestBody WmOmNoticeHPage wmOmNoticeHPage) { //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. @@ -1795,13 +1855,13 @@ public class WmOmNoticeHController extends BaseController { //保存 List wmOmNoticeIList = wmOmNoticeHPage.getWmOmNoticeIList(); - + WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity(); try{ MyBeanUtils.copyBeanNotNull2Bean(wmOmNoticeH,wmOmNoticeHPage); }catch(Exception e){ - logger.info(e.getMessage()); - } + logger.info(e.getMessage()); + } wmOmNoticeHService.updateMain(wmOmNoticeH, wmOmNoticeIList); //按Restful约定,返回204状态码, 无内容. 也可以返回200状态码. diff --git a/src/main/java/com/zzjee/wm/page/wmomnoticeipage.java b/src/main/java/com/zzjee/wm/page/wmomnoticeipage.java new file mode 100644 index 00000000..81e2c442 --- /dev/null +++ b/src/main/java/com/zzjee/wm/page/wmomnoticeipage.java @@ -0,0 +1,20 @@ +package com.zzjee.wm.page; + +import com.zzjee.wm.entity.WmOmNoticeIEntity; + +import java.util.List; + + +/** + */ +public class wmomnoticeipage { + private List wmomnoticeirows; + + public List getWmomnoticeirows() { + return wmomnoticeirows; + } + + public void setWmomnoticeirows(List wmomnoticeirows) { + this.wmomnoticeirows = wmomnoticeirows; + } +} \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeIList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeIList.jsp index 341fabf6..b5d9fbea 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeIList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeIList.jsp @@ -1467,11 +1467,19 @@ - -<%-- --%> + + + + <%-- --%> - + + + + + <%-- + <%--dictCondition="${wmImNoticeHPage.wherecon}" dictTable="mv_goods" dictField="goods_code" dictText="goods_name" defaultVal="${poVal.goodsCode }" hasLabel="false" title="商品编码"> --%> <%-- diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-update.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-update.jsp index 4f31a44a..45ec6822 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-update.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-update.jsp @@ -172,8 +172,8 @@ 三方客户:
- +
diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeIList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeIList.jsp index 190da301..ba7c57d3 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeIList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeIList.jsp @@ -1728,14 +1728,23 @@ -<%-- --%> + + + + <%-- +wmOmNoticeIList[${stuts.index }].goodsId --%> + + + <%-- <%-- type="text" class="form-control" style="width:120px;" value="${poVal.goodsId }"> --%> - + <%-- + <%--dictTable="mv_goods" dictField="goods_code" dictText="goods_name" defaultVal="${poVal.goodsId }" hasLabel="false" title="商品编码">--%> diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeitemList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeitemList.jsp new file mode 100644 index 00000000..f2f1ea0b --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeitemList.jsp @@ -0,0 +1,112 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +<%-- --%> + + + +<%-- --%> + +
+
+ \ No newline at end of file