商品编码根据类目自动编码 增加SKU
parent
50e6e7ac9e
commit
5b3dd6b947
|
@ -214,30 +214,22 @@ public class MdGoodsController extends BaseController {
|
|||
AjaxJson j = new AjaxJson();
|
||||
message = "商品信息添加成功";
|
||||
try {
|
||||
MdGoodsEntity mdGoods1 = systemService.findUniqueByProperty(
|
||||
MdGoodsEntity.class, "shpBianMa", mdGoods.getShpBianMa());
|
||||
|
||||
if(mdGoods1 ==null ){
|
||||
if(StringUtil.isEmpty(mdGoods.getChlKongZhi()) ){
|
||||
mdGoods.setChlKongZhi("N");
|
||||
}
|
||||
if("N".equals(mdGoods.getChlKongZhi() )){
|
||||
mdGoods.setChlShl("1");
|
||||
mdGoods.setJshDanWei(mdGoods.getShlDanWei());
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
if(StringUtil.isEmpty(mdGoods.getZhlKgm())){
|
||||
if(!StringUtil.isEmpty(mdGoods.getBzhiQi())){
|
||||
int bzhiq = Integer.parseInt(mdGoods.getBzhiQi());
|
||||
mdGoods.setZhlKgm(Integer.toString(bzhiq));
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
if(StringUtil.isEmpty(mdGoods.getShpBianMa())){
|
||||
//查询当前商品类型的商品数量
|
||||
Map<String, Object> countMap = systemService.findOneForJdbc("select right(shp_bian_ma,7) shp_bian_ma from md_goods where category_code =? and suo_shu_ke_hu = ? and shp_bian_ma like ? ORDER BY shp_bian_ma desc LIMIT 1",mdGoods.getCategoryCode(),mdGoods.getSuoShuKeHu(),mdGoods.getSuoShuKeHu()+mdGoods.getCategoryCode()+"%");
|
||||
if (countMap == null) {
|
||||
|
@ -254,10 +246,18 @@ public class MdGoodsController extends BaseController {
|
|||
systemService.addLog(message, Globals.Log_Type_INSERT,
|
||||
Globals.Log_Leavel_INFO);
|
||||
}else{
|
||||
message = "商品编码或者条码已经存在";
|
||||
MdGoodsEntity mdGoods1 = systemService.findUniqueByProperty(
|
||||
MdGoodsEntity.class, "shpBianMa", mdGoods.getShpBianMa());
|
||||
if(mdGoods1 != null){
|
||||
message = "商品编码已经存在";
|
||||
j.setSuccess(false);
|
||||
}else{
|
||||
mdGoodsService.save(mdGoods);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT,
|
||||
Globals.Log_Leavel_INFO);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "商品信息添加失败";
|
||||
|
@ -447,13 +447,7 @@ public class MdGoodsController extends BaseController {
|
|||
MdGoodsEntity.class, "shpBianMa", mdGoods.getShpBianMa());
|
||||
if(mdGoods1 ==null ){
|
||||
try {
|
||||
//查询当前商品类型的商品数量
|
||||
// Map<String, Object> map = systemService.findOneForJdbc("select ifnull(count(1),0) num from ba_goods_type where goods_type_code = ? order by create_date desc limit 1",mdGoods.getChpShuXing());
|
||||
// if ((Long)map.get("num") <= 0L) {
|
||||
// j.setSuccess(false);
|
||||
// j.setMsg("产品属性错误:"+mdGoods.getChpShuXing());
|
||||
// return j;
|
||||
// }
|
||||
if(StringUtil.isEmpty(mdGoods.getShpBianMa())){//商品编码为空则自动编码
|
||||
if (StringUtils.isEmpty(mdGoods.getCategoryCode())) {
|
||||
j.setSuccess(false);
|
||||
j.setMsg("类目编码为空:");
|
||||
|
@ -470,6 +464,8 @@ public class MdGoodsController extends BaseController {
|
|||
mdGoods.setShpBianMa(mdGoods.getSuoShuKeHu()+mdGoods.getCategoryCode()+String.format("%07d", 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(StringUtil.isEmpty(mdGoods.getZhlKgm())){
|
||||
if(!StringUtil.isEmpty(mdGoods.getBzhiQi())){
|
||||
|
@ -488,8 +484,6 @@ public class MdGoodsController extends BaseController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -98,21 +98,21 @@ function counttiji(){
|
|||
<span class="Validform_checktip" style="float:left;height:0px;"></span>
|
||||
<label class="Validform_label" style="display: none">价格</label>
|
||||
</div>
|
||||
<%-- </div>--%>
|
||||
</div>
|
||||
|
||||
|
||||
<%-- <div class="row show-grid">--%>
|
||||
<div class="row show-grid">
|
||||
|
||||
<%-- <div class="col-xs-3 text-center">--%>
|
||||
<%-- <b style="color:red">商品编码</b>--%>
|
||||
<%-- </div>--%>
|
||||
<%-- <div class="col-xs-3">--%>
|
||||
<%-- <input id="shpBianMa" name="shpBianMa" type="text" class="form-control"--%>
|
||||
<%-- ignore="checked"--%>
|
||||
<%-- datatype="*" required="required" />--%>
|
||||
<%-- <span class="Validform_checktip" style="float:left;height:0px;"></span>--%>
|
||||
<%-- <label class="Validform_label" style="display: none">商品编码</label>--%>
|
||||
<%-- </div>--%>
|
||||
<div class="col-xs-3 text-center">
|
||||
<b style="color:red">商品编码</b>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<input id="shpBianMa" name="shpBianMa" type="text" class="form-control"
|
||||
ignore="checked"
|
||||
datatype="*" required="required" />
|
||||
<span class="Validform_checktip" style="float:left;height:0px;"></span>
|
||||
<label class="Validform_label" style="display: none">商品编码</label>
|
||||
</div>
|
||||
<div class="col-xs-3 text-center">
|
||||
<b >客户商品编码</b>
|
||||
</div>
|
||||
|
@ -153,6 +153,18 @@ function counttiji(){
|
|||
<span class="Validform_checktip" style="float:left;height:0px;"></span>
|
||||
<label class="Validform_label" style="display: none">商品品牌</label>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-3 text-center">
|
||||
<b >SKU</b>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<input id="sku" name="sku" type="text" class="form-control"
|
||||
ignore="ignore"
|
||||
/>
|
||||
<span class="Validform_checktip" style="float:left;height:0px;"></span>
|
||||
<label class="Validform_label" style="display: none">sku</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row show-grid">
|
||||
<div class="col-xs-3 text-center">
|
||||
|
|
|
@ -157,6 +157,18 @@
|
|||
<span class="Validform_checktip" style="float:left;height:0px;"></span>
|
||||
<label class="Validform_label" style="display: none">商品品牌</label>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-3 text-center">
|
||||
<b >SKU</b>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<input id="sku" name="sku" type="text" value='${mdGoodsPage.sku}' class="form-control"
|
||||
ignore="ignore"
|
||||
/>
|
||||
<span class="Validform_checktip" style="float:left;height:0px;"></span>
|
||||
<label class="Validform_label" style="display: none">sku</label>
|
||||
</div>
|
||||
|
||||
<div class="row show-grid">
|
||||
<div class="col-xs-3 text-center">
|
||||
<b style="color:red">商品类目</b>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
<t:dgCol title="长" field="chZhXiang" queryMode="group" width="80"></t:dgCol>
|
||||
<t:dgCol title="宽" field="kuZhXiang" queryMode="group" width="80"></t:dgCol>
|
||||
<t:dgCol title="高" field="gaoZhXiang" queryMode="group" width="80"></t:dgCol>
|
||||
<%--<t:dgCol title="基准温度" field="jiZhunwendu" queryMode="group" width="80"></t:dgCol>--%>
|
||||
<t:dgCol title="sku" field="sku" queryMode="group" width="80"></t:dgCol>
|
||||
<t:dgCol title="商品描述" field="shpMiaoShu" hidden="true" queryMode="group" width="120"></t:dgCol>
|
||||
<t:dgCol title="停用" field="zhuangTai" query="true" dictionary="sf_yn" width="120"></t:dgCol>
|
||||
<t:dgFunOpt title="打印" funname="doprint(id)" urlclass="ace_button" />
|
||||
|
|
Loading…
Reference in New Issue