解决条码长度超长的问题

This commit is contained in:
季圣华
2020-02-18 23:26:44 +08:00
parent ebc637fe72
commit d23f1f4117
6 changed files with 34 additions and 65 deletions

View File

@@ -1606,6 +1606,7 @@
function CheckData() { function CheckData() {
var row = $('#materialExtendData').datagrid('getRows'); var row = $('#materialExtendData').datagrid('getRows');
var totalRowNum = ""; var totalRowNum = "";
var totalBarCodeOverNum = "";
for (var i = 0; i < row.length; i++) { for (var i = 0; i < row.length; i++) {
if (row[i].BarCode == "") { if (row[i].BarCode == "") {
totalRowNum += (i + 1) + ""; totalRowNum += (i + 1) + "";
@@ -1613,12 +1614,20 @@
if (row[i].CommodityUnit == "") { if (row[i].CommodityUnit == "") {
totalRowNum += (i + 1) + ""; totalRowNum += (i + 1) + "";
} }
if (row[i].BarCode.length > 15) {
totalBarCodeOverNum += (i + 1) + "";
}
} }
if (totalRowNum != "") { if (totalRowNum != "") {
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1); var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
$.messager.alert('提示',"" + totalRowNum + "行数据填写不完整",'info'); $.messager.alert('提示',"" + totalRowNum + "行数据填写不完整",'info');
return false; return false;
} }
if (totalBarCodeOverNum != "") {
var totalBarCodeOverNum = totalBarCodeOverNum.substring(0, totalBarCodeOverNum.length - 1);
$.messager.alert('提示',"" + totalBarCodeOverNum + "行条码长度超过15位",'info');
return false;
}
return true; return true;
} }

View File

@@ -20,4 +20,6 @@ public interface MaterialExtendMapperEx {
@Param("syncNum") Long syncNum); @Param("syncNum") Long syncNum);
List<MaterialExtend> getListByMId(@Param("ids") Long ids[]); List<MaterialExtend> getListByMId(@Param("ids") Long ids[]);
int batchDeleteMaterialExtendByMIds(@Param("ids") String ids[]);
} }

View File

@@ -268,62 +268,4 @@ public class MaterialExtendService {
} }
return list; return list;
} }
/**
* 根据条码更新零售价
* @param retailPrice
* @param barCode
*/
public int updateRetailPriceByCode(BigDecimal retailPrice,String barCode) {
int result=0;
try{
MaterialExtend materialExtend = new MaterialExtend();
materialExtend.setCommodityDecimal(retailPrice);
MaterialExtendExample example = new MaterialExtendExample();
example.createCriteria().andBarCodeEqualTo(barCode);
result = materialExtendMapper.updateByExampleSelective(materialExtend, example);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
/**
* 根据条码更新进价
* @param purchasePrice
* @param barCode
*/
public int updatePurchasePriceByCode(BigDecimal purchasePrice,String barCode) {
int result=0;
try{
MaterialExtend materialExtend = new MaterialExtend();
materialExtend.setPurchaseDecimal(purchasePrice);
MaterialExtendExample example = new MaterialExtendExample();
example.createCriteria().andBarCodeEqualTo(barCode);
result = materialExtendMapper.updateByExampleSelective(materialExtend, example);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
/**
* 根据条码更新进价
* @param barCode
* @param barCode
*/
public MaterialExtend getMaterialExtendByBarCode(String barCode) {
MaterialExtend me = new MaterialExtend();
try{
MaterialExtendExample example = new MaterialExtendExample();
example.createCriteria().andBarCodeEqualTo(barCode);
List<MaterialExtend> list = materialExtendMapper.selectByExample(example);
if(list!=null && list.size()>0) {
me = list.get(0);
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return me;
}
} }

View File

@@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.DepotItemMapperEx; import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.datasource.mappers.MaterialMapper;
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
import com.jsh.erp.datasource.mappers.MaterialStockMapper;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException; import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.MaterialExtend.MaterialExtendService; import com.jsh.erp.service.MaterialExtend.MaterialExtendService;
@@ -45,6 +42,8 @@ public class MaterialService {
@Resource @Resource
private MaterialMapperEx materialMapperEx; private MaterialMapperEx materialMapperEx;
@Resource @Resource
private MaterialExtendMapperEx materialExtendMapperEx;
@Resource
private LogService logService; private LogService logService;
@Resource @Resource
private UserService userService; private UserService userService;
@@ -603,13 +602,16 @@ public class MaterialService {
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
int result =0;
try{ try{
result= materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); //逻辑删除商品
materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
//逻辑删除商品价格扩展
materialExtendMapperEx.batchDeleteMaterialExtendByMIds(idArray);
return 1;
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
return 0;
} }
return result;
} }
/** /**
* create by: qiankunpingtai * create by: qiankunpingtai

View File

@@ -53,4 +53,16 @@
</foreach> </foreach>
) )
</update> </update>
<update id="batchDeleteMaterialExtendByMIds">
update jsh_material_extend
set delete_Flag='1'
where 1=1
and ifnull(delete_Flag,'0') !='1'
and material_id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper> </mapper>

View File

@@ -219,6 +219,8 @@
<select id="getMaxBarCode" resultType="java.lang.String"> <select id="getMaxBarCode" resultType="java.lang.String">
select max(CAST(l.bar_code AS SIGNED)) bar_code from jsh_material_extend l select max(CAST(l.bar_code AS SIGNED)) bar_code from jsh_material_extend l
where 1=1
and ifnull(l.delete_Flag,'0') !='1'
</select> </select>
<select id="getMaterialByMeId" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList"> <select id="getMaterialByMeId" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">