diff --git a/src/main/java/com/zzjee/md/entity/MdGoodsEntity.java b/src/main/java/com/zzjee/md/entity/MdGoodsEntity.java index 43c0d43e..4ef003be 100644 --- a/src/main/java/com/zzjee/md/entity/MdGoodsEntity.java +++ b/src/main/java/com/zzjee/md/entity/MdGoodsEntity.java @@ -40,9 +40,9 @@ public class MdGoodsEntity implements java.io.Serializable { /**所属公司*/ private java.lang.String sysCompanyCode; /**所属客户*/ - @Excel(name="所属客户") + @Excel(name="供应商编码") private java.lang.String suoShuKeHu; - @Excel(name="客户名称") + @Excel(name="供应商名称") private java.lang.String cusName; @Excel(name="配送点") private java.lang.String peisongdian; diff --git a/src/main/java/com/zzjee/md/entity/MvGoodsEntity.java b/src/main/java/com/zzjee/md/entity/MvGoodsEntity.java index 6847bdb1..c473beaa 100644 --- a/src/main/java/com/zzjee/md/entity/MvGoodsEntity.java +++ b/src/main/java/com/zzjee/md/entity/MvGoodsEntity.java @@ -81,6 +81,19 @@ public class MvGoodsEntity implements java.io.Serializable { private java.lang.String gaoZhXiang; @Excel(name="产品属性") private java.lang.String chpShuXing; + @Excel(name="价格") + private java.lang.String gaoDanPin; + + @Column(name ="gao_dan_pin",nullable=true,length=100) + public String getGaoDanPin() { + return gaoDanPin; + } + + public MvGoodsEntity setGaoDanPin(String gaoDanPin) { + this.gaoDanPin = gaoDanPin; + return this; + } + @Id @GeneratedValue(generator = "paymentableGenerator") @GenericGenerator(name = "paymentableGenerator", strategy = "uuid") diff --git a/src/main/java/com/zzjee/wm/controller/WmImNoticeHController.java b/src/main/java/com/zzjee/wm/controller/WmImNoticeHController.java index a0053851..4465710e 100644 --- a/src/main/java/com/zzjee/wm/controller/WmImNoticeHController.java +++ b/src/main/java/com/zzjee/wm/controller/WmImNoticeHController.java @@ -1,6 +1,7 @@ package com.zzjee.wm.controller; import com.zzjee.api.ResultDO; +import com.zzjee.ba.entity.BaStoreEntity; import com.zzjee.md.entity.MdCusEntity; import com.zzjee.md.entity.MdGoodsEntity; import com.zzjee.md.entity.MdSupEntity; @@ -47,6 +48,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; import javax.imageio.ImageIO; +import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.ConstraintViolation; @@ -71,1910 +73,1450 @@ import java.util.*; @Controller @RequestMapping("/wmImNoticeHController") public class WmImNoticeHController extends BaseController { - /** - * Logger for this class - */ - private static final Logger logger = Logger - .getLogger(WmImNoticeHController.class); + /** + * Logger for this class + */ + private static final Logger logger = Logger + .getLogger(WmImNoticeHController.class); - @Autowired - private WmImNoticeHServiceI wmImNoticeHService; - @Autowired - private SystemService systemService; - @Autowired - private Validator validator; + @Autowired + private WmImNoticeHServiceI wmImNoticeHService; + @Autowired + private SystemService systemService; + @Autowired + private Validator validator; - /** - * 进货通知抬头列表 页面跳转 - * - * @return - */ - @RequestMapping(params = "list") - public ModelAndView list(HttpServletRequest request) { - return new ModelAndView("com/zzjee/wm/wmImNoticeHList"); - } - @RequestMapping(params = "listqt") - public ModelAndView listqt(HttpServletRequest request) { - return new ModelAndView("com/zzjee/wm/wmImqtNoticeHList"); - } - @RequestMapping(params = "tlist") - public ModelAndView tlist(HttpServletRequest request) { - return new ModelAndView("com/zzjee/wm/wmImtNoticeHList"); - } - @RequestMapping(params = "yklist") - public ModelAndView yklist(HttpServletRequest request) { - return new ModelAndView("com/zzjee/wm/wmImykNoticeHList"); - } - @RequestMapping(params = "cuslist") - public ModelAndView cuslist(HttpServletRequest request) { - return new ModelAndView("com/zzjee/wm/cuswmImNoticeHList"); - } - @RequestMapping(params = "custlist") - public ModelAndView custlist(HttpServletRequest request) { - return new ModelAndView("com/zzjee/wm/cuswmImtNoticeHList"); - } - @RequestMapping(params = "batchlist")//收货验收 - public ModelAndView batchlist(HttpServletRequest request) { - return new ModelAndView("com/zzjee/wm/wminqmbatchList"); - } - @RequestMapping(params = "tbatchlist")//退货验收 - public ModelAndView tbatchlist(HttpServletRequest request) { - return new ModelAndView("com/zzjee/wm/wmintqmbatchList"); - } + /** + * 进货通知抬头列表 页面跳转 + * + * @return + */ + @RequestMapping(params = "list") + public ModelAndView list(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/wmImNoticeHList"); + } + @RequestMapping(params = "listqt") + public ModelAndView listqt(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/wmImqtNoticeHList"); + } + @RequestMapping(params = "tlist") + public ModelAndView tlist(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/wmImtNoticeHList"); + } + @RequestMapping(params = "yklist") + public ModelAndView yklist(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/wmImykNoticeHList"); + } + @RequestMapping(params = "cuslist") + public ModelAndView cuslist(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/cuswmImNoticeHList"); + } + @RequestMapping(params = "custlist") + public ModelAndView custlist(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/cuswmImtNoticeHList"); + } + @RequestMapping(params = "batchlist")//收货验收 + public ModelAndView batchlist(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/wminqmbatchList"); + } + @RequestMapping(params = "tbatchlist")//退货验收 + public ModelAndView tbatchlist(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/wmintqmbatchList"); + } - @RequestMapping(params = "doPrintpage") - public ModelAndView doPrint(String id,HttpServletRequest request) { - WmImNoticeHEntity wmImNoticeHEntity = wmImNoticeHService.getEntity(WmImNoticeHEntity.class, id); - request.setAttribute("wmImNoticeHPage", wmImNoticeHEntity); - request.setAttribute("kprq", DateUtils.date2Str(wmImNoticeHEntity.getCreateDate(), DateUtils.date_sdf)); - request.setAttribute("comname", ResourceUtil.getConfigByName("comname")); + @RequestMapping(params = "doPrintpage") + public ModelAndView doPrint(String id,HttpServletRequest request) { + WmImNoticeHEntity wmImNoticeHEntity = wmImNoticeHService.getEntity(WmImNoticeHEntity.class, id); + request.setAttribute("wmImNoticeHPage", wmImNoticeHEntity); + request.setAttribute("kprq", DateUtils.date2Str(wmImNoticeHEntity.getCreateDate(), DateUtils.date_sdf)); + request.setAttribute("comname", ResourceUtil.getConfigByName("comname")); - if(StringUtil.isNotEmpty(wmImNoticeHEntity.getImCusCode())){ - request.setAttribute("noticeid", wmImNoticeHEntity.getImCusCode()); - }else{ - request.setAttribute("noticeid", wmImNoticeHEntity.getNoticeId()); - } + if(StringUtil.isNotEmpty(wmImNoticeHEntity.getImCusCode())){ + request.setAttribute("noticeid", wmImNoticeHEntity.getImCusCode()); + }else{ + request.setAttribute("noticeid", wmImNoticeHEntity.getNoticeId()); + } - try{ - MdSupEntity mdSupEntity = systemService.findUniqueByProperty(MdSupEntity.class,"gysBianMa",wmImNoticeHEntity.getSupCode()); - MdCusEntity mdcus = systemService.findUniqueByProperty(MdCusEntity.class,"keHuBianMa",wmImNoticeHEntity.getCusCode()); + BaStoreEntity baStoreEntity = systemService.findUniqueByProperty(BaStoreEntity.class,"storeCode",wmImNoticeHEntity.getStoreCode()); + if (baStoreEntity != null && StringUtils.isNotEmpty(baStoreEntity.getStoreCode())) { + request.setAttribute("storeName",baStoreEntity.getStoreName()); + }else { + request.setAttribute("storeName",""); + } - request.setAttribute("cusname",wmImNoticeHEntity.getCusCode()+"-"+mdcus.getZhongWenQch()); - request.setAttribute("supname",mdSupEntity.getGysBianMa()+"-"+ mdSupEntity.getZhongWenQch()); + try{ + MdSupEntity mdSupEntity = systemService.findUniqueByProperty(MdSupEntity.class,"gysBianMa",wmImNoticeHEntity.getSupCode()); + MdCusEntity mdcus = systemService.findUniqueByProperty(MdCusEntity.class,"keHuBianMa",wmImNoticeHEntity.getCusCode()); - }catch (Exception e){ + request.setAttribute("cusname",wmImNoticeHEntity.getCusCode()+"-"+mdcus.getZhongWenQch()); - } - //获取参数 - Object id0 = wmImNoticeHEntity.getNoticeId(); - //=================================================================================== - //查询-产品 + request.setAttribute("supname",mdSupEntity.getGysBianMa()+"-"+ mdSupEntity.getZhongWenQch()); + + }catch (Exception e){ + + } + //获取参数 + Object id0 = wmImNoticeHEntity.getNoticeId(); + //=================================================================================== + //查询-产品 // Double tomsum = 0.00; // Double noticesum = 0.00; - DecimalFormat dfsum=new DecimalFormat(".##"); + DecimalFormat dfsum=new DecimalFormat(".##"); - List wmImNoticeIEntitynewList = new ArrayList<>(); - String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; - try { - List wmImNoticeIEntityList = systemService - .findHql(hql0, id0); - BigDecimal totalCount = BigDecimal.ZERO; - for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIEntityList) { - if (StringUtil.isEmpty(wmImNoticeIEntity.getBinPlan())){ - String hqlup = "from WmToUpGoodsEntity where 1 = 1 AND goodsId = ? order by createDate desc"; - try { - WmToUpGoodsEntity wmToUpGoodsEntity = (WmToUpGoodsEntity)systemService.findHql(hqlup,wmImNoticeIEntity.getGoodsCode()).get(0); - wmImNoticeIEntity.setBinPlan(wmToUpGoodsEntity.getKuWeiBianMa()); - }catch (Exception e){ + List wmImNoticeIEntitynewList = new ArrayList<>(); + String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; + try { + List wmImNoticeIEntityList = systemService + .findHql(hql0, id0); + BigDecimal totalCount = BigDecimal.ZERO; + for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIEntityList) { + if (StringUtil.isEmpty(wmImNoticeIEntity.getBinPlan())){ + String hqlup = "from WmToUpGoodsEntity where 1 = 1 AND goodsId = ? order by createDate desc"; + try { + WmToUpGoodsEntity wmToUpGoodsEntity = (WmToUpGoodsEntity)systemService.findHql(hqlup,wmImNoticeIEntity.getGoodsCode()).get(0); + wmImNoticeIEntity.setBinPlan(wmToUpGoodsEntity.getKuWeiBianMa()); + }catch (Exception e){ - } - } - try{ - MvGoodsEntity mvgoods = systemService.findUniqueByProperty( - MvGoodsEntity.class, "goodsCode", wmImNoticeIEntity.getGoodsCode()); - if (mvgoods != null) { - wmImNoticeIEntity.setBzhiQi(mvgoods.getBzhiQi()); - wmImNoticeIEntity.setShpGuiGe(mvgoods.getShpGuiGe()); - wmImNoticeIEntity.setGoodsName(mvgoods.getShpMingCheng()); - } - }catch (Exception e){ + } + } + try{ + MvGoodsEntity mvgoods = systemService.findUniqueByProperty( + MvGoodsEntity.class, "goodsCode", wmImNoticeIEntity.getGoodsCode()); + if (mvgoods != null) { + wmImNoticeIEntity.setBzhiQi(mvgoods.getBzhiQi()); + wmImNoticeIEntity.setShpGuiGe(mvgoods.getShpGuiGe()); + wmImNoticeIEntity.setGoodsName(mvgoods.getShpMingCheng()); + } + }catch (Exception e){ - } + } - try{ + try{ - wmImNoticeIEntity.setGoodsFvol(dfsum.format(Double.parseDouble(wmImNoticeIEntity.getGoodsFvol()))); - }catch (Exception e){ + wmImNoticeIEntity.setGoodsFvol(dfsum.format(Double.parseDouble(wmImNoticeIEntity.getGoodsFvol()))); + }catch (Exception e){ - } + } - try{ - wmImNoticeIEntity.setGoodsWeight(dfsum.format(Double.parseDouble(wmImNoticeIEntity.getGoodsWeight()))); + try{ + wmImNoticeIEntity.setGoodsWeight(dfsum.format(Double.parseDouble(wmImNoticeIEntity.getGoodsWeight()))); - }catch (Exception e){ + }catch (Exception e){ - } - totalCount = totalCount.add(new BigDecimal(wmImNoticeIEntity.getGoodsCount())); + } + totalCount = totalCount.add(new BigDecimal(wmImNoticeIEntity.getGoodsCount())); - wmImNoticeIEntitynewList.add(wmImNoticeIEntity); - } - request.setAttribute("wmImNoticeIList", wmImNoticeIEntitynewList); - request.setAttribute("totalCount",totalCount); - }catch (Exception e){ + wmImNoticeIEntitynewList.add(wmImNoticeIEntity); + } + request.setAttribute("wmImNoticeIList", wmImNoticeIEntitynewList); + request.setAttribute("totalCount",totalCount); + }catch (Exception e){ - } - return new ModelAndView("com/zzjee/wm/print/imnotice-print"); - } + } + return new ModelAndView("com/zzjee/wm/print/imnotice-print"); + } - @RequestMapping(params = "datagridbatch") - public void datagridbatch(WmImNoticeIEntity wmImNoticeI, + @RequestMapping(params = "datagridbatch") + public void datagridbatch(WmImNoticeIEntity wmImNoticeI, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { - CriteriaQuery cq = new CriteriaQuery(WmImNoticeIEntity.class, dataGrid); - // 查询条件组装器 - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, - wmImNoticeI); - if ("on".equals(ResourceUtil.getConfigByName("comgroup"))){ - cq.like("sysOrgCode", wmUtil.getCurrentDepartCode()+"%"); - } - cq.eq("binPre", "N"); - cq.add(); - this.wmImNoticeHService.getDataGridReturn(cq, true); - List resultnew = new ArrayList(); - List resultold = dataGrid.getResults(); - for (WmImNoticeIEntity wmImNoticeIEntity : resultold) { - try { - if (Double.parseDouble(wmImNoticeIEntity.getGoodsCount()) > Double.parseDouble(wmImNoticeIEntity.getGoodsQmCount())) { - wmImNoticeIEntity.setGoodsWqmCount(Double.toString(Double.parseDouble(wmImNoticeIEntity.getGoodsCount()) - Double.parseDouble(wmImNoticeIEntity.getGoodsQmCount()))); - resultnew.add(wmImNoticeIEntity); - } - } catch (Exception e) { - wmImNoticeIEntity.setGoodsQmCount("0"); - resultnew.add(wmImNoticeIEntity); - } + CriteriaQuery cq = new CriteriaQuery(WmImNoticeIEntity.class, dataGrid); + // 查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, + wmImNoticeI); + if ("on".equals(ResourceUtil.getConfigByName("comgroup"))){ + cq.like("sysOrgCode", wmUtil.getCurrentDepartCode()+"%"); + } + cq.eq("binPre", "N"); + cq.add(); + this.wmImNoticeHService.getDataGridReturn(cq, true); + List resultnew = new ArrayList(); + List resultold = dataGrid.getResults(); + for (WmImNoticeIEntity wmImNoticeIEntity : resultold) { + try { + if (Double.parseDouble(wmImNoticeIEntity.getGoodsCount()) > Double.parseDouble(wmImNoticeIEntity.getGoodsQmCount())) { + wmImNoticeIEntity.setGoodsWqmCount(Double.toString(Double.parseDouble(wmImNoticeIEntity.getGoodsCount()) - Double.parseDouble(wmImNoticeIEntity.getGoodsQmCount()))); + resultnew.add(wmImNoticeIEntity); + } + } catch (Exception e) { + wmImNoticeIEntity.setGoodsQmCount("0"); + resultnew.add(wmImNoticeIEntity); + } - } - dataGrid.setResults(resultnew); - dataGrid.setTotal(resultnew.size()); - TagUtil.datagrid(response, dataGrid); + } + dataGrid.setResults(resultnew); + dataGrid.setTotal(resultnew.size()); + TagUtil.datagrid(response, dataGrid); - } - @RequestMapping(params = "datagridtbatch") - public void datagridtbatch(WmImNoticeIEntity wmImNoticeI, + } + @RequestMapping(params = "datagridtbatch") + public void datagridtbatch(WmImNoticeIEntity wmImNoticeI, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { - CriteriaQuery cq = new CriteriaQuery(WmImNoticeIEntity.class, dataGrid); - // 查询条件组装器 - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, - wmImNoticeI); - cq.eq("binPre", "N"); - cq.like("imNoticeId", "TH%"); - cq.add(); - this.wmImNoticeHService.getDataGridReturn(cq, true); - List resultnew = new ArrayList(); - List resultold = dataGrid.getResults(); - for (WmImNoticeIEntity wmImNoticeIEntity : resultold) { - if (Double.parseDouble(wmImNoticeIEntity.getGoodsCount()) > Double.parseDouble(wmImNoticeIEntity.getGoodsQmCount())) { - wmImNoticeIEntity.setGoodsWqmCount(Double.toString(Double.parseDouble(wmImNoticeIEntity.getGoodsCount()) - Double.parseDouble(wmImNoticeIEntity.getGoodsQmCount()))); + CriteriaQuery cq = new CriteriaQuery(WmImNoticeIEntity.class, dataGrid); + // 查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, + wmImNoticeI); + cq.eq("binPre", "N"); + cq.like("imNoticeId", "TH%"); + cq.add(); + this.wmImNoticeHService.getDataGridReturn(cq, true); + List resultnew = new ArrayList(); + List resultold = dataGrid.getResults(); + for (WmImNoticeIEntity wmImNoticeIEntity : resultold) { + if (Double.parseDouble(wmImNoticeIEntity.getGoodsCount()) > Double.parseDouble(wmImNoticeIEntity.getGoodsQmCount())) { + wmImNoticeIEntity.setGoodsWqmCount(Double.toString(Double.parseDouble(wmImNoticeIEntity.getGoodsCount()) - Double.parseDouble(wmImNoticeIEntity.getGoodsQmCount()))); - resultnew.add(wmImNoticeIEntity); - } - } - dataGrid.setResults(resultnew); - dataGrid.setTotal(resultnew.size()); - TagUtil.datagrid(response, dataGrid); + resultnew.add(wmImNoticeIEntity); + } + } + dataGrid.setResults(resultnew); + dataGrid.setTotal(resultnew.size()); + TagUtil.datagrid(response, dataGrid); - } - /** - * easyui AJAX请求数据 - * - * @param request - * @param response - * @param dataGrid - * @param - */ + } + /** + * easyui AJAX请求数据 + * + * @param request + * @param response + * @param dataGrid + * @param + */ - @RequestMapping(params = "datagrid") - public void datagrid(WmImNoticeHEntity wmImNoticeH, + @RequestMapping(params = "datagrid") + public void datagrid(WmImNoticeHEntity wmImNoticeH, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { - CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); - // 查询条件组装器 - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, - wmImNoticeH); - try { - // 自定义追加查询条件 - String query_imData_begin = request.getParameter("imData_begin1"); - String query_imData_end = request.getParameter("imData_end2"); + CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); + // 查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, + wmImNoticeH); + try { + // 自定义追加查询条件 + String query_imData_begin = request.getParameter("imData_begin1"); + String query_imData_end = request.getParameter("imData_end2"); - if (StringUtil.isNotEmpty(query_imData_begin)) { - cq.ge("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") - .parse(query_imData_begin)); - } - if (StringUtil.isNotEmpty(query_imData_end)) { - cq.le("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") - .parse(query_imData_end)); - } - } catch (Exception e) { - throw new BusinessException(e.getMessage()); - } - if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ - cq.eq("cusCode", wmUtil.getCusCode()); - } - Map map1 = new HashMap(); - map1.put("createDate", "desc"); - cq.setOrder(map1); - cq.add(); + if (StringUtil.isNotEmpty(query_imData_begin)) { + cq.ge("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") + .parse(query_imData_begin)); + } + if (StringUtil.isNotEmpty(query_imData_end)) { + cq.le("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") + .parse(query_imData_end)); + } + } catch (Exception e) { + throw new BusinessException(e.getMessage()); + } + if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ + cq.eq("cusCode", wmUtil.getCusCode()); + } + Map map1 = new HashMap(); + map1.put("createDate", "desc"); + cq.setOrder(map1); + cq.add(); - this.wmImNoticeHService.getDataGridReturn(cq, true); - TagUtil.datagrid(response, dataGrid); - } + this.wmImNoticeHService.getDataGridReturn(cq, true); + TagUtil.datagrid(response, dataGrid); + } - /** - * easyui AJAX请求数据 - * - * @param request - * @param response - * @param dataGrid - * @param - */ + /** + * easyui AJAX请求数据 + * + * @param request + * @param response + * @param dataGrid + * @param + */ - @RequestMapping(params = "datagridqt") - public void datagridqt(WmImNoticeHEntity wmImNoticeH, + @RequestMapping(params = "datagridqt") + public void datagridqt(WmImNoticeHEntity wmImNoticeH, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { - CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); - // 查询条件组装器 - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, - wmImNoticeH); - try { - // 自定义追加查询条件 - String query_imData_begin = request.getParameter("imData_begin1"); - String query_imData_end = request.getParameter("imData_end2"); + CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); + // 查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, + wmImNoticeH); + try { + // 自定义追加查询条件 + String query_imData_begin = request.getParameter("imData_begin1"); + String query_imData_end = request.getParameter("imData_end2"); - if (StringUtil.isNotEmpty(query_imData_begin)) { - cq.ge("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") - .parse(query_imData_begin)); - } - if (StringUtil.isNotEmpty(query_imData_end)) { - cq.le("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") - .parse(query_imData_end)); - } - } catch (Exception e) { - throw new BusinessException(e.getMessage()); - } + if (StringUtil.isNotEmpty(query_imData_begin)) { + cq.ge("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") + .parse(query_imData_begin)); + } + if (StringUtil.isNotEmpty(query_imData_end)) { + cq.le("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") + .parse(query_imData_end)); + } + } catch (Exception e) { + throw new BusinessException(e.getMessage()); + } // if (wmImNoticeH.getImSta() == null) { // cq.eq("imSta", Constants.wm_sta1); // } - if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ - cq.eq("cusCode", wmUtil.getCusCode()); - } + if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ + cq.eq("cusCode", wmUtil.getCusCode()); + } // Map map = new HashMap(); // map.put("imSta", "desc"); // cq.setOrder(map); - Map map1 = new HashMap(); - map1.put("createDate", "desc"); - cq.setOrder(map1); - cq.eq("orderTypeCode", "09"); - cq.add(); + Map map1 = new HashMap(); + map1.put("createDate", "desc"); + cq.setOrder(map1); + cq.eq("orderTypeCode", "09"); + cq.add(); - this.wmImNoticeHService.getDataGridReturn(cq, true); - TagUtil.datagrid(response, dataGrid); - } + this.wmImNoticeHService.getDataGridReturn(cq, true); + TagUtil.datagrid(response, dataGrid); + } - //退货 - @RequestMapping(params = "datagridt") - public void datagridt(WmImNoticeHEntity wmImNoticeH, + //退货 + @RequestMapping(params = "datagridt") + public void datagridt(WmImNoticeHEntity wmImNoticeH, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { - CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); - // 查询条件组装器 - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, - wmImNoticeH); - try { - // 自定义追加查询条件 - String query_imData_begin = request.getParameter("imData_begin1"); - String query_imData_end = request.getParameter("imData_end2"); + CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); + // 查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, + wmImNoticeH); + try { + // 自定义追加查询条件 + String query_imData_begin = request.getParameter("imData_begin1"); + String query_imData_end = request.getParameter("imData_end2"); - if (StringUtil.isNotEmpty(query_imData_begin)) { - cq.ge("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") - .parse(query_imData_begin)); - } - if (StringUtil.isNotEmpty(query_imData_end)) { - cq.le("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") - .parse(query_imData_end)); - } - } catch (Exception e) { - throw new BusinessException(e.getMessage()); - } - if (wmImNoticeH.getImSta() == null) { - cq.eq("imSta", Constants.wm_sta1); - } + if (StringUtil.isNotEmpty(query_imData_begin)) { + cq.ge("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") + .parse(query_imData_begin)); + } + if (StringUtil.isNotEmpty(query_imData_end)) { + cq.le("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") + .parse(query_imData_end)); + } + } catch (Exception e) { + throw new BusinessException(e.getMessage()); + } + if (wmImNoticeH.getImSta() == null) { + cq.eq("imSta", Constants.wm_sta1); + } - if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ - cq.eq("cusCode", wmUtil.getCusCode()); - } + if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ + cq.eq("cusCode", wmUtil.getCusCode()); + } // Map map = new HashMap(); // map.put("imSta", "desc"); // cq.setOrder(map); - Map map1 = new HashMap(); - map1.put("createDate", "desc"); - cq.setOrder(map1); - cq.eq("orderTypeCode", "03"); - cq.add(); + Map map1 = new HashMap(); + map1.put("createDate", "desc"); + cq.setOrder(map1); + cq.eq("orderTypeCode", "03"); + cq.add(); - this.wmImNoticeHService.getDataGridReturn(cq, true); - TagUtil.datagrid(response, dataGrid); - } + this.wmImNoticeHService.getDataGridReturn(cq, true); + TagUtil.datagrid(response, dataGrid); + } - //退货 - @RequestMapping(params = "datagridyk") - public void datagridyk(WmImNoticeHEntity wmImNoticeH, + //退货 + @RequestMapping(params = "datagridyk") + public void datagridyk(WmImNoticeHEntity wmImNoticeH, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { - CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); - // 查询条件组装器 - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, - wmImNoticeH); - try { - // 自定义追加查询条件 - String query_imData_begin = request.getParameter("imData_begin1"); - String query_imData_end = request.getParameter("imData_end2"); + CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); + // 查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, + wmImNoticeH); + try { + // 自定义追加查询条件 + String query_imData_begin = request.getParameter("imData_begin1"); + String query_imData_end = request.getParameter("imData_end2"); - if (StringUtil.isNotEmpty(query_imData_begin)) { - cq.ge("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") - .parse(query_imData_begin)); - } - if (StringUtil.isNotEmpty(query_imData_end)) { - cq.le("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") - .parse(query_imData_end)); - } - } catch (Exception e) { - throw new BusinessException(e.getMessage()); - } - if (wmImNoticeH.getImSta() == null) { - cq.eq("imSta", Constants.wm_sta1); - } - if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ - cq.eq("cusCode", wmUtil.getCusCode()); - } + if (StringUtil.isNotEmpty(query_imData_begin)) { + cq.ge("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") + .parse(query_imData_begin)); + } + if (StringUtil.isNotEmpty(query_imData_end)) { + cq.le("imData", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") + .parse(query_imData_end)); + } + } catch (Exception e) { + throw new BusinessException(e.getMessage()); + } + if (wmImNoticeH.getImSta() == null) { + cq.eq("imSta", Constants.wm_sta1); + } + if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ + cq.eq("cusCode", wmUtil.getCusCode()); + } - Map map1 = new HashMap(); - map1.put("createDate", "desc"); - cq.setOrder(map1); - cq.eq("orderTypeCode", "04"); - cq.add(); + Map map1 = new HashMap(); + map1.put("createDate", "desc"); + cq.setOrder(map1); + cq.eq("orderTypeCode", "04"); + cq.add(); - this.wmImNoticeHService.getDataGridReturn(cq, true); - TagUtil.datagrid(response, dataGrid); - } + this.wmImNoticeHService.getDataGridReturn(cq, true); + TagUtil.datagrid(response, dataGrid); + } - /** - * 删除进货通知抬头 - * - * @return - */ - @RequestMapping(params = "appor") - @ResponseBody - public AjaxJson doappor(WmImNoticeHEntity wmImNoticeH, + /** + * 删除进货通知抬头 + * + * @return + */ + @RequestMapping(params = "appor") + @ResponseBody + public AjaxJson doappor(WmImNoticeHEntity wmImNoticeH, HttpServletRequest request) { - AjaxJson j = new AjaxJson(); + AjaxJson j = new AjaxJson(); - String message = "审核成功"; - try { - wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, - request.getParameter("id")); - wmImNoticeH.setImSta(Constants.wm_sta1); - wmImNoticeHService.saveOrUpdate(wmImNoticeH); - systemService.addLog(message, Globals.Log_Type_DEL, - Globals.Log_Leavel_INFO); - Object id0 = wmImNoticeH.getNoticeId(); - // =================================================================================== - // 查询-进货通知明细 - String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; - try { - List wmImNoticeIEntityList = systemService - .findHql(hql0, id0); - for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIEntityList) { - wmImNoticeIEntity.setBinPre("N"); - systemService.updateEntitie(wmImNoticeIEntity); - } - }catch (Exception e) { + String message = "审核成功"; + try { + wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, + request.getParameter("id")); + wmImNoticeH.setImSta(Constants.wm_sta1); + wmImNoticeHService.saveOrUpdate(wmImNoticeH); + systemService.addLog(message, Globals.Log_Type_DEL, + Globals.Log_Leavel_INFO); + Object id0 = wmImNoticeH.getNoticeId(); + // =================================================================================== + // 查询-进货通知明细 + String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; + try { + List wmImNoticeIEntityList = systemService + .findHql(hql0, id0); + for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIEntityList) { + wmImNoticeIEntity.setBinPre("N"); + systemService.updateEntitie(wmImNoticeIEntity); + } + }catch (Exception e) { - } - } catch (Exception e) { - e.printStackTrace(); - message = "审核失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } + } + } catch (Exception e) { + e.printStackTrace(); + message = "审核失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } - /** - * 删除进货通知抬头 - * - * @return - */ - @RequestMapping(params = "close") - @ResponseBody - public AjaxJson doclose(WmImNoticeHEntity wmImNoticeH, + /** + * 删除进货通知抬头 + * + * @return + */ + @RequestMapping(params = "close") + @ResponseBody + public AjaxJson doclose(WmImNoticeHEntity wmImNoticeH, HttpServletRequest request) { - AjaxJson j = new AjaxJson(); + AjaxJson j = new AjaxJson(); - String message = "完成成功"; - try { - wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, - request.getParameter("id")); - wmImNoticeH.setImSta(Constants.wm_sta4); - wmImNoticeHService.saveOrUpdate(wmImNoticeH); - systemService.addLog(message, Globals.Log_Type_DEL, - Globals.Log_Leavel_INFO); - Object id0 = wmImNoticeH.getNoticeId(); - // =================================================================================== - // 查询-进货通知明细 - String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; - try { - List wmImNoticeIEntityList = systemService - .findHql(hql0, id0); - for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIEntityList) { - wmImNoticeIEntity.setBinPre("Y"); - systemService.updateEntitie(wmImNoticeIEntity); - } - }catch (Exception e) { + String message = "完成成功"; + try { + wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, + request.getParameter("id")); + wmImNoticeH.setImSta(Constants.wm_sta4); + wmImNoticeHService.saveOrUpdate(wmImNoticeH); + systemService.addLog(message, Globals.Log_Type_DEL, + Globals.Log_Leavel_INFO); + Object id0 = wmImNoticeH.getNoticeId(); + // =================================================================================== + // 查询-进货通知明细 + String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; + try { + List wmImNoticeIEntityList = systemService + .findHql(hql0, id0); + for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIEntityList) { + wmImNoticeIEntity.setBinPre("Y"); + systemService.updateEntitie(wmImNoticeIEntity); + } + }catch (Exception e) { - } - } catch (Exception e) { - e.printStackTrace(); - message = "完成失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } + } + } catch (Exception e) { + e.printStackTrace(); + message = "完成失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } - /** - * 删除进货通知抬头 - * - * @return - */ - @RequestMapping(params = "doDel") - @ResponseBody - public AjaxJson doDel(WmImNoticeHEntity wmImNoticeH, + /** + * 删除进货通知抬头 + * + * @return + */ + @RequestMapping(params = "doDel") + @ResponseBody + public AjaxJson doDel(WmImNoticeHEntity wmImNoticeH, HttpServletRequest request) { - boolean deltrue = true; - if(!"database".equals(ResourceUtil.getConfigByName("sys.del"))){ - deltrue=false; - } - AjaxJson j = new AjaxJson(); - wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, - wmImNoticeH.getId()); - String message = "进货通知删除成功"; - try { - WmPlatIoEntity wmPlatIo = systemService.findUniqueByProperty( - WmPlatIoEntity.class, "docId", wmImNoticeH.getNoticeId());// 删除月台计划 - if (wmPlatIo != null) { - systemService.delete(wmPlatIo); - } - wmImNoticeH.setImSta(Constants.wm_sta3); - if(deltrue){ - wmImNoticeHService.delete(wmImNoticeH); + boolean deltrue = true; + if(!"database".equals(ResourceUtil.getConfigByName("sys.del"))){ + deltrue=false; + } + AjaxJson j = new AjaxJson(); + wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, + wmImNoticeH.getId()); + String message = "进货通知删除成功"; + try { + WmPlatIoEntity wmPlatIo = systemService.findUniqueByProperty( + WmPlatIoEntity.class, "docId", wmImNoticeH.getNoticeId());// 删除月台计划 + if (wmPlatIo != null) { + systemService.delete(wmPlatIo); + } + wmImNoticeH.setImSta(Constants.wm_sta3); + if(deltrue){ + wmImNoticeHService.delete(wmImNoticeH); - }else{ - wmImNoticeHService.saveOrUpdate(wmImNoticeH); + }else{ + wmImNoticeHService.saveOrUpdate(wmImNoticeH); - } - systemService.addLog(message, Globals.Log_Type_DEL, - Globals.Log_Leavel_INFO); - Object id0 = wmImNoticeH.getNoticeId(); - // =================================================================================== - // 查询-进货通知明细 + } + systemService.addLog(message, Globals.Log_Type_DEL, + Globals.Log_Leavel_INFO); + Object id0 = wmImNoticeH.getNoticeId(); + // =================================================================================== + // 查询-进货通知明细 - if(wmImNoticeH.getOrderTypeCode().equals("04")){ - String tsql = "delete from wm_in_qm_i where im_notice_id = ?"; - systemService.executeSql(tsql, wmImNoticeH.getNoticeId()); - } - String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; - try { - List wmImNoticeIEntityList = systemService - .findHql(hql0, id0); - for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIEntityList) { - wmImNoticeIEntity.setBinPre("Y"); - if(deltrue){ - systemService.delete(wmImNoticeIEntity); + if(wmImNoticeH.getOrderTypeCode().equals("04")){ + String tsql = "delete from wm_in_qm_i where im_notice_id = ?"; + systemService.executeSql(tsql, wmImNoticeH.getNoticeId()); + } + String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; + try { + List wmImNoticeIEntityList = systemService + .findHql(hql0, id0); + for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIEntityList) { + wmImNoticeIEntity.setBinPre("Y"); + if(deltrue){ + systemService.delete(wmImNoticeIEntity); - }else{ - systemService.updateEntitie(wmImNoticeIEntity); + }else{ + systemService.updateEntitie(wmImNoticeIEntity); - } - } - }catch (Exception e) { + } + } + }catch (Exception e) { - } - } catch (Exception e) { - e.printStackTrace(); - message = "进货通知删除失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } - @RequestMapping(params = "doPrinthpid") - @ResponseBody - public void downReceiveExcelhpid(WmImNoticeHEntity wmImNoticeH, + } + } catch (Exception e) { + e.printStackTrace(); + message = "进货通知删除失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } + @RequestMapping(params = "doPrinthpid") + @ResponseBody + public void downReceiveExcelhpid(WmImNoticeHEntity wmImNoticeH, HttpServletRequest request, HttpServletResponse response) { - OutputStream fileOut = null; - BufferedImage bufferImg = null; + OutputStream fileOut = null; + BufferedImage bufferImg = null; // String codedFileName = null; - wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, - wmImNoticeH.getId());// 获取抬头 - String hql0 = "from WmInQmIEntity where 1 = 1 AND imNoticeId = ? "; - List wmImQmIEntityList = systemService.findHql( - hql0, wmImNoticeH.getNoticeId());// 获取行项目 - // 先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray - try { + wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, + wmImNoticeH.getId());// 获取抬头 + String hql0 = "from WmInQmIEntity where 1 = 1 AND imNoticeId = ? "; + List wmImQmIEntityList = systemService.findHql( + hql0, wmImNoticeH.getNoticeId());// 获取行项目 + // 先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray + try { // StringBuffer sber = new StringBuffer(); - ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); + ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); // bufferImg = ImageIO.read(BarcodeUtil.generateToStream(wmImNoticeH // .getNoticeId())); - // 进行转码,使其支持中文文件名 + // 进行转码,使其支持中文文件名 // codedFileName = java.net.URLEncoder.encode("中文", "UTF-8"); - response.setHeader("content-disposition", "attachment;filename=" - + wmImNoticeH.getNoticeId() + "hpid.xls"); + response.setHeader("content-disposition", "attachment;filename=" + + wmImNoticeH.getNoticeId() + "hpid.xls"); // ImageIO.write(bufferImg, "jpg", byteArrayOut); - HSSFWorkbook wb = new HSSFWorkbook(); - HSSFSheet sheet = wb.createSheet("货品ID"); - - sheet.setMargin(HSSFSheet.TopMargin,0.1);// 页边距(上) - sheet.setMargin(HSSFSheet.BottomMargin,0.1);// 页边距(下) - sheet.setMargin(HSSFSheet.LeftMargin,0.1);// 页边距(左) - sheet.setMargin(HSSFSheet.RightMargin,0.1);// 页边距(右 - sheet.setColumnWidth(0, 28 * 256); - sheet.setColumnWidth(1, 29 * 256); - sheet.setColumnWidth(2, 6 * 200); - - sheet.setColumnWidth(3, 14 * 256); - sheet.setColumnWidth(4, 14 * 256); - sheet.setColumnWidth(5, 6 * 256); - // sheet.setColumnWidth(6, 8 * 256); - // sheet.setColumnWidth(7, 8 * 256); - // sheet.setColumnWidth(8, 8 * 256); - // 画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) - HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); - // anchor主要用于设置图片的属性 - HSSFClientAnchor anchor = null; - - - - // 创建两种单元格格式 - CellStyle csh = wb.createCellStyle(); - CellStyle csh1 = wb.createCellStyle(); - CellStyle cs = wb.createCellStyle(); - CellStyle cs2 = wb.createCellStyle(); - CellStyle cs3 = wb.createCellStyle(); - CellStyle cs4 = wb.createCellStyle(); - CellStyle cs5 = wb.createCellStyle(); - // 创建两种字体 - Font f = wb.createFont(); - Font f2 = wb.createFont(); - Font fh = wb.createFont(); - fh.setFontHeightInPoints((short) 42); - fh.setColor(IndexedColors.BLACK.getIndex()); - fh.setBoldweight(Font.BOLDWEIGHT_BOLD); - Font fh1 = wb.createFont(); - fh1.setFontHeightInPoints((short) 32); - fh1.setColor(IndexedColors.BLACK.getIndex()); - fh1.setBoldweight(Font.BOLDWEIGHT_BOLD); - // 创建第一种字体样式(用于列名) - f.setFontHeightInPoints((short) 22); - 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()); - csh.setFont(fh); - csh.setBorderLeft(CellStyle.BORDER_NONE); - csh.setBorderRight(CellStyle.BORDER_NONE); - csh.setBorderTop(CellStyle.BORDER_NONE); - csh.setBorderBottom(CellStyle.BORDER_NONE); - csh.setAlignment(HSSFCellStyle.ALIGN_LEFT); - csh1.setFont(fh1); - csh1.setBorderLeft(CellStyle.BORDER_NONE); - csh1.setBorderRight(CellStyle.BORDER_NONE); - csh1.setBorderTop(CellStyle.BORDER_NONE); - csh1.setBorderBottom(CellStyle.BORDER_NONE); - csh1.setAlignment(HSSFCellStyle.ALIGN_LEFT); - // 设置第一种单元格的样式(用于列名) - 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_LEFT); - // 设置第二种单元格的样式(用于值) - 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.setAlignment(CellStyle.BORDER_HAIR); - cs4.setFont(f2); - cs4.setBorderTop(CellStyle.BORDER_MEDIUM); - cs4.setBorderBottom(CellStyle.BORDER_MEDIUM); - - cs5.setFont(f2); - cs5.setBorderLeft(CellStyle.BORDER_NONE); - cs5.setBorderRight(CellStyle.BORDER_NONE); - cs5.setBorderTop(CellStyle.BORDER_NONE); - cs5.setBorderBottom(CellStyle.BORDER_NONE); - cs5.setWrapText(true); - - int cellsNum = 0; - int pagesize = 1; - int page = 0; - short high = 600; - for (WmInQmIEntity wmInQmIEntity : wmImQmIEntityList) { - cellsNum++; - MvGoodsEntity goods = systemService.findUniqueByProperty( - MvGoodsEntity.class, "goodsCode", - wmInQmIEntity.getGoodsId()); - Row rowColumnValue = sheet.createRow((short) page*pagesize+cellsNum); // 列名 - rowColumnValue.setHeight((short) 1000); - Cell cell1 = rowColumnValue.createCell(0); - try { - cell1.setCellValue("库别:"+wmInQmIEntity.getBinId().substring(0,2)+" "+wmInQmIEntity.getQmOkQuat()+goods.getShlDanWei()); - - } catch (Exception e) { - // TODO: handle exception - } - cell1.setCellStyle(csh); - CellRangeAddress c0 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); - sheet.addMergedRegion(c0); - - cellsNum++; - Row rowColumnValue1 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 - rowColumnValue1.setHeight( (short) 1000); - Cell cell2 = rowColumnValue1.createCell(0); - - cell2.setCellValue( goods.getShpMingCheng()); - cell2.setCellStyle(csh1); - CellRangeAddress c2 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); - sheet.addMergedRegion(c2); - cellsNum++; - //插入图片 - try { - byteArrayOut = new ByteArrayOutputStream(); - try { - bufferImg = - ImageIO.read(BarcodeUtil.generateToStream(wmInQmIEntity.getBinId().substring(0,2))); - } catch (Exception e) { - // TODO: handle exception - } - - ImageIO.write(bufferImg, "jpg", byteArrayOut); - anchor = new HSSFClientAnchor(0, 0, 0, 0,(short)2, page*pagesize+cellsNum, - (short)5, page*pagesize+cellsNum+4); - patriarch.createPicture(anchor, - wb.addPicture(byteArrayOut.toByteArray(), - HSSFWorkbook.PICTURE_TYPE_JPEG)); - } catch (Exception e) { - // TODO: handle exception - } - Row rowColumnValue12 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 - rowColumnValue12.setHeight((short) 1000); - Cell cell13 = rowColumnValue12.createCell(0); - cell13.setCellValue(goods.getGoodsCode() ); - cell13.setCellStyle(cs); - CellRangeAddress c13 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); - sheet.addMergedRegion(c13); - cellsNum++; - - Row rowColumnValue2 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 - rowColumnValue2.setHeight(high); - Cell cell3 = rowColumnValue2.createCell(0); - cell3.setCellValue("生产日期:"+wmInQmIEntity.getProData() ); - cell3.setCellStyle(cs); - CellRangeAddress c3 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); - sheet.addMergedRegion(c3); - cellsNum++; - Row rowColumnValue3 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 - rowColumnValue3.setHeight(high); - Cell cell4 = rowColumnValue3.createCell(0); - try { - Calendar cal = Calendar.getInstance();//使用默认时区和语言环境获得一个日历。 - cal.setTime(DateUtils.str2Date(wmInQmIEntity.getProData(), DateUtils.date_sdf)); - cal.add(Calendar.DAY_OF_MONTH, Integer.parseInt(goods.getBzhiQi()));//取当前日期的后一天. - cell4.setCellValue("到期日期:"+ DateUtils.date2Str(cal.getTime(), DateUtils.date_sdf)); - } catch (Exception e) { - // TODO: handle exception - } - cell4.setCellStyle(cs); - CellRangeAddress c4 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); - sheet.addMergedRegion(c4); - cellsNum++; - Row rowColumnValue4 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 - rowColumnValue4.setHeight(high); - Cell cell5 = rowColumnValue4.createCell(0); - cell5.setCellValue("进货日期:"+ DateUtils.date2Str(wmInQmIEntity.getCreateDate() , DateUtils.date_sdf) ); - cell5.setCellStyle(cs); - CellRangeAddress c5 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); - sheet.addMergedRegion(c5); - - page++; - } - fileOut = response.getOutputStream(); - HSSFPrintSetup printSetup = sheet.getPrintSetup(); - printSetup.setLandscape(true); - printSetup.setPaperSize(HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE); - wb.write(fileOut); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (fileOut != null) { - try { - fileOut.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } - - /** - * 打印进货通知 - * - * @return - */ - - @RequestMapping(params = "doPrint") - @ResponseBody - public void downReceiveExcel(WmImNoticeHEntity wmImNoticeH, - HttpServletRequest request, HttpServletResponse response) { - OutputStream fileOut = null; - BufferedImage bufferImg = null; -// String codedFileName = null; - wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, - wmImNoticeH.getId());// 获取抬头 - String hql0 = "from WmImNoticeIEntity where 1 = 1 AND imNoticeId = ? "; - List wmImNoticeIEntityList = systemService.findHql( - hql0, wmImNoticeH.getNoticeId());// 获取行项目 - // 先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray - try { -// StringBuffer sber = new StringBuffer(); - - ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); - bufferImg = ImageIO.read(BarcodeUtil.generateToStream(wmImNoticeH - .getNoticeId())); - // 进行转码,使其支持中文文件名 -// codedFileName = java.net.URLEncoder.encode("中文", "UTF-8"); - response.setHeader("content-disposition", "attachment;filename=" - + wmImNoticeH.getNoticeId() + ".xls"); - ImageIO.write(bufferImg, "jpg", byteArrayOut); - - HSSFWorkbook wb = new HSSFWorkbook(); - HSSFSheet sheet = wb.createSheet("收货通知"); - sheet.setColumnWidth(0, 5 * 256); - sheet.setColumnWidth(1, 42 * 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, 8 * 256); - // 画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) - HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); - // anchor主要用于设置图片的属性 - HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, - (short) 3, 1, (short) 6, 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(); - CellStyle cs5 = 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); - - // 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.setAlignment(CellStyle.BORDER_HAIR); - cs4.setFont(f2); - cs4.setBorderTop(CellStyle.BORDER_MEDIUM); - cs4.setBorderBottom(CellStyle.BORDER_MEDIUM); - - cs5.setFont(f2); - cs5.setBorderLeft(CellStyle.BORDER_NONE); - cs5.setBorderRight(CellStyle.BORDER_NONE); - cs5.setBorderTop(CellStyle.BORDER_NONE); - cs5.setBorderBottom(CellStyle.BORDER_NONE); - cs5.setWrapText(true); - - Row row1 = sheet.createRow((short) 1); // 第二行标题 - row1.setHeight((short) 700); - Cell cellTitle = row1.createCell(0); - cellTitle.setCellValue("收货通知"); - cellTitle.setCellStyle(cs); - - Row rowHead1 = sheet.createRow((short) 2); // 头部第一行 - Cell cellHead11 = rowHead1.createCell(0); - cellHead11.setCellValue("通知单号:" + wmImNoticeH.getNoticeId()); - cellHead11.setCellStyle(cs2); - - Row rowHead2 = sheet.createRow((short) 3); // 头部第二行 - Cell cellHead21 = rowHead2.createCell(0); - try { - MdCusEntity md = systemService.findUniqueByProperty( - MdCusEntity.class, "keHuBianMa", - wmImNoticeH.getCusCode()); - if (md != null) { - cellHead21.setCellValue("客户:" + wmImNoticeH.getCusCode() - + "-" + md.getZhongWenQch()); - } else { - cellHead21.setCellValue("客户:" + wmImNoticeH.getCusCode()); - } - } finally { - - } - - cellHead21.setCellStyle(cs2); - - Cell cellHead23 = rowHead2.createCell(2); - cellHead23.setCellValue(" 计划送货时间:" + wmImNoticeH.getImData()); - cellHead23.setCellStyle(cs2); - - Row rowHead3 = sheet.createRow((short) 4); // 头部第三行 - Cell cellHead31 = rowHead3.createCell(0); - cellHead31.setCellValue("司机:" + wmImNoticeH.getImCarDri() - + " 司机电话:" + wmImNoticeH.getImCarMobile()); - cellHead31.setCellStyle(cs2); - - Cell cellHead35 = rowHead3.createCell(2); - cellHead35.setCellValue("车号:" + wmImNoticeH.getImCarNo() + " 备注:" - + wmImNoticeH.getImBeizhu()); - cellHead35.setCellStyle(cs2); - - // 合并单元格 - CellRangeAddress c = new CellRangeAddress(0, 0, 0, 8); // 第一行空白 - CellRangeAddress c0 = new CellRangeAddress(1, 1, 0, 5);// 第二行标题 - CellRangeAddress c1 = new CellRangeAddress(2, 2, 0, 8);// 第三行通知单号 - CellRangeAddress c2 = new CellRangeAddress(3, 3, 0, 1);// 第四行客户 - CellRangeAddress c3 = new CellRangeAddress(3, 3, 2, 5);// 第四行客户送货时间 - CellRangeAddress c4 = new CellRangeAddress(4, 4, 0, 1);// 第五行客户 - CellRangeAddress c5 = new CellRangeAddress(4, 4, 2, 5);// 第五行客户送货时间 - // 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) 5); // 列名 - String[] columnNames = { "序号", "商品详情", "数量", "体积cm³", "重量KG", - "TiHi" }; - - for (int i = 0; i < columnNames.length; i++) { - Cell cell = rowColumnName.createCell(i); - cell.setCellValue(columnNames[i]); - cell.setCellStyle(cs3); - } - int cellsNum = 5; - int cerconNo = 1; - for (int i = 0; i < wmImNoticeIEntityList.size(); i++) { - WmImNoticeIEntity entity = wmImNoticeIEntityList.get(i); - cellsNum++; - Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 - rowColumnValue.setHeight((short) 1000); - Cell cell1 = rowColumnValue.createCell(0); - cell1.setCellValue(cerconNo); - cell1.setCellStyle(cs4); - Cell cell2 = rowColumnValue.createCell(1); - - Cell cell6 = rowColumnValue.createCell(5); - cell6.setCellStyle(cs3); - try { - MvGoodsEntity goods = systemService.findUniqueByProperty( - MvGoodsEntity.class, "goodsCode", - entity.getGoodsCode()); - if (goods != null) { - cell2.setCellValue(new HSSFRichTextString(goods - .getGoodsName())); - cell2.setCellStyle(cs3); - - cell6.setCellValue(goods.getMpDanCeng() + "*" - + goods.getMpCengGao()); - } - } finally { - - } - Cell cell3 = rowColumnValue.createCell(2); - cell3.setCellValue(entity.getGoodsCount()); - cell3.setCellStyle(cs4); - - Cell cell4 = rowColumnValue.createCell(3); - cell4.setCellValue(entity.getGoodsFvol()); - cell4.setCellStyle(cs4); - Cell cell5 = rowColumnValue.createCell(4); - cell5.setCellValue(entity.getGoodsWeight()); - cell5.setCellStyle(cs4); - - - cerconNo++; - } - Row rowColumnInfo = sheet.createRow((short) 2 + cellsNum); // 列名 - rowColumnInfo.createCell(0).setCellValue( - "注:烦请按时送到"+ ResourceUtil.getConfigByName("comaddr")+" 谢谢!"); - CellRangeAddress c15 = new CellRangeAddress(10 + cellsNum, - 10 + cellsNum, 0, 15); - sheet.addMergedRegion(c15); - fileOut = response.getOutputStream(); - wb.write(fileOut); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (fileOut != null) { - try { - fileOut.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } - - @RequestMapping(params = "doPrintysd") - @ResponseBody - public void downReceiveExcelysd(WmImNoticeHEntity wmImNoticeH, - HttpServletRequest request, HttpServletResponse response) { - OutputStream fileOut = null; - BufferedImage bufferImg = null; -// String codedFileName = null; - wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, - wmImNoticeH.getId());// 获取抬头 - - // 先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray - try { -// StringBuffer sber = new StringBuffer(); - - ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); -// bufferImg = ImageIO.read(BarcodeUtil.generateToStream(wmImNoticeH -// .getNoticeId())); - bufferImg = QRcodeUtil.createImage(wmImNoticeH - .getNoticeId()); - - // 进行转码,使其支持中文文件名 -// codedFileName = java.net.URLEncoder.encode("中文", "UTF-8"); - response.setHeader("content-disposition", "attachment;filename=" - + wmImNoticeH.getNoticeId() + "验收单.xls"); - ImageIO.write(bufferImg, "jpg", byteArrayOut); - - HSSFWorkbook wb = new HSSFWorkbook(); - HSSFSheet sheet = wb.createSheet(wmImNoticeH.getNoticeId()); - sheet.setMargin(HSSFSheet.TopMargin,0.1);// 页边距(上) - sheet.setMargin(HSSFSheet.BottomMargin,0.1);// 页边距(下) - 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); - sheet.setColumnWidth(3, 11 * 256); - sheet.setColumnWidth(4, 5 * 256); - sheet.setColumnWidth(5, 5 * 256); - sheet.setColumnWidth(6, 7 * 256); - sheet.setColumnWidth(7, 7 * 256); - 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(); - CellStyle cs1 = wb.createCellStyle(); - CellStyle cs2 = wb.createCellStyle(); - CellStyle cs3 = wb.createCellStyle(); - CellStyle cs4 = wb.createCellStyle(); - CellStyle cs5 = wb.createCellStyle(); - CellStyle cs5r = wb.createCellStyle(); - - CellStyle cs51 = wb.createCellStyle(); - CellStyle cs52 = wb.createCellStyle(); - // 创建两种字体 - Font f = wb.createFont(); - Font f2 = wb.createFont(); - Font f5 = 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()); - - - f5.setFontHeightInPoints((short) 8); - f5.setColor(IndexedColors.BLACK.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); - - cs1.setFont(f2); - cs1.setBorderLeft(CellStyle.BORDER_NONE); - cs1.setBorderRight(CellStyle.BORDER_NONE); - cs1.setBorderTop(CellStyle.BORDER_NONE); - cs1.setBorderBottom(CellStyle.BORDER_NONE); - cs1.setAlignment(HSSFCellStyle.ALIGN_CENTER); - - cs1.setWrapText(true); - // 设置第二种单元格的样式(用于值) - 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.setAlignment(CellStyle.BORDER_HAIR); - cs4.setFont(f2); - cs4.setBorderTop(CellStyle.BORDER_MEDIUM); - cs4.setBorderBottom(CellStyle.BORDER_MEDIUM); - - cs5.setFont(f2); - cs5.setBorderLeft(CellStyle.BORDER_THIN); - cs5.setBorderRight(CellStyle.BORDER_THIN); - cs5.setBorderTop(CellStyle.BORDER_THIN); - cs5.setBorderBottom(CellStyle.BORDER_THIN); - cs5.setWrapText(true); - - - cs5r.setFont(f2); - cs5r.setBorderLeft(CellStyle.BORDER_THIN); - cs5r.setBorderRight(CellStyle.BORDER_THIN); - cs5r.setBorderTop(CellStyle.BORDER_THIN); - cs5r.setBorderBottom(CellStyle.BORDER_THIN); - cs5r.setWrapText(true); - cs5r.setAlignment(CellStyle.ALIGN_RIGHT); - - - - cs51.setFont(f2); - cs51.setBorderLeft(CellStyle.BORDER_THIN); - cs51.setBorderRight(CellStyle.BORDER_THIN); - cs51.setBorderTop(CellStyle.BORDER_THIN); - cs51.setBorderBottom(CellStyle.BORDER_THIN); - cs51.setAlignment(HSSFCellStyle.ALIGN_CENTER); - - cs51.setWrapText(true); - - cs52.setFont(f5); - cs52.setBorderLeft(CellStyle.BORDER_NONE); - cs52.setBorderRight(CellStyle.BORDER_NONE); - cs52.setBorderTop(CellStyle.BORDER_NONE); - cs52.setBorderBottom(CellStyle.BORDER_NONE); - cs52.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP); - - cs52.setWrapText(true); - cs52.setRotation((short)255); - - int page = 0; - int cerconNo = 1; - String tsql = "SELECT wq.pro_data,wq.goods_unit,wq.rec_deg, mg.shp_gui_ge ,mg.goods_code, mg.goods_id,mg.shp_ming_cheng," - + "cast(sum(wq.qm_ok_quat) as signed) as goods_count,truncate(sum(wq.tin_tj),2) tin_tj ,truncate(sum(wq.tin_zhl),2) as tin_zhl,count(*) as tuopan " - + "FROM wm_in_qm_i wq,mv_goods mg where wq.im_notice_id = ? and wq.goods_id = mg.goods_code group by wq.im_notice_id, mg.goods_code,wq.pro_data"; - List> result = systemService - .findForJdbc(tsql, wmImNoticeH.getNoticeId()); - - - int size = result.size(); - int pagesize = 10; - int pagecount = size%pagesize==0?size/pagesize:size/pagesize+1; - double sum = 0; - double sumzl = 0; - do { - - // 画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) - HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); - // anchor主要用于设置图片的属性 - HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, - (short) 8, page*20+1, (short) 10, page*20+5); - anchor.setAnchorType(2); - // 插入图片 - patriarch - .createPicture(anchor, wb.addPicture( - byteArrayOut.toByteArray(), - HSSFWorkbook.PICTURE_TYPE_JPEG)); - - // 创建第一行 - Row row = sheet.createRow((short) page*20+0); // 第一行空白 - - - Row row1 = sheet.createRow((short) page*20+1); // 第二行标题 - row1.setHeight((short) 700); - Cell cellTitle = row1.createCell(0); - if(wmImNoticeH.getOrderTypeCode().equals("03")){ - cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"退货验收单"); - }else if(wmImNoticeH.getOrderTypeCode().equals("01")){ - cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"收货验收单"); - }else if(wmImNoticeH.getOrderTypeCode().equals("04")){ - cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"越库单"); - }else if(wmImNoticeH.getOrderTypeCode().equals("09")){ - 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(wmImNoticeH.getImData(), DateUtils.date_sdf) ); - cellHead4.setCellStyle(cs2); - - Cell cellHead42 = rowHead4.createCell(3); - cellHead42.setCellValue("预约单号: " +wmImNoticeH.getNoticeId()); - cellHead42.setCellStyle(cs2); - - Row rowHead5 = sheet.createRow((short) page*20+5); // 头部第二行 - Cell cellHead5 = rowHead5.createCell(0); - cellHead5.setCellValue("客户采购单号: "+wmImNoticeH.getImCusCode() ); - cellHead5.setCellStyle(cs2); - - Cell cellHead52 = rowHead5.createCell(3); - cellHead52.setCellValue("月台: " +(StringUtils.isEmpty(wmImNoticeH.getPlatformCode())?"":wmImNoticeH.getPlatformCode())); - cellHead52.setCellStyle(cs2); - - Row rowHead6 = sheet.createRow((short) page*20+6); // 头部第二行 - Cell cellHead6 = rowHead6.createCell(0); - MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmImNoticeH.getCusCode()); - - cellHead6.setCellValue("客户名称: " +wmImNoticeH.getCusCode()+md.getZhongWenQch()); - cellHead6.setCellStyle(cs2); - - Cell cellHead62 = rowHead6.createCell(3); - cellHead62.setCellValue("供应商/车号: "+wmImNoticeH.getImCarNo() ); - cellHead62.setCellStyle(cs2); - - Row rowHead7 = sheet.createRow((short) page*20+7); // 头部第二行 - Cell cellHead7 = rowHead7.createCell(0); - cellHead7.setCellValue("客户电话: " +md.getDianHua()); - cellHead7.setCellStyle(cs2); - - Cell cellHead72 = rowHead7.createCell(3); - 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, 8);// 第二行标题 - CellRangeAddress c2 = new CellRangeAddress(page*20+2, page*20+2, 0, 9);// 第三行地址 - CellRangeAddress c3 = new CellRangeAddress(page*20+3, page*20+3, 0, 9);// 第四行电话 - - CellRangeAddress c4 = new CellRangeAddress(page*20+4, page*20+4, 0, 2);// 第5行 到货日期 - CellRangeAddress c42 = new CellRangeAddress(page*20+4, page*20+4, 3, 9);// 第5行预约单号 - CellRangeAddress c5 = new CellRangeAddress(page*20+5, page*20+5, 0, 2);// 第6行客户采购单号 - CellRangeAddress c52 = new CellRangeAddress(page*20+5, page*20+5, 3, 9);// 第6行月台 - CellRangeAddress c6 = new CellRangeAddress(page*20+6, page*20+6, 0, 2);// 第7行客户名称 - CellRangeAddress c62 = new CellRangeAddress(page*20+6, page*20+6, 3, 9);// 第7行车号 - CellRangeAddress c7 = new CellRangeAddress(page*20+7, page*20+7, 0, 2);//第7行客户电话 - CellRangeAddress c72 = new CellRangeAddress(page*20+7, page*20+7, 3, 9);//第7行打印时间 - sheet.addMergedRegion(c); - sheet.addMergedRegion(c1); - sheet.addMergedRegion(c2); - sheet.addMergedRegion(c3); - sheet.addMergedRegion(c4); - sheet.addMergedRegion(c5); - sheet.addMergedRegion(c6); - 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+0, page*20+19, 10, 10);//第7行打印时间 - sheet.addMergedRegion(c73); - - Row rowColumnName = sheet.createRow((short) page*20+8); // 列名 - String[] columnNames = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","规格","备注" }; - if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ - String[] columnNamest = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","规格","备注" }; - columnNames = columnNamest; - } - try{ - if("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))){ - String[] columnNames1 = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","规格","备注" }; - if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ - String[] columnNamest1 = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","规格","备注" }; - columnNames1 = columnNamest1; - } - columnNames = columnNames1; - } - }catch ( Exception e){ - } - for (int i = 0; i < columnNames.length; i++) { - Cell cell = rowColumnName.createCell(i); - cell.setCellValue(columnNames[i]); - cell.setCellStyle(cs3); - } - - - int cellsNum = page*20+8; - int oversize = 0; - if(size==pagesize&&page==pagecount-1){ - oversize = 1; - } - for (int i = page*pagesize; i < (page+1)*pagesize + oversize; i++) { - if(i< size){ - - cellsNum++; - Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 - rowColumnValue.setHeight((short) 250); - - Cell cell1 = rowColumnValue.createCell(0); - cell1.setCellValue(cerconNo); - cell1.setCellStyle(cs51); - Cell cell2 = rowColumnValue.createCell(1); - cell2.setCellValue(result.get(i).get("goods_id") - .toString()); - cell2.setCellStyle(cs5); - - Cell cell3 = rowColumnValue.createCell(2); - cell3.setCellValue(result.get(i).get("shp_ming_cheng") - .toString()); - cell3.setCellStyle(cs5); - try { - Cell cell4 = rowColumnValue.createCell(3);// 生产日期 - - cell4.setCellStyle(cs5r); - cell4.setCellValue(result.get(i).get("pro_data") - .toString()); - - } catch (Exception e) { - // TODO: handle exception - - } - - try { - Cell cell5 = rowColumnValue.createCell(4);// 温度 - - cell5.setCellStyle(cs5); - cell5.setCellValue(""); -// cell5.setCellValue(result.get(i) -// .get("rec_deg").toString()); - } catch (Exception e) { - // TODO: handle exception - } - - try { - Cell cell6 = rowColumnValue.createCell(5);// 单位 - - cell6.setCellStyle(cs5); - cell6.setCellValue(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()); - Cell cell7 = rowColumnValue.createCell(6);// 数量 - - cell7.setCellStyle(cs5); - cell7.setCellValue(result.get(i).get("goods_count") - .toString()); - } catch (Exception e) { - // TODO: handle exception - } - - try { - Cell cell8 = rowColumnValue.createCell(7);// 毛重 - sumzl = sumzl + Double.parseDouble(result.get(i).get("tin_zhl") - .toString()); - cell8.setCellStyle(cs5); - cell8.setCellValue(result.get(i).get("tin_zhl") - .toString()); - } catch (Exception e) { - // TODO: handle exception - } - try { - - Cell cell9 = rowColumnValue.createCell(8);// 体积 - - cell9.setCellValue(result.get(i).get("shp_gui_ge").toString()); - cell9.setCellStyle(cs5); -// if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ -// cell9.setCellValue(result.get(i).get("tuopan") -// .toString()); -// }else{ -// cell9.setCellValue(result.get(i).get("tin_tj") -// .toString()); -// } - - - } catch (Exception e) { - // TODO: handle exception - } - - - Cell cell10 = rowColumnValue.createCell(9);// 备注 - try{ - if("hr".equals(ResourceUtil.getConfigByName("wm.rkd"))) { - try{ -// cell10.setCellValue(wmUtil.getstock(result.get(i).get("goods_id").toString())); - }catch (Exception e){ - - } - } - }catch (Exception e){ - - } - cell10.setCellStyle(cs5); - - cerconNo++; - } - if(i== size){ - - cellsNum++; - Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 - rowColumnValue.setHeight((short) 250); - Cell cell6 = rowColumnValue.createCell(6);// 备注 - cell6.setCellValue(Double.toString(sum)); - Cell cell7 = rowColumnValue.createCell(7);// 重量 - cell7.setCellValue(Double.toString(sumzl)); -// cell6.setCellStyle(cs5); - Cell cell0 = rowColumnValue.createCell(0);// 合计 - cell0.setCellValue("合计:"); -// cell0.setCellStyle(cs5); - CellRangeAddress c15 = new CellRangeAddress( cellsNum, - cellsNum, 0, 5); - sheet.addMergedRegion(c15); - cerconNo++; - - } - - - } - Row rowColumnInfo = sheet.createRow((short) 1 + cellsNum); // 列名 - rowColumnInfo.setHeight((short) 250); - rowColumnInfo.createCell(0).setCellValue( - "制单: 仓管: 主管: 叉车:"); - CellRangeAddress c15 = new CellRangeAddress(1 + cellsNum, - 1 + cellsNum, 0, 9); - sheet.addMergedRegion(c15); - page++; - } while (page> result = systemService - .findForJdbc(tsql, wmImNoticeH.getNoticeId()); - - - int size = result.size(); - int pagesize = 10; - int pagecount = size%pagesize==0?size/pagesize:size/pagesize+1; - double sum = 0; - double sumzl = 0; - do { - - // 画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) - HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); - // anchor主要用于设置图片的属性 - HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, - (short) 8, page*20+1, (short) 10, page*20+5); - anchor.setAnchorType(2); - // 插入图片 - patriarch - .createPicture(anchor, wb.addPicture( - byteArrayOut.toByteArray(), - HSSFWorkbook.PICTURE_TYPE_JPEG)); - - // 创建第一行 - Row row = sheet.createRow((short) page*20+0); // 第一行空白 - - - Row row1 = sheet.createRow((short) page*20+1); // 第二行标题 - row1.setHeight((short) 700); - Cell cellTitle = row1.createCell(0); - if(wmImNoticeH.getOrderTypeCode().equals("03")){ - cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"退货入库单"); - }else if(wmImNoticeH.getOrderTypeCode().equals("01")){ - cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"收货入库单"); - }else if(wmImNoticeH.getOrderTypeCode().equals("04")){ - cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"越库单"); - }else if(wmImNoticeH.getOrderTypeCode().equals("09")){ - 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(wmImNoticeH.getImData(), DateUtils.date_sdf) ); - cellHead4.setCellStyle(cs2); - - Cell cellHead42 = rowHead4.createCell(3); - cellHead42.setCellValue("预约单号: " +wmImNoticeH.getNoticeId()); - cellHead42.setCellStyle(cs2); - - Row rowHead5 = sheet.createRow((short) page*20+5); // 头部第二行 - Cell cellHead5 = rowHead5.createCell(0); - cellHead5.setCellValue("客户采购单号: "+wmImNoticeH.getImCusCode() ); - cellHead5.setCellStyle(cs2); - - Cell cellHead52 = rowHead5.createCell(3); - cellHead52.setCellValue("月台: " +(StringUtils.isEmpty(wmImNoticeH.getPlatformCode())?"":wmImNoticeH.getPlatformCode())); - cellHead52.setCellStyle(cs2); - - Row rowHead6 = sheet.createRow((short) page*20+6); // 头部第二行 - Cell cellHead6 = rowHead6.createCell(0); - MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmImNoticeH.getCusCode()); - - cellHead6.setCellValue("客户名称: " +wmImNoticeH.getCusCode()+md.getZhongWenQch()); - cellHead6.setCellStyle(cs2); - - Cell cellHead62 = rowHead6.createCell(3); - cellHead62.setCellValue("供应商/车号: "+wmImNoticeH.getImCarNo() ); - cellHead62.setCellStyle(cs2); - - Row rowHead7 = sheet.createRow((short) page*20+7); // 头部第二行 - Cell cellHead7 = rowHead7.createCell(0); - cellHead7.setCellValue("客户电话: " +md.getDianHua()); - cellHead7.setCellStyle(cs2); - - Cell cellHead72 = rowHead7.createCell(3); - 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, 8);// 第二行标题 - CellRangeAddress c2 = new CellRangeAddress(page*20+2, page*20+2, 0, 9);// 第三行地址 - CellRangeAddress c3 = new CellRangeAddress(page*20+3, page*20+3, 0, 9);// 第四行电话 - - CellRangeAddress c4 = new CellRangeAddress(page*20+4, page*20+4, 0, 2);// 第5行 到货日期 - CellRangeAddress c42 = new CellRangeAddress(page*20+4, page*20+4, 3, 9);// 第5行预约单号 - CellRangeAddress c5 = new CellRangeAddress(page*20+5, page*20+5, 0, 2);// 第6行客户采购单号 - CellRangeAddress c52 = new CellRangeAddress(page*20+5, page*20+5, 3, 9);// 第6行月台 - CellRangeAddress c6 = new CellRangeAddress(page*20+6, page*20+6, 0, 2);// 第7行客户名称 - CellRangeAddress c62 = new CellRangeAddress(page*20+6, page*20+6, 3, 9);// 第7行车号 - CellRangeAddress c7 = new CellRangeAddress(page*20+7, page*20+7, 0, 2);//第7行客户电话 - CellRangeAddress c72 = new CellRangeAddress(page*20+7, page*20+7, 3, 9);//第7行打印时间 - sheet.addMergedRegion(c); - sheet.addMergedRegion(c1); - sheet.addMergedRegion(c2); - sheet.addMergedRegion(c3); - sheet.addMergedRegion(c4); - sheet.addMergedRegion(c5); - sheet.addMergedRegion(c6); - 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+0, page*20+19, 10, 10);//第7行打印时间 - sheet.addMergedRegion(c73); - - Row rowColumnName = sheet.createRow((short) page*20+8); // 列名 - String[] columnNames = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","体积cm³","备注" }; - if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ - String[] columnNamest = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","体积cm³","备注" }; - columnNames = columnNamest; - } - try{ - if("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))){ - String[] columnNames1 = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","体积cm³","备注" }; - if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ - String[] columnNamest1 = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","体积","备注" }; - columnNames1 = columnNamest1; - } - columnNames = columnNames1; - } - }catch ( Exception e){ - } - for (int i = 0; i < columnNames.length; i++) { - Cell cell = rowColumnName.createCell(i); - cell.setCellValue(columnNames[i]); - cell.setCellStyle(cs3); - } - - - int cellsNum = page*20+8; - int oversize = 0; - if(size==pagesize&&page==pagecount-1){ - oversize = 1; + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet sheet = wb.createSheet("货品ID"); + + sheet.setMargin(HSSFSheet.TopMargin,0.1);// 页边距(上) + sheet.setMargin(HSSFSheet.BottomMargin,0.1);// 页边距(下) + sheet.setMargin(HSSFSheet.LeftMargin,0.1);// 页边距(左) + sheet.setMargin(HSSFSheet.RightMargin,0.1);// 页边距(右 + sheet.setColumnWidth(0, 28 * 256); + sheet.setColumnWidth(1, 29 * 256); + sheet.setColumnWidth(2, 6 * 200); + + sheet.setColumnWidth(3, 14 * 256); + sheet.setColumnWidth(4, 14 * 256); + sheet.setColumnWidth(5, 6 * 256); + // sheet.setColumnWidth(6, 8 * 256); + // sheet.setColumnWidth(7, 8 * 256); + // sheet.setColumnWidth(8, 8 * 256); + // 画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) + HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); + // anchor主要用于设置图片的属性 + HSSFClientAnchor anchor = null; + + + + // 创建两种单元格格式 + CellStyle csh = wb.createCellStyle(); + CellStyle csh1 = wb.createCellStyle(); + CellStyle cs = wb.createCellStyle(); + CellStyle cs2 = wb.createCellStyle(); + CellStyle cs3 = wb.createCellStyle(); + CellStyle cs4 = wb.createCellStyle(); + CellStyle cs5 = wb.createCellStyle(); + // 创建两种字体 + Font f = wb.createFont(); + Font f2 = wb.createFont(); + Font fh = wb.createFont(); + fh.setFontHeightInPoints((short) 42); + fh.setColor(IndexedColors.BLACK.getIndex()); + fh.setBoldweight(Font.BOLDWEIGHT_BOLD); + Font fh1 = wb.createFont(); + fh1.setFontHeightInPoints((short) 32); + fh1.setColor(IndexedColors.BLACK.getIndex()); + fh1.setBoldweight(Font.BOLDWEIGHT_BOLD); + // 创建第一种字体样式(用于列名) + f.setFontHeightInPoints((short) 22); + 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()); + csh.setFont(fh); + csh.setBorderLeft(CellStyle.BORDER_NONE); + csh.setBorderRight(CellStyle.BORDER_NONE); + csh.setBorderTop(CellStyle.BORDER_NONE); + csh.setBorderBottom(CellStyle.BORDER_NONE); + csh.setAlignment(HSSFCellStyle.ALIGN_LEFT); + csh1.setFont(fh1); + csh1.setBorderLeft(CellStyle.BORDER_NONE); + csh1.setBorderRight(CellStyle.BORDER_NONE); + csh1.setBorderTop(CellStyle.BORDER_NONE); + csh1.setBorderBottom(CellStyle.BORDER_NONE); + csh1.setAlignment(HSSFCellStyle.ALIGN_LEFT); + // 设置第一种单元格的样式(用于列名) + 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_LEFT); + // 设置第二种单元格的样式(用于值) + 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.setAlignment(CellStyle.BORDER_HAIR); + cs4.setFont(f2); + cs4.setBorderTop(CellStyle.BORDER_MEDIUM); + cs4.setBorderBottom(CellStyle.BORDER_MEDIUM); + + cs5.setFont(f2); + cs5.setBorderLeft(CellStyle.BORDER_NONE); + cs5.setBorderRight(CellStyle.BORDER_NONE); + cs5.setBorderTop(CellStyle.BORDER_NONE); + cs5.setBorderBottom(CellStyle.BORDER_NONE); + cs5.setWrapText(true); + + int cellsNum = 0; + int pagesize = 1; + int page = 0; + short high = 600; + for (WmInQmIEntity wmInQmIEntity : wmImQmIEntityList) { + cellsNum++; + MvGoodsEntity goods = systemService.findUniqueByProperty( + MvGoodsEntity.class, "goodsCode", + wmInQmIEntity.getGoodsId()); + Row rowColumnValue = sheet.createRow((short) page*pagesize+cellsNum); // 列名 + rowColumnValue.setHeight((short) 1000); + Cell cell1 = rowColumnValue.createCell(0); + try { + cell1.setCellValue("库别:"+wmInQmIEntity.getBinId().substring(0,2)+" "+wmInQmIEntity.getQmOkQuat()+goods.getShlDanWei()); + + } catch (Exception e) { + // TODO: handle exception + } + cell1.setCellStyle(csh); + CellRangeAddress c0 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); + sheet.addMergedRegion(c0); + + cellsNum++; + Row rowColumnValue1 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 + rowColumnValue1.setHeight( (short) 1000); + Cell cell2 = rowColumnValue1.createCell(0); + + cell2.setCellValue( goods.getShpMingCheng()); + cell2.setCellStyle(csh1); + CellRangeAddress c2 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); + sheet.addMergedRegion(c2); + cellsNum++; + //插入图片 + try { + byteArrayOut = new ByteArrayOutputStream(); + try { + bufferImg = + ImageIO.read(BarcodeUtil.generateToStream(wmInQmIEntity.getBinId().substring(0,2))); + } catch (Exception e) { + // TODO: handle exception + } + + ImageIO.write(bufferImg, "jpg", byteArrayOut); + anchor = new HSSFClientAnchor(0, 0, 0, 0,(short)2, page*pagesize+cellsNum, + (short)5, page*pagesize+cellsNum+4); + patriarch.createPicture(anchor, + wb.addPicture(byteArrayOut.toByteArray(), + HSSFWorkbook.PICTURE_TYPE_JPEG)); + } catch (Exception e) { + // TODO: handle exception + } + Row rowColumnValue12 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 + rowColumnValue12.setHeight((short) 1000); + Cell cell13 = rowColumnValue12.createCell(0); + cell13.setCellValue(goods.getGoodsCode() ); + cell13.setCellStyle(cs); + CellRangeAddress c13 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); + sheet.addMergedRegion(c13); + cellsNum++; + + Row rowColumnValue2 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 + rowColumnValue2.setHeight(high); + Cell cell3 = rowColumnValue2.createCell(0); + cell3.setCellValue("生产日期:"+wmInQmIEntity.getProData() ); + cell3.setCellStyle(cs); + CellRangeAddress c3 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); + sheet.addMergedRegion(c3); + cellsNum++; + Row rowColumnValue3 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 + rowColumnValue3.setHeight(high); + Cell cell4 = rowColumnValue3.createCell(0); + try { + Calendar cal = Calendar.getInstance();//使用默认时区和语言环境获得一个日历。 + cal.setTime(DateUtils.str2Date(wmInQmIEntity.getProData(), DateUtils.date_sdf)); + cal.add(Calendar.DAY_OF_MONTH, Integer.parseInt(goods.getBzhiQi()));//取当前日期的后一天. + cell4.setCellValue("到期日期:"+ DateUtils.date2Str(cal.getTime(), DateUtils.date_sdf)); + } catch (Exception e) { + // TODO: handle exception + } + cell4.setCellStyle(cs); + CellRangeAddress c4 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); + sheet.addMergedRegion(c4); + cellsNum++; + Row rowColumnValue4 = sheet.createRow((short) page*pagesize+cellsNum); // 列名 + rowColumnValue4.setHeight(high); + Cell cell5 = rowColumnValue4.createCell(0); + cell5.setCellValue("进货日期:"+ DateUtils.date2Str(wmInQmIEntity.getCreateDate() , DateUtils.date_sdf) ); + cell5.setCellStyle(cs); + CellRangeAddress c5 = new CellRangeAddress( page*pagesize+cellsNum, page*pagesize+cellsNum, 0, 5); + sheet.addMergedRegion(c5); + + page++; } - for (int i = page*pagesize; i < (page+1)*pagesize + oversize; i++) { - if(i< size){ + fileOut = response.getOutputStream(); + HSSFPrintSetup printSetup = sheet.getPrintSetup(); + printSetup.setLandscape(true); + printSetup.setPaperSize(HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE); + wb.write(fileOut); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (fileOut != null) { + try { + fileOut.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } - cellsNum++; - Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 - rowColumnValue.setHeight((short) 250); + /** + * 打印进货通知 + * + * @return + */ - Cell cell1 = rowColumnValue.createCell(0); - cell1.setCellValue(cerconNo); - cell1.setCellStyle(cs51); - Cell cell2 = rowColumnValue.createCell(1); - cell2.setCellValue(result.get(i).get("goods_id") - .toString()); - cell2.setCellStyle(cs5); + @RequestMapping(params = "doPrint") + @ResponseBody + public void downReceiveExcel(WmImNoticeHEntity wmImNoticeH, + HttpServletRequest request, HttpServletResponse response) { + OutputStream fileOut = null; + BufferedImage bufferImg = null; +// String codedFileName = null; + wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, + wmImNoticeH.getId());// 获取抬头 + String hql0 = "from WmImNoticeIEntity where 1 = 1 AND imNoticeId = ? "; + List wmImNoticeIEntityList = systemService.findHql( + hql0, wmImNoticeH.getNoticeId());// 获取行项目 + // 先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray + try { +// StringBuffer sber = new StringBuffer(); - Cell cell3 = rowColumnValue.createCell(2); - cell3.setCellValue(result.get(i).get("shp_ming_cheng") - .toString()); - cell3.setCellStyle(cs5); + ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); + bufferImg = ImageIO.read(BarcodeUtil.generateToStream(wmImNoticeH + .getNoticeId())); + // 进行转码,使其支持中文文件名 +// codedFileName = java.net.URLEncoder.encode("中文", "UTF-8"); + response.setHeader("content-disposition", "attachment;filename=" + + wmImNoticeH.getNoticeId() + ".xls"); + ImageIO.write(bufferImg, "jpg", byteArrayOut); + + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet sheet = wb.createSheet("收货通知"); + sheet.setColumnWidth(0, 5 * 256); + sheet.setColumnWidth(1, 42 * 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, 8 * 256); + // 画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) + HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); + // anchor主要用于设置图片的属性 + HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, + (short) 3, 1, (short) 6, 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(); + CellStyle cs5 = 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); + + // 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.setAlignment(CellStyle.BORDER_HAIR); + cs4.setFont(f2); + cs4.setBorderTop(CellStyle.BORDER_MEDIUM); + cs4.setBorderBottom(CellStyle.BORDER_MEDIUM); + + cs5.setFont(f2); + cs5.setBorderLeft(CellStyle.BORDER_NONE); + cs5.setBorderRight(CellStyle.BORDER_NONE); + cs5.setBorderTop(CellStyle.BORDER_NONE); + cs5.setBorderBottom(CellStyle.BORDER_NONE); + cs5.setWrapText(true); + + Row row1 = sheet.createRow((short) 1); // 第二行标题 + row1.setHeight((short) 700); + Cell cellTitle = row1.createCell(0); + cellTitle.setCellValue("收货通知"); + cellTitle.setCellStyle(cs); + + Row rowHead1 = sheet.createRow((short) 2); // 头部第一行 + Cell cellHead11 = rowHead1.createCell(0); + cellHead11.setCellValue("通知单号:" + wmImNoticeH.getNoticeId()); + cellHead11.setCellStyle(cs2); + + Row rowHead2 = sheet.createRow((short) 3); // 头部第二行 + Cell cellHead21 = rowHead2.createCell(0); + try { + MdCusEntity md = systemService.findUniqueByProperty( + MdCusEntity.class, "keHuBianMa", + wmImNoticeH.getCusCode()); + if (md != null) { + cellHead21.setCellValue("客户:" + wmImNoticeH.getCusCode() + + "-" + md.getZhongWenQch()); + } else { + cellHead21.setCellValue("客户:" + wmImNoticeH.getCusCode()); + } + } finally { + + } + + cellHead21.setCellStyle(cs2); + + Cell cellHead23 = rowHead2.createCell(2); + cellHead23.setCellValue(" 计划送货时间:" + wmImNoticeH.getImData()); + cellHead23.setCellStyle(cs2); + + Row rowHead3 = sheet.createRow((short) 4); // 头部第三行 + Cell cellHead31 = rowHead3.createCell(0); + cellHead31.setCellValue("司机:" + wmImNoticeH.getImCarDri() + + " 司机电话:" + wmImNoticeH.getImCarMobile()); + cellHead31.setCellStyle(cs2); + + Cell cellHead35 = rowHead3.createCell(2); + cellHead35.setCellValue("车号:" + wmImNoticeH.getImCarNo() + " 备注:" + + wmImNoticeH.getImBeizhu()); + cellHead35.setCellStyle(cs2); + + // 合并单元格 + CellRangeAddress c = new CellRangeAddress(0, 0, 0, 8); // 第一行空白 + CellRangeAddress c0 = new CellRangeAddress(1, 1, 0, 5);// 第二行标题 + CellRangeAddress c1 = new CellRangeAddress(2, 2, 0, 8);// 第三行通知单号 + CellRangeAddress c2 = new CellRangeAddress(3, 3, 0, 1);// 第四行客户 + CellRangeAddress c3 = new CellRangeAddress(3, 3, 2, 5);// 第四行客户送货时间 + CellRangeAddress c4 = new CellRangeAddress(4, 4, 0, 1);// 第五行客户 + CellRangeAddress c5 = new CellRangeAddress(4, 4, 2, 5);// 第五行客户送货时间 + // 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) 5); // 列名 + String[] columnNames = { "序号", "商品详情", "数量", "体积cm³", "重量KG", + "TiHi" }; + + for (int i = 0; i < columnNames.length; i++) { + Cell cell = rowColumnName.createCell(i); + cell.setCellValue(columnNames[i]); + cell.setCellStyle(cs3); + } + int cellsNum = 5; + int cerconNo = 1; + for (int i = 0; i < wmImNoticeIEntityList.size(); i++) { + WmImNoticeIEntity entity = wmImNoticeIEntityList.get(i); + cellsNum++; + Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 + rowColumnValue.setHeight((short) 1000); + Cell cell1 = rowColumnValue.createCell(0); + cell1.setCellValue(cerconNo); + cell1.setCellStyle(cs4); + Cell cell2 = rowColumnValue.createCell(1); + + Cell cell6 = rowColumnValue.createCell(5); + cell6.setCellStyle(cs3); + try { + MvGoodsEntity goods = systemService.findUniqueByProperty( + MvGoodsEntity.class, "goodsCode", + entity.getGoodsCode()); + if (goods != null) { + cell2.setCellValue(new HSSFRichTextString(goods + .getGoodsName())); + cell2.setCellStyle(cs3); + + cell6.setCellValue(goods.getMpDanCeng() + "*" + + goods.getMpCengGao()); + } + } finally { + + } + Cell cell3 = rowColumnValue.createCell(2); + cell3.setCellValue(entity.getGoodsCount()); + cell3.setCellStyle(cs4); + + Cell cell4 = rowColumnValue.createCell(3); + cell4.setCellValue(entity.getGoodsFvol()); + cell4.setCellStyle(cs4); + Cell cell5 = rowColumnValue.createCell(4); + cell5.setCellValue(entity.getGoodsWeight()); + cell5.setCellStyle(cs4); + + + cerconNo++; + } + Row rowColumnInfo = sheet.createRow((short) 2 + cellsNum); // 列名 + rowColumnInfo.createCell(0).setCellValue( + "注:烦请按时送到"+ ResourceUtil.getConfigByName("comaddr")+" 谢谢!"); + CellRangeAddress c15 = new CellRangeAddress(10 + cellsNum, + 10 + cellsNum, 0, 15); + sheet.addMergedRegion(c15); + fileOut = response.getOutputStream(); + wb.write(fileOut); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (fileOut != null) { + try { + fileOut.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + @RequestMapping(params = "doPrintysd") + @ResponseBody + public void downReceiveExcelysd(WmImNoticeHEntity wmImNoticeH, + HttpServletRequest request, HttpServletResponse response) { + OutputStream fileOut = null; + BufferedImage bufferImg = null; +// String codedFileName = null; + wmImNoticeH = systemService.getEntity(WmImNoticeHEntity.class, + wmImNoticeH.getId());// 获取抬头 + + // 先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray + try { +// StringBuffer sber = new StringBuffer(); + + ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); +// bufferImg = ImageIO.read(BarcodeUtil.generateToStream(wmImNoticeH +// .getNoticeId())); + bufferImg = QRcodeUtil.createImage(wmImNoticeH + .getNoticeId()); + + // 进行转码,使其支持中文文件名 +// codedFileName = java.net.URLEncoder.encode("中文", "UTF-8"); + response.setHeader("content-disposition", "attachment;filename=" + + wmImNoticeH.getNoticeId() + "验收单.xls"); + ImageIO.write(bufferImg, "jpg", byteArrayOut); + + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet sheet = wb.createSheet(wmImNoticeH.getNoticeId()); + sheet.setMargin(HSSFSheet.TopMargin,0.1);// 页边距(上) + sheet.setMargin(HSSFSheet.BottomMargin,0.1);// 页边距(下) + 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); + sheet.setColumnWidth(3, 11 * 256); + sheet.setColumnWidth(4, 5 * 256); + sheet.setColumnWidth(5, 5 * 256); + sheet.setColumnWidth(6, 7 * 256); + sheet.setColumnWidth(7, 7 * 256); + 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(); + CellStyle cs1 = wb.createCellStyle(); + CellStyle cs2 = wb.createCellStyle(); + CellStyle cs3 = wb.createCellStyle(); + CellStyle cs4 = wb.createCellStyle(); + CellStyle cs5 = wb.createCellStyle(); + CellStyle cs5r = wb.createCellStyle(); + + CellStyle cs51 = wb.createCellStyle(); + CellStyle cs52 = wb.createCellStyle(); + // 创建两种字体 + Font f = wb.createFont(); + Font f2 = wb.createFont(); + Font f5 = 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()); + + + f5.setFontHeightInPoints((short) 8); + f5.setColor(IndexedColors.BLACK.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); + + cs1.setFont(f2); + cs1.setBorderLeft(CellStyle.BORDER_NONE); + cs1.setBorderRight(CellStyle.BORDER_NONE); + cs1.setBorderTop(CellStyle.BORDER_NONE); + cs1.setBorderBottom(CellStyle.BORDER_NONE); + cs1.setAlignment(HSSFCellStyle.ALIGN_CENTER); + + cs1.setWrapText(true); + // 设置第二种单元格的样式(用于值) + 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.setAlignment(CellStyle.BORDER_HAIR); + cs4.setFont(f2); + cs4.setBorderTop(CellStyle.BORDER_MEDIUM); + cs4.setBorderBottom(CellStyle.BORDER_MEDIUM); + + cs5.setFont(f2); + cs5.setBorderLeft(CellStyle.BORDER_THIN); + cs5.setBorderRight(CellStyle.BORDER_THIN); + cs5.setBorderTop(CellStyle.BORDER_THIN); + cs5.setBorderBottom(CellStyle.BORDER_THIN); + cs5.setWrapText(true); + + + cs5r.setFont(f2); + cs5r.setBorderLeft(CellStyle.BORDER_THIN); + cs5r.setBorderRight(CellStyle.BORDER_THIN); + cs5r.setBorderTop(CellStyle.BORDER_THIN); + cs5r.setBorderBottom(CellStyle.BORDER_THIN); + cs5r.setWrapText(true); + cs5r.setAlignment(CellStyle.ALIGN_RIGHT); + + + + cs51.setFont(f2); + cs51.setBorderLeft(CellStyle.BORDER_THIN); + cs51.setBorderRight(CellStyle.BORDER_THIN); + cs51.setBorderTop(CellStyle.BORDER_THIN); + cs51.setBorderBottom(CellStyle.BORDER_THIN); + cs51.setAlignment(HSSFCellStyle.ALIGN_CENTER); + + cs51.setWrapText(true); + + cs52.setFont(f5); + cs52.setBorderLeft(CellStyle.BORDER_NONE); + cs52.setBorderRight(CellStyle.BORDER_NONE); + cs52.setBorderTop(CellStyle.BORDER_NONE); + cs52.setBorderBottom(CellStyle.BORDER_NONE); + cs52.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP); + + cs52.setWrapText(true); + cs52.setRotation((short)255); + + int page = 0; + int cerconNo = 1; + String tsql = "SELECT wq.pro_data,wq.goods_unit,wq.rec_deg, mg.shp_gui_ge ,mg.goods_code, mg.goods_id,mg.shp_ming_cheng," + + "cast(sum(wq.qm_ok_quat) as signed) as goods_count,truncate(sum(wq.tin_tj),2) tin_tj ,truncate(sum(wq.tin_zhl),2) as tin_zhl,count(*) as tuopan " + + "FROM wm_in_qm_i wq,mv_goods mg where wq.im_notice_id = ? and wq.goods_id = mg.goods_code group by wq.im_notice_id, mg.goods_code,wq.pro_data"; + List> result = systemService + .findForJdbc(tsql, wmImNoticeH.getNoticeId()); + + + int size = result.size(); + int pagesize = 10; + int pagecount = size%pagesize==0?size/pagesize:size/pagesize+1; + double sum = 0; + double sumzl = 0; + do { + + // 画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) + HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); + // anchor主要用于设置图片的属性 + HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, + (short) 8, page*20+1, (short) 10, page*20+5); + anchor.setAnchorType(2); + // 插入图片 + patriarch + .createPicture(anchor, wb.addPicture( + byteArrayOut.toByteArray(), + HSSFWorkbook.PICTURE_TYPE_JPEG)); + + // 创建第一行 + Row row = sheet.createRow((short) page*20+0); // 第一行空白 + + + Row row1 = sheet.createRow((short) page*20+1); // 第二行标题 + row1.setHeight((short) 700); + Cell cellTitle = row1.createCell(0); + if(wmImNoticeH.getOrderTypeCode().equals("03")){ + cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"退货验收单"); + }else if(wmImNoticeH.getOrderTypeCode().equals("01")){ + cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"收货验收单"); + }else if(wmImNoticeH.getOrderTypeCode().equals("04")){ + cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"越库单"); + }else if(wmImNoticeH.getOrderTypeCode().equals("09")){ + 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("到货日期: " + wmImNoticeH.getImData() !=null ?DateUtils.date2Str(wmImNoticeH.getImData(), DateUtils.date_sdf) :"" ); + cellHead4.setCellStyle(cs2); + + Cell cellHead42 = rowHead4.createCell(3); + cellHead42.setCellValue("预约单号: " +wmImNoticeH.getNoticeId()); + cellHead42.setCellStyle(cs2); + + Row rowHead5 = sheet.createRow((short) page*20+5); // 头部第二行 + Cell cellHead5 = rowHead5.createCell(0); + cellHead5.setCellValue("客户采购单号: "+wmImNoticeH.getImCusCode() ); + cellHead5.setCellStyle(cs2); + + Cell cellHead52 = rowHead5.createCell(3); + BaStoreEntity baStoreEntity = systemService.findUniqueByProperty(BaStoreEntity.class,"storeCode",wmImNoticeH.getStoreCode()); + if (baStoreEntity != null && StringUtils.isNotEmpty(baStoreEntity.getStoreCode())) { + cellHead52.setCellValue("仓库: " +baStoreEntity.getStoreName()); + }else { + cellHead52.setCellValue("仓库: "); + } + //cellHead52.setCellValue("月台: " +(StringUtils.isEmpty(wmImNoticeH.getPlatformCode())?"":wmImNoticeH.getPlatformCode())); + cellHead52.setCellStyle(cs2); + + Row rowHead6 = sheet.createRow((short) page*20+6); // 头部第二行 + Cell cellHead6 = rowHead6.createCell(0); + MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmImNoticeH.getCusCode()); + + cellHead6.setCellValue("客户名称: " +wmImNoticeH.getCusCode()+md.getZhongWenQch()); + cellHead6.setCellStyle(cs2); + + Cell cellHead62 = rowHead6.createCell(3); + cellHead62.setCellValue("供应商/车号: "+wmImNoticeH.getImCarNo() ); + cellHead62.setCellStyle(cs2); + + Row rowHead7 = sheet.createRow((short) page*20+7); // 头部第二行 + Cell cellHead7 = rowHead7.createCell(0); + cellHead7.setCellValue("客户电话: " +md.getDianHua()); + cellHead7.setCellStyle(cs2); + + Cell cellHead72 = rowHead7.createCell(3); + 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, 8);// 第二行标题 + CellRangeAddress c2 = new CellRangeAddress(page*20+2, page*20+2, 0, 9);// 第三行地址 + CellRangeAddress c3 = new CellRangeAddress(page*20+3, page*20+3, 0, 9);// 第四行电话 + + CellRangeAddress c4 = new CellRangeAddress(page*20+4, page*20+4, 0, 2);// 第5行 到货日期 + CellRangeAddress c42 = new CellRangeAddress(page*20+4, page*20+4, 3, 9);// 第5行预约单号 + CellRangeAddress c5 = new CellRangeAddress(page*20+5, page*20+5, 0, 2);// 第6行客户采购单号 + CellRangeAddress c52 = new CellRangeAddress(page*20+5, page*20+5, 3, 9);// 第6行月台 + CellRangeAddress c6 = new CellRangeAddress(page*20+6, page*20+6, 0, 2);// 第7行客户名称 + CellRangeAddress c62 = new CellRangeAddress(page*20+6, page*20+6, 3, 9);// 第7行车号 + CellRangeAddress c7 = new CellRangeAddress(page*20+7, page*20+7, 0, 2);//第7行客户电话 + CellRangeAddress c72 = new CellRangeAddress(page*20+7, page*20+7, 3, 9);//第7行打印时间 + sheet.addMergedRegion(c); + sheet.addMergedRegion(c1); + sheet.addMergedRegion(c2); + sheet.addMergedRegion(c3); + sheet.addMergedRegion(c4); + sheet.addMergedRegion(c5); + sheet.addMergedRegion(c6); + 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+0, page*20+19, 10, 10);//第7行打印时间 + sheet.addMergedRegion(c73); + + Row rowColumnName = sheet.createRow((short) page*20+8); // 列名 + String[] columnNames = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","规格","备注" }; + if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ + String[] columnNamest = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","规格","备注" }; + columnNames = columnNamest; + } + try{ + if("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))){ + String[] columnNames1 = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","规格","备注" }; + if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ + String[] columnNamest1 = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","规格","备注" }; + columnNames1 = columnNamest1; + } + columnNames = columnNames1; + } + }catch ( Exception e){ + } + for (int i = 0; i < columnNames.length; i++) { + Cell cell = rowColumnName.createCell(i); + cell.setCellValue(columnNames[i]); + cell.setCellStyle(cs3); + } + + + int cellsNum = page*20+8; + int oversize = 0; + if(size==pagesize&&page==pagecount-1){ + oversize = 1; + } + for (int i = page*pagesize; i < (page+1)*pagesize + oversize; i++) { + if(i< size){ + + cellsNum++; + Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 + rowColumnValue.setHeight((short) 250); + + Cell cell1 = rowColumnValue.createCell(0); + cell1.setCellValue(cerconNo); + cell1.setCellStyle(cs51); + Cell cell2 = rowColumnValue.createCell(1); + cell2.setCellValue(result.get(i).get("goods_id") + .toString()); + cell2.setCellStyle(cs5); + + Cell cell3 = rowColumnValue.createCell(2); + cell3.setCellValue(result.get(i).get("shp_ming_cheng") + .toString()); + cell3.setCellStyle(cs5); try { - Cell cell4 = rowColumnValue.createCell(3);// 生产日期 + Cell cell4 = rowColumnValue.createCell(3);// 生产日期 - cell4.setCellStyle(cs5r); - cell4.setCellValue(result.get(i).get("pro_data") - .toString()); + cell4.setCellStyle(cs5r); + cell4.setCellValue(result.get(i).get("pro_data") + .toString()); - } catch (Exception e) { - // TODO: handle exception + } catch (Exception e) { + // TODO: handle exception - } + } - try { - Cell cell5 = rowColumnValue.createCell(4);// 温度 + try { + Cell cell5 = rowColumnValue.createCell(4);// 温度 - cell5.setCellStyle(cs5); + cell5.setCellStyle(cs5); + cell5.setCellValue(""); // cell5.setCellValue(result.get(i) // .get("rec_deg").toString()); - cell5.setCellValue(""); - } catch (Exception e) { - // TODO: handle exception - } + } catch (Exception e) { + // TODO: handle exception + } - try { - Cell cell6 = rowColumnValue.createCell(5);// 单位 + try { + Cell cell6 = rowColumnValue.createCell(5);// 单位 - cell6.setCellStyle(cs5); - cell6.setCellValue(result.get(i).get("goods_unit") - .toString()); - } catch (Exception e) { - // TODO: handle exception - } + cell6.setCellStyle(cs5); + cell6.setCellValue(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()); - Cell cell7 = rowColumnValue.createCell(6);// 数量 + try { + sum = sum + Double.parseDouble(result.get(i).get("goods_count") + .toString()); + Cell cell7 = rowColumnValue.createCell(6);// 数量 - cell7.setCellStyle(cs5); - cell7.setCellValue(result.get(i).get("goods_count") - .toString()); - } catch (Exception e) { - // TODO: handle exception - } + cell7.setCellStyle(cs5); + cell7.setCellValue(result.get(i).get("goods_count") + .toString()); + } catch (Exception e) { + // TODO: handle exception + } - try { - Cell cell8 = rowColumnValue.createCell(7);// 毛重 - sumzl = sumzl + Double.parseDouble(result.get(i).get("tin_zhl") - .toString()); - cell8.setCellStyle(cs5); - cell8.setCellValue(result.get(i).get("tin_zhl") - .toString()); - } catch (Exception e) { - // TODO: handle exception - } - try { + try { + Cell cell8 = rowColumnValue.createCell(7);// 毛重 + sumzl = sumzl + Double.parseDouble(result.get(i).get("tin_zhl") + .toString()); + cell8.setCellStyle(cs5); + cell8.setCellValue(result.get(i).get("tin_zhl") + .toString()); + } catch (Exception e) { + // TODO: handle exception + } + try { - Cell cell9 = rowColumnValue.createCell(8);// 体积 + Cell cell9 = rowColumnValue.createCell(8);// 体积 - cell9.setCellStyle(cs5); - cell9.setCellValue(result.get(i).get("tin_tj") - .toString()); + cell9.setCellValue(result.get(i).get("shp_gui_ge").toString()); + cell9.setCellStyle(cs5); // if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ // cell9.setCellValue(result.get(i).get("tuopan") // .toString()); @@ -1984,428 +1526,921 @@ public class WmImNoticeHController extends BaseController { // } - } catch (Exception e) { - // TODO: handle exception - } + } catch (Exception e) { + // TODO: handle exception + } - Cell cell10 = rowColumnValue.createCell(9);// 备注 - try{ - if("hr".equals(ResourceUtil.getConfigByName("wm.rkd"))) { - try{ + Cell cell10 = rowColumnValue.createCell(9);// 备注 + try{ + if("hr".equals(ResourceUtil.getConfigByName("wm.rkd"))) { + try{ // cell10.setCellValue(wmUtil.getstock(result.get(i).get("goods_id").toString())); - }catch (Exception e){ + }catch (Exception e){ - } - } - }catch (Exception e){ + } + } + }catch (Exception e){ - } - cell10.setCellStyle(cs5); + } + cell10.setCellStyle(cs5); - cerconNo++; - } - if(i== size){ + cerconNo++; + } + if(i== size){ - cellsNum++; - Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 - rowColumnValue.setHeight((short) 250); - Cell cell6 = rowColumnValue.createCell(6);// 备注 - cell6.setCellValue(Double.toString(sum)); - Cell cell7 = rowColumnValue.createCell(7);// 重量 - cell7.setCellValue(Double.toString(sumzl)); + cellsNum++; + Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 + rowColumnValue.setHeight((short) 250); + Cell cell6 = rowColumnValue.createCell(6);// 备注 + cell6.setCellValue(Double.toString(sum)); + Cell cell7 = rowColumnValue.createCell(7);// 重量 + cell7.setCellValue(Double.toString(sumzl)); // cell6.setCellStyle(cs5); - Cell cell0 = rowColumnValue.createCell(0);// 合计 - cell0.setCellValue("合计:"); + Cell cell0 = rowColumnValue.createCell(0);// 合计 + cell0.setCellValue("合计:"); // cell0.setCellStyle(cs5); - CellRangeAddress c15 = new CellRangeAddress( cellsNum, - cellsNum, 0, 5); - sheet.addMergedRegion(c15); - cerconNo++; + CellRangeAddress c15 = new CellRangeAddress( cellsNum, + cellsNum, 0, 5); + sheet.addMergedRegion(c15); + cerconNo++; - } + } - } - Row rowColumnInfo = sheet.createRow((short) 1 + cellsNum); // 列名 - rowColumnInfo.setHeight((short) 250); - rowColumnInfo.createCell(0).setCellValue( - "仓管: 制单: 仓库主管: 叉车司机"); - CellRangeAddress c15 = new CellRangeAddress(1 + cellsNum, - 1 + cellsNum, 0, 9); - sheet.addMergedRegion(c15); - page++; - } while (page> result = systemService + .findForJdbc(tsql, wmImNoticeH.getNoticeId()); + + + int size = result.size(); + int pagesize = 10; + int pagecount = size%pagesize==0?size/pagesize:size/pagesize+1; + double sum = 0; + double sumzl = 0; + do { + + // 画图的顶级管理器,一个sheet只能获取一个(一定要注意这点) + HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); + // anchor主要用于设置图片的属性 + HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, + (short) 8, page*20+1, (short) 10, page*20+5); + anchor.setAnchorType(2); + // 插入图片 + patriarch + .createPicture(anchor, wb.addPicture( + byteArrayOut.toByteArray(), + HSSFWorkbook.PICTURE_TYPE_JPEG)); + + // 创建第一行 + Row row = sheet.createRow((short) page*20+0); // 第一行空白 + + + Row row1 = sheet.createRow((short) page*20+1); // 第二行标题 + row1.setHeight((short) 700); + Cell cellTitle = row1.createCell(0); + if(wmImNoticeH.getOrderTypeCode().equals("03")){ + cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"退货入库单"); + }else if(wmImNoticeH.getOrderTypeCode().equals("01")){ + cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"收货入库单"); + }else if(wmImNoticeH.getOrderTypeCode().equals("04")){ + cellTitle.setCellValue(ResourceUtil.getConfigByName("comname")+"越库单"); + }else if(wmImNoticeH.getOrderTypeCode().equals("09")){ + 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("到货日期: " + wmImNoticeH.getImData() != null ? DateUtils.date2Str(wmImNoticeH.getImData(), DateUtils.date_sdf):"" ); + cellHead4.setCellStyle(cs2); + + Cell cellHead42 = rowHead4.createCell(3); + cellHead42.setCellValue("预约单号: " +wmImNoticeH.getNoticeId()); + cellHead42.setCellStyle(cs2); + + Row rowHead5 = sheet.createRow((short) page*20+5); // 头部第二行 + Cell cellHead5 = rowHead5.createCell(0); + cellHead5.setCellValue("客户采购单号: "+wmImNoticeH.getImCusCode() ); + cellHead5.setCellStyle(cs2); + + Cell cellHead52 = rowHead5.createCell(3); + BaStoreEntity baStoreEntity = systemService.findUniqueByProperty(BaStoreEntity.class,"storeCode",wmImNoticeH.getStoreCode()); + if (baStoreEntity != null && StringUtils.isNotEmpty(baStoreEntity.getStoreCode())) { + cellHead52.setCellValue("仓库: " +baStoreEntity.getStoreName()); + }else { + cellHead52.setCellValue("仓库: "); + } + // cellHead52.setCellValue("月台: " +(StringUtils.isEmpty(wmImNoticeH.getPlatformCode())?"":wmImNoticeH.getPlatformCode())); + cellHead52.setCellStyle(cs2); + + Row rowHead6 = sheet.createRow((short) page*20+6); // 头部第二行 + Cell cellHead6 = rowHead6.createCell(0); + MdCusEntity md = systemService.findUniqueByProperty(MdCusEntity.class, "keHuBianMa", wmImNoticeH.getCusCode()); + + cellHead6.setCellValue("货主: " +wmImNoticeH.getCusCode()+md.getZhongWenQch()); + cellHead6.setCellStyle(cs2); + + Cell cellHead62 = rowHead6.createCell(3); + cellHead62.setCellValue("供应商/车号: "+wmImNoticeH.getImCarNo() ); + cellHead62.setCellStyle(cs2); + + Row rowHead7 = sheet.createRow((short) page*20+7); // 头部第二行 + Cell cellHead7 = rowHead7.createCell(0); + cellHead7.setCellValue("客户电话: " +md.getDianHua()); + cellHead7.setCellStyle(cs2); + + Cell cellHead72 = rowHead7.createCell(3); + 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, 8);// 第二行标题 + CellRangeAddress c2 = new CellRangeAddress(page*20+2, page*20+2, 0, 9);// 第三行地址 + CellRangeAddress c3 = new CellRangeAddress(page*20+3, page*20+3, 0, 9);// 第四行电话 + + CellRangeAddress c4 = new CellRangeAddress(page*20+4, page*20+4, 0, 2);// 第5行 到货日期 + CellRangeAddress c42 = new CellRangeAddress(page*20+4, page*20+4, 3, 9);// 第5行预约单号 + CellRangeAddress c5 = new CellRangeAddress(page*20+5, page*20+5, 0, 2);// 第6行客户采购单号 + CellRangeAddress c52 = new CellRangeAddress(page*20+5, page*20+5, 3, 9);// 第6行月台 + CellRangeAddress c6 = new CellRangeAddress(page*20+6, page*20+6, 0, 2);// 第7行客户名称 + CellRangeAddress c62 = new CellRangeAddress(page*20+6, page*20+6, 3, 9);// 第7行车号 + CellRangeAddress c7 = new CellRangeAddress(page*20+7, page*20+7, 0, 2);//第7行客户电话 + CellRangeAddress c72 = new CellRangeAddress(page*20+7, page*20+7, 3, 9);//第7行打印时间 + sheet.addMergedRegion(c); + sheet.addMergedRegion(c1); + sheet.addMergedRegion(c2); + sheet.addMergedRegion(c3); + sheet.addMergedRegion(c4); + sheet.addMergedRegion(c5); + sheet.addMergedRegion(c6); + 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+0, page*20+19, 10, 10);//第7行打印时间 + sheet.addMergedRegion(c73); + + Row rowColumnName = sheet.createRow((short) page*20+8); // 列名 + String[] columnNames = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","体积cm³","备注" }; + if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ + String[] columnNamest = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","体积cm³","备注" }; + columnNames = columnNamest; + } + try{ + if("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))){ + String[] columnNames1 = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","体积cm³","备注" }; + if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ + String[] columnNamest1 = { "序号", "商品编码", "商品名称", "生产日期", "生产批号","单位", "数量", "毛重KG","体积","备注" }; + columnNames1 = columnNamest1; + } + columnNames = columnNames1; + } + }catch ( Exception e){ + } + for (int i = 0; i < columnNames.length; i++) { + Cell cell = rowColumnName.createCell(i); + cell.setCellValue(columnNames[i]); + cell.setCellStyle(cs3); + } + + + int cellsNum = page*20+8; + int oversize = 0; + if(size==pagesize&&page==pagecount-1){ + oversize = 1; + } + for (int i = page*pagesize; i < (page+1)*pagesize + oversize; i++) { + if(i< size){ + + cellsNum++; + Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 + rowColumnValue.setHeight((short) 250); + + Cell cell1 = rowColumnValue.createCell(0); + cell1.setCellValue(cerconNo); + cell1.setCellStyle(cs51); + Cell cell2 = rowColumnValue.createCell(1); + cell2.setCellValue(result.get(i).get("goods_id") + .toString()); + cell2.setCellStyle(cs5); + + Cell cell3 = rowColumnValue.createCell(2); + cell3.setCellValue(result.get(i).get("shp_ming_cheng") + .toString()); + cell3.setCellStyle(cs5); + try { + Cell cell4 = rowColumnValue.createCell(3);// 生产日期 + + cell4.setCellStyle(cs5r); + cell4.setCellValue(result.get(i).get("pro_data") + .toString()); + + } catch (Exception e) { + // TODO: handle exception + + } + + try { + Cell cell5 = rowColumnValue.createCell(4);// 温度 + + cell5.setCellStyle(cs5); +// cell5.setCellValue(result.get(i) +// .get("rec_deg").toString()); + cell5.setCellValue(""); + } catch (Exception e) { + // TODO: handle exception + } + + try { + Cell cell6 = rowColumnValue.createCell(5);// 单位 + + cell6.setCellStyle(cs5); + cell6.setCellValue(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()); + Cell cell7 = rowColumnValue.createCell(6);// 数量 + + cell7.setCellStyle(cs5); + cell7.setCellValue(result.get(i).get("goods_count") + .toString()); + } catch (Exception e) { + // TODO: handle exception + } + + try { + Cell cell8 = rowColumnValue.createCell(7);// 毛重 + sumzl = sumzl + Double.parseDouble(result.get(i).get("tin_zhl") + .toString()); + cell8.setCellStyle(cs5); + cell8.setCellValue(result.get(i).get("tin_zhl") + .toString()); + } catch (Exception e) { + // TODO: handle exception + } + try { + + Cell cell9 = rowColumnValue.createCell(8);// 体积 + + cell9.setCellStyle(cs5); + cell9.setCellValue(result.get(i).get("tin_tj") + .toString()); +// if(ResourceUtil.getConfigByName("systuopan").equals("yes")){ +// cell9.setCellValue(result.get(i).get("tuopan") +// .toString()); +// }else{ +// cell9.setCellValue(result.get(i).get("tin_tj") +// .toString()); +// } + + + } catch (Exception e) { + // TODO: handle exception + } + + + Cell cell10 = rowColumnValue.createCell(9);// 备注 + try{ + if("hr".equals(ResourceUtil.getConfigByName("wm.rkd"))) { + try{ +// cell10.setCellValue(wmUtil.getstock(result.get(i).get("goods_id").toString())); + }catch (Exception e){ + + } + } + }catch (Exception e){ + + } + cell10.setCellStyle(cs5); + + cerconNo++; + } + if(i== size){ + + cellsNum++; + Row rowColumnValue = sheet.createRow((short) cellsNum); // 列名 + rowColumnValue.setHeight((short) 250); + Cell cell6 = rowColumnValue.createCell(6);// 备注 + cell6.setCellValue(Double.toString(sum)); + Cell cell7 = rowColumnValue.createCell(7);// 重量 + cell7.setCellValue(Double.toString(sumzl)); +// cell6.setCellStyle(cs5); + Cell cell0 = rowColumnValue.createCell(0);// 合计 + cell0.setCellValue("合计:"); +// cell0.setCellStyle(cs5); + CellRangeAddress c15 = new CellRangeAddress( cellsNum, + cellsNum, 0, 5); + sheet.addMergedRegion(c15); + cerconNo++; + + } + + + } + Row rowColumnInfo = sheet.createRow((short) 1 + cellsNum); // 列名 + rowColumnInfo.setHeight((short) 250); + rowColumnInfo.createCell(0).setCellValue( + "仓管: 制单: 仓库主管: 叉车司机"); + CellRangeAddress c15 = new CellRangeAddress(1 + cellsNum, + 1 + cellsNum, 0, 9); + sheet.addMergedRegion(c15); + page++; + } while (page listitem = new ArrayList<>(); + BaStoreEntity baStoreEntity = systemService.findUniqueByProperty(BaStoreEntity.class,"storeCode",wmImNoticeH.getStoreCode()); + if (baStoreEntity != null && StringUtils.isNotEmpty(baStoreEntity.getStoreCode())) { + printHeader.setHeader16("仓库: " +baStoreEntity.getStoreName()); + }else { + printHeader.setHeader16("仓库: "); + } - 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> result = systemService - .findForJdbc(tsql, wmImNoticeH.getNoticeId()); + List listitem = new ArrayList<>(); -Double sum =0.00; - Double sumzl = 0.00; - int cerconNo = 0; + 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> result = systemService + .findForJdbc(tsql, wmImNoticeH.getNoticeId()); - for (int i = 0; i < result.size(); i++) { - PrintItem printItem = new PrintItem(); - cerconNo++; - printItem.setItem20(Integer.toString(cerconNo)); - 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 { + Double sum =0.00; + Double sumzl = 0.00; + int cerconNo = 0; - 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()); + for (int i = 0; i < result.size(); i++) { + PrintItem printItem = new PrintItem(); + cerconNo++; + printItem.setItem20(Integer.toString(cerconNo)); + 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.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 - } + 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()); - listitem.add(printItem); - } + 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 + } - printHeader.setHeader12(sum.toString()); - printHeader.setHeader13(sumzl.toString()); - request.setAttribute("printHeader", printHeader); + listitem.add(printItem); + } - request.setAttribute("listitem", listitem); + printHeader.setHeader12(sum.toString()); + printHeader.setHeader13(sumzl.toString()); + request.setAttribute("printHeader", printHeader); - return new ModelAndView("com/zzjee/wm/print/imnoticerkd-print"); - } + request.setAttribute("listitem", listitem); + + return new ModelAndView("com/zzjee/wm/print/imnoticerkd-print"); + } //打印的接口改造结束在线打印非EXCEL - /** - * 批量删除进货通知抬头 - * - * @return - */ - @RequestMapping(params = "doBatchDel") - @ResponseBody - public AjaxJson doBatchDel(String ids, HttpServletRequest request) { - AjaxJson j = new AjaxJson(); - String message = "进货通知删除成功"; - try { - for (String id : ids.split(",")) { - WmImNoticeHEntity wmImNoticeH = systemService.getEntity( - WmImNoticeHEntity.class, id); - WmPlatIoEntity wmPlatIo = systemService.findUniqueByProperty( - // 删除月台计划 - WmPlatIoEntity.class, "docId", - wmImNoticeH.getNoticeId()); - if (wmPlatIo != null) { - systemService.delete(wmPlatIo); - } - wmImNoticeH.setImSta(Constants.wm_sta3); - wmImNoticeHService.saveOrUpdate(wmImNoticeH); - systemService.addLog(message, Globals.Log_Type_DEL, - Globals.Log_Leavel_INFO); - } - } catch (Exception e) { - e.printStackTrace(); - message = "进货通知删除失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } + /** + * 批量删除进货通知抬头 + * + * @return + */ + @RequestMapping(params = "doBatchDel") + @ResponseBody + public AjaxJson doBatchDel(String ids, HttpServletRequest request) { + AjaxJson j = new AjaxJson(); + String message = "进货通知删除成功"; + try { + for (String id : ids.split(",")) { + WmImNoticeHEntity wmImNoticeH = systemService.getEntity( + WmImNoticeHEntity.class, id); + WmPlatIoEntity wmPlatIo = systemService.findUniqueByProperty( + // 删除月台计划 + WmPlatIoEntity.class, "docId", + wmImNoticeH.getNoticeId()); + if (wmPlatIo != null) { + systemService.delete(wmPlatIo); + } + wmImNoticeH.setImSta(Constants.wm_sta3); + wmImNoticeHService.saveOrUpdate(wmImNoticeH); + systemService.addLog(message, Globals.Log_Type_DEL, + Globals.Log_Leavel_INFO); + } + } catch (Exception e) { + e.printStackTrace(); + message = "进货通知删除失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } - /** - * 添加进货通知抬头 - * - * @param - * @return - */ - @RequestMapping(params = "doAdd") - @ResponseBody - public AjaxJson doAdd(WmImNoticeHEntity wmImNoticeH, + /** + * 添加进货通知抬头 + * + * @param + * @return + */ + @RequestMapping(params = "doAdd") + @ResponseBody + public AjaxJson doAdd(WmImNoticeHEntity wmImNoticeH, WmImNoticeHPage wmImNoticeHPage, HttpServletRequest request) { - List wmImNoticeIList = wmImNoticeHPage - .getWmImNoticeIList(); - AjaxJson j = new AjaxJson(); - String message = "进货通知添加成功"; - try { + List wmImNoticeIList = wmImNoticeHPage + .getWmImNoticeIList(); + AjaxJson j = new AjaxJson(); + String message = "进货通知添加成功"; + try { - String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode()) ; - wmImNoticeH.setNoticeId(noticeid); - WmPlatIoEntity wmPlatIo = new WmPlatIoEntity(); - wmPlatIo.setCarno(wmImNoticeH.getImCarNo()); - wmPlatIo.setDocId(wmImNoticeH.getNoticeId()); - wmPlatIo.setPlanIndata(wmImNoticeH.getImData()); - wmPlatIo.setPlatId(wmImNoticeH.getPlatformCode()); - wmPlatIo.setPlatSta(Constants.wm_sta1); - wmPlatIo.setPlatBeizhu("司机:" + wmImNoticeH.getImCarDri() + "电话:" - + wmImNoticeH.getImCarMobile()); - systemService.save(wmPlatIo); + String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode()) ; + wmImNoticeH.setNoticeId(noticeid); + WmPlatIoEntity wmPlatIo = new WmPlatIoEntity(); + wmPlatIo.setCarno(wmImNoticeH.getImCarNo()); + wmPlatIo.setDocId(wmImNoticeH.getNoticeId()); + wmPlatIo.setPlanIndata(wmImNoticeH.getImData()); + wmPlatIo.setPlatId(wmImNoticeH.getPlatformCode()); + wmPlatIo.setPlatSta(Constants.wm_sta1); + wmPlatIo.setPlatBeizhu("司机:" + wmImNoticeH.getImCarDri() + "电话:" + + wmImNoticeH.getImCarMobile()); + systemService.save(wmPlatIo); - Map map = new HashMap(); - map.put("id", wmImNoticeH.getNoticeId()); - 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")){ - wmImNoticeH.setCusCode(user.getUserName()); + Map map = new HashMap(); + map.put("id", wmImNoticeH.getNoticeId()); + 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")){ + wmImNoticeH.setCusCode(user.getUserName()); - } - } - if(roles.equals("CUS")){ - wmImNoticeH.setImSta(Constants.wm_sta0); - }else{ - wmImNoticeH.setImSta(Constants.wm_sta1); - } - if(wmImNoticeH.getCusCode()==null){ - if(roles.equals("CUS")){ - wmImNoticeH.setCusCode(user.getUserName()); - } - } - //获取供应商 - if(StringUtil.isNotEmpty(wmImNoticeH.getSupCode())){ - try{ - MdSupEntity mdSupEntity = systemService.findUniqueByProperty(MdSupEntity.class,"gysBianMa",wmImNoticeH.getSupCode()); - wmImNoticeH.setSupName(mdSupEntity.getZhongWenQch()); - }catch (Exception e){ - } - } - // - List wmImNoticeIListnew = new ArrayList(); - for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIList) { - if(!StringUtil.isEmpty(wmImNoticeIEntity.getGoodsCode())){ - try { - MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class,"goodsId" - ,wmImNoticeIEntity.getGoodsCode().split("-")[0]); + } + } + if(roles.equals("CUS")){ + wmImNoticeH.setImSta(Constants.wm_sta0); + }else{ + wmImNoticeH.setImSta(Constants.wm_sta1); + } + if(wmImNoticeH.getCusCode()==null){ + if(roles.equals("CUS")){ + wmImNoticeH.setCusCode(user.getUserName()); + } + } + //获取供应商 + if(StringUtil.isNotEmpty(wmImNoticeH.getSupCode())){ + try{ + MdSupEntity mdSupEntity = systemService.findUniqueByProperty(MdSupEntity.class,"gysBianMa",wmImNoticeH.getSupCode()); + wmImNoticeH.setSupName(mdSupEntity.getZhongWenQch()); + }catch (Exception e){ + } + } + // + List wmImNoticeIListnew = new ArrayList(); + for (WmImNoticeIEntity wmImNoticeIEntity : wmImNoticeIList) { + if(!StringUtil.isEmpty(wmImNoticeIEntity.getGoodsCode())){ + try { + + + String goodsId = wmImNoticeIEntity.getGoodsCode().split("-")[0]; + if(goodsId.endsWith("l")){ + goodsId = goodsId.substring(0,goodsId.lastIndexOf("l")); + } + MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class,"goodsId",goodsId); // String date[]=wmImNoticeIEntity.getGoodsCode().split("-"); - long hiti = 0; - try { - if(StringUtil.isEmpty(wmImNoticeIEntity.getBinPlan())){ - hiti = Long.parseLong(wmImNoticeIEntity.getGoodsCount())/ ( Long.parseLong(mvgoods.getMpCengGao()) * Long.parseLong(mvgoods.getMpDanCeng()) * Long.parseLong(mvgoods.getChlShl())); - wmImNoticeIEntity.setBinPlan(Long.toString(hiti)); - } - } catch (Exception e) { - } + long hiti = 0; + try { + if(StringUtil.isEmpty(wmImNoticeIEntity.getBinPlan())){ + hiti = Long.parseLong(wmImNoticeIEntity.getGoodsCount())/ ( Long.parseLong(mvgoods.getMpCengGao()) * Long.parseLong(mvgoods.getMpDanCeng()) * Long.parseLong(mvgoods.getChlShl())); + wmImNoticeIEntity.setBinPlan(Long.toString(hiti)); + } + } catch (Exception e) { + } - wmImNoticeIEntity.setGoodsCode(mvgoods.getGoodsCode()); - wmImNoticeIEntity.setGoodsName(mvgoods.getShpMingCheng()); - } catch (Exception e) { - // TODO: handle exception - } - wmImNoticeIListnew.add(wmImNoticeIEntity); - } - } - wmImNoticeHService.addMain(wmImNoticeH, wmImNoticeIListnew); - try { - TuiSongMsgUtil.sendMessage("收货通知", Constants.SMS_SEND_TYPE_3, - "RKYYTZ", map, "admin", ResourceUtil.getSessionUserName() - .getUserName()); - } catch (Exception e) { - // TODO: handle exception - } + wmImNoticeIEntity.setGoodsCode(mvgoods.getGoodsCode()); + wmImNoticeIEntity.setGoodsName(mvgoods.getShpMingCheng()); + } catch (Exception e) { + // TODO: handle exception + } + wmImNoticeIListnew.add(wmImNoticeIEntity); + } + } + wmImNoticeHService.addMain(wmImNoticeH, wmImNoticeIListnew); + try { + TuiSongMsgUtil.sendMessage("收货通知", Constants.SMS_SEND_TYPE_3, + "RKYYTZ", map, "admin", ResourceUtil.getSessionUserName() + .getUserName()); + } catch (Exception e) { + // TODO: handle exception + } - systemService.addLog(message, Globals.Log_Type_INSERT, - Globals.Log_Leavel_INFO); - } catch (Exception e) { - e.printStackTrace(); - message = "进货通知添加失败"; - throw new BusinessException(e.getMessage()); - } - j.setMsg(message); - return j; - } + systemService.addLog(message, Globals.Log_Type_INSERT, + Globals.Log_Leavel_INFO); + } catch (Exception e) { + e.printStackTrace(); + message = "进货通知添加失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } @RequestMapping(params = "doGet") @ResponseBody public AjaxJson dogetfromother(String formDate, HttpServletRequest request) { String message = null; AjaxJson j = new AjaxJson(); message = "读取成功"; - if ("U8".equals(ResourceUtil.getConfigByName("interfacetype"))){ - if(StringUtil.isEmpty(formDate)){ - formDate = "2011-01-01"; - } - yyUtil.getPord(formDate); - yyUtil.getcprd(formDate); - yyUtil.getqtrd(formDate); - } - if ("UAS".equals(ResourceUtil.getConfigByName("interfacetype"))){ - 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); + if ("U8".equals(ResourceUtil.getConfigByName("interfacetype"))){ + if(StringUtil.isEmpty(formDate)){ + formDate = "2011-01-01"; + } + yyUtil.getPord(formDate); + yyUtil.getcprd(formDate); + yyUtil.getqtrd(formDate); + } + if ("UAS".equals(ResourceUtil.getConfigByName("interfacetype"))){ + 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); - billResult billResult = wmIntUtil.getBillin(paramMap); - for (int s = 0; s < billResult.getData().size(); s++) { - String imcuscode = billResult.getData().get(s).getPiInoutno(); - if (StringUtil.isNotEmpty(imcuscode)) { - WmImNoticeHEntity wmimh = systemService.findUniqueByProperty(WmImNoticeHEntity.class, "imCusCode", imcuscode); - if (wmimh == null) { - WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity(); - List wmImNoticeIListnew = new ArrayList(); + billResult billResult = wmIntUtil.getBillin(paramMap); + for (int s = 0; s < billResult.getData().size(); s++) { + String imcuscode = billResult.getData().get(s).getPiInoutno(); + if (StringUtil.isNotEmpty(imcuscode)) { + WmImNoticeHEntity wmimh = systemService.findUniqueByProperty(WmImNoticeHEntity.class, "imCusCode", imcuscode); + if (wmimh == null) { + WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity(); + List wmImNoticeIListnew = new ArrayList(); - wmImNoticeH.setOrderTypeCode("01"); - String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode()); + wmImNoticeH.setOrderTypeCode("01"); + String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode()); - wmImNoticeH.setCusCode(ResourceUtil.getConfigByName("uas.cuscode")); - wmImNoticeH.setNoticeId(noticeid); - wmImNoticeH.setPlatformCode(Integer.toString(billResult.getData().get(s).getPiId())); - wmImNoticeH.setPiClass(billResult.getData().get(s).getPiClass()); - wmImNoticeH.setPiMaster(master); - wmImNoticeH.setSupCode(billResult.getData().get(s).getPiCardcode()); - MdSupEntity mdsup = systemService.findUniqueByProperty(MdSupEntity.class, "gysBianMa", wmImNoticeH.getSupCode()); - if (mdsup != null) { - wmImNoticeH.setSupName(mdsup.getZhongWenQch()); - } - wmImNoticeH.setImCusCode(imcuscode); - wmImNoticeH.setSupName(billResult.getData().get(s).getPiReceivename()); - for (int k = 0; k < billResult.getData().get(s).getDetail().size(); k++) { - WmImNoticeIEntity wmi = new WmImNoticeIEntity(); - wmi.setGoodsCode(billResult.getData().get(s).getDetail().get(k).getPdProdcode()); - MvGoodsEntity mvgoods = systemService.findUniqueByProperty( - MvGoodsEntity.class, "goodsCode", wmi.getGoodsCode()); - if (mvgoods != null) { - wmi.setGoodsName(mvgoods.getGoodsName()); - wmi.setGoodsUnit(mvgoods.getShlDanWei()); - } - wmi.setGoodsCount(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdInqty())); + wmImNoticeH.setCusCode(ResourceUtil.getConfigByName("uas.cuscode")); + wmImNoticeH.setNoticeId(noticeid); + wmImNoticeH.setPlatformCode(Integer.toString(billResult.getData().get(s).getPiId())); + wmImNoticeH.setPiClass(billResult.getData().get(s).getPiClass()); + wmImNoticeH.setPiMaster(master); + wmImNoticeH.setSupCode(billResult.getData().get(s).getPiCardcode()); + MdSupEntity mdsup = systemService.findUniqueByProperty(MdSupEntity.class, "gysBianMa", wmImNoticeH.getSupCode()); + if (mdsup != null) { + wmImNoticeH.setSupName(mdsup.getZhongWenQch()); + } + wmImNoticeH.setImCusCode(imcuscode); + wmImNoticeH.setSupName(billResult.getData().get(s).getPiReceivename()); + for (int k = 0; k < billResult.getData().get(s).getDetail().size(); k++) { + WmImNoticeIEntity wmi = new WmImNoticeIEntity(); + wmi.setGoodsCode(billResult.getData().get(s).getDetail().get(k).getPdProdcode()); + MvGoodsEntity mvgoods = systemService.findUniqueByProperty( + MvGoodsEntity.class, "goodsCode", wmi.getGoodsCode()); + if (mvgoods != null) { + wmi.setGoodsName(mvgoods.getGoodsName()); + wmi.setGoodsUnit(mvgoods.getShlDanWei()); + } + wmi.setGoodsCount(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdInqty())); // wmi.setGoodsPrdData(billResult.getData().get(s).getDetail().get(k).getPdProdmadedate2User()); - wmi.setOtherId(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPdno())); - wmImNoticeIListnew.add(wmi); - } - wmImNoticeHService.addMain(wmImNoticeH, wmImNoticeIListnew); - } - } else { - continue; - } - } - } + wmi.setOtherId(Integer.toString(billResult.getData().get(s).getDetail().get(k).getPdPdno())); + wmImNoticeIListnew.add(wmi); + } + wmImNoticeHService.addMain(wmImNoticeH, wmImNoticeIListnew); + } + } else { + continue; + } + } + } - systemService.addLog(message, Globals.Log_Type_UPDATE, - Globals.Log_Leavel_INFO); - } catch (Exception e) { - e.printStackTrace(); - message = "读取失败"; - throw new BusinessException(e.getMessage()); - } - } - } + systemService.addLog(message, Globals.Log_Type_UPDATE, + Globals.Log_Leavel_INFO); + } catch (Exception e) { + e.printStackTrace(); + message = "读取失败"; + throw new BusinessException(e.getMessage()); + } + } + } @@ -2413,34 +2448,34 @@ Double sum =0.00; return j; } - @RequestMapping(params = "doPost") - @ResponseBody - public AjaxJson dopost(String id, HttpServletRequest request) { - String message = null; - AjaxJson j = new AjaxJson(); - message = "读取成功"; - WmImNoticeHEntity wmImNoticeH = wmImNoticeHService.getEntity(WmImNoticeHEntity.class, id); + @RequestMapping(params = "doPost") + @ResponseBody + public AjaxJson dopost(String id, HttpServletRequest request) { + String message = null; + AjaxJson j = new AjaxJson(); + message = "读取成功"; + WmImNoticeHEntity wmImNoticeH = wmImNoticeHService.getEntity(WmImNoticeHEntity.class, id); - //获取参数 - Object id0 = wmImNoticeH.getNoticeId(); - //=================================================================================== - //查询-产品 - String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; - try{ - List wmImNoticeIEntityList = systemService - .findHql(hql0, id0); - List> list = new ArrayList>(); - for(WmImNoticeIEntity t:wmImNoticeIEntityList){ + //获取参数 + Object id0 = wmImNoticeH.getNoticeId(); + //=================================================================================== + //查询-产品 + String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; + try{ + List wmImNoticeIEntityList = systemService + .findHql(hql0, id0); + List> list = new ArrayList>(); + for(WmImNoticeIEntity t:wmImNoticeIEntityList){ // List WmInQmlist = new ArrayList(); - String hql = null; - hql = "from WmInQmIEntity t where t.imNoticeItem = ? "; + String hql = null; + hql = "from WmInQmIEntity t where t.imNoticeItem = ? "; - List WmInQmlist = systemService.findHql(hql, new Object[] { t.getId() }); + List WmInQmlist = systemService.findHql(hql, new Object[] { t.getId() }); for(WmInQmIEntity qm:WmInQmlist){ Map map = new HashMap(); - // [{"pd_pdno":1,"pd_outqty":"100","pi_class":"出货单","pi_id":50765226,"pi_inoutno":"JRS180800008"}] + // [{"pd_pdno":1,"pd_outqty":"100","pi_class":"出货单","pi_id":50765226,"pi_inoutno":"JRS180800008"}] map.put("pd_pdno",t.getOtherId()); map.put("pd_outqty",qm.getBaseGoodscount()); map.put("pi_class",wmImNoticeH.getPiClass()); @@ -2466,20 +2501,20 @@ Double sum =0.00; } - } - String jsonStr = JSONArray.fromObject(list).toString(); - JSONArray ja = JSONArray.fromObject(jsonStr); - resResult resResult = wmIntUtil.postBill(ja.toString(),wmImNoticeH.getPiMaster()); - j.setMsg(resResult.getDetailedMessage()); - }catch (Exception e){ - e.printStackTrace(); - message = "读取失败"; - throw new BusinessException(e.getMessage()); - } + } + String jsonStr = JSONArray.fromObject(list).toString(); + JSONArray ja = JSONArray.fromObject(jsonStr); + resResult resResult = wmIntUtil.postBill(ja.toString(),wmImNoticeH.getPiMaster()); + j.setMsg(resResult.getDetailedMessage()); + }catch (Exception e){ + e.printStackTrace(); + message = "读取失败"; + throw new BusinessException(e.getMessage()); + } - j.setMsg(message); - return j; - } + j.setMsg(message); + return j; + } @@ -2491,69 +2526,69 @@ Double sum =0.00; } - /** - * 更新进货通知抬头 - * - * @param - * @return - */ - @RequestMapping(params = "doUpdate") - @ResponseBody - public AjaxJson doUpdate(WmImNoticeHEntity wmImNoticeH, + /** + * 更新进货通知抬头 + * + * @param + * @return + */ + @RequestMapping(params = "doUpdate") + @ResponseBody + public AjaxJson doUpdate(WmImNoticeHEntity wmImNoticeH, WmImNoticeHPage wmImNoticeHPage, HttpServletRequest request) { - List wmImNoticeIList = wmImNoticeHPage - .getWmImNoticeIList(); - AjaxJson j = new AjaxJson(); - String message = "更新成功"; - try { - try { - WmPlatIoEntity wmPlatIo = systemService.findUniqueByProperty( - WmPlatIoEntity.class, "docId", wmImNoticeH.getNoticeId()); - if (wmPlatIo != null) { - wmPlatIo.setCarno(wmImNoticeH.getImCarNo()); - wmPlatIo.setDocId(wmImNoticeH.getNoticeId()); - wmPlatIo.setPlanIndata(wmImNoticeH.getImData()); - wmPlatIo.setPlatId(wmImNoticeH.getPlatformCode()); - wmPlatIo.setPlatSta(Constants.wm_sta1); - wmPlatIo.setPlatBeizhu("司机" + wmImNoticeH.getImCarDri() + "电话" - + wmImNoticeH.getImCarMobile()); - systemService.saveOrUpdate(wmPlatIo); - } - } catch (Exception e) { - // TODO: handle exception - } + List wmImNoticeIList = wmImNoticeHPage + .getWmImNoticeIList(); + AjaxJson j = new AjaxJson(); + String message = "更新成功"; + try { + try { + WmPlatIoEntity wmPlatIo = systemService.findUniqueByProperty( + WmPlatIoEntity.class, "docId", wmImNoticeH.getNoticeId()); + if (wmPlatIo != null) { + wmPlatIo.setCarno(wmImNoticeH.getImCarNo()); + wmPlatIo.setDocId(wmImNoticeH.getNoticeId()); + wmPlatIo.setPlanIndata(wmImNoticeH.getImData()); + wmPlatIo.setPlatId(wmImNoticeH.getPlatformCode()); + wmPlatIo.setPlatSta(Constants.wm_sta1); + wmPlatIo.setPlatBeizhu("司机" + wmImNoticeH.getImCarDri() + "电话" + + wmImNoticeH.getImCarMobile()); + systemService.saveOrUpdate(wmPlatIo); + } + } catch (Exception e) { + // TODO: handle exception + } - if(wmImNoticeH.getCusCode()==null){ - 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")){ - wmImNoticeH.setCusCode(user.getUserName()); + if(wmImNoticeH.getCusCode()==null){ + 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")){ + wmImNoticeH.setCusCode(user.getUserName()); - } - } - } + } + } + } - wmImNoticeHService.updateMain(wmImNoticeH, wmImNoticeIList); - 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; - } + wmImNoticeHService.updateMain(wmImNoticeH, wmImNoticeIList); + 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; + } /** * 进货通知抬头新增页面跳转 @@ -2568,38 +2603,38 @@ Double sum =0.00; wmImNoticeH.getId()); req.setAttribute("wmImNoticeHPage", wmImNoticeH); - }else{ - wmImNoticeH.setOrderTypeCode(req.getParameter("orderTypeCode").toString()); - 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")){ - wmImNoticeH.setCusCode(user.getUserName()); - wmImNoticeH.setReadonly("readonly"); - wmImNoticeH.setWherecon("where cus_code = '"+user.getUserName()+"'"); - modelMap.put("roleName", roles); - req.setAttribute("wmImNoticeHPage", wmImNoticeH); + }else{ + wmImNoticeH.setOrderTypeCode(req.getParameter("orderTypeCode").toString()); + 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")){ + wmImNoticeH.setCusCode(user.getUserName()); + wmImNoticeH.setReadonly("readonly"); + wmImNoticeH.setWherecon("where cus_code = '"+user.getUserName()+"'"); + modelMap.put("roleName", roles); + req.setAttribute("wmImNoticeHPage", wmImNoticeH); - }else{ - if(!StringUtil.isEmpty( wmImNoticeH.getCusCode())){ - wmImNoticeH.setWherecon("where cus_code = '"+wmImNoticeH.getCusCode()+"'"); - }else{ - wmImNoticeH.setWherecon("where 1 = 1"); - } + }else{ + if(!StringUtil.isEmpty( wmImNoticeH.getCusCode())){ + wmImNoticeH.setWherecon("where cus_code = '"+wmImNoticeH.getCusCode()+"'"); + }else{ + wmImNoticeH.setWherecon("where 1 = 1"); + } - req.setAttribute("wmImNoticeHPage", wmImNoticeH); - } - } - } + req.setAttribute("wmImNoticeHPage", wmImNoticeH); + } + } + } @@ -2607,334 +2642,334 @@ Double sum =0.00; return new ModelAndView("com/zzjee/wm/wmImNoticeH-add"); } - /** - * 进货通知抬头编辑页面跳转 - * - * @return - */ - @RequestMapping(params = "goUpdate") - public ModelAndView goUpdate(WmImNoticeHEntity wmImNoticeH, + /** + * 进货通知抬头编辑页面跳转 + * + * @return + */ + @RequestMapping(params = "goUpdate") + public ModelAndView goUpdate(WmImNoticeHEntity wmImNoticeH, HttpServletRequest req) { - if (StringUtil.isNotEmpty(wmImNoticeH.getId())) { - wmImNoticeH = wmImNoticeHService.getEntity(WmImNoticeHEntity.class, - wmImNoticeH.getId()); + if (StringUtil.isNotEmpty(wmImNoticeH.getId())) { + wmImNoticeH = wmImNoticeHService.getEntity(WmImNoticeHEntity.class, + wmImNoticeH.getId()); - 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")){ - wmImNoticeH.setCusCode(user.getUserName()); - wmImNoticeH.setReadonly("readonly"); - wmImNoticeH.setWherecon("where cus_code = '"+user.getUserName()+"'"); - }else{ + 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")){ + wmImNoticeH.setCusCode(user.getUserName()); + wmImNoticeH.setReadonly("readonly"); + wmImNoticeH.setWherecon("where cus_code = '"+user.getUserName()+"'"); + }else{ - wmImNoticeH.setWherecon("where 1 = 1"); - } - } + wmImNoticeH.setWherecon("where 1 = 1"); + } + } - req.setAttribute("wmImNoticeHPage", wmImNoticeH); - } - return new ModelAndView("com/zzjee/wm/wmImNoticeH-update"); - } + req.setAttribute("wmImNoticeHPage", wmImNoticeH); + } + return new ModelAndView("com/zzjee/wm/wmImNoticeH-update"); + } - /** - * 加载明细列表[进货通知明细] - * - * @return - */ - @RequestMapping(params = "wmImNoticeIList") - public ModelAndView wmImNoticeIList(WmImNoticeHEntity wmImNoticeH, + /** + * 加载明细列表[进货通知明细] + * + * @return + */ + @RequestMapping(params = "wmImNoticeIList") + public ModelAndView wmImNoticeIList(WmImNoticeHEntity wmImNoticeH, HttpServletRequest req) { - // =================================================================================== - // 获取参数 - Object id0 = wmImNoticeH.getNoticeId(); - // =================================================================================== - // 查询-进货通知明细 - String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; - try { - if(StringUtil.isNotEmpty(id0)){ - List wmImNoticeIEntityList = systemService - .findHql(hql0, id0); - req.setAttribute("wmImNoticeIList", wmImNoticeIEntityList); - } - } catch (Exception e) { - logger.info(e.getMessage()); - } - return new ModelAndView("com/zzjee/wm/wmImNoticeIList"); - } + // =================================================================================== + // 获取参数 + Object id0 = wmImNoticeH.getNoticeId(); + // =================================================================================== + // 查询-进货通知明细 + String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; + try { + if(StringUtil.isNotEmpty(id0)){ + List wmImNoticeIEntityList = systemService + .findHql(hql0, id0); + req.setAttribute("wmImNoticeIList", wmImNoticeIEntityList); + } + } catch (Exception e) { + logger.info(e.getMessage()); + } + return new ModelAndView("com/zzjee/wm/wmImNoticeIList"); + } - /** - * 导出excel - * - * @param request - * @param response - */ - @RequestMapping(params = "exportXls") - public String exportXls(WmImNoticeHEntity wmImNoticeH, + /** + * 导出excel + * + * @param request + * @param response + */ + @RequestMapping(params = "exportXls") + public String exportXls(WmImNoticeHEntity wmImNoticeH, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid, ModelMap map) { - CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); - // 查询条件组装器 - org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, - wmImNoticeH); - 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.wmImNoticeHService - .getListByCriteriaQuery(cq, false); - List pageList = new ArrayList(); - if (list != null && list.size() > 0) { - for (WmImNoticeHEntity entity : list) { - try { - WmImNoticeHPage page = new WmImNoticeHPage(); - MyBeanUtils.copyBeanNotNull2Bean(entity, page); - Object id0 = entity.getNoticeId(); - String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; - List wmImNoticeIEntityList = systemService - .findHql(hql0, id0); - page.setWmImNoticeIList(wmImNoticeIEntityList); - pageList.add(page); - } catch (Exception e) { - logger.info(e.getMessage()); - } - } - } - map.put(NormalExcelConstants.FILE_NAME, "进货通知抬头"); - map.put(NormalExcelConstants.CLASS, WmImNoticeHPage.class); - map.put(NormalExcelConstants.PARAMS, new ExportParams("进货通知抬头列表", - "导出人:admin", "导出信息")); - map.put(NormalExcelConstants.DATA_LIST, pageList); - return NormalExcelConstants.JEECG_EXCEL_VIEW; - } - - /** - * 通过excel导入数据 - * - * @param request - * @param - * @return - */ - @RequestMapping(params = "importExcel", method = RequestMethod.POST) - @ResponseBody - public AjaxJson importExcel(HttpServletRequest request, - HttpServletResponse response) { - AjaxJson j = new AjaxJson(); - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - Map fileMap = multipartRequest.getFileMap(); - for (Map.Entry entity : fileMap.entrySet()) { - MultipartFile file = entity.getValue();// 获取上传文件对象 - ImportParams params = new ImportParams(); - params.setTitleRows(2); - params.setHeadRows(1); - params.setNeedSave(true); - try { - List list = ExcelImportUtil.importExcel( - file.getInputStream(), WmNoticeImpPage.class, params); - - String flag = "Y"; - String message=""; - for(WmNoticeImpPage wmt:list){ - MvGoodsEntity mvgoods = systemService.findUniqueByProperty( - MvGoodsEntity.class, "goodsCode", wmt.getGoodsId()); - if(mvgoods==null){ - flag = "N"; - message=message+wmt.getGoodsId(); - } - } - if("N".equals(flag)){ - j.setMsg(message+"不存在"); - return j; - } - - List listheader = ExcelImportUtil.importExcel( - file.getInputStream(), WmNoticeImpPage.class, params); - for(int i=0; ii;k--){ - if (listheader.get(k).getImCusCode().equals(listheader.get(i).getImCusCode())) { - listheader.remove(k); - } - } - } - - for(WmNoticeImpPage pageheader: listheader){ - List wmimh = systemService.findByProperty(WmImNoticeHEntity.class, "imCusCode", pageheader.getImCusCode()); - if(wmimh!=null&&wmimh.size()>0){ - continue; - } - List wmImNoticeIListnew = new ArrayList(); - for (WmNoticeImpPage page : list) { - if(pageheader.getImCusCode().equals(page.getImCusCode())){ - WmImNoticeIEntity wmi = new WmImNoticeIEntity(); - wmi.setGoodsCode(page.getGoodsId()); - MvGoodsEntity mvgoods = systemService.findUniqueByProperty( - MvGoodsEntity.class, "goodsCode", wmi.getGoodsCode()); - if (mvgoods != null) { - wmi.setGoodsName(mvgoods.getGoodsName()); - wmi.setGoodsUnit(mvgoods.getShlDanWei()); - } - try{ - wmi.setGoodsCount(page.getGoodsQua()); - String[] args=page.getGoodsQua().split("\\."); - wmi.setGoodsCount(args[0]); - }catch (Exception e){ - - } - - wmi.setOtherId(page.getOtherId()); - wmImNoticeIListnew.add(wmi); - } - } - - WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity(); - wmImNoticeH.setOrderTypeCode(pageheader.getOrderTypeCode()); - String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode()); - wmImNoticeH.setCusCode(pageheader.getCusCode()); - wmImNoticeH.setNoticeId(noticeid); - wmImNoticeH.setImData(pageheader.getImData()); - wmImNoticeH.setPlatformCode(pageheader.getCusCode()); - wmImNoticeH.setImBeizhu(pageheader.getImBeizhu() ); - wmImNoticeH.setSupCode(pageheader.getSupCode() ); - MdSupEntity mdsup = systemService.findUniqueByProperty(MdSupEntity.class,"gysBianMa",wmImNoticeH.getSupCode()); - if(mdsup!=null){ - wmImNoticeH.setSupName(mdsup.getZhongWenQch()); + CriteriaQuery cq = new CriteriaQuery(WmImNoticeHEntity.class, dataGrid); + // 查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, + wmImNoticeH); + 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.wmImNoticeHService + .getListByCriteriaQuery(cq, false); + List pageList = new ArrayList(); + if (list != null && list.size() > 0) { + for (WmImNoticeHEntity entity : list) { + try { + WmImNoticeHPage page = new WmImNoticeHPage(); + MyBeanUtils.copyBeanNotNull2Bean(entity, page); + Object id0 = entity.getNoticeId(); + String hql0 = "from WmImNoticeIEntity where 1 = 1 AND iM_NOTICE_ID = ? "; + List wmImNoticeIEntityList = systemService + .findHql(hql0, id0); + page.setWmImNoticeIList(wmImNoticeIEntityList); + pageList.add(page); + } catch (Exception e) { + logger.info(e.getMessage()); + } + } + } + map.put(NormalExcelConstants.FILE_NAME, "进货通知抬头"); + map.put(NormalExcelConstants.CLASS, WmImNoticeHPage.class); + map.put(NormalExcelConstants.PARAMS, new ExportParams("进货通知抬头列表", + "导出人:admin", "导出信息")); + map.put(NormalExcelConstants.DATA_LIST, pageList); + return NormalExcelConstants.JEECG_EXCEL_VIEW; + } + + /** + * 通过excel导入数据 + * + * @param request + * @param + * @return + */ + @RequestMapping(params = "importExcel", method = RequestMethod.POST) + @ResponseBody + public AjaxJson importExcel(HttpServletRequest request, + HttpServletResponse response) { + AjaxJson j = new AjaxJson(); + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List list = ExcelImportUtil.importExcel( + file.getInputStream(), WmNoticeImpPage.class, params); + + String flag = "Y"; + String message=""; + for(WmNoticeImpPage wmt:list){ + MvGoodsEntity mvgoods = systemService.findUniqueByProperty( + MvGoodsEntity.class, "goodsCode", wmt.getGoodsId()); + if(mvgoods==null){ + flag = "N"; + message=message+wmt.getGoodsId(); + } + } + if("N".equals(flag)){ + j.setMsg(message+"不存在"); + return j; + } + + List listheader = ExcelImportUtil.importExcel( + file.getInputStream(), WmNoticeImpPage.class, params); + for(int i=0; ii;k--){ + if (listheader.get(k).getImCusCode().equals(listheader.get(i).getImCusCode())) { + listheader.remove(k); + } + } + } + + for(WmNoticeImpPage pageheader: listheader){ + List wmimh = systemService.findByProperty(WmImNoticeHEntity.class, "imCusCode", pageheader.getImCusCode()); + if(wmimh!=null&&wmimh.size()>0){ + continue; + } + List wmImNoticeIListnew = new ArrayList(); + for (WmNoticeImpPage page : list) { + if(pageheader.getImCusCode().equals(page.getImCusCode())){ + WmImNoticeIEntity wmi = new WmImNoticeIEntity(); + wmi.setGoodsCode(page.getGoodsId()); + MvGoodsEntity mvgoods = systemService.findUniqueByProperty( + MvGoodsEntity.class, "goodsCode", wmi.getGoodsCode()); + if (mvgoods != null) { + wmi.setGoodsName(mvgoods.getGoodsName()); + wmi.setGoodsUnit(mvgoods.getShlDanWei()); + } + try{ + wmi.setGoodsCount(page.getGoodsQua()); + String[] args=page.getGoodsQua().split("\\."); + wmi.setGoodsCount(args[0]); + }catch (Exception e){ + + } + + wmi.setOtherId(page.getOtherId()); + wmImNoticeIListnew.add(wmi); + } + } + + WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity(); + wmImNoticeH.setOrderTypeCode(pageheader.getOrderTypeCode()); + String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode()); + wmImNoticeH.setCusCode(pageheader.getCusCode()); + wmImNoticeH.setNoticeId(noticeid); + wmImNoticeH.setImData(pageheader.getImData()); + wmImNoticeH.setPlatformCode(pageheader.getCusCode()); + wmImNoticeH.setImBeizhu(pageheader.getImBeizhu() ); + wmImNoticeH.setSupCode(pageheader.getSupCode() ); + MdSupEntity mdsup = systemService.findUniqueByProperty(MdSupEntity.class,"gysBianMa",wmImNoticeH.getSupCode()); + if(mdsup!=null){ + wmImNoticeH.setSupName(mdsup.getZhongWenQch()); + } + wmImNoticeH.setImCusCode(pageheader.getImCusCode()); + wmImNoticeHService.addMain(wmImNoticeH, wmImNoticeIListnew); } - wmImNoticeH.setImCusCode(pageheader.getImCusCode()); - wmImNoticeHService.addMain(wmImNoticeH, wmImNoticeIListnew); - } j.setMsg("文件导入成功!"); - } catch (Exception e) { - j.setMsg("文件导入失败!"); - logger.error(ExceptionUtil.getExceptionMessage(e)); - } finally { - try { - file.getInputStream().close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - return j; - } + } catch (Exception e) { + j.setMsg("文件导入失败!"); + logger.error(ExceptionUtil.getExceptionMessage(e)); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return j; + } - /** - * 导出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; - } + /** + * 导出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 - */ - @RequestMapping(params = "upload") - public ModelAndView upload(HttpServletRequest req) { - req.setAttribute("controller_name", "wmImNoticeHController"); - return new ModelAndView("common/upload/pub_excel_upload"); - } + /** + * 导入功能跳转 + * + * @return + */ + @RequestMapping(params = "upload") + public ModelAndView upload(HttpServletRequest req) { + req.setAttribute("controller_name", "wmImNoticeHController"); + return new ModelAndView("common/upload/pub_excel_upload"); + } - @RequestMapping(method = RequestMethod.GET) - @ResponseBody - public List list() { - List listWmImNoticeHs = wmImNoticeHService - .getList(WmImNoticeHEntity.class); - return listWmImNoticeHs; - } + @RequestMapping(method = RequestMethod.GET) + @ResponseBody + public List list() { + List listWmImNoticeHs = wmImNoticeHService + .getList(WmImNoticeHEntity.class); + return listWmImNoticeHs; + } - @RequestMapping(value = "/{id}", method = RequestMethod.GET ) - @ResponseBody - public ResponseEntity get(@PathVariable("id") String id) { - WmImNoticeHEntity task = wmImNoticeHService.get( - WmImNoticeHEntity.class, id); - if (task == null) { - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - return new ResponseEntity(task, HttpStatus.OK); - } + @RequestMapping(value = "/{id}", method = RequestMethod.GET ) + @ResponseBody + public ResponseEntity get(@PathVariable("id") String id) { + WmImNoticeHEntity task = wmImNoticeHService.get( + WmImNoticeHEntity.class, id); + if (task == null) { + return new ResponseEntity(HttpStatus.NOT_FOUND); + } + return new ResponseEntity(task, HttpStatus.OK); + } @RequestMapping(value = "/apicreate") - @ResponseBody - public ResponseEntity create( - @RequestBody WmImNoticeHPage wmImNoticeHPage) { - // 调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. - ResultDO D0 = new ResultDO(); - try{//如果已经创建则直接返回 - String hql = "from WmImNoticeHEntity where imCusCode = ? "; - String imCusCode = wmImNoticeHPage.getImCusCode(); - if(StringUtil.isNotEmpty(imCusCode)){ - List listim = systemService.findHql(hql,imCusCode); - if(listim!=null&&listim.size()>0){ - D0.setOK(true); - return new ResponseEntity(D0, HttpStatus.OK); - } - } - }catch (Exception e){ - } - // 保存 - List wmImNoticeIList = wmImNoticeHPage - .getWmImNoticeIList(); + @ResponseBody + public ResponseEntity create( + @RequestBody WmImNoticeHPage wmImNoticeHPage) { + // 调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. + ResultDO D0 = new ResultDO(); + try{//如果已经创建则直接返回 + String hql = "from WmImNoticeHEntity where imCusCode = ? "; + String imCusCode = wmImNoticeHPage.getImCusCode(); + if(StringUtil.isNotEmpty(imCusCode)){ + List listim = systemService.findHql(hql,imCusCode); + if(listim!=null&&listim.size()>0){ + D0.setOK(true); + return new ResponseEntity(D0, HttpStatus.OK); + } + } + }catch (Exception e){ + } + // 保存 + List wmImNoticeIList = wmImNoticeHPage + .getWmImNoticeIList(); - WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity(); - try { - String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode()) ; - wmImNoticeHPage.setNoticeId(noticeid); - MyBeanUtils.copyBeanNotNull2Bean(wmImNoticeHPage,wmImNoticeH); - } catch (Exception e) { - logger.info(e.getMessage()); - } + WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity(); + try { + String noticeid = wmUtil.getNextNoticeid(wmImNoticeH.getOrderTypeCode()) ; + wmImNoticeHPage.setNoticeId(noticeid); + MyBeanUtils.copyBeanNotNull2Bean(wmImNoticeHPage,wmImNoticeH); + } catch (Exception e) { + logger.info(e.getMessage()); + } - List wmOmNoticeIListnew = new ArrayList<>(); - for(WmImNoticeIEntity t: wmImNoticeIList){ - try{ - MdGoodsEntity md =systemService.findUniqueByProperty(MdGoodsEntity.class,"shpBianMa",t.getGoodsCode()); - wmImNoticeH.setCusCode(md.getSuoShuKeHu()); - }catch ( Exception e){ + List wmOmNoticeIListnew = new ArrayList<>(); + for(WmImNoticeIEntity t: wmImNoticeIList){ + try{ + MdGoodsEntity md =systemService.findUniqueByProperty(MdGoodsEntity.class,"shpBianMa",t.getGoodsCode()); + wmImNoticeH.setCusCode(md.getSuoShuKeHu()); + }catch ( Exception e){ - } + } - wmOmNoticeIListnew.add(t); - } - wmImNoticeHService.addMain(wmImNoticeH, wmOmNoticeIListnew); - D0.setOK(true); - return new ResponseEntity(D0, HttpStatus.OK); + wmOmNoticeIListnew.add(t); + } + wmImNoticeHService.addMain(wmImNoticeH, wmOmNoticeIListnew); + D0.setOK(true); + return new ResponseEntity(D0, HttpStatus.OK); - // 按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象. + // 按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象. // String id = wmImNoticeHPage.getId(); // URI uri = uriBuilder.path("/rest/wmImNoticeHController/" + id).build() // .toUri(); @@ -2942,40 +2977,40 @@ Double sum =0.00; // headers.setLocation(uri); // // return new ResponseEntity(headers, HttpStatus.CREATED); - } + } - @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity update(@RequestBody WmImNoticeHPage wmImNoticeHPage) { - // 调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. - Set> failures = validator - .validate(wmImNoticeHPage); - if (!failures.isEmpty()) { - return new ResponseEntity( - BeanValidators.extractPropertyAndMessage(failures), - HttpStatus.BAD_REQUEST); - } + @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity update(@RequestBody WmImNoticeHPage wmImNoticeHPage) { + // 调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. + Set> failures = validator + .validate(wmImNoticeHPage); + if (!failures.isEmpty()) { + return new ResponseEntity( + BeanValidators.extractPropertyAndMessage(failures), + HttpStatus.BAD_REQUEST); + } - // 保存 - List wmImNoticeIList = wmImNoticeHPage - .getWmImNoticeIList(); + // 保存 + List wmImNoticeIList = wmImNoticeHPage + .getWmImNoticeIList(); - WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity(); - try { - MyBeanUtils.copyBeanNotNull2Bean(wmImNoticeH, wmImNoticeHPage); - } catch (Exception e) { - logger.info(e.getMessage()); - } - wmImNoticeHService.updateMain(wmImNoticeH, wmImNoticeIList); + WmImNoticeHEntity wmImNoticeH = new WmImNoticeHEntity(); + try { + MyBeanUtils.copyBeanNotNull2Bean(wmImNoticeH, wmImNoticeHPage); + } catch (Exception e) { + logger.info(e.getMessage()); + } + wmImNoticeHService.updateMain(wmImNoticeH, wmImNoticeIList); - // 按Restful约定,返回204状态码, 无内容. 也可以返回200状态码. - return new ResponseEntity(HttpStatus.NO_CONTENT); - } + // 按Restful约定,返回204状态码, 无内容. 也可以返回200状态码. + return new ResponseEntity(HttpStatus.NO_CONTENT); + } - @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) - @ResponseStatus(HttpStatus.NO_CONTENT) - public void delete(@PathVariable("id") String id) { - WmImNoticeHEntity wmImNoticeH = wmImNoticeHService.get( - WmImNoticeHEntity.class, id); - wmImNoticeHService.delMain(wmImNoticeH); - } + @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) + @ResponseStatus(HttpStatus.NO_CONTENT) + public void delete(@PathVariable("id") String id) { + WmImNoticeHEntity wmImNoticeH = wmImNoticeHService.get( + WmImNoticeHEntity.class, id); + wmImNoticeHService.delMain(wmImNoticeH); + } } diff --git a/src/main/java/com/zzjee/wm/controller/WmInQmIController.java b/src/main/java/com/zzjee/wm/controller/WmInQmIController.java index 4c172443..3b6fa0f1 100644 --- a/src/main/java/com/zzjee/wm/controller/WmInQmIController.java +++ b/src/main/java/com/zzjee/wm/controller/WmInQmIController.java @@ -37,6 +37,8 @@ import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; import org.jeecgframework.tag.core.easyui.TagUtil; +import org.jeecgframework.web.system.pojo.base.TSBaseUser; +import org.jeecgframework.web.system.pojo.base.TSUser; import org.jeecgframework.web.system.service.SystemService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -1061,6 +1063,11 @@ for (WmInQmIEntity wmInQmIEntity : wmInQmIso) { }catch (Exception e){ } } + //查询create_name + TSBaseUser user = systemService.findUniqueByProperty(TSBaseUser.class,"userName",wmInQmI.getCreateBy()); + if (user != null ) { + wmInQmI.setCreateName(user.getRealName()); + } String id = wmInQmIService.save(wmInQmI).toString(); if("on".equals(ResourceUtil.getConfigByName("onestepup"))&&StringUtil.isNotEmpty(wmInQmI.getBinId())){ toup(id); diff --git a/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java b/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java index 83cf2183..04d50367 100644 --- a/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java +++ b/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java @@ -15,6 +15,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.ConstraintViolation; import javax.validation.Validator; +import com.zzjee.ba.entity.BaStoreEntity; import com.zzjee.md.entity.MdGoodsEntity; import com.zzjee.tms.entity.TmsMdCheliangEntity; import com.zzjee.tms.entity.TmsYwDingdanEntity; @@ -23,6 +24,7 @@ import com.zzjee.wm.entity.*; import com.zzjee.wm.page.*; import com.zzjee.wmutil.dsc.dscUtil; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFClientAnchor; @@ -222,6 +224,13 @@ public class WmOmNoticeHController extends BaseController { request.setAttribute("noticeid", wmOmNoticeHEntity.getOmNoticeId()); } + BaStoreEntity baStoreEntity = systemService.findUniqueByProperty(BaStoreEntity.class,"storeCode",wmOmNoticeHEntity.getStoreCode()); + if (baStoreEntity != null && StringUtils.isNotEmpty(baStoreEntity.getStoreName())) { + request.setAttribute("storeName", baStoreEntity.getStoreName()); + }else { + request.setAttribute("storeName", ""); + } + try{ MdCusEntity mdcus = systemService.findUniqueByProperty(MdCusEntity.class,"keHuBianMa",wmOmNoticeHEntity.getCusCode()); MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class,"keHuBianMa",wmOmNoticeHEntity.getOcusCode()); @@ -325,8 +334,12 @@ public class WmOmNoticeHController extends BaseController { @RequestMapping(params = "doPrintOutStorage") public ModelAndView doPrintOutStorage(String id,HttpServletRequest request) { WmOmNoticeHEntity wmOmNoticeHEntity = wmOmNoticeHService.getEntity(WmOmNoticeHEntity.class, id); + List> list = new ArrayList<>(); + list = wmOmNoticeHService.findForJdbc("select id,goods_id ,goods_name ,base_goodscount,goods_unit from wm_to_down_goods where order_id = ? ",wmOmNoticeHEntity.getOmNoticeId()); + if (list.size() == 0 ) { + list = systemService.findForJdbc("select id,goods_id ,goods_name ,base_goodscount,goods_unit from wm_om_qm_i where om_notice_id = ? ",wmOmNoticeHEntity.getOmNoticeId()); + } - List> list = wmOmNoticeHService.findForJdbc("select id,goods_id ,goods_name ,base_goodscount,goods_unit from wm_to_down_goods where order_id = ? ",wmOmNoticeHEntity.getOmNoticeId()); if (list != null && list.size() > 0) { List resultList = new ArrayList<>(); for (Map map : list) { @@ -362,6 +375,13 @@ public class WmOmNoticeHController extends BaseController { request.setAttribute("noticeid", wmOmNoticeHEntity.getOmNoticeId()); } + BaStoreEntity baStoreEntity = systemService.findUniqueByProperty(BaStoreEntity.class,"storeCode",wmOmNoticeHEntity.getStoreCode()); + if (baStoreEntity != null && StringUtils.isNotEmpty(baStoreEntity.getStoreName())) { + request.setAttribute("storeName", baStoreEntity.getStoreName()); + }else { + request.setAttribute("storeName", ""); + } + try{ MdCusEntity mdcus = systemService.findUniqueByProperty(MdCusEntity.class,"keHuBianMa",wmOmNoticeHEntity.getCusCode()); MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class,"keHuBianMa",wmOmNoticeHEntity.getOcusCode()); @@ -941,8 +961,12 @@ public class WmOmNoticeHController extends BaseController { if(!StringUtil.isEmpty(wmomNoticeIEntity.getGoodsId())){ try { + String goodsId = wmomNoticeIEntity.getGoodsId().split("-")[0]; + if(goodsId.endsWith("l")){ + goodsId = goodsId.substring(0,goodsId.lastIndexOf("l")); + } - MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class,"goodsId",wmomNoticeIEntity.getGoodsId().split("-")[0]); + MvGoodsEntity mvgoods = systemService.findUniqueByProperty(MvGoodsEntity.class,"goodsId",goodsId); // String date[]=wmImNoticeIEntity.getGoodsCode().split("-"); // wmImNoticeIEntity.setGoodsCode(mvgoods.getGoodsCode()); @@ -1548,9 +1572,9 @@ public class WmOmNoticeHController extends BaseController { // 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.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,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_code group by wq.order_id, mg.goods_code,wq.goods_pro_data"; + +" and wq.goods_id = mg.goods_id group by wq.order_id, mg.goods_code,wq.goods_pro_data"; List> result = systemService .findForJdbc(tsql, wmOmNoticeH.getOmNoticeId()); @@ -1558,9 +1582,9 @@ public class WmOmNoticeHController extends BaseController { int size = result.size(); if(size<1){ - tsql = "SELECT wq.pro_data,wq.base_unit, 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 " + 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 " +" 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"; + +" and wq.goods_id = mg.goods_id group by wq.om_notice_id, mg.goods_code,wq.pro_data"; result = systemService .findForJdbc(tsql, wmOmNoticeH.getOmNoticeId()); size = result.size(); @@ -1591,14 +1615,22 @@ public class WmOmNoticeHController extends BaseController { cellTitle.setCellValue("配送单"); cellTitle.setCellStyle(cs); + BaStoreEntity baStoreEntity = systemService.findUniqueByProperty(BaStoreEntity.class,"storeCode",wmOmNoticeH.getStoreCode()); Row row2 = sheet.createRow((short) page*20+1); // 第二行标题 //row2.setHeight((short) 700); - Cell cellTitle2 = row2.createCell(0); + Cell cellTitle20 = row2.createCell(0); + if (baStoreEntity != null) { + cellTitle20.setCellValue("仓库:"+(StringUtils.isEmpty(baStoreEntity.getStoreName())?"":baStoreEntity.getStoreName())); + }else { + cellTitle20.setCellValue("仓库:"); + } + cellTitle20.setCellStyle(cs1); + Cell cellTitle2 = row2.createCell(3); cellTitle2.setCellValue("销售部门:"); cellTitle2.setCellStyle(cs1); - Cell cellTitle21 = row2.createCell(3); - cellTitle21.setCellValue("送货方式:仓库自提"); + Cell cellTitle21 = row2.createCell(6); + cellTitle21.setCellValue("送货方式:"+ (StringUtils.isEmpty(wmOmNoticeH.getDelvMethod())?"":wmOmNoticeH.getDelvMethod())); cellTitle21.setCellStyle(cs1); Row row3 = sheet.createRow((short) page*20+2); // 第二行标题 @@ -1613,6 +1645,7 @@ public class WmOmNoticeHController extends BaseController { 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); @@ -1623,7 +1656,7 @@ public class WmOmNoticeHController extends BaseController { cellTitle42.setCellValue("客户名称:"+wmOmNoticeH.getOcusName() == null ?"":wmOmNoticeH.getOcusName()); cellTitle42.setCellStyle(cs1); Cell cellTitle43 = row4.createCell(6); - cellTitle43.setCellValue("送货日期:"+DateUtils.date2Str(wmOmNoticeH.getDelvData(), DateUtils.date_sdf)); + cellTitle43.setCellValue("送货日期:"+wmOmNoticeH.getDelvData() == null?"":DateUtils.date2Str(wmOmNoticeH.getDelvData(), DateUtils.date_sdf)); cellTitle43.setCellStyle(cs1); //MdCusOtherEntity cusOther = systemService.findUniqueByProperty(MdCusOtherEntity.class,"keHuBianMa",wmOmNoticeH.getOcusCode()); @@ -1643,7 +1676,7 @@ public class WmOmNoticeHController extends BaseController { Row row6 = sheet.createRow((short) page*20+5); // 第二行标题 //row6.setHeight((short) 700); Cell cellTitle61 = row6.createCell(0); - cellTitle61.setCellValue("送货地址:"+wmOmNoticeH.getDelvAddr()); + cellTitle61.setCellValue("送货地址:"+wmOmNoticeH.getDelvAddr() == null ?"":wmOmNoticeH.getDelvAddr()); cellTitle61.setCellStyle(cs1); Row row7 = sheet.createRow((short) page*20+6); // 第二行标题 @@ -1766,7 +1799,7 @@ public class WmOmNoticeHController extends BaseController { Row rowColumnName = sheet.createRow((short) page*20+7); // 列名 String[] columnNames = { "序号", "商品编码", "商品名称", "生产日期", "品质","箱数", "拆零数", "毛重/KG","体积/cm³","备注" }; - String[] columnNames2 = { "物料", "物料名称", "型号", "批次", "规格","数量", "重量", "体积","库区","备注" }; + String[] columnNames2 = { "物料", "物料名称", "单价", "批次", "规格","数量", "重量", "体积","库区","备注" }; try{ if("hr".equals(ResourceUtil.getConfigByName("wm.ckd"))){ // String[] columnNames1 = { "序号", "商品编码", "商品名称", "生产日期", "品质","箱数", "拆零数", "毛重/KG","库存","备注" }; @@ -1810,8 +1843,7 @@ public class WmOmNoticeHController extends BaseController { cell2.setCellStyle(cs5); Cell cell3 = rowColumnValue.createCell(2); -// cell3.setCellValue(result.get(i).get("shp_ming_cheng") -// .toString()); + cell3.setCellValue(result.get(i).get("gao_dan_pin").toString()); // cell3.setCellValue("0"); cell3.setCellStyle(cs5); try { @@ -1821,8 +1853,7 @@ public class WmOmNoticeHController extends BaseController { // cell4.setCellValue(result.get(i).get("pro_data") // .toString()); - cell4.setCellValue("无"); - + cell4.setCellValue(""); cell4.setCellStyle(cs5r); } catch (Exception e) { // TODO: handle exception @@ -1842,13 +1873,12 @@ public class WmOmNoticeHController extends BaseController { try { - long xs = (long) Math.floor(Double.parseDouble(result.get(i).get("goods_count") - .toString()) / Double.parseDouble(result.get(i).get("chl_shl") + 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(sumxs); + cell6.setCellValue(xs); cell6.setCellStyle(cs5); } catch (Exception e) { @@ -1862,11 +1892,11 @@ public class WmOmNoticeHController extends BaseController { // .toString()); // sum = sum + bs; double zhl = Double.parseDouble(result.get(i).get("tin_zhl") - .toString()) * Double.parseDouble(result.get(i).get("goods_count").toString()); + .toString()); sumzl = sumzl + zhl; Cell cell7 = rowColumnValue.createCell(6);// 数量 // cell7.setCellValue(bs); - cell7.setCellValue(sumzl); + cell7.setCellValue(zhl); cell7.setCellStyle(cs5); } catch (Exception e) { // TODO: handle exception @@ -1927,14 +1957,15 @@ public class WmOmNoticeHController extends BaseController { cell5.setCellStyle(cs5); Cell cell6 = rowColumnValue.createCell(6);// 备注 cell6.setCellValue(Double.toString(sumzl)); +// cell6.setCellValue(""); cell5.setCellStyle(cs5); - Cell cell7 = rowColumnValue.createCell(7);// 重量合计 + Cell cell7 = rowColumnValue.createCell(7);// cell7.setCellValue(""); cell7.setCellStyle(cs5); - Cell cell8 = rowColumnValue.createCell(8);// 重量合计 + Cell cell8 = rowColumnValue.createCell(8);// cell8.setCellValue(""); cell8.setCellStyle(cs5); - Cell cell9 = rowColumnValue.createCell(9);// 重量合计 + Cell cell9 = rowColumnValue.createCell(9);// cell9.setCellValue(""); cell9.setCellStyle(cs5); // cell6.setCellStyle(cs5); @@ -2064,18 +2095,18 @@ public class WmOmNoticeHController extends BaseController { id);//获取抬头 - printHeader.setHeader01(ResourceUtil.getConfigByName("comname")+"出库单"); + printHeader.setHeader01("配送单"); printHeader.setHeader02("公司地址:"+ResourceUtil.getConfigByName("comaddr") ); printHeader.setHeader03("电话:"+ ResourceUtil.getConfigByName("comtel")); - printHeader.setHeader04("出库日期: " +DateUtils.date2Str(wmOmNoticeH.getDelvData(), DateUtils.date_sdf) ); + printHeader.setHeader04("送货日期: " +(wmOmNoticeH.getDelvData() == null ?"":DateUtils.date2Str(wmOmNoticeH.getDelvData(), DateUtils.date_sdf))); printHeader.setHeader05("出库单号: " +wmOmNoticeH.getOmNoticeId()); - printHeader.setHeader06("客户单号: " +wmOmNoticeH.getImCusCode()); + printHeader.setHeader06("参考单号: " +wmOmNoticeH.getImCusCode()); printHeader.setHeader07("车号: " +wmOmNoticeH.getReCarno()); @@ -2084,18 +2115,32 @@ public class WmOmNoticeHController extends BaseController { printHeader.setHeader08("客户名称: " +wmOmNoticeH.getCusCode()+md.getZhongWenQch()); - printHeader.setHeader09("收货人: "+wmOmNoticeH.getDelvMember()+" 电话:"+wmOmNoticeH.getDelvMobile() ); + printHeader.setHeader09("联系人: "+wmOmNoticeH.getDelvMember()); - printHeader.setHeader10("收货地址: " +wmOmNoticeH.getDelvAddr()); + printHeader.setHeader10("送货地址: " +wmOmNoticeH.getDelvAddr()); printHeader.setHeader11("打印时间: "+DateUtils.date2Str(DateUtils.getDate(), DateUtils.datetimeFormat) ); - printHeader.setHeader14("备注: " +wmOmNoticeH.getOmBeizhu()); + printHeader.setHeader14("销售部门: " ); + printHeader.setHeader15("送货方式: "+(StringUtils.isEmpty(wmOmNoticeH.getDelvMethod())?"":wmOmNoticeH.getDelvMethod()) ); + printHeader.setHeader16("备注: " +wmOmNoticeH.getOmBeizhu()); + printHeader.setHeader17("销售员: "); + printHeader.setHeader18("销售员电话: "); + 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())); + }else { + printHeader.setHeader21("仓库: "); + } + List 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_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_code group by wq.order_id, mg.goods_code,wq.goods_pro_data"; + +" and wq.goods_id = mg.goods_id group by wq.order_id, mg.goods_code,wq.goods_pro_data"; List> result = systemService .findForJdbc(tsql, itemId); @@ -2103,9 +2148,9 @@ 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,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_code group by wq.om_notice_id, mg.goods_code,wq.pro_data"; + +" and wq.goods_id = mg.goods_id group by wq.om_notice_id, mg.goods_code,wq.pro_data"; result = systemService .findForJdbc(tsql, wmOmNoticeH.getOmNoticeId()); size = result.size(); @@ -2135,8 +2180,7 @@ public class WmOmNoticeHController extends BaseController { try { - long xs = (long) Math.floor(Double.parseDouble(result.get(i).get("goods_count") - .toString()) / Double.parseDouble(result.get(i).get("chl_shl") + long xs = (long) Math.floor(Double.parseDouble(result.get(i).get("base_goodscount") .toString())); sumxs = sumxs + xs; printItem.setItem05(Long.toString(xs)); @@ -2159,7 +2203,7 @@ public class WmOmNoticeHController extends BaseController { 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)); + printItem.setItem07(""); } catch (Exception e) { // TODO: handle exception @@ -2179,7 +2223,14 @@ public class WmOmNoticeHController extends BaseController { }catch (Exception e){ logger.error(ExceptionUtil.getExceptionMessage(e)); } - + printItem.setItem10(result.get(i).get("shp_gui_ge") + .toString()); + try{ + printItem.setItem11(result.get(i).get("gao_dan_pin") + .toString()); + }catch (Exception e){ + logger.error(ExceptionUtil.getExceptionMessage(e)); + } listitem.add(printItem); } @@ -2233,7 +2284,7 @@ public class WmOmNoticeHController extends BaseController { 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"; + +" and wq.goods_id = mg.goods_id group by wq.order_id, mg.goods_code,wq.goods_pro_data"; List> result = systemService .findForJdbc(tsql, wmOmNoticeH.getOmNoticeId()); @@ -2243,7 +2294,7 @@ public class WmOmNoticeHController extends BaseController { 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"; + +" and wq.goods_id = mg.goods_id group by wq.om_notice_id, mg.goods_code,wq.pro_data"; result = systemService .findForJdbc(tsql, wmOmNoticeH.getOmNoticeId()); size = result.size(); @@ -2533,12 +2584,12 @@ public class WmOmNoticeHController extends BaseController { } if(roles.equals("CUS")){ cq.eq("cusCode", user.getUserName()); - } } //自定义追加查询条件 }catch (Exception e) { + e.printStackTrace(); throw new BusinessException(e.getMessage()); } cq.add(); diff --git a/src/main/java/com/zzjee/wm/controller/WmSttInGoodsController.java b/src/main/java/com/zzjee/wm/controller/WmSttInGoodsController.java index 57fcabe9..f13f414a 100644 --- a/src/main/java/com/zzjee/wm/controller/WmSttInGoodsController.java +++ b/src/main/java/com/zzjee/wm/controller/WmSttInGoodsController.java @@ -2,6 +2,7 @@ package com.zzjee.wm.controller; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -612,8 +613,10 @@ public class WmSttInGoodsController extends BaseController { //保存 try{ WmSttInGoodsEntity t = systemService.get(WmSttInGoodsEntity.class,wmSttInGoods.getId()); + MyBeanUtils.copyBeanNotNull2Bean(wmSttInGoods,t); t.setSttSta(Constants.wm_sta4); + t.setUpdateDate(new Date()); wmSttInGoodsService.saveOrUpdate(t); D0.setOK(true); } catch (Exception e) { diff --git a/src/main/java/com/zzjee/wm/controller/WmToUpGoodsController.java b/src/main/java/com/zzjee/wm/controller/WmToUpGoodsController.java index 4a3b0271..ccdf423d 100644 --- a/src/main/java/com/zzjee/wm/controller/WmToUpGoodsController.java +++ b/src/main/java/com/zzjee/wm/controller/WmToUpGoodsController.java @@ -33,6 +33,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants; import org.jeecgframework.tag.core.easyui.TagUtil; +import org.jeecgframework.web.system.pojo.base.TSBaseUser; import org.jeecgframework.web.system.service.SystemService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -498,6 +499,12 @@ public class WmToUpGoodsController extends BaseController { wmToUpGoods.setGoodsName(wmInQmIEntity.getGoodsName()); wmToUpGoods.setCreateDate(DateUtils.getDate()); + + TSBaseUser user = systemService.findUniqueByProperty(TSBaseUser.class,"userName",wmToUpGoods.getCreateBy()); + if (user != null ) { + wmToUpGoods.setCreateName(user.getRealName()); + } + wmToUpGoodsService.save(wmToUpGoods); } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/com/zzjee/wm/controller/WmsApiController.java b/src/main/java/com/zzjee/wm/controller/WmsApiController.java index 44a1ade0..4014030d 100644 --- a/src/main/java/com/zzjee/wm/controller/WmsApiController.java +++ b/src/main/java/com/zzjee/wm/controller/WmsApiController.java @@ -117,8 +117,8 @@ public class WmsApiController { org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, mdGoods, request.getParameterMap()); - if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ - cq.eq("suoShuKeHu", wmUtil.getCusCode()); + if(StringUtil.isNotEmpty(mdGoods.getSuoShuKeHu())){ + cq.eq("suoShuKeHu", mdGoods.getSuoShuKeHu()); } if(StringUtil.isNotEmpty(mdGoods.getShpBianMakh())){ cq.eq("shpBianMakh", mdGoods.getShpBianMakh()); diff --git a/src/main/java/com/zzjee/wm/entity/PrintHeader.java b/src/main/java/com/zzjee/wm/entity/PrintHeader.java index 8040cf7c..6d119de0 100644 --- a/src/main/java/com/zzjee/wm/entity/PrintHeader.java +++ b/src/main/java/com/zzjee/wm/entity/PrintHeader.java @@ -21,6 +21,16 @@ public class PrintHeader { private String header18; private String header19; private String header20; + private String header21; + + public String getHeader21() { + return header21; + } + + public PrintHeader setHeader21(String header21) { + this.header21 = header21; + return this; + } public String getHeader01() { return header01; diff --git a/src/main/java/com/zzjee/wm/entity/WmImNoticeHEntity.java b/src/main/java/com/zzjee/wm/entity/WmImNoticeHEntity.java index 731d767f..56e1365d 100644 --- a/src/main/java/com/zzjee/wm/entity/WmImNoticeHEntity.java +++ b/src/main/java/com/zzjee/wm/entity/WmImNoticeHEntity.java @@ -61,7 +61,7 @@ public class WmImNoticeHEntity implements java.io.Serializable { private java.lang.String sysCompanyCode; /**客户编码*/ - @Excel(name="客户编码") + @Excel(name="供应商编码") private java.lang.String cusCode; /**预计到货时间*/ @Excel(name="预计到货时间",format = "yyyy-MM-dd") @@ -108,6 +108,19 @@ public class WmImNoticeHEntity implements java.io.Serializable { private java.lang.String piClass; private java.lang.String piMaster; + + @Column(name ="store_code",length=50) + public String getStoreCode() { + return storeCode; + } + + public WmImNoticeHEntity setStoreCode(String storeCode) { + this.storeCode = storeCode; + return this; + } + + private String storeCode; + /** *方法: 取得java.lang.String *@return: java.lang.String 主键 diff --git a/src/main/java/com/zzjee/wm/entity/WmOmNoticeHEntity.java b/src/main/java/com/zzjee/wm/entity/WmOmNoticeHEntity.java index a58a4fd1..957e3068 100644 --- a/src/main/java/com/zzjee/wm/entity/WmOmNoticeHEntity.java +++ b/src/main/java/com/zzjee/wm/entity/WmOmNoticeHEntity.java @@ -59,7 +59,7 @@ public class WmOmNoticeHEntity implements java.io.Serializable { private java.lang.String sysCompanyCode; /**客户*/ - @Excel(name="客户") + @Excel(name="供应商编码") private java.lang.String cusCode; /**客户订单号*/ @Excel(name="客户订单号") @@ -100,10 +100,10 @@ public class WmOmNoticeHEntity implements java.io.Serializable { /**附件*/ private java.lang.String fuJian; - @Excel(name="三方客户编号") + @Excel(name="客户编号") private java.lang.String ocusCode; - @Excel(name="三方客户名称") + @Excel(name="客户名称") private java.lang.String ocusName; private java.lang.String printStatus; @@ -111,6 +111,31 @@ public class WmOmNoticeHEntity implements java.io.Serializable { private java.lang.String piClass; private java.lang.String piMaster; + @Excel(name = "送货方式") + private String delvMethod; + + private String storeCode; + + + @Column(name ="store_code",nullable=true,length=50) + public String getStoreCode() { + return storeCode; + } + + public WmOmNoticeHEntity setStoreCode(String storeCode) { + this.storeCode = storeCode; + return this; + } + + @Column(name ="delv_method",nullable=true,length=32) + public String getDelvMethod() { + return delvMethod; + } + + public WmOmNoticeHEntity setDelvMethod(String delvMethod) { + this.delvMethod = delvMethod; + return this; + } /** *方法: 取得java.lang.String diff --git a/src/main/java/com/zzjee/wm/entity/WmSttInGoodsEntity.java b/src/main/java/com/zzjee/wm/entity/WmSttInGoodsEntity.java index f0a7c343..f8e04acd 100644 --- a/src/main/java/com/zzjee/wm/entity/WmSttInGoodsEntity.java +++ b/src/main/java/com/zzjee/wm/entity/WmSttInGoodsEntity.java @@ -18,12 +18,12 @@ import org.hibernate.annotations.GenericGenerator; import javax.persistence.SequenceGenerator; import org.jeecgframework.poi.excel.annotation.Excel; -/** +/** * @Title: Entity * @Description: 盘点 * @author erzhongxmu * @date 2017-09-11 15:25:24 - * @version V1.0 + * @version V1.0 * */ @Entity @@ -56,11 +56,11 @@ public class WmSttInGoodsEntity implements java.io.Serializable { /**所属公司*/ @Excel(name="所属公司") private java.lang.String sysCompanyCode; - + /**盘点单号*/ @Excel(name="盘点单号") private java.lang.String sttId; - + /**库位编码*/ @Excel(name="库位编码") private java.lang.String binId; @@ -91,10 +91,10 @@ public class WmSttInGoodsEntity implements java.io.Serializable { @Excel(name="盘点数量") private java.lang.String sttQua; /**客户名称*/ - @Excel(name="客户名称") + @Excel(name="货主名称") private java.lang.String cusName; /**客户*/ - @Excel(name="客户") + @Excel(name="货主编码") private java.lang.String cusCode; /**盘点状态*/ @Excel(name="盘点状态") @@ -108,7 +108,7 @@ public class WmSttInGoodsEntity implements java.io.Serializable { /**基本单位数量*/ @Excel(name="基本单位数量") private java.lang.String baseGoodscount; - + /** *方法: 取得java.lang.String *@return: java.lang.String 主键 @@ -256,10 +256,10 @@ public class WmSttInGoodsEntity implements java.io.Serializable { public void setSysCompanyCode(java.lang.String sysCompanyCode){ this.sysCompanyCode = sysCompanyCode; } - - - - + + + + @Column(name ="STT_ID",nullable=true,length=36) public java.lang.String getSttId() { return sttId; @@ -285,7 +285,7 @@ public class WmSttInGoodsEntity implements java.io.Serializable { public void setBinId(java.lang.String binId){ this.binId = binId; } - + @Column(name ="DONG_XIAN",nullable=true,length=36) public java.lang.String getDongXian(){ return this.dongXian; @@ -298,8 +298,8 @@ public class WmSttInGoodsEntity implements java.io.Serializable { public void setDongXian(java.lang.String dongXian){ this.dongXian = dongXian; } - - + + /** *方法: 取得java.lang.String *@return: java.lang.String 托盘编码 @@ -308,7 +308,7 @@ public class WmSttInGoodsEntity implements java.io.Serializable { public java.lang.String getTinId(){ return this.tinId; } - + /** *方法: 设置java.lang.String *@param: java.lang.String 托盘编码 diff --git a/src/main/java/com/zzjee/wm/page/WmOmNoticeHPage.java b/src/main/java/com/zzjee/wm/page/WmOmNoticeHPage.java index 3a9bf00c..8aebb817 100644 --- a/src/main/java/com/zzjee/wm/page/WmOmNoticeHPage.java +++ b/src/main/java/com/zzjee/wm/page/WmOmNoticeHPage.java @@ -20,34 +20,34 @@ import javax.persistence.SequenceGenerator; import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.ExcelCollection; -/** +/** * @Title: Entity * @Description: 出货通知抬头 * @author erzhongxmu * @date 2017-09-11 15:24:58 - * @version V1.0 + * @version V1.0 * */ public class WmOmNoticeHPage implements java.io.Serializable { /**主键*/ private java.lang.String id; /**创建人名称*/ - + private java.lang.String createName; /**创建人登录名称*/ - + private java.lang.String createBy; /**创建日期*/ - + private java.util.Date createDate; /**更新人名称*/ - + private java.lang.String updateName; /**更新人登录名称*/ - + private java.lang.String updateBy; /**更新日期*/ - + private java.util.Date updateDate; /**所属部门*/ private java.lang.String readonly; @@ -56,44 +56,79 @@ public class WmOmNoticeHPage implements java.io.Serializable { private java.lang.String wherecon; private java.lang.String sysOrgCode; /**所属公司*/ - + private java.lang.String sysCompanyCode; /**客户*/ + @Excel(name="供应商编码") private java.lang.String cusCode; /**要求交货时间*/ + @Excel(name="要求交货时间",format = "yyyy-MM-dd") private java.util.Date delvData; /**收货人*/ + @Excel(name="收货人") private java.lang.String delvMember; /**收货人电话*/ + @Excel(name="收货人电话") private java.lang.String delvMobile; /**收货人地址*/ + @Excel(name="收货人地址") private java.lang.String delvAddr; /**承运人*/ + @Excel(name="承运人") private java.lang.String reMember; /**承运人电话*/ + @Excel(name="承运人电话") private java.lang.String reMobile; /**承运人车号*/ + @Excel(name="承运人车号") private java.lang.String reCarno; /**发货月台*/ private java.lang.String omPlatNo; /**备注*/ + @Excel(name="备注") private java.lang.String omBeizhu; /**状态*/ private java.lang.String omSta; /**出货单号*/ + @Excel(name="出货单号",width = 30) private java.lang.String omNoticeId; /**附件*/ - + private java.lang.String fuJian; - + @Excel(name="客户编号") private java.lang.String ocusCode; - + @Excel(name="客户名称") private java.lang.String ocusName; + @Excel(name="客户订单号") private java.lang.String imCusCode; private java.lang.String printStatus; private java.lang.String piClass; private java.lang.String piMaster; + @Excel(name = "送货方式") + private String delvMethod; + + private String storeCode; + + public String getDelvMethod() { + return delvMethod; + } + + public WmOmNoticeHPage setDelvMethod(String delvMethod) { + this.delvMethod = delvMethod; + return this; + } + + public String getStoreCode() { + return storeCode; + } + + public WmOmNoticeHPage setStoreCode(String storeCode) { + this.storeCode = storeCode; + return this; + } + + /** *方法: 取得java.lang.String *@return: java.lang.String 主键 @@ -500,6 +535,7 @@ public class WmOmNoticeHPage implements java.io.Serializable { } /**保存-出货通知项目*/ + @ExcelCollection(name = "出货通知项目") private List wmOmNoticeIList = new ArrayList(); public List getWmOmNoticeIList() { return wmOmNoticeIList; diff --git a/src/main/java/com/zzjee/wm/service/WmToUpGoodsServiceI.java b/src/main/java/com/zzjee/wm/service/WmToUpGoodsServiceI.java index 89f4a37c..f1595cfc 100644 --- a/src/main/java/com/zzjee/wm/service/WmToUpGoodsServiceI.java +++ b/src/main/java/com/zzjee/wm/service/WmToUpGoodsServiceI.java @@ -1,15 +1,18 @@ package com.zzjee.wm.service; import com.zzjee.wm.entity.WmToUpGoodsEntity; import org.jeecgframework.core.common.service.CommonService; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.util.UriComponentsBuilder; import java.io.Serializable; public interface WmToUpGoodsServiceI extends CommonService{ - + public void delete(WmToUpGoodsEntity entity) throws Exception; - + public Serializable save(WmToUpGoodsEntity entity) throws Exception; - + public void saveOrUpdate(WmToUpGoodsEntity entity) throws Exception; - + } diff --git a/src/main/java/com/zzjee/wm/service/impl/WmToUpGoodsServiceImpl.java b/src/main/java/com/zzjee/wm/service/impl/WmToUpGoodsServiceImpl.java index c55b8218..6b172c23 100644 --- a/src/main/java/com/zzjee/wm/service/impl/WmToUpGoodsServiceImpl.java +++ b/src/main/java/com/zzjee/wm/service/impl/WmToUpGoodsServiceImpl.java @@ -1,30 +1,50 @@ package com.zzjee.wm.service.impl; +import com.zzjee.api.ResultDO; +import com.zzjee.wm.entity.WmInQmIEntity; import com.zzjee.wm.service.WmToUpGoodsServiceI; +import com.zzjee.wmutil.wmUtil; +import org.jeecgframework.core.beanvalidator.BeanValidators; import org.jeecgframework.core.common.service.impl.CommonServiceImpl; import com.zzjee.wm.entity.WmToUpGoodsEntity; +import org.jeecgframework.core.util.DateUtils; +import org.jeecgframework.core.util.JSONHelper; +import org.jeecgframework.web.system.pojo.base.TSBaseUser; +import org.jeecgframework.web.system.service.SystemService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.Set; import java.util.UUID; import java.io.Serializable; import org.jeecgframework.core.util.ApplicationContextUtil; import org.jeecgframework.core.util.MyClassLoader; import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.util.UriComponentsBuilder; + +import javax.validation.ConstraintViolation; @Service("wmToUpGoodsService") @Transactional public class WmToUpGoodsServiceImpl extends CommonServiceImpl implements WmToUpGoodsServiceI { - + @Autowired + private SystemService systemService; + + @Override public void delete(WmToUpGoodsEntity entity) throws Exception{ super.delete(entity); //执行删除操作增强业务 this.doDelBus(entity); } - + @Override public Serializable save(WmToUpGoodsEntity entity) throws Exception{ Serializable t = super.save(entity); @@ -32,14 +52,14 @@ public class WmToUpGoodsServiceImpl extends CommonServiceImpl implements WmToUpG this.doAddBus(entity); return t; } - + @Override public void saveOrUpdate(WmToUpGoodsEntity entity) throws Exception{ super.saveOrUpdate(entity); //执行更新操作增强业务 this.doUpdateBus(entity); } - + /** * 新增操作增强业务 * @param t @@ -48,7 +68,7 @@ public class WmToUpGoodsServiceImpl extends CommonServiceImpl implements WmToUpG private void doAddBus(WmToUpGoodsEntity t) throws Exception{ //-----------------sql增强 start---------------------------- //-----------------sql增强 end------------------------------ - + //-----------------java增强 start--------------------------- //-----------------java增强 end----------------------------- } @@ -60,7 +80,7 @@ public class WmToUpGoodsServiceImpl extends CommonServiceImpl implements WmToUpG private void doUpdateBus(WmToUpGoodsEntity t) throws Exception{ //-----------------sql增强 start---------------------------- //-----------------sql增强 end------------------------------ - + //-----------------java增强 start--------------------------- //-----------------java增强 end----------------------------- } @@ -72,11 +92,11 @@ public class WmToUpGoodsServiceImpl extends CommonServiceImpl implements WmToUpG private void doDelBus(WmToUpGoodsEntity t) throws Exception{ //-----------------sql增强 start---------------------------- //-----------------sql增强 end------------------------------ - + //-----------------java增强 start--------------------------- //-----------------java增强 end----------------------------- } - + private Map populationMap(WmToUpGoodsEntity t){ Map map = new HashMap(); map.put("id", t.getId()); @@ -105,7 +125,7 @@ public class WmToUpGoodsServiceImpl extends CommonServiceImpl implements WmToUpG map.put("base_goodscount", t.getBaseGoodscount()); return map; } - + /** * 替换sql中的变量 * @param sql @@ -140,7 +160,7 @@ public class WmToUpGoodsServiceImpl extends CommonServiceImpl implements WmToUpG sql = sql.replace("#{UUID}",UUID.randomUUID().toString()); return sql; } - + /** * 执行JAVA增强 */ @@ -161,7 +181,7 @@ public class WmToUpGoodsServiceImpl extends CommonServiceImpl implements WmToUpG } catch (Exception e) { e.printStackTrace(); throw new Exception("执行JAVA增强出现异常!"); - } + } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/zzjee/wmutil/wmUtil.java b/src/main/java/com/zzjee/wmutil/wmUtil.java index 9b4cc24e..61630639 100644 --- a/src/main/java/com/zzjee/wmutil/wmUtil.java +++ b/src/main/java/com/zzjee/wmutil/wmUtil.java @@ -379,9 +379,8 @@ public class wmUtil { + " and ws.ku_wei_bian_ma = ? " + " and ws.bin_id = ? " + " and ws.goods_id = ? " - + " and ws.goods_pro_data = ? " + " group by ws.ku_wei_bian_ma,ws.bin_id,ws.goods_id,mb.qu_huo_ci_xu, ws.goods_pro_data order by ws.goods_pro_data , ws.goods_qua ,mb.qu_huo_ci_xu,ws.create_date desc"; - List> result= systemService.findForJdbc(tsql, binid,tinid,goods,prodate); + List> result= systemService.findForJdbc(tsql, binid,tinid,goods); if(result.size() > 0) { if(Double.parseDouble(result.get(0).get("goods_qua").toString())>=Double.parseDouble(basecount)){ flag = true; @@ -475,10 +474,9 @@ public class wmUtil { + " and ws.ku_wei_bian_ma = ? " + " and ws.bin_id = ? " + " and ws.goods_id = ? " - + " and ws.goods_pro_data = ? " - + " group by ws.ku_wei_bian_ma,ws.bin_id,ws.goods_id,mb.qu_huo_ci_xu, ws.goods_pro_data order by ws.goods_pro_data , ws.goods_qua ,mb.qu_huo_ci_xu,ws.create_date desc"; + + " group by ws.ku_wei_bian_ma,ws.bin_id,ws.goods_id,mb.qu_huo_ci_xu order by ws.goods_pro_data , ws.goods_qua ,mb.qu_huo_ci_xu,ws.create_date desc"; - List> result = systemService.findForJdbc(tsql, binid, tinid, goods, prodate); + List> result = systemService.findForJdbc(tsql, binid, tinid, goods); if (result.size() > 0) { if (Double.parseDouble(result.get(0).get("goods_qua").toString()) >= Double.parseDouble(basecount)) { flag = true; @@ -567,11 +565,10 @@ e.printStackTrace(); + " and ws.ku_wei_bian_ma = ? " + " and ws.bin_id = ? " + " and ws.goods_id = ? " - + " and ws.goods_pro_data = ? " + " and ws.cus_code = ? " + " group by ws.ku_wei_bian_ma,ws.bin_id,ws.goods_id,mb.qu_huo_ci_xu, ws.goods_pro_data order by ws.goods_pro_data , ws.goods_qua ,mb.qu_huo_ci_xu,ws.create_date desc"; - List> result = systemService.findForJdbc(tsql, binid, tinid, goods, prodate,cuscode); + List> result = systemService.findForJdbc(tsql, binid, tinid, goods,cuscode); if (result.size() > 0) { if (Double.parseDouble(result.get(0).get("goods_qua").toString()) >= Double.parseDouble(basecount)) { flag = true; diff --git a/src/main/java/com/zzjee/wv/entity/MvStockCusEntity.java b/src/main/java/com/zzjee/wv/entity/MvStockCusEntity.java index 03a8063a..86ee0374 100644 --- a/src/main/java/com/zzjee/wv/entity/MvStockCusEntity.java +++ b/src/main/java/com/zzjee/wv/entity/MvStockCusEntity.java @@ -18,12 +18,12 @@ import org.hibernate.annotations.GenericGenerator; import javax.persistence.SequenceGenerator; import org.jeecgframework.poi.excel.annotation.Excel; -/** +/** * @Title: Entity * @Description: 客户库存 * @author erzhongxmu * @date 2017-09-17 21:45:28 - * @version V1.0 + * @version V1.0 * */ @Entity @@ -56,10 +56,10 @@ public class MvStockCusEntity implements java.io.Serializable { // @Excel(name="托盘") private java.lang.String binId; /**客户*/ - @Excel(name="客户") + @Excel(name="供应商编码") private java.lang.String cusCode; /**客户名称*/ - @Excel(name="客户名称") + @Excel(name="供应商名称") private java.lang.String zhongWenQch; /**商品编码*/ @Excel(name="商品编码") @@ -86,12 +86,12 @@ public class MvStockCusEntity implements java.io.Serializable { @Excel(name="库位类型") private java.lang.String kuWeiLeiXing; /**取货次序*/ - + private java.lang.String quHuoCiXu; /**上架次序*/ - + private java.lang.String shangJiaCiXu; - + /** *方法: 取得java.lang.String *@return: java.lang.String id @@ -290,9 +290,9 @@ public class MvStockCusEntity implements java.io.Serializable { public void setGoodsId(java.lang.String goodsId){ this.goodsId = goodsId; } - - - + + + @Column(name ="shp_bian_makh",nullable=true,length=32) public java.lang.String getShpBianmakh(){ return this.shpBianmakh; @@ -305,8 +305,8 @@ public class MvStockCusEntity implements java.io.Serializable { public void setShpBianmakh(java.lang.String shpBianmakh){ this.shpBianmakh = shpBianmakh; } - - + + /** *方法: 取得java.lang.String *@return: java.lang.String 商品名称 @@ -427,7 +427,7 @@ public class MvStockCusEntity implements java.io.Serializable { public void setKuWeiLeiXing(java.lang.String kuWeiLeiXing) { this.kuWeiLeiXing = kuWeiLeiXing; } - - - + + + } diff --git a/src/main/java/org/jeecgframework/web/system/sms/util/task/SmsSendTask.java b/src/main/java/org/jeecgframework/web/system/sms/util/task/SmsSendTask.java index 10d0f06f..d17a1462 100644 --- a/src/main/java/org/jeecgframework/web/system/sms/util/task/SmsSendTask.java +++ b/src/main/java/org/jeecgframework/web/system/sms/util/task/SmsSendTask.java @@ -5,6 +5,7 @@ import java.util.Date; import java.util.List; import java.util.Map; +import com.sap.tc.logging.interfaces.IFileLog; import org.jeecgframework.core.util.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -302,7 +303,7 @@ public class SmsSendTask { wmToMoveGoodsEntity.setRunSta("库存不足"); systemService.saveOrUpdate(wmToMoveGoodsEntity); continue; - }; + } MdBinEntity mdbin = systemService.findUniqueByProperty(MdBinEntity.class, "kuWeiBianMa", wmToMoveGoodsEntity.getBinTo()); if(mdbin==null){ wmToMoveGoodsEntity.setMoveSta("储位不存在"); @@ -332,7 +333,7 @@ public class SmsSendTask { } MvGoodsEntity mvgoods = new MvGoodsEntity(); mvgoods = systemService.findUniqueByProperty( - MvGoodsEntity.class, "goodsCode", + MvGoodsEntity.class, "goodsId", wmToMoveGoodsEntity.getGoodsId()); wmToDownGoods.setGoodsName(mvgoods.getGoodsName()); if(StringUtil.isEmpty(wmToMoveGoodsEntity.getBaseGoodscount())){ @@ -384,6 +385,7 @@ public class SmsSendTask { systemService.saveOrUpdate(wmToMoveGoodsEntity); } } catch (Exception e) { + e.printStackTrace(); // TODO: handle exception } this.rundowntask();//下架任务 @@ -475,12 +477,12 @@ public class SmsSendTask { } } catch (Exception e) { - + e.printStackTrace(); } try { mvgoods = systemService.findUniqueByProperty( - MvGoodsEntity.class, "goodsCode", + MvGoodsEntity.class, "goodsId", goods); wmOmQmIEntity.setGoodsId(mvgoods.getGoodsId()); wmOmQmIEntity.setBarCode(mvgoods.getShpTiaoMa()); @@ -533,7 +535,7 @@ public class SmsSendTask { resultt = systemService .findForJdbc(tsql, mvgoods.getGoodsId(), wmOmQmIEntity.getCusCode()); } catch (Exception e) { - +e.printStackTrace(); } if (resultt != null && resultt.size() > 0) { String goodprodata = null; @@ -541,7 +543,7 @@ public class SmsSendTask { goodprodata = resultt.get(0).get("goods_pro_data").toString(); } catch (Exception e) { - +e.printStackTrace(); } String hiti = "0"; try { @@ -664,8 +666,9 @@ public class SmsSendTask { try { double bin_qua = Double.valueOf(result.get(i) .get("goods_qua").toString()); + System.out.println("****************bin_qua"+bin_qua+"****************omcountwq"+omcountwq); if (bin_qua > 0 && omcountwq > 0) { - if (omcountwq > bin_qua) { + if (omcountwq >= bin_qua) { wmOmQmIEntity.setBinId(result.get(i) .get("ku_wei_bian_ma").toString()); wmOmQmIEntity.setTinId(result.get(i) @@ -676,10 +679,15 @@ public class SmsSendTask { .setBaseGoodscount(result.get(i) .get("goods_qua") .toString()); - wmOmQmIEntity.setProData(result.get(i) - .get("goods_pro_data").toString()); - wmOmQmIEntity.setCusName(result.get(i) - .get("zhong_wen_qch").toString()); + if (result.get(i).get("goods_pro_data") != null) { + wmOmQmIEntity.setProData(result.get(i).get("goods_pro_data").toString()); + } + + if (result.get(i) + .get("zhong_wen_qch") != null) { + wmOmQmIEntity.setCusName(result.get(i) + .get("zhong_wen_qch").toString()); + } wmOmQmIEntity.setGoodsName(result.get(i) .get("shp_ming_cheng").toString()); omcountwq = omcountwq - bin_qua; @@ -733,8 +741,12 @@ public class SmsSendTask { .get("base_unit").toString()); wmOmQmIEntity.setBaseGoodscount(Double .toString(omcountwq)); - wmOmQmIEntity.setProData(result.get(i) - .get("goods_pro_data").toString()); + if (result.get(i) + .get("goods_pro_data") != null) { + wmOmQmIEntity.setProData(result.get(i) + .get("goods_pro_data").toString()); + } + wmOmQmIEntity.setCusName(result.get(i) .get("zhong_wen_qch").toString()); wmOmQmIEntity.setGoodsName(result.get(i) @@ -789,6 +801,7 @@ public class SmsSendTask { } } }catch (Exception e){ + e.printStackTrace(); } //catch jieshu diff --git a/src/main/resources/dbconfig.properties b/src/main/resources/dbconfig.properties index 958d5d3d..82f767b0 100644 --- a/src/main/resources/dbconfig.properties +++ b/src/main/resources/dbconfig.properties @@ -18,10 +18,11 @@ hibernate.dialect=org.hibernate.dialect.MySQLDialect validationQuery.sqlserver=SELECT 1 jdbc.url.jeecg=jdbc:mysql://127.0.0.1:3306/wms?useUnicode=true&characterEncoding=UTF-8 +#jdbc.url.jeecg=jdbc:mysql://120.92.53.114:3306/wms?useUnicode=true&characterEncoding=UTF-8 -jdbc.username.jeecg=root -#jdbc.password.jeecg=Qwer12345 -jdbc.password.jeecg=zx123456 +jdbc.username.jeecg=Hughst +jdbc.password.jeecg=123456 +#jdbc.password.jeecg=zx123456 jdbc.dbType=mysql #Oracle diff --git a/src/main/webapp/images/icon_sx.jpeg b/src/main/webapp/images/icon_sx.jpeg new file mode 100644 index 00000000..311c1d81 Binary files /dev/null and b/src/main/webapp/images/icon_sx.jpeg differ diff --git a/src/main/webapp/webpage/com/zzjee/md/mdGoods-add.jsp b/src/main/webapp/webpage/com/zzjee/md/mdGoods-add.jsp index e5986e4d..5a792dbd 100644 --- a/src/main/webapp/webpage/com/zzjee/md/mdGoods-add.jsp +++ b/src/main/webapp/webpage/com/zzjee/md/mdGoods-add.jsp @@ -61,7 +61,7 @@ function counttiji(){
- 所属供应商 + 所属货主
- 所属供应商 + 所属货主
- \ No newline at end of file + diff --git a/src/main/webapp/webpage/com/zzjee/wm/print/jianhuorenwuzhuisu.jsp b/src/main/webapp/webpage/com/zzjee/wm/print/jianhuorenwuzhuisu.jsp index 77c6c2fd..6855faf7 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/print/jianhuorenwuzhuisu.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/print/jianhuorenwuzhuisu.jsp @@ -181,6 +181,10 @@ function downloadqrcode() { 单号:${noticeid} + + 仓库:${storeName} + + 货主:${cusname} 客户:${ocusname} diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeH-add.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeH-add.jsp index 8e4d4eed..fca9e758 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeH-add.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeH-add.jsp @@ -1,5 +1,7 @@ <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/context/mytags.jsp"%> + + @@ -173,7 +175,7 @@
- 供应商: + 货主:
- 生产厂商: + 供应商:
@@ -280,8 +282,18 @@
+
+ 仓库: +
+
+ + + + <%-- --%> +
- +
<%--
--%> <%--月台:--%> <%--
--%> diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeH-update.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeH-update.jsp index 2133f485..98aabb9c 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeH-update.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeH-update.jsp @@ -123,13 +123,13 @@
- 供应商: + 货主:
- +
@@ -202,7 +202,7 @@ ignore="ignore" value='${wmImNoticeHPage.supCode}' /> -
预约库区: @@ -234,6 +234,16 @@
+
+ 仓库: +
+
+ + + + <%-- --%> +
<%--
--%> diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeHList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeHList.jsp index 1a22e5ff..207b2b6d 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeHList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmImNoticeHList.jsp @@ -16,14 +16,14 @@ - + - + <%----%> @@ -41,7 +41,7 @@ - +<%-- --%> <%-- --%> diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmImqtNoticeHList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmImqtNoticeHList.jsp index b8c1a3a9..f25e285d 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmImqtNoticeHList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmImqtNoticeHList.jsp @@ -16,7 +16,7 @@ - + diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmImtNoticeHList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmImtNoticeHList.jsp index 0191808b..a3fc719c 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmImtNoticeHList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmImtNoticeHList.jsp @@ -16,7 +16,7 @@ - + diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmImykNoticeHList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmImykNoticeHList.jsp index 7a9db92e..1308b9b9 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmImykNoticeHList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmImykNoticeHList.jsp @@ -14,7 +14,7 @@ - + diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-add.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-add.jsp index 28de20f4..6a4254a3 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-add.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-add.jsp @@ -144,13 +144,13 @@
- 供应商: + 货主:
+ defaultVal="${wmOmNoticeHPage.cusCode}" readonly="${wmOmNoticeHPage.readonly}" dictTable="mv_cus" dictField="cus_code" dictText="cus_name" hasLabel="false" title="货主编码"> - +
@@ -295,6 +295,17 @@
+ +
+ 送货方式: +
+
+ + + + +
@@ -319,6 +330,15 @@
+
+ 仓库: +
+
+ + + +
附件 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 9637d4ee..ed193ce4 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-update.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeH-update.jsp @@ -119,14 +119,14 @@
- 供应商: + 货主:
+ readonly="${wmOmNoticeHPage.readonly}" dictTable="mv_cus" dictField="cus_code" dictText="cus_name" defaultVal='${wmOmNoticeHPage.cusCode}' hasLabel="false" title="货主编码"> - +
@@ -263,6 +263,19 @@
+
+ 送货方式: +
+
+ + + + <%-- + <%-- />--%> + + +
@@ -303,7 +316,15 @@
- +
+ 仓库: +
+
+ + + +
附件 diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeHList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeHList.jsp index d9cfe721..3da5b04d 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeHList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmOmNoticeHList.jsp @@ -19,7 +19,7 @@ - + diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodsList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodsList.jsp index ff09d95e..fc84b0f0 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodsList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodsList.jsp @@ -17,8 +17,8 @@ - - + + diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodscygzList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodscygzList.jsp index 73f0e3d7..ebf9e515 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodscygzList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodscygzList.jsp @@ -17,8 +17,8 @@ - - + + diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodsfpList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodsfpList.jsp index 52996777..1f44b7a1 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodsfpList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmSttInGoodsfpList.jsp @@ -23,8 +23,8 @@ - - + + diff --git a/src/main/webapp/webpage/com/zzjee/wv/mvStockCusList.jsp b/src/main/webapp/webpage/com/zzjee/wv/mvStockCusList.jsp index e56b7f8a..6ab575f4 100644 --- a/src/main/webapp/webpage/com/zzjee/wv/mvStockCusList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wv/mvStockCusList.jsp @@ -17,8 +17,8 @@ <%-- --%> <%-- --%> - - + + <%-- --%>