diff --git a/src/main/java/com/zzjee/md/controller/MdGoodsController.java b/src/main/java/com/zzjee/md/controller/MdGoodsController.java index fdd48fcb..66f4fa89 100644 --- a/src/main/java/com/zzjee/md/controller/MdGoodsController.java +++ b/src/main/java/com/zzjee/md/controller/MdGoodsController.java @@ -238,18 +238,17 @@ public class MdGoodsController extends BaseController { // TODO: handle exception } //查询当前商品类型的商品数量 - Map countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getChpShuXing()+"%"); + Map countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+"%"); if (countMap == null) { - mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); + mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1)); }else { Object goodsCode = countMap.get("shp_bian_ma"); if (goodsCode != null) { - mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1)); + mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1)); }else { - mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); + mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1)); } } - mdGoods.setShpTiaoMa(mdGoods.getShpBianMa()); mdGoodsService.save(mdGoods); systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); @@ -455,15 +454,15 @@ public class MdGoodsController extends BaseController { // j.setMsg("产品属性错误:"+mdGoods.getChpShuXing()); // return j; // } - Map countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getChpShuXing()+"%"); + Map countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+"%"); if (countMap == null) { - mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); + mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1)); }else { Object goodsCode = countMap.get("shp_bian_ma"); if (goodsCode != null) { - mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1)); + mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1)); }else { - mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); + mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1)); } } diff --git a/src/main/java/com/zzjee/wm/controller/WmsApiController.java b/src/main/java/com/zzjee/wm/controller/WmsApiController.java index c78cc572..17d06b1d 100644 --- a/src/main/java/com/zzjee/wm/controller/WmsApiController.java +++ b/src/main/java/com/zzjee/wm/controller/WmsApiController.java @@ -1,5 +1,7 @@ package com.zzjee.wm.controller; +import com.zzjee.ba.entity.BaGoodsTypeEntity; +import com.zzjee.ba.service.BaGoodsTypeServiceI; import com.zzjee.md.entity.MdBinEntity; import com.zzjee.md.entity.MdCusEntity; import com.zzjee.md.entity.MdCusOtherEntity; @@ -33,6 +35,7 @@ import org.jeecgframework.core.util.StringUtil; import org.jeecgframework.jwt.util.JwtUtils; import org.jeecgframework.jwt.util.ResponseMessage; import org.jeecgframework.jwt.util.Result; +import org.jeecgframework.tag.core.easyui.TagUtil; import org.jeecgframework.web.system.pojo.base.TSRole; import org.jeecgframework.web.system.pojo.base.TSRoleUser; import org.jeecgframework.web.system.pojo.base.TSUser; @@ -78,6 +81,8 @@ public class WmsApiController { private WmImNoticeHServiceI wmImNoticeHService; @Autowired private WmOmNoticeHServiceI wmOmNoticeHService; + @Autowired + private BaGoodsTypeServiceI baGoodsTypeService; @RequestMapping(params = "getToken") @ResponseBody @@ -135,15 +140,15 @@ public class WmsApiController { MdGoodsEntity.class, "shpBianMa", mdGoods.getShpBianMa()); if(mdGoods1 ==null ){ - Map countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getChpShuXing()+"%"); + Map countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where chp_shu_xing=? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getChpShuXing(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+"%"); if (countMap == null) { - mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); + mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1)); }else { Object goodsCode = countMap.get("shp_bian_ma"); if (goodsCode != null) { - mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1)); + mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d",Integer.parseInt(((String) goodsCode))+1)); }else { - mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); + mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1)); } } if(StringUtil.isEmpty(mdGoods.getChlKongZhi()) ){ @@ -170,6 +175,7 @@ public class WmsApiController { mdGoodsService.save(mdGoods); systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); + j.setObj(mdGoods); }else{ message = "商品编码或者条码已经存在"; j.setSuccess(false); @@ -211,6 +217,14 @@ public class WmsApiController { return j; } + /** + * 客户信息查询 + * @param mdCus + * @param request + * @param response + * @param dataGrid + * @return + */ @RequestMapping(params = "cusList") @ResponseBody public ResponseMessage datagrid(MdCusEntity mdCus, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { @@ -738,6 +752,52 @@ public class WmsApiController { return Result.success(data); } + @RequestMapping(params = "goodsTypeList") + @ResponseBody + public void goodsTypeList(BaGoodsTypeEntity baGoodsType, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { + CriteriaQuery cq = new CriteriaQuery(BaGoodsTypeEntity.class, dataGrid); + //查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, baGoodsType, request.getParameterMap()); + try{ + //自定义追加查询条件 + }catch (Exception e) { + throw new BusinessException(e.getMessage()); + } + cq.add(); + this.baGoodsTypeService.getDataGridReturn(cq, true); + TagUtil.datagrid(response, dataGrid); + } + /** + * 添加产品属性 + * + * @param ids + * @return + */ + @RequestMapping(params = "addGoodsType") + @ResponseBody + public AjaxJson addGoodsType(BaGoodsTypeEntity baGoodsType, HttpServletRequest request) { + String message = null; + AjaxJson j = new AjaxJson(); + message = "产品属性添加成功"; + try{ + //查询编码是否重复 + BaGoodsTypeEntity goodsType = systemService.findUniqueByProperty( + BaGoodsTypeEntity.class, "goodsTypeCode", baGoodsType.getGoodsTypeCode()); + if (goodsType != null ) { + j.setSuccess(false); + j.setMsg("编码重复"); + return j; + } + baGoodsTypeService.save(baGoodsType); + 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; + } } diff --git a/src/main/java/org/jeecgframework/web/cgreport/controller/core/CgReportController.java b/src/main/java/org/jeecgframework/web/cgreport/controller/core/CgReportController.java index 14b88845..b4cdea23 100644 --- a/src/main/java/org/jeecgframework/web/cgreport/controller/core/CgReportController.java +++ b/src/main/java/org/jeecgframework/web/cgreport/controller/core/CgReportController.java @@ -25,6 +25,7 @@ import org.jeecgframework.core.online.exception.CgReportNotFoundException; import org.jeecgframework.core.online.util.CgReportQueryParamUtil; import org.jeecgframework.core.online.util.FreemarkerHelper; import org.jeecgframework.core.util.*; +import org.jeecgframework.web.cgreport.entity.core.CgreportConfigParamEntity; import org.jeecgframework.web.cgreport.service.core.CgReportServiceI; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -163,7 +164,7 @@ public class CgReportController extends BaseController { private void loadVars(Map cgReportMap,HttpServletRequest request) { Map mainM = (Map) cgReportMap.get(CgReportConstant.MAIN); List> fieldList = (List>) cgReportMap.get(CgReportConstant.ITEMS); - List paramList = (List)cgReportMap.get(CgReportConstant.PARAMS); + List paramList = (List )cgReportMap.get(CgReportConstant.PARAMS); List> queryList = new ArrayList>(0); for(Map fl:fieldList){ fl.put(CgReportConstant.ITEM_FIELDNAME, ((String)fl.get(CgReportConstant.ITEM_FIELDNAME)).toLowerCase()); @@ -176,9 +177,9 @@ public class CgReportController extends BaseController { StringBuilder sb = new StringBuilder(""); if(paramList!=null&¶mList.size()>0){ queryList = new ArrayList>(0); - for(String param:paramList){ - sb.append("&").append(param).append("="); - String value = request.getParameter(param); + for(CgreportConfigParamEntity param:paramList){ + sb.append("&").append(param.getParamName()).append("="); + String value = request.getParameter(param.getParamName()); if(StringUtil.isNotEmpty(value)){ sb.append(value); } @@ -281,13 +282,13 @@ public class CgReportController extends BaseController { Map configM = (Map) cgReportMap.get(CgReportConstant.MAIN); String querySql = (String) configM.get(CgReportConstant.CONFIG_SQL); List> items = (List>) cgReportMap.get(CgReportConstant.ITEMS); - List paramList = (List) cgReportMap.get(CgReportConstant.PARAMS); + List paramList = (List) cgReportMap.get(CgReportConstant.PARAMS); Map queryparams = new LinkedHashMap(); if(paramList!=null&¶mList.size()>0){ - for(String param :paramList){ - String value = request.getParameter(param); - value = value==null?"":value; - querySql = querySql.replace("${"+param+"}", value); + for(CgreportConfigParamEntity param :paramList){ + String value = request.getParameter(param.getParamName()); + value = StringUtil.isEmpty(value)?param.getParamValue():value; + querySql = querySql.replace("${"+param.getParamName()+"}", value); } }else{ for(Map item:items){ diff --git a/src/main/java/org/jeecgframework/web/cgreport/service/impl/core/CgReportServiceImpl.java b/src/main/java/org/jeecgframework/web/cgreport/service/impl/core/CgReportServiceImpl.java index 75ee35f7..ae6aa1c2 100644 --- a/src/main/java/org/jeecgframework/web/cgreport/service/impl/core/CgReportServiceImpl.java +++ b/src/main/java/org/jeecgframework/web/cgreport/service/impl/core/CgReportServiceImpl.java @@ -30,59 +30,59 @@ public class CgReportServiceImpl extends CommonServiceImpl implements private JdbcDao jdbcDao; @Autowired private CgReportDao cgReportDao; - - + + @Override public Map queryCgReportConfig(String reportId) { Map cgReportM = new HashMap(0); Map mainM = queryCgReportMainConfig(reportId); List> itemsM = queryCgReportItems(reportId); - List params =queryCgReportParam(reportId); + List params =queryCgReportParam(reportId); cgReportM.put(CgReportConstant.MAIN, mainM); cgReportM.put(CgReportConstant.ITEMS, itemsM); cgReportM.put(CgReportConstant.PARAMS, params); return cgReportM; } - + @Override public Map queryCgReportMainConfig(String reportId){ // String sql = JeecgSqlUtil.getMethodSql(JeecgSqlUtil.getMethodUrl()); // Map parameters = new LinkedHashMap(); // parameters.put("id", reportId); // Map mainM = jdbcDao.findForMap(sql, parameters); - + //采用MiniDao实现方式 return cgReportDao.queryCgReportMainConfig(reportId); } - + @Override public List> queryCgReportItems(String reportId){ // String sql = JeecgSqlUtil.getMethodSql(JeecgSqlUtil.getMethodUrl()); // Map parameters = new LinkedHashMap(); // parameters.put("configId", reportId); // List> items = jdbcDao.findForListMap(sql, parameters); - + //采用MiniDao实现方式 return cgReportDao.queryCgReportItems(reportId); } - - public List queryCgReportParam(String reportId){ + + public List queryCgReportParam(String reportId){ List list = null; CgreportConfigHeadEntity cgreportConfigHead = this.findUniqueByProperty(CgreportConfigHeadEntity.class, "code", reportId); String hql0 = "from CgreportConfigParamEntity where 1 = 1 AND cgrheadId = ? "; List cgreportConfigParamList = this.findHql(hql0,cgreportConfigHead.getId()); - if(cgreportConfigParamList!=null&cgreportConfigParamList.size()>0){ - list = new ArrayList(); - for(CgreportConfigParamEntity cgreportConfigParam :cgreportConfigParamList){ - list.add(cgreportConfigParam.getParamName()); - } - } - return list; +// if(cgreportConfigParamList!=null&cgreportConfigParamList.size()>0){ +// list = new ArrayList(); +// for(CgreportConfigParamEntity cgreportConfigParam :cgreportConfigParamList){ +// list.add(cgreportConfigParam.getParamName()); +// } +// } + return cgreportConfigParamList; } - + @Override @SuppressWarnings("unchecked") - + public List> queryByCgReportSql(String sql, Map params, int page, int rows) { String querySql = getFullSql(sql,params); @@ -122,7 +122,7 @@ public class CgReportServiceImpl extends CommonServiceImpl implements } @Override @SuppressWarnings("unchecked") - + public long countQueryByCgReportSql(String sql, Map params) { String querySql = getFullSql(sql,params); querySql = "SELECT COUNT(*) FROM ("+querySql+") t2"; @@ -131,7 +131,7 @@ public class CgReportServiceImpl extends CommonServiceImpl implements } @Override @SuppressWarnings( "unchecked" ) - + public List getSqlFields(String sql) { if(oConvertUtils.isEmpty(sql)){ return null;