给单据中商品的选择增加批次和序列号过滤的接口字段

This commit is contained in:
季圣华 2022-05-22 23:48:42 +08:00
parent f52a4c34b0
commit 286bc0c375
4 changed files with 39 additions and 12 deletions

View File

@ -176,14 +176,18 @@ public class MaterialController {
@RequestParam(value = "q", required = false) String q,
@RequestParam("mpList") String mpList,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam(value = "enableSerialNumber", required = false) String enableSerialNumber,
@RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
@RequestParam("page") Integer currentPage,
@RequestParam("rows") Integer pageSize,
HttpServletRequest request) throws Exception{
JSONObject object = new JSONObject();
try {
List<MaterialVo4Unit> dataList = materialService.findBySelectWithBarCode(categoryId, q, (currentPage-1)*pageSize, pageSize);
List<MaterialVo4Unit> dataList = materialService.findBySelectWithBarCode(categoryId, q, enableSerialNumber,
enableBatchNumber, (currentPage-1)*pageSize, pageSize);
String[] mpArr = mpList.split(",");
int total = materialService.findBySelectWithBarCodeCount(categoryId, q);
int total = materialService.findBySelectWithBarCodeCount(categoryId, q, enableSerialNumber,
enableBatchNumber);
object.put("total", total);
JSONArray dataArray = new JSONArray();
//存放数据json数组
@ -293,11 +297,16 @@ public class MaterialController {
/**
* 生成excel表格
* @param barCode
* @param name
* @param standard
* @param model
* @param categoryId
* @param materialParam
* @param color
* @param weight
* @param expiryNum
* @param enabled
* @param enableSerialNumber
* @param enableBatchNumber
* @param remark
* @param mpList
* @param request
* @param response
*/

View File

@ -54,11 +54,15 @@ public interface MaterialMapperEx {
List<MaterialVo4Unit> findBySelectWithBarCode(@Param("idList") List<Long> idList,
@Param("q") String q,
@Param("enableSerialNumber") String enableSerialNumber,
@Param("enableBatchNumber") String enableBatchNumber,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
int findBySelectWithBarCodeCount(@Param("idList") List<Long> idList,
@Param("q") String q);
@Param("q") String q,
@Param("enableSerialNumber") String enableSerialNumber,
@Param("enableBatchNumber") String enableBatchNumber);
List<MaterialVo4Unit> exportExcel(
@Param("materialParam") String materialParam,

View File

@ -390,7 +390,8 @@ public class MaterialService {
return idList;
}
public List<MaterialVo4Unit> findBySelectWithBarCode(Long categoryId, String q, Integer offset, Integer rows)throws Exception{
public List<MaterialVo4Unit> findBySelectWithBarCode(Long categoryId, String q, String enableSerialNumber,
String enableBatchNumber, Integer offset, Integer rows)throws Exception{
List<MaterialVo4Unit> list =null;
try{
List<Long> idList = new ArrayList<>();
@ -402,14 +403,15 @@ public class MaterialService {
q = q.replace("'", "");
q = q.trim();
}
list= materialMapperEx.findBySelectWithBarCode(idList, q, offset, rows);
list= materialMapperEx.findBySelectWithBarCode(idList, q, enableSerialNumber, enableBatchNumber, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public int findBySelectWithBarCodeCount(Long categoryId, String q)throws Exception{
public int findBySelectWithBarCodeCount(Long categoryId, String q, String enableSerialNumber,
String enableBatchNumber)throws Exception{
int result=0;
try{
List<Long> idList = new ArrayList<>();
@ -420,7 +422,7 @@ public class MaterialService {
if(StringUtil.isNotEmpty(q)) {
q = q.replace("'", "");
}
result = materialMapperEx.findBySelectWithBarCodeCount(idList, q);
result = materialMapperEx.findBySelectWithBarCodeCount(idList, q, enableSerialNumber, enableBatchNumber);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);

View File

@ -290,7 +290,7 @@
where m.enabled=1 and me.id is not null
<if test="q != null and q !=''">
<bind name="bindKey" value="'%'+q+'%'"/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey} or m.color like #{bindKey})
</if>
<if test="idList.size()>0">
and m.category_id in
@ -298,6 +298,12 @@
#{item}
</foreach>
</if>
<if test="enableSerialNumber != null and enableSerialNumber !=''">
and m.enable_serial_number = #{enableSerialNumber}
</if>
<if test="enableBatchNumber != null and enableBatchNumber !=''">
and m.enable_batch_number = #{enableBatchNumber}
</if>
and ifnull(m.delete_flag,'0') !='1'
ORDER BY m.id desc, me.default_flag desc, me.id asc
<if test="offset != null and rows != null">
@ -320,6 +326,12 @@
#{item}
</foreach>
</if>
<if test="enableSerialNumber != null and enableSerialNumber !=''">
and m.enable_serial_number = #{enableSerialNumber}
</if>
<if test="enableBatchNumber != null and enableBatchNumber !=''">
and m.enable_batch_number = #{enableBatchNumber}
</if>
and ifnull(m.delete_flag,'0') !='1'
</select>