删除时检查是否存在库存
parent
db515e2f05
commit
6395a5cec6
|
@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
|
|
||||||
|
import com.zzjee.wmutil.wmUtil;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.jeecgframework.core.beanvalidator.BeanValidators;
|
import org.jeecgframework.core.beanvalidator.BeanValidators;
|
||||||
import org.jeecgframework.core.common.controller.BaseController;
|
import org.jeecgframework.core.common.controller.BaseController;
|
||||||
|
@ -130,6 +131,12 @@ public class MdBinController extends BaseController {
|
||||||
try{
|
try{
|
||||||
// mdBin.setTingYong("Y");
|
// mdBin.setTingYong("Y");
|
||||||
// mdBinService.saveOrUpdate(mdBin);
|
// mdBinService.saveOrUpdate(mdBin);
|
||||||
|
if(wmUtil.checkishavestock("bin",mdBin.getKuWeiBianMa())){
|
||||||
|
message = "仓位存在库存";
|
||||||
|
j.setSuccess(false);
|
||||||
|
j.setMsg(message);
|
||||||
|
return j;
|
||||||
|
}
|
||||||
mdBinService.delete(mdBin);
|
mdBinService.delete(mdBin);
|
||||||
|
|
||||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||||
|
@ -211,6 +218,12 @@ public class MdBinController extends BaseController {
|
||||||
id
|
id
|
||||||
);
|
);
|
||||||
// mdBin.setTingYong("Y");
|
// mdBin.setTingYong("Y");
|
||||||
|
if(wmUtil.checkishavestock("bin",mdBin.getKuWeiBianMa())){
|
||||||
|
message = "仓位存在库存";
|
||||||
|
j.setSuccess(false);
|
||||||
|
j.setMsg(message);
|
||||||
|
return j;
|
||||||
|
}
|
||||||
mdBinService.delete(mdBin);
|
mdBinService.delete(mdBin);
|
||||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
|
|
||||||
|
import com.zzjee.wmutil.wmUtil;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.jeecgframework.core.beanvalidator.BeanValidators;
|
import org.jeecgframework.core.beanvalidator.BeanValidators;
|
||||||
import org.jeecgframework.core.common.controller.BaseController;
|
import org.jeecgframework.core.common.controller.BaseController;
|
||||||
|
@ -131,6 +132,12 @@ public class MdCusController extends BaseController {
|
||||||
mdCus = systemService.getEntity(MdCusEntity.class, mdCus.getId());
|
mdCus = systemService.getEntity(MdCusEntity.class, mdCus.getId());
|
||||||
message = "客户删除成功";
|
message = "客户删除成功";
|
||||||
try{
|
try{
|
||||||
|
if(wmUtil.checkishavestock("cus",mdCus.getKeHuBianMa())){
|
||||||
|
message = "货主存在库存";
|
||||||
|
j.setSuccess(false);
|
||||||
|
j.setMsg(message);
|
||||||
|
return j;
|
||||||
|
}
|
||||||
mdCusService.delete(mdCus);
|
mdCusService.delete(mdCus);
|
||||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
@ -158,6 +165,12 @@ public class MdCusController extends BaseController {
|
||||||
MdCusEntity mdCus = systemService.getEntity(MdCusEntity.class,
|
MdCusEntity mdCus = systemService.getEntity(MdCusEntity.class,
|
||||||
id
|
id
|
||||||
);
|
);
|
||||||
|
if(wmUtil.checkishavestock("cus",mdCus.getKeHuBianMa())){
|
||||||
|
message = "货主存在库存";
|
||||||
|
j.setSuccess(false);
|
||||||
|
j.setMsg(message);
|
||||||
|
return j;
|
||||||
|
}
|
||||||
mdCusService.delete(mdCus);
|
mdCusService.delete(mdCus);
|
||||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,12 @@ public class MdGoodsController extends BaseController {
|
||||||
message = "商品删除成功";
|
message = "商品删除成功";
|
||||||
try {
|
try {
|
||||||
// mdGoods.setZhuangTai("Y");
|
// mdGoods.setZhuangTai("Y");
|
||||||
|
if(wmUtil.checkishavestock("goods",mdGoods.getShpBianMa())){
|
||||||
|
message = "商品存在库存";
|
||||||
|
j.setSuccess(false);
|
||||||
|
j.setMsg(message);
|
||||||
|
return j;
|
||||||
|
}
|
||||||
mdGoodsService.delete(mdGoods);;
|
mdGoodsService.delete(mdGoods);;
|
||||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||||
Globals.Log_Leavel_INFO);
|
Globals.Log_Leavel_INFO);
|
||||||
|
@ -176,6 +182,12 @@ public class MdGoodsController extends BaseController {
|
||||||
for (String id : ids.split(",")) {
|
for (String id : ids.split(",")) {
|
||||||
MdGoodsEntity mdGoods = systemService.getEntity(
|
MdGoodsEntity mdGoods = systemService.getEntity(
|
||||||
MdGoodsEntity.class, id);
|
MdGoodsEntity.class, id);
|
||||||
|
if(wmUtil.checkishavestock("goods",mdGoods.getShpBianMa())){
|
||||||
|
message = "商品存在库存";
|
||||||
|
j.setSuccess(false);
|
||||||
|
j.setMsg(message);
|
||||||
|
return j;
|
||||||
|
}
|
||||||
mdGoodsService.delete(mdGoods);
|
mdGoodsService.delete(mdGoods);
|
||||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||||
Globals.Log_Leavel_INFO);
|
Globals.Log_Leavel_INFO);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.zzjee.conf.entity.FxjOtherLoginEntity;
|
||||||
import com.zzjee.md.entity.MdBinEntity;
|
import com.zzjee.md.entity.MdBinEntity;
|
||||||
import com.zzjee.md.entity.MdGoodsEntity;
|
import com.zzjee.md.entity.MdGoodsEntity;
|
||||||
import com.zzjee.sys.entity.SysParaEntity;
|
import com.zzjee.sys.entity.SysParaEntity;
|
||||||
|
import com.zzjee.wm.entity.WvStockEntity;
|
||||||
import org.antlr.stringtemplate.language.Cat;
|
import org.antlr.stringtemplate.language.Cat;
|
||||||
import org.jeecgframework.core.common.exception.BusinessException;
|
import org.jeecgframework.core.common.exception.BusinessException;
|
||||||
import org.jeecgframework.core.util.DateUtils;
|
import org.jeecgframework.core.util.DateUtils;
|
||||||
|
@ -372,6 +373,33 @@ public class wmUtil {
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean checkishavestock(String checktype,String checkvalue){
|
||||||
|
boolean ishavestock = false;
|
||||||
|
String hql = "from WvStockEntity where ";
|
||||||
|
if("bin".equals(checktype)){
|
||||||
|
hql = hql + " kuWeiBianMa = ?";
|
||||||
|
}
|
||||||
|
if("cus".equals(checktype)){
|
||||||
|
hql = hql + " cusCode = ?";
|
||||||
|
|
||||||
|
}
|
||||||
|
if("goods".equals(checktype)){
|
||||||
|
hql = hql + " goodsId = ?";
|
||||||
|
|
||||||
|
}
|
||||||
|
SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class);
|
||||||
|
|
||||||
|
List<WvStockEntity> list = systemService.findHql(hql,checkvalue);
|
||||||
|
if(list!=null&&list.size()>0){
|
||||||
|
ishavestock = true;
|
||||||
|
}
|
||||||
|
return ishavestock;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getstock(String goodsid) {
|
public static String getstock(String goodsid) {
|
||||||
String goodsqua = "0";
|
String goodsqua = "0";
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue