master
zhouxi 2021-08-17 17:04:54 +08:00
parent 37d13b78ed
commit 95e155548f
4 changed files with 102 additions and 42 deletions

View File

@ -238,18 +238,17 @@ public class MdGoodsController extends BaseController {
// TODO: handle exception // TODO: handle exception
} }
//查询当前商品类型的商品数量 //查询当前商品类型的商品数量
Map<String, Object> 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<String, Object> 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) { if (countMap == null) {
mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
}else { }else {
Object goodsCode = countMap.get("shp_bian_ma"); Object goodsCode = countMap.get("shp_bian_ma");
if (goodsCode != null) { 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 { }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); mdGoodsService.save(mdGoods);
systemService.addLog(message, Globals.Log_Type_INSERT, systemService.addLog(message, Globals.Log_Type_INSERT,
Globals.Log_Leavel_INFO); Globals.Log_Leavel_INFO);
@ -455,15 +454,15 @@ public class MdGoodsController extends BaseController {
// j.setMsg("产品属性错误:"+mdGoods.getChpShuXing()); // j.setMsg("产品属性错误:"+mdGoods.getChpShuXing());
// return j; // return j;
// } // }
Map<String, Object> 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<String, Object> 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) { if (countMap == null) {
mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
}else { }else {
Object goodsCode = countMap.get("shp_bian_ma"); Object goodsCode = countMap.get("shp_bian_ma");
if (goodsCode != null) { 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 { }else {
mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
} }
} }

View File

@ -1,5 +1,7 @@
package com.zzjee.wm.controller; 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.MdBinEntity;
import com.zzjee.md.entity.MdCusEntity; import com.zzjee.md.entity.MdCusEntity;
import com.zzjee.md.entity.MdCusOtherEntity; 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.JwtUtils;
import org.jeecgframework.jwt.util.ResponseMessage; import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result; 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.TSRole;
import org.jeecgframework.web.system.pojo.base.TSRoleUser; import org.jeecgframework.web.system.pojo.base.TSRoleUser;
import org.jeecgframework.web.system.pojo.base.TSUser; import org.jeecgframework.web.system.pojo.base.TSUser;
@ -78,6 +81,8 @@ public class WmsApiController {
private WmImNoticeHServiceI wmImNoticeHService; private WmImNoticeHServiceI wmImNoticeHService;
@Autowired @Autowired
private WmOmNoticeHServiceI wmOmNoticeHService; private WmOmNoticeHServiceI wmOmNoticeHService;
@Autowired
private BaGoodsTypeServiceI baGoodsTypeService;
@RequestMapping(params = "getToken") @RequestMapping(params = "getToken")
@ResponseBody @ResponseBody
@ -135,15 +140,15 @@ public class WmsApiController {
MdGoodsEntity.class, "shpBianMa", mdGoods.getShpBianMa()); MdGoodsEntity.class, "shpBianMa", mdGoods.getShpBianMa());
if(mdGoods1 ==null ){ if(mdGoods1 ==null ){
Map<String, Object> 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<String, Object> 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) { if (countMap == null) {
mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
}else { }else {
Object goodsCode = countMap.get("shp_bian_ma"); Object goodsCode = countMap.get("shp_bian_ma");
if (goodsCode != null) { 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 { }else {
mdGoods.setShpBianMa(mdGoods.getChpShuXing()+String.format("%07d", 1)); mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+"&"+mdGoods.getChpShuXing()+String.format("%07d", 1));
} }
} }
if(StringUtil.isEmpty(mdGoods.getChlKongZhi()) ){ if(StringUtil.isEmpty(mdGoods.getChlKongZhi()) ){
@ -170,6 +175,7 @@ public class WmsApiController {
mdGoodsService.save(mdGoods); mdGoodsService.save(mdGoods);
systemService.addLog(message, Globals.Log_Type_INSERT, systemService.addLog(message, Globals.Log_Type_INSERT,
Globals.Log_Leavel_INFO); Globals.Log_Leavel_INFO);
j.setObj(mdGoods);
}else{ }else{
message = "商品编码或者条码已经存在"; message = "商品编码或者条码已经存在";
j.setSuccess(false); j.setSuccess(false);
@ -211,6 +217,14 @@ public class WmsApiController {
return j; return j;
} }
/**
*
* @param mdCus
* @param request
* @param response
* @param dataGrid
* @return
*/
@RequestMapping(params = "cusList") @RequestMapping(params = "cusList")
@ResponseBody @ResponseBody
public ResponseMessage<DataGridReturn> datagrid(MdCusEntity mdCus, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { public ResponseMessage<DataGridReturn> datagrid(MdCusEntity mdCus, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
@ -738,6 +752,52 @@ public class WmsApiController {
return Result.success(data); 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;
}
} }

View File

@ -25,6 +25,7 @@ import org.jeecgframework.core.online.exception.CgReportNotFoundException;
import org.jeecgframework.core.online.util.CgReportQueryParamUtil; import org.jeecgframework.core.online.util.CgReportQueryParamUtil;
import org.jeecgframework.core.online.util.FreemarkerHelper; import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.*; import org.jeecgframework.core.util.*;
import org.jeecgframework.web.cgreport.entity.core.CgreportConfigParamEntity;
import org.jeecgframework.web.cgreport.service.core.CgReportServiceI; import org.jeecgframework.web.cgreport.service.core.CgReportServiceI;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -163,7 +164,7 @@ public class CgReportController extends BaseController {
private void loadVars(Map<String, Object> cgReportMap,HttpServletRequest request) { private void loadVars(Map<String, Object> cgReportMap,HttpServletRequest request) {
Map mainM = (Map) cgReportMap.get(CgReportConstant.MAIN); Map mainM = (Map) cgReportMap.get(CgReportConstant.MAIN);
List<Map<String,Object>> fieldList = (List<Map<String, Object>>) cgReportMap.get(CgReportConstant.ITEMS); List<Map<String,Object>> fieldList = (List<Map<String, Object>>) cgReportMap.get(CgReportConstant.ITEMS);
List<String> paramList = (List<String>)cgReportMap.get(CgReportConstant.PARAMS); List<CgreportConfigParamEntity> paramList = (List<CgreportConfigParamEntity> )cgReportMap.get(CgReportConstant.PARAMS);
List<Map<String,Object>> queryList = new ArrayList<Map<String,Object>>(0); List<Map<String,Object>> queryList = new ArrayList<Map<String,Object>>(0);
for(Map<String,Object> fl:fieldList){ for(Map<String,Object> fl:fieldList){
fl.put(CgReportConstant.ITEM_FIELDNAME, ((String)fl.get(CgReportConstant.ITEM_FIELDNAME)).toLowerCase()); 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(""); StringBuilder sb = new StringBuilder("");
if(paramList!=null&&paramList.size()>0){ if(paramList!=null&&paramList.size()>0){
queryList = new ArrayList<Map<String,Object>>(0); queryList = new ArrayList<Map<String,Object>>(0);
for(String param:paramList){ for(CgreportConfigParamEntity param:paramList){
sb.append("&").append(param).append("="); sb.append("&").append(param.getParamName()).append("=");
String value = request.getParameter(param); String value = request.getParameter(param.getParamName());
if(StringUtil.isNotEmpty(value)){ if(StringUtil.isNotEmpty(value)){
sb.append(value); sb.append(value);
} }
@ -281,13 +282,13 @@ public class CgReportController extends BaseController {
Map configM = (Map) cgReportMap.get(CgReportConstant.MAIN); Map configM = (Map) cgReportMap.get(CgReportConstant.MAIN);
String querySql = (String) configM.get(CgReportConstant.CONFIG_SQL); String querySql = (String) configM.get(CgReportConstant.CONFIG_SQL);
List<Map<String,Object>> items = (List<Map<String, Object>>) cgReportMap.get(CgReportConstant.ITEMS); List<Map<String,Object>> items = (List<Map<String, Object>>) cgReportMap.get(CgReportConstant.ITEMS);
List<String> paramList = (List<String>) cgReportMap.get(CgReportConstant.PARAMS); List<CgreportConfigParamEntity> paramList = (List<CgreportConfigParamEntity>) cgReportMap.get(CgReportConstant.PARAMS);
Map queryparams = new LinkedHashMap<String,Object>(); Map queryparams = new LinkedHashMap<String,Object>();
if(paramList!=null&&paramList.size()>0){ if(paramList!=null&&paramList.size()>0){
for(String param :paramList){ for(CgreportConfigParamEntity param :paramList){
String value = request.getParameter(param); String value = request.getParameter(param.getParamName());
value = value==null?"":value; value = StringUtil.isEmpty(value)?param.getParamValue():value;
querySql = querySql.replace("${"+param+"}", value); querySql = querySql.replace("${"+param.getParamName()+"}", value);
} }
}else{ }else{
for(Map<String,Object> item:items){ for(Map<String,Object> item:items){

View File

@ -37,7 +37,7 @@ public class CgReportServiceImpl extends CommonServiceImpl implements
Map<String,Object> cgReportM = new HashMap<String, Object>(0); Map<String,Object> cgReportM = new HashMap<String, Object>(0);
Map<String,Object> mainM = queryCgReportMainConfig(reportId); Map<String,Object> mainM = queryCgReportMainConfig(reportId);
List<Map<String,Object>> itemsM = queryCgReportItems(reportId); List<Map<String,Object>> itemsM = queryCgReportItems(reportId);
List<String> params =queryCgReportParam(reportId); List<CgreportConfigParamEntity> params =queryCgReportParam(reportId);
cgReportM.put(CgReportConstant.MAIN, mainM); cgReportM.put(CgReportConstant.MAIN, mainM);
cgReportM.put(CgReportConstant.ITEMS, itemsM); cgReportM.put(CgReportConstant.ITEMS, itemsM);
cgReportM.put(CgReportConstant.PARAMS, params); cgReportM.put(CgReportConstant.PARAMS, params);
@ -66,18 +66,18 @@ public class CgReportServiceImpl extends CommonServiceImpl implements
return cgReportDao.queryCgReportItems(reportId); return cgReportDao.queryCgReportItems(reportId);
} }
public List<String> queryCgReportParam(String reportId){ public List<CgreportConfigParamEntity> queryCgReportParam(String reportId){
List<String> list = null; List<String> list = null;
CgreportConfigHeadEntity cgreportConfigHead = this.findUniqueByProperty(CgreportConfigHeadEntity.class, "code", reportId); CgreportConfigHeadEntity cgreportConfigHead = this.findUniqueByProperty(CgreportConfigHeadEntity.class, "code", reportId);
String hql0 = "from CgreportConfigParamEntity where 1 = 1 AND cgrheadId = ? "; String hql0 = "from CgreportConfigParamEntity where 1 = 1 AND cgrheadId = ? ";
List<CgreportConfigParamEntity> cgreportConfigParamList = this.findHql(hql0,cgreportConfigHead.getId()); List<CgreportConfigParamEntity> cgreportConfigParamList = this.findHql(hql0,cgreportConfigHead.getId());
if(cgreportConfigParamList!=null&cgreportConfigParamList.size()>0){ // if(cgreportConfigParamList!=null&cgreportConfigParamList.size()>0){
list = new ArrayList<String>(); // list = new ArrayList<String>();
for(CgreportConfigParamEntity cgreportConfigParam :cgreportConfigParamList){ // for(CgreportConfigParamEntity cgreportConfigParam :cgreportConfigParamList){
list.add(cgreportConfigParam.getParamName()); // list.add(cgreportConfigParam.getParamName());
} // }
} // }
return list; return cgreportConfigParamList;
} }
@Override @Override