增加批次商品选择
This commit is contained in:
@@ -6,6 +6,7 @@ import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
||||
import com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.materialExtend.MaterialExtendService;
|
||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||
@@ -608,4 +609,38 @@ public class DepotItemController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取批次商品列表信息
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getBatchNumberList")
|
||||
public BaseResponseInfo getBatchNumberList(@RequestParam("name") String name,
|
||||
@RequestParam("depotId") Long depotId,
|
||||
@RequestParam("barCode") String barCode,
|
||||
@RequestParam(value = "batchNumber", required = false) String batchNumber,
|
||||
HttpServletRequest request) throws Exception{
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
try {
|
||||
List<DepotItemVoBatchNumberList> reslist = new ArrayList<>();
|
||||
List<DepotItemVoBatchNumberList> list = depotItemService.getBatchNumberList(name, depotId, barCode, batchNumber);
|
||||
for(DepotItemVoBatchNumberList bn: list) {
|
||||
if(bn.getTotalNum()!=null && bn.getTotalNum().compareTo(BigDecimal.ZERO)>0) {
|
||||
reslist.add(bn);
|
||||
}
|
||||
bn.setExpirationDateStr(Tools.parseDateToStr(bn.getExpirationDate()));
|
||||
}
|
||||
map.put("rows", reslist);
|
||||
map.put("total", reslist.size());
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@ package com.jsh.erp.controller;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.SerialNumber;
|
||||
import com.jsh.erp.datasource.entities.SerialNumberEx;
|
||||
import com.jsh.erp.exception.BusinessParamCheckingException;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
@@ -84,4 +88,39 @@ public class SerialNumberController {
|
||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取序列号商品
|
||||
* @param name
|
||||
* @param depotId
|
||||
* @param materialId
|
||||
* @param currentPage
|
||||
* @param pageSize
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping(value = "/getEnableSerialNumberList")
|
||||
public BaseResponseInfo getEnableSerialNumberList(@RequestParam("name") String name,
|
||||
@RequestParam("depotId") Long depotId,
|
||||
@RequestParam("materialId") Long materialId,
|
||||
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
|
||||
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
try {
|
||||
List<SerialNumber> list = serialNumberService.getEnableSerialNumberList(name, depotId, materialId, (currentPage-1)*pageSize, pageSize);
|
||||
Long total = serialNumberService.getEnableSerialNumberCount(name, depotId, materialId);
|
||||
map.put("rows", list);
|
||||
map.put("total", total);
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ public class SerialNumber {
|
||||
|
||||
private Long materialId;
|
||||
|
||||
private Long depotId;
|
||||
|
||||
private String serialNumber;
|
||||
|
||||
private String isSell;
|
||||
@@ -43,6 +45,14 @@ public class SerialNumber {
|
||||
this.materialId = materialId;
|
||||
}
|
||||
|
||||
public Long getDepotId() {
|
||||
return depotId;
|
||||
}
|
||||
|
||||
public void setDepotId(Long depotId) {
|
||||
this.depotId = depotId;
|
||||
}
|
||||
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ public class SerialNumberEx extends SerialNumber{
|
||||
/**单据类型(出库入库)*/
|
||||
private String depotHeadType;
|
||||
|
||||
private String depotName;
|
||||
|
||||
public String getMaterialCode() {
|
||||
return materialCode;
|
||||
}
|
||||
@@ -75,4 +77,12 @@ public class SerialNumberEx extends SerialNumber{
|
||||
public void setDepotHeadType(String depotHeadType) {
|
||||
this.depotHeadType = depotHeadType;
|
||||
}
|
||||
|
||||
public String getDepotName() {
|
||||
return depotName;
|
||||
}
|
||||
|
||||
public void setDepotName(String depotName) {
|
||||
this.depotName = depotName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,66 @@ public class SerialNumberExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdIsNull() {
|
||||
addCriterion("depot_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdIsNotNull() {
|
||||
addCriterion("depot_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdEqualTo(Long value) {
|
||||
addCriterion("depot_id =", value, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdNotEqualTo(Long value) {
|
||||
addCriterion("depot_id <>", value, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdGreaterThan(Long value) {
|
||||
addCriterion("depot_id >", value, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("depot_id >=", value, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdLessThan(Long value) {
|
||||
addCriterion("depot_id <", value, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("depot_id <=", value, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdIn(List<Long> values) {
|
||||
addCriterion("depot_id in", values, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdNotIn(List<Long> values) {
|
||||
addCriterion("depot_id not in", values, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdBetween(Long value1, Long value2) {
|
||||
addCriterion("depot_id between", value1, value2, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("depot_id not between", value1, value2, "depotId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSerialNumberIsNull() {
|
||||
addCriterion("serial_number is null");
|
||||
return (Criteria) this;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.jsh.erp.datasource.mappers;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
||||
import com.jsh.erp.datasource.vo.DepotItemVo4Stock;
|
||||
import com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -128,4 +129,11 @@ public interface DepotItemMapperEx {
|
||||
@Param("mId") Long mId,
|
||||
@Param("linkNumber") String linkNumber,
|
||||
@Param("goToType") String goToType);
|
||||
|
||||
List<DepotItemVoBatchNumberList> getBatchNumberList(
|
||||
@Param("name") String name,
|
||||
@Param("depotId") Long depotId,
|
||||
@Param("barCode") String barCode,
|
||||
@Param("batchNumber") String batchNumber
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsh.erp.datasource.mappers;
|
||||
|
||||
import com.jsh.erp.datasource.entities.SerialNumber;
|
||||
import com.jsh.erp.datasource.entities.SerialNumberEx;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -62,4 +63,13 @@ public interface SerialNumberMapperEx {
|
||||
int batAddSerialNumber(@Param("list") List<SerialNumberEx> list);
|
||||
|
||||
int batchDeleteSerialNumberByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
|
||||
|
||||
List<SerialNumber> getEnableSerialNumberList(@Param("name") String name,
|
||||
@Param("depotId") Long depotId,
|
||||
@Param("materialId") Long materialId,
|
||||
@Param("offset") Integer offset, @Param("rows") Integer rows);
|
||||
|
||||
Long getEnableSerialNumberCount(@Param("name") String name,
|
||||
@Param("depotId") Long depotId,
|
||||
@Param("materialId") Long materialId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.jsh.erp.datasource.vo;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class DepotItemVoBatchNumberList {
|
||||
|
||||
private String id;
|
||||
private String barCode;
|
||||
private String name;
|
||||
private String standard;
|
||||
private String model;
|
||||
private String batchNumber;
|
||||
private Date expirationDate;
|
||||
private String expirationDateStr;
|
||||
private BigDecimal totalNum;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getBarCode() {
|
||||
return barCode;
|
||||
}
|
||||
|
||||
public void setBarCode(String barCode) {
|
||||
this.barCode = barCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStandard() {
|
||||
return standard;
|
||||
}
|
||||
|
||||
public void setStandard(String standard) {
|
||||
this.standard = standard;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public String getBatchNumber() {
|
||||
return batchNumber;
|
||||
}
|
||||
|
||||
public void setBatchNumber(String batchNumber) {
|
||||
this.batchNumber = batchNumber;
|
||||
}
|
||||
|
||||
public Date getExpirationDate() {
|
||||
return expirationDate;
|
||||
}
|
||||
|
||||
public void setExpirationDate(Date expirationDate) {
|
||||
this.expirationDate = expirationDate;
|
||||
}
|
||||
|
||||
public String getExpirationDateStr() {
|
||||
return expirationDateStr;
|
||||
}
|
||||
|
||||
public void setExpirationDateStr(String expirationDateStr) {
|
||||
this.expirationDateStr = expirationDateStr;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalNum() {
|
||||
return totalNum;
|
||||
}
|
||||
|
||||
public void setTotalNum(BigDecimal totalNum) {
|
||||
this.totalNum = totalNum;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.mappers.*;
|
||||
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
||||
import com.jsh.erp.datasource.vo.DepotItemVo4Stock;
|
||||
import com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.materialExtend.MaterialExtendService;
|
||||
@@ -661,4 +662,8 @@ public class DepotItemService {
|
||||
BigDecimal count = depotItemMapperEx.getFinishNumber(mId, linkNumber, goToType);
|
||||
return count;
|
||||
}
|
||||
|
||||
public List<DepotItemVoBatchNumberList> getBatchNumberList(String name, Long depotId, String barCode, String batchNumber){
|
||||
return depotItemMapperEx.getBatchNumberList(name, depotId, barCode, batchNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,4 +458,24 @@ public class SerialNumberService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<SerialNumber> getEnableSerialNumberList(String name, Long depotId, Long materialId, Integer offset, Integer rows)throws Exception {
|
||||
List<SerialNumber> list =null;
|
||||
try{
|
||||
list = serialNumberMapperEx.getEnableSerialNumberList(StringUtil.toNull(name), depotId, materialId, offset, rows);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long getEnableSerialNumberCount(String name, Long depotId, Long materialId)throws Exception {
|
||||
Long count = 0L;
|
||||
try{
|
||||
count = serialNumberMapperEx.getEnableSerialNumberCount(StringUtil.toNull(name), depotId, materialId);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user