!53 添加仓库默认及商品明细时默认显示仓库,会员、客户快捷添加方式
Merge pull request !53 from 天门溪水/master
This commit is contained in:
@@ -86,7 +86,7 @@ public class BusinessConstants {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/3/14 11:41
|
||||
* description:
|
||||
* description:
|
||||
* 为了使用户可以自己建初始目录,设定根目录的父级目录id为-1
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -207,5 +207,16 @@ public class DepotController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/updateDepotIsDefault")
|
||||
public String updateDepotIsDefault(@RequestParam("isDefault") Boolean isDefault,
|
||||
@RequestParam("depotID") Long depotID,
|
||||
HttpServletRequest request) throws Exception{
|
||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||
int res = depotService.updateDepotIsDefault(isDefault, depotID);
|
||||
if(res > 0) {
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} else {
|
||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
@@ -448,7 +449,7 @@ public class DepotItemController {
|
||||
BigDecimal InPrice = sumPrice("入库", pid, diEx.getMId(), monthTime, false);
|
||||
BigDecimal OutPrice = sumPrice("出库", pid, diEx.getMId(), monthTime, false);
|
||||
item.put("MaterialName", diEx.getMName());
|
||||
item.put("MaterialModel", diEx.getMColor());
|
||||
item.put("MaterialModel", diEx.getMModel());
|
||||
//扩展信息
|
||||
String materialOther = getOtherInfo(mpArr, diEx);
|
||||
item.put("MaterialOther", materialOther);
|
||||
@@ -827,4 +828,81 @@ public class DepotItemController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 库存预警报表
|
||||
* @param currentPage
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findStockWarningCount")
|
||||
public BaseResponseInfo findStockWarningCount(@RequestParam("currentPage") Integer currentPage,
|
||||
@RequestParam("pageSize") Integer pageSize, @RequestParam("projectId") Integer pid )throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
List<DepotItemStockWarningCount> resList = new ArrayList<DepotItemStockWarningCount>();
|
||||
List<DepotItemStockWarningCount> list = depotItemService.findStockWarningCount((currentPage-1)*pageSize, pageSize,pid);
|
||||
int total = depotItemService.findStockWarningCountTotal(pid);
|
||||
map.put("total", total);
|
||||
map.put("rows", list);
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/**
|
||||
* 导出库存预警excel表格
|
||||
* @param currentPage
|
||||
* @param pageSize
|
||||
* @param projectId
|
||||
* @param monthTime
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/exportWarningExcel")
|
||||
public BaseResponseInfo exportWarningExcel(@RequestParam("currentPage") Integer currentPage,
|
||||
@RequestParam("pageSize") Integer pageSize,
|
||||
@RequestParam("projectId") Integer projectId,
|
||||
HttpServletRequest request, HttpServletResponse response)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String message = "成功";
|
||||
try {
|
||||
List<DepotItemStockWarningCount> dataList = depotItemService.findStockWarningCount((currentPage - 1) * pageSize, pageSize, projectId);
|
||||
//存放数据json数组
|
||||
Integer pid = projectId;
|
||||
String[] names = {"名称", "型号", "扩展信息", "单位", "入库数量", "出库数量", "库存数量", "安全库存量", "临界库存量"};
|
||||
String title = "库存预警报表";
|
||||
List<String[]> objects = new ArrayList<String[]>();
|
||||
if (null != dataList) {
|
||||
for (DepotItemStockWarningCount diEx : dataList) {
|
||||
String[] objs = new String[9];
|
||||
|
||||
objs[0] = diEx.getMaterialName().toString();
|
||||
objs[1] = diEx.getMaterialModel().toString();
|
||||
objs[2] = diEx.getMaterialOther().toString();
|
||||
objs[3] = diEx.getMaterialUnit().toString();
|
||||
objs[4] = diEx.getBasicInNumber().toString();
|
||||
objs[5] = diEx.getBasicOutNumber() == null ? "0" : diEx.getBasicOutNumber().toString();
|
||||
objs[6] = diEx.getBasicNumber() == null ? "0" : diEx.getBasicNumber().toString();
|
||||
objs[7] = diEx.getSafetystock() == null ? "0" : diEx.getSafetystock().toString();
|
||||
objs[8] = diEx.getBasicLinjieNumber() == null ? "0" : diEx.getBasicLinjieNumber().toString();
|
||||
objects.add(objs);
|
||||
}
|
||||
}
|
||||
File file = ExcelUtils.exportObjectsWithoutTitle(title+pid, names, title, objects);
|
||||
ExportExecUtil.showExec(file, file.getName(), response);
|
||||
res.code = 200;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "导出失败";
|
||||
res.code = 500;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,15 @@ public class Depot {
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String deleteFlag;
|
||||
private Boolean isdefault;
|
||||
|
||||
public Boolean getIsdefault() {
|
||||
return isdefault;
|
||||
}
|
||||
|
||||
public void setIsdefault(Boolean isdefault) {
|
||||
this.isdefault = isdefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@@ -354,4 +363,4 @@ public class Depot {
|
||||
public void setDeleteFlag(String deleteFlag) {
|
||||
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +235,7 @@ public class DepotExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
|
||||
public Criteria andIdIn(List<Long> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
@@ -664,7 +665,65 @@ public class DepotExample {
|
||||
addCriterion("remark <>", value, "remark");
|
||||
return (Criteria) this;
|
||||
}
|
||||
public Criteria andIsdefaultIsNull() {
|
||||
addCriterion("IsDefault is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultIsNotNull() {
|
||||
addCriterion("IsDefault is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultEqualTo(Boolean value) {
|
||||
addCriterion("IsDefault =", value, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultNotEqualTo(Boolean value) {
|
||||
addCriterion("IsDefault <>", value, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultGreaterThan(Boolean value) {
|
||||
addCriterion("IsDefault >", value, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("IsDefault >=", value, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultLessThan(Boolean value) {
|
||||
addCriterion("IsDefault <", value, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("IsDefault <=", value, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultIn(List<Boolean> values) {
|
||||
addCriterion("IsDefault in", values, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultNotIn(List<Boolean> values) {
|
||||
addCriterion("IsDefault not in", values, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("IsDefault between", value1, value2, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsdefaultNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("IsDefault not between", value1, value2, "isdefault");
|
||||
return (Criteria) this;
|
||||
}
|
||||
public Criteria andRemarkGreaterThan(String value) {
|
||||
addCriterion("remark >", value, "remark");
|
||||
return (Criteria) this;
|
||||
@@ -1010,4 +1069,4 @@ public class DepotExample {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsh.erp.datasource.mappers;
|
||||
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -172,4 +173,10 @@ public interface DepotItemMapperEx {
|
||||
List<DepotItem> getDepotItemListListByDepotIds(@Param("depotIds") String[] depotIds);
|
||||
|
||||
List<DepotItem> getDepotItemListListByMaterialIds(@Param("materialIds") String[] materialIds);
|
||||
|
||||
|
||||
List<DepotItemStockWarningCount> findStockWarningCount(@Param("offset") Integer offset,
|
||||
@Param("rows") Integer rows, @Param("pid") Integer pid);
|
||||
|
||||
int findStockWarningCountTotal( @Param("pid") Integer pid);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.jsh.erp.datasource.vo;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class DepotItemStockWarningCount {
|
||||
|
||||
|
||||
private String MaterialName;
|
||||
|
||||
private String MaterialModel;
|
||||
|
||||
private String categoryName;
|
||||
|
||||
private String MaterialOther;
|
||||
|
||||
private String MaterialUnit;
|
||||
|
||||
private BigDecimal safetystock;//安全库存量
|
||||
|
||||
private BigDecimal BasicInNumber;//入库量
|
||||
|
||||
private BigDecimal BasicOutNumber;//出库量
|
||||
|
||||
|
||||
private BigDecimal BasicNumber;//库存
|
||||
|
||||
private BigDecimal BasicLinjieNumber;//临界库存
|
||||
|
||||
public String getMaterialName() {
|
||||
return MaterialName;
|
||||
}
|
||||
|
||||
public void setMaterialName(String materialName) {
|
||||
MaterialName = materialName;
|
||||
}
|
||||
|
||||
public String getMaterialModel() {
|
||||
return MaterialModel;
|
||||
}
|
||||
|
||||
public void setMaterialModel(String materialModel) {
|
||||
MaterialModel = materialModel;
|
||||
}
|
||||
|
||||
public String getCategoryName() {
|
||||
return categoryName;
|
||||
}
|
||||
|
||||
public void setCategoryName(String categoryName) {
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public String getMaterialOther() {
|
||||
return MaterialOther;
|
||||
}
|
||||
|
||||
public void setMaterialOther(String materialOther) {
|
||||
MaterialOther = materialOther;
|
||||
}
|
||||
|
||||
public String getMaterialUnit() {
|
||||
return MaterialUnit;
|
||||
}
|
||||
|
||||
public void setMaterialUnit(String materialUnit) {
|
||||
MaterialUnit = materialUnit;
|
||||
}
|
||||
|
||||
public BigDecimal getSafetystock() {
|
||||
return safetystock;
|
||||
}
|
||||
|
||||
public void setSafetystock(BigDecimal safetystock) {
|
||||
this.safetystock = safetystock;
|
||||
}
|
||||
|
||||
public BigDecimal getBasicInNumber() {
|
||||
return BasicInNumber;
|
||||
}
|
||||
|
||||
public void setBasicInNumber(BigDecimal basicInNumber) {
|
||||
BasicInNumber = basicInNumber;
|
||||
}
|
||||
|
||||
public BigDecimal getBasicOutNumber() {
|
||||
return BasicOutNumber;
|
||||
}
|
||||
|
||||
public void setBasicOutNumber(BigDecimal basicOutNumber) {
|
||||
BasicOutNumber = basicOutNumber;
|
||||
}
|
||||
|
||||
public BigDecimal getBasicNumber() {
|
||||
return BasicNumber;
|
||||
}
|
||||
|
||||
public void setBasicNumber(BigDecimal basicNumber) {
|
||||
BasicNumber = basicNumber;
|
||||
}
|
||||
|
||||
public BigDecimal getBasicLinjieNumber() {
|
||||
return BasicLinjieNumber;
|
||||
}
|
||||
|
||||
public void setBasicLinjieNumber(BigDecimal basicLinjieNumber) {
|
||||
BasicLinjieNumber = basicLinjieNumber;
|
||||
}
|
||||
}
|
||||
@@ -316,4 +316,24 @@ public class DepotService {
|
||||
return deleteTotal;
|
||||
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateDepotIsDefault(Boolean isDefault, Long depotID) throws Exception{
|
||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+depotID,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
Depot depot = new Depot();
|
||||
depot.setIsdefault(isDefault);
|
||||
DepotExample example = new DepotExample();
|
||||
example.createCriteria().andIdEqualTo(depotID);
|
||||
int result=0;
|
||||
try{
|
||||
result = depotMapper.updateByExampleSelective(depot, example);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,17 +9,16 @@ import com.jsh.erp.datasource.mappers.DepotHeadMapper;
|
||||
import com.jsh.erp.datasource.mappers.DepotItemMapper;
|
||||
import com.jsh.erp.datasource.mappers.DepotItemMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.SerialNumberMapperEx;
|
||||
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
@@ -32,8 +31,6 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
|
||||
@Service
|
||||
public class DepotItemService {
|
||||
private Logger logger = LoggerFactory.getLogger(DepotItemService.class);
|
||||
@@ -795,4 +792,32 @@ public class DepotItemService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public List<DepotItemStockWarningCount> findStockWarningCount(int offset, Integer rows, Integer pid) {
|
||||
|
||||
List<DepotItemStockWarningCount> list = null;
|
||||
try{
|
||||
list =depotItemMapperEx.findStockWarningCount( offset, rows, pid);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int findStockWarningCountTotal(Integer pid) {
|
||||
int result = 0;
|
||||
try{
|
||||
result =depotItemMapperEx.findStockWarningCountTotal(pid);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,18 @@
|
||||
<result column="MaterialUnit" jdbcType="VARCHAR" property="MaterialUnit" />
|
||||
<result column="MColor" jdbcType="VARCHAR" property="MColor" />
|
||||
</resultMap>
|
||||
<resultMap id="ResultStockWarningCount" type="com.jsh.erp.datasource.vo.DepotItemStockWarningCount">
|
||||
<result column="MaterialName" jdbcType="VARCHAR" property="MaterialName" />
|
||||
<result column="MaterialModel" jdbcType="VARCHAR" property="MaterialModel" />
|
||||
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
|
||||
<result column="MaterialOther" jdbcType="VARCHAR" property="MaterialOther" />
|
||||
<result column="MaterialUnit" jdbcType="VARCHAR" property="MaterialUnit" />
|
||||
<result column="safetystock" jdbcType="DECIMAL" property="safetystock" />
|
||||
<result column="BasicInNumber" jdbcType="DECIMAL" property="BasicInNumber" />
|
||||
<result column="BasicOutNumber" jdbcType="DECIMAL" property="BasicOutNumber" />
|
||||
<result column="BasicNumber" jdbcType="DECIMAL" property="BasicNumber" />
|
||||
<result column="BasicLinjieNumber" jdbcType="DECIMAL" property="BasicLinjieNumber" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByConditionDepotItem" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap">
|
||||
select *
|
||||
@@ -438,5 +450,95 @@
|
||||
|
||||
|
||||
|
||||
<select id="findStockWarningCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultStockWarningCount">
|
||||
SELECT
|
||||
m. NAME MaterialName,
|
||||
m.Model MaterialModel,
|
||||
mc.`Name` categoryName,
|
||||
CONCAT(
|
||||
'(',
|
||||
m.Standard,
|
||||
')',
|
||||
'(',
|
||||
m.Color,
|
||||
')'
|
||||
) AS MaterialOther,
|
||||
m.unit MaterialUnit,
|
||||
ifnull(m.safetystock,0) safetystock,
|
||||
IFNULL(intype.BasicInNumber ,0) BasicInNumber,
|
||||
IFNULL(outtype.BasicOutNumber ,0) BasicOutNumber,
|
||||
(
|
||||
IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0)
|
||||
) BasicNumber,
|
||||
(IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0) - ifnull(m.safetystock,0)) BasicLinjieNumber
|
||||
FROM
|
||||
jsh_material m
|
||||
LEFT JOIN jsh_materialcategory mc ON mc.Id = m.CategoryId
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
di.MaterialId,
|
||||
ifnull(sum(BasicNumber), 0) AS BasicInNumber
|
||||
FROM
|
||||
jsh_depothead dh
|
||||
INNER JOIN jsh_depotitem di ON dh.id = di.HeaderId
|
||||
AND ifnull(di.delete_Flag, '0') != '1'
|
||||
WHERE
|
||||
dh.type = '入库'
|
||||
<if test="pid != null">
|
||||
and di.DepotId= ${pid}
|
||||
</if>
|
||||
AND ifnull(dh.delete_Flag, '0') != '1' group by di.MaterialId
|
||||
) intype ON intype.MaterialId = m.id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
di.MaterialId,
|
||||
ifnull(sum(BasicNumber), 0) AS BasicOutNumber
|
||||
FROM
|
||||
jsh_depothead dh
|
||||
INNER JOIN jsh_depotitem di ON dh.id = di.HeaderId
|
||||
AND ifnull(di.delete_Flag, '0') != '1'
|
||||
WHERE
|
||||
dh.type = '出库'
|
||||
AND dh.SubType != '调拨'
|
||||
<if test="pid != null">
|
||||
and di.DepotId= ${pid}
|
||||
</if>
|
||||
AND ifnull(dh.delete_Flag, '0') != '1' group by di.MaterialId
|
||||
) outtype ON outtype.MaterialId = m.id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND ifnull(m.delete_Flag, '0') != '1'
|
||||
AND intype.BasicInNumber > 0
|
||||
ORDER BY
|
||||
(IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0) - ifnull(m.safetystock,0))
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
<select id="findStockWarningCountTotal" resultType="java.lang.Integer">
|
||||
select count(1) from
|
||||
jsh_material m
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
di.MaterialId,
|
||||
ifnull(sum(BasicNumber), 0) AS BasicInNumber
|
||||
FROM
|
||||
jsh_depothead dh
|
||||
INNER JOIN jsh_depotitem di ON dh.id = di.HeaderId
|
||||
AND ifnull(di.delete_Flag, '0') != '1'
|
||||
WHERE
|
||||
dh.type = '入库'
|
||||
<if test="pid != null">
|
||||
and di.DepotId= ${pid}
|
||||
</if>
|
||||
AND ifnull(dh.delete_Flag, '0') != '1' group by di.MaterialId
|
||||
) intype ON intype.MaterialId = m.id
|
||||
|
||||
WHERE
|
||||
1 = 1
|
||||
AND ifnull(m.delete_Flag, '0') != '1'
|
||||
AND intype.BasicInNumber > 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jsh.erp.datasource.mappers.DepotMapper">
|
||||
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Depot">
|
||||
<!--
|
||||
@@ -17,6 +17,7 @@
|
||||
<result column="principal" jdbcType="BIGINT" property="principal" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
|
||||
<result column="IsDefault" jdbcType="BIT" property="isdefault" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<!--
|
||||
@@ -89,8 +90,8 @@
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, name, address, warehousing, truckage, type, sort, remark, principal, tenant_id,
|
||||
delete_Flag
|
||||
id, name, address, warehousing, truckage, type, sort, remark, principal, tenant_id,
|
||||
delete_Flag,IsDefault
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
@@ -115,7 +116,7 @@
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from jsh_depot
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
@@ -143,13 +144,13 @@
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
insert into jsh_depot (id, name, address,
|
||||
warehousing, truckage, type,
|
||||
sort, remark, principal,
|
||||
insert into jsh_depot (id, name, address,
|
||||
warehousing, truckage, type,
|
||||
sort, remark, principal,
|
||||
tenant_id, delete_Flag)
|
||||
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
|
||||
#{warehousing,jdbcType=DECIMAL}, #{truckage,jdbcType=DECIMAL}, #{type,jdbcType=INTEGER},
|
||||
#{sort,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{principal,jdbcType=BIGINT},
|
||||
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
|
||||
#{warehousing,jdbcType=DECIMAL}, #{truckage,jdbcType=DECIMAL}, #{type,jdbcType=INTEGER},
|
||||
#{sort,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{principal,jdbcType=BIGINT},
|
||||
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Depot">
|
||||
@@ -279,6 +280,9 @@
|
||||
<if test="record.deleteFlag != null">
|
||||
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.isdefault != null">
|
||||
IsDefault = #{record.isdefault,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@@ -363,4 +367,4 @@
|
||||
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user