库存调整
This commit is contained in:
@@ -4,6 +4,8 @@ import com.yxt.common.core.query.PagerQuery;
|
|||||||
import com.yxt.common.core.result.ResultBean;
|
import com.yxt.common.core.result.ResultBean;
|
||||||
import com.yxt.common.core.vo.PagerVo;
|
import com.yxt.common.core.vo.PagerVo;
|
||||||
import com.yxt.warehouse.biz.inventoryadjustment.*;
|
import com.yxt.warehouse.biz.inventoryadjustment.*;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinventory.AvailableCountVo;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryDto;
|
||||||
import com.yxt.warehouse.utils.OrgPathQuery;
|
import com.yxt.warehouse.utils.OrgPathQuery;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -55,4 +57,9 @@ public class InventoryAdjustmentRest {
|
|||||||
inventoryAdjustmentService.delAll(sids);
|
inventoryAdjustmentService.delAll(sids);
|
||||||
return rb.success();
|
return rb.success();
|
||||||
}
|
}
|
||||||
|
@ApiOperation("根据skuSid查询商品可用库存")
|
||||||
|
@PostMapping("/adjustment")
|
||||||
|
public ResultBean adjustment(@RequestBody adjustmentDto dto) {
|
||||||
|
return inventoryAdjustmentService.adjustment(dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,5 +226,20 @@ public class WarehouseInventoryRest {
|
|||||||
}
|
}
|
||||||
return rb.success().setData(w);
|
return rb.success().setData(w);
|
||||||
}
|
}
|
||||||
|
@ApiOperation("根据skuSid查询商品可用库存")
|
||||||
|
@PostMapping("/selAvailBySkuSid")
|
||||||
|
public ResultBean<List<AvailableCountVo>> selAvailBySkuSid(@RequestBody WarehouseInventoryQuery query) {
|
||||||
|
ResultBean rb =new ResultBean().fail();
|
||||||
|
List<AvailableCountVo> w=WarehouseInventoryService.selAvailableBySkuSid1(query.getGoodsSkuSid(),query.getRackSid(),query.getOrgSid());
|
||||||
|
return rb.success().setData(w);
|
||||||
|
}
|
||||||
|
// @ApiOperation("根据skuSid查询商品可用库存")
|
||||||
|
// @PostMapping("/selInventoryByRackSid/{}")
|
||||||
|
// public ResultBean<List<AvailableCountVo>> selInventoryByRackSid(@RequestBody WarehouseInventoryQuery query) {
|
||||||
|
// ResultBean rb =new ResultBean().fail();
|
||||||
|
// List<AvailableCountVo> w=WarehouseInventoryService.selInventoryByRackSid(query.getGoodsSkuSid(),query.getOrgSid());
|
||||||
|
// return rb.success().setData(w);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
<select id="listPage" resultType="com.yxt.warehouse.biz.inventoryadjustment.InventoryAdjustmentVo">
|
<select id="listPage" resultType="com.yxt.warehouse.biz.inventoryadjustment.InventoryAdjustmentVo">
|
||||||
select
|
select
|
||||||
a.*
|
a.*, case a.type when 1 then '数量调整' end as typeValue,
|
||||||
|
case a.state when 1 then '未调整' when 2 then '部分调整' when 3 then '调整完成' end as stateValue
|
||||||
from inventory_adjustment a
|
from inventory_adjustment a
|
||||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||||
<where>
|
<where>
|
||||||
@@ -24,7 +25,8 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="initialization" resultType="com.yxt.warehouse.biz.inventoryadjustment.InventoryAdjustmentVo">
|
<select id="initialization" resultType="com.yxt.warehouse.biz.inventoryadjustment.InventoryAdjustmentVo">
|
||||||
select
|
select
|
||||||
a.*
|
a.*,case a.type when 1 then '数量调整' end as typeValue,
|
||||||
|
case a.state when 1 then '未调整' when 2 then '部分调整' when 3 then '调整完成' end as stateValue
|
||||||
from inventory_adjustment a
|
from inventory_adjustment a
|
||||||
where a.sid =#{sid}
|
where a.sid =#{sid}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetail
|
|||||||
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailService;
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailService;
|
||||||
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailVo;
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailVo;
|
||||||
import com.yxt.warehouse.biz.warehouseinfo.WarehouseInfoVo;
|
import com.yxt.warehouse.biz.warehouseinfo.WarehouseInfoVo;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinventory.AvailableCountVo;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinventory.WarehouseInventory;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryDto;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryService;
|
||||||
import com.yxt.warehouse.utils.ExcelUtil;
|
import com.yxt.warehouse.utils.ExcelUtil;
|
||||||
import com.yxt.warehouse.utils.OrgPathQuery;
|
import com.yxt.warehouse.utils.OrgPathQuery;
|
||||||
import com.yxt.warehouse.utils.Rule;
|
import com.yxt.warehouse.utils.Rule;
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -36,51 +41,53 @@ public class InventoryAdjustmentService extends MybatisBaseService<InventoryAdju
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
InventoryAdjustmentDetailService inventoryAdjustmentDetailService;
|
InventoryAdjustmentDetailService inventoryAdjustmentDetailService;
|
||||||
|
@Autowired
|
||||||
|
WarehouseInventoryService warehouseInventoryService;
|
||||||
public ResultBean<PagerVo<InventoryAdjustmentVo>> listPage(PagerQuery<InventoryAdjustmentQuery> pq) {
|
public ResultBean<PagerVo<InventoryAdjustmentVo>> listPage(PagerQuery<InventoryAdjustmentQuery> pq) {
|
||||||
ResultBean rb = ResultBean.fireFail();
|
ResultBean rb = ResultBean.fireFail();
|
||||||
InventoryAdjustmentQuery query = pq.getParams();
|
InventoryAdjustmentQuery query = pq.getParams();
|
||||||
QueryWrapper<InventoryAdjustment> qw = new QueryWrapper<>();
|
QueryWrapper<InventoryAdjustment> qw = new QueryWrapper<>();
|
||||||
|
if (StringUtils.isNotBlank(query.getOrgLevelKey())) {
|
||||||
// if (StringUtils.isNotBlank(query.getOrgLevelKey())) {
|
//数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
||||||
// //数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
String orgLevelKey=query.getOrgLevelKey();
|
||||||
// String orgLevelKey=query.getOrgLevelKey();
|
String orgSidPath=query.getOrgPath();
|
||||||
// String orgSidPath=query.getOrgPath();
|
int index=query.getIndex();
|
||||||
// int index=query.getIndex();
|
if ("1".equals(orgLevelKey)) {
|
||||||
// if ("1".equals(orgLevelKey)) {
|
orgSidPath = orgSidPath.substring(0, index);
|
||||||
// orgSidPath = orgSidPath.substring(0, index);
|
qw.like("s.orgSidPath", orgSidPath);
|
||||||
// qw.like("s.orgSidPath", orgSidPath);
|
} else if ("2".equals(orgLevelKey)) {
|
||||||
// } else if ("2".equals(orgLevelKey)) {
|
orgSidPath = orgSidPath.substring(0, index);
|
||||||
// orgSidPath = orgSidPath.substring(0, index);
|
qw.like("s.orgSidPath", orgSidPath);
|
||||||
// qw.like("s.orgSidPath", orgSidPath);
|
} else if ("3".equals(orgLevelKey)) {
|
||||||
// } else if ("3".equals(orgLevelKey)) {
|
orgSidPath = orgSidPath.substring(0, index);
|
||||||
// orgSidPath = orgSidPath.substring(0, index);
|
qw.apply("s.orgSidPath like('"+orgSidPath+"')");
|
||||||
// qw.apply("s.orgSidPath like('"+orgSidPath+"')");
|
} else if ("4".equals(orgLevelKey)) {
|
||||||
// } else if ("4".equals(orgLevelKey)) {
|
qw.eq("a.createBySid", query.getUserSid());
|
||||||
// qw.eq("a.createBySid", query.getUserSid());
|
} else {
|
||||||
// } else {
|
PagerVo<WarehouseInfoVo> p = new PagerVo<>();
|
||||||
// PagerVo<WarehouseInfoVo> p = new PagerVo<>();
|
return rb.success().setData(p);
|
||||||
// return rb.success().setData(p);
|
}
|
||||||
// }
|
} else {
|
||||||
// } else {
|
PagerVo<WarehouseInfoVo> p = new PagerVo<>();
|
||||||
// PagerVo<WarehouseInfoVo> p = new PagerVo<>();
|
return rb.success().setData(p);
|
||||||
// return rb.success().setData(p);
|
}
|
||||||
// }
|
|
||||||
qw.apply(StringUtils.isNotBlank(query.getStartTime()), "date_format (a.createTime,'%Y-%m-%d') >= date_format('" + query.getStartTime() + "','%Y-%m-%d')").
|
qw.apply(StringUtils.isNotBlank(query.getStartTime()), "date_format (a.createTime,'%Y-%m-%d') >= date_format('" + query.getStartTime() + "','%Y-%m-%d')").
|
||||||
apply(StringUtils.isNotBlank(query.getEndTime()), "date_format (a.createTime,'%Y-%m-%d') <= date_format('" + query.getEndTime() + "','%Y-%m-%d')"
|
apply(StringUtils.isNotBlank(query.getEndTime()), "date_format (a.createTime,'%Y-%m-%d') <= date_format('" + query.getEndTime() + "','%Y-%m-%d')"
|
||||||
);
|
);
|
||||||
if (StringUtils.isNotBlank(query.getBillNo())) {
|
if (StringUtils.isNotBlank(query.getBillNo())) {
|
||||||
qw.like("a.areaName", query.getBillNo());
|
qw.like("a.billNo", query.getBillNo());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(query.getGoodsSkuSid())) {
|
if (StringUtils.isNotBlank(query.getGoodsSkuSid())) {
|
||||||
qw.like("a.areaCode", query.getGoodsSkuSid());
|
qw.like("b.goodsSkuSid", query.getGoodsSkuSid());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(query.getType())) {
|
if (StringUtils.isNotBlank(query.getType())) {
|
||||||
qw.eq("b.sid", query.getType());
|
qw.eq("a.type", query.getType());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(query.getOperator())) {
|
if (StringUtils.isNotBlank(query.getOperator())) {
|
||||||
qw.eq("c.sid", query.getOperator());
|
qw.eq("a.operator", query.getOperator());
|
||||||
}
|
}
|
||||||
qw.ne("a.isDelete", "1");
|
qw.ne("a.isDelete", "1");
|
||||||
|
qw.ne("a.state", "3");
|
||||||
IPage<InventoryAdjustment> page = PagerUtil.queryToPage(pq);
|
IPage<InventoryAdjustment> page = PagerUtil.queryToPage(pq);
|
||||||
IPage<InventoryAdjustmentVo> pagging = baseMapper.listPage(page, qw);
|
IPage<InventoryAdjustmentVo> pagging = baseMapper.listPage(page, qw);
|
||||||
PagerVo<InventoryAdjustmentVo> p = PagerUtil.pageToVo(pagging, null);
|
PagerVo<InventoryAdjustmentVo> p = PagerUtil.pageToVo(pagging, null);
|
||||||
@@ -100,6 +107,9 @@ public class InventoryAdjustmentService extends MybatisBaseService<InventoryAdju
|
|||||||
InventoryAdjustment inventoryAdjustment = fetchBySid(dto.getSid());
|
InventoryAdjustment inventoryAdjustment = fetchBySid(dto.getSid());
|
||||||
BeanUtil.copyProperties(dto, inventoryAdjustment, "id", "sid");
|
BeanUtil.copyProperties(dto, inventoryAdjustment, "id", "sid");
|
||||||
inventoryAdjustment.setModifyTime(new Date());
|
inventoryAdjustment.setModifyTime(new Date());
|
||||||
|
if(inventoryAdjustment.getType().equals("数量调整")){
|
||||||
|
inventoryAdjustment.setType("1");
|
||||||
|
}
|
||||||
baseMapper.updateById(inventoryAdjustment);
|
baseMapper.updateById(inventoryAdjustment);
|
||||||
// dto.getList().stream().forEach(a->{
|
// dto.getList().stream().forEach(a->{
|
||||||
// a.setBillNo(inventoryAdjustment.getBillNo());
|
// a.setBillNo(inventoryAdjustment.getBillNo());
|
||||||
@@ -127,8 +137,12 @@ public class InventoryAdjustmentService extends MybatisBaseService<InventoryAdju
|
|||||||
a.setBillNo(inventoryAdjustment.getBillNo());
|
a.setBillNo(inventoryAdjustment.getBillNo());
|
||||||
a.setBillSid(inventoryAdjustment.getSid());
|
a.setBillSid(inventoryAdjustment.getSid());
|
||||||
a.setUserSid(dto.getUserSid());
|
a.setUserSid(dto.getUserSid());
|
||||||
|
// a.setBrandName();
|
||||||
});
|
});
|
||||||
inventoryAdjustmentDetailService.saveOrUpdate(dto.getList());
|
inventoryAdjustmentDetailService.saveOrUpdate(dto.getList());
|
||||||
|
if(inventoryAdjustment.getType().equals("数量调整")){
|
||||||
|
inventoryAdjustment.setType("1");
|
||||||
|
}
|
||||||
baseMapper.insert(inventoryAdjustment);
|
baseMapper.insert(inventoryAdjustment);
|
||||||
}
|
}
|
||||||
return rb.success().setMsg("成功");
|
return rb.success().setMsg("成功");
|
||||||
@@ -145,5 +159,26 @@ public class InventoryAdjustmentService extends MybatisBaseService<InventoryAdju
|
|||||||
int count = baseMapper.deleteByBillSid(Arrays.stream(sids).collect(Collectors.toList()));
|
int count = baseMapper.deleteByBillSid(Arrays.stream(sids).collect(Collectors.toList()));
|
||||||
inventoryAdjustmentDetailService.delAll(sids);
|
inventoryAdjustmentDetailService.delAll(sids);
|
||||||
}
|
}
|
||||||
|
public ResultBean adjustment(adjustmentDto dto) {
|
||||||
|
ResultBean rb =new ResultBean().fail();
|
||||||
|
for (adjustmentDetail adjustmentDetail: dto.getList()) {
|
||||||
|
WarehouseInventory warehouseInventory=warehouseInventoryService.getOne(new QueryWrapper<WarehouseInventory>().eq("sid",adjustmentDetail.getInventorySid()));
|
||||||
|
warehouseInventory.setCount(warehouseInventory.getCount().add(adjustmentDetail.getCount()));;
|
||||||
|
if(warehouseInventory.getCount().compareTo(new BigDecimal(0))==-1){
|
||||||
|
return rb.setMsg("库存可用小于差异量");
|
||||||
|
}
|
||||||
|
warehouseInventoryService.updateById(warehouseInventory);
|
||||||
|
}
|
||||||
|
InventoryAdjustmentDetail w=inventoryAdjustmentDetailService.getOne(new QueryWrapper<InventoryAdjustmentDetail>().eq("sid",dto.getDetailSid()));
|
||||||
|
w.setState(3);
|
||||||
|
inventoryAdjustmentDetailService.updateById(w);
|
||||||
|
List<InventoryAdjustmentDetail> ws=inventoryAdjustmentDetailService.list(new QueryWrapper<InventoryAdjustmentDetail>().eq("billSid",w.getBillSid()));
|
||||||
|
List<InventoryAdjustmentDetail> wss=ws.stream().filter(s->s.getState().toString().equals("3")).collect(Collectors.toList());
|
||||||
|
if(ws.size()==wss.size()){
|
||||||
|
InventoryAdjustment inventoryAdjustment=baseMapper.selectOne(new QueryWrapper<InventoryAdjustment>().eq("sid",w.getBillSid()));
|
||||||
|
inventoryAdjustment.setState(3);
|
||||||
|
baseMapper.updateById(inventoryAdjustment);
|
||||||
|
}
|
||||||
|
return rb.success().setData("成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,10 @@ public class InventoryAdjustmentVo implements Vo {
|
|||||||
private String remarks;
|
private String remarks;
|
||||||
private String isEnable;
|
private String isEnable;
|
||||||
private String state;
|
private String state;
|
||||||
|
private String stateValue;
|
||||||
private String isDelete;
|
private String isDelete;
|
||||||
private String type;//库位名称
|
private String type;//库位名称
|
||||||
|
private String typeValue;//库位名称
|
||||||
private String billNo;//库位编码
|
private String billNo;//库位编码
|
||||||
private String warehouseSid;//仓库sid
|
private String warehouseSid;//仓库sid
|
||||||
private String warehouseName;//库位容量
|
private String warehouseName;//库位容量
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustment;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/9/27 14:30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class adjustmentDetail {
|
||||||
|
private String inventorySid;
|
||||||
|
private BigDecimal count;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustment;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/9/27 14:29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class adjustmentDto {
|
||||||
|
private String detailSid;
|
||||||
|
private List<adjustmentDetail> list;
|
||||||
|
}
|
||||||
@@ -26,4 +26,8 @@ public class InventoryAdjustmentDetail extends BaseEntity {
|
|||||||
private String goodsSkuOwnSpec;//商品规格
|
private String goodsSkuOwnSpec;//商品规格
|
||||||
private String count;
|
private String count;
|
||||||
private String unit;
|
private String unit;
|
||||||
|
private String brandSid;
|
||||||
|
private String brandName;
|
||||||
|
private String typeSid;
|
||||||
|
private String typeName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,4 +35,8 @@ public class InventoryAdjustmentDetailDto implements Dto {
|
|||||||
private String count;
|
private String count;
|
||||||
private String unit;
|
private String unit;
|
||||||
private String userSid;
|
private String userSid;
|
||||||
|
private String brandSid;
|
||||||
|
private String brandName;
|
||||||
|
private String typeSid;
|
||||||
|
private String typeName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import com.yxt.common.core.result.ResultBean;
|
|||||||
import com.yxt.common.core.vo.PagerVo;
|
import com.yxt.common.core.vo.PagerVo;
|
||||||
import com.yxt.warehouse.biz.inventoryadjustment.InventoryAdjustmentAllVo;
|
import com.yxt.warehouse.biz.inventoryadjustment.InventoryAdjustmentAllVo;
|
||||||
import com.yxt.warehouse.biz.warehouseinfo.WarehouseInfoVo;
|
import com.yxt.warehouse.biz.warehouseinfo.WarehouseInfoVo;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinventory.WarehouseInventory;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryService;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryVo;
|
||||||
import com.yxt.warehouse.utils.OrgPathQuery;
|
import com.yxt.warehouse.utils.OrgPathQuery;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -27,56 +30,60 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class InventoryAdjustmentDetailService extends MybatisBaseService<InventoryAdjustmentDetailMapper, InventoryAdjustmentDetail> {
|
public class InventoryAdjustmentDetailService extends MybatisBaseService<InventoryAdjustmentDetailMapper, InventoryAdjustmentDetail> {
|
||||||
|
@Autowired
|
||||||
|
WarehouseInventoryService warehouseInventoryService;
|
||||||
public ResultBean<PagerVo<InventoryAdjustmentDetailVo>> listPage(PagerQuery<InventoryAdjustmentDetailQuery> pq) {
|
public ResultBean<PagerVo<InventoryAdjustmentDetailVo>> listPage(PagerQuery<InventoryAdjustmentDetailQuery> pq) {
|
||||||
ResultBean rb = ResultBean.fireFail();
|
ResultBean rb = ResultBean.fireFail();
|
||||||
InventoryAdjustmentDetailQuery query = pq.getParams();
|
InventoryAdjustmentDetailQuery query = pq.getParams();
|
||||||
QueryWrapper<InventoryAdjustmentDetail> qw = new QueryWrapper<>();
|
QueryWrapper<InventoryAdjustmentDetail> qw = new QueryWrapper<>();
|
||||||
//
|
|
||||||
// if (StringUtils.isNotBlank(query.getOrgLevelKey())) {
|
if (StringUtils.isNotBlank(query.getOrgLevelKey())) {
|
||||||
// //数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
//数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
||||||
// String orgLevelKey=query.getOrgLevelKey();
|
String orgLevelKey=query.getOrgLevelKey();
|
||||||
// String orgSidPath=query.getOrgPath();
|
String orgSidPath=query.getOrgPath();
|
||||||
// int index=query.getIndex();
|
int index=query.getIndex();
|
||||||
// if ("1".equals(orgLevelKey)) {
|
if ("1".equals(orgLevelKey)) {
|
||||||
// orgSidPath = orgSidPath.substring(0, index);
|
orgSidPath = orgSidPath.substring(0, index);
|
||||||
// qw.like("s.orgSidPath", orgSidPath);
|
qw.like("s.orgSidPath", orgSidPath);
|
||||||
// } else if ("2".equals(orgLevelKey)) {
|
} else if ("2".equals(orgLevelKey)) {
|
||||||
// orgSidPath = orgSidPath.substring(0, index);
|
orgSidPath = orgSidPath.substring(0, index);
|
||||||
// qw.like("s.orgSidPath", orgSidPath);
|
qw.like("s.orgSidPath", orgSidPath);
|
||||||
// } else if ("3".equals(orgLevelKey)) {
|
} else if ("3".equals(orgLevelKey)) {
|
||||||
// orgSidPath = orgSidPath.substring(0, index);
|
orgSidPath = orgSidPath.substring(0, index);
|
||||||
// qw.apply("s.orgSidPath like('"+orgSidPath+"')");
|
qw.apply("s.orgSidPath like('"+orgSidPath+"')");
|
||||||
// } else if ("4".equals(orgLevelKey)) {
|
} else if ("4".equals(orgLevelKey)) {
|
||||||
// qw.eq("a.createBySid", query.getUserSid());
|
qw.eq("a.createBySid", query.getUserSid());
|
||||||
// } else {
|
} else {
|
||||||
// PagerVo<WarehouseInfoVo> p = new PagerVo<>();
|
PagerVo<WarehouseInfoVo> p = new PagerVo<>();
|
||||||
// return rb.success().setData(p);
|
return rb.success().setData(p);
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// PagerVo<WarehouseInfoVo> p = new PagerVo<>();
|
PagerVo<WarehouseInfoVo> p = new PagerVo<>();
|
||||||
// return rb.success().setData(p);
|
return rb.success().setData(p);
|
||||||
// }
|
}
|
||||||
qw.apply(StringUtils.isNotBlank(query.getStart()), "count >= " + query.getStart() ) .
|
|
||||||
apply(StringUtils.isNotBlank(query.getEnd()), "count<= " + query.getEnd()
|
|
||||||
);
|
|
||||||
if (StringUtils.isNotBlank(query.getBrandSid())) {
|
if (StringUtils.isNotBlank(query.getBrandSid())) {
|
||||||
qw.like("a.areaName", query.getBrandSid());
|
qw.like("a.brandSid", query.getBrandSid());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(query.getWarehouseSid())) {
|
if (StringUtils.isNotBlank(query.getWarehouseSid())) {
|
||||||
qw.like("a.areaCode", query.getWarehouseSid());
|
qw.like("b.warehouseSid", query.getWarehouseSid());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(query.getGoodsSkuSid())) {
|
if (StringUtils.isNotBlank(query.getGoodsSkuSid())) {
|
||||||
qw.eq("b.sid", query.getGoodsSkuSid());
|
qw.eq("a.goodsSkuSid", query.getGoodsSkuSid());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(query.getTypeSid())) {
|
if (StringUtils.isNotBlank(query.getTypeSid())) {
|
||||||
qw.eq("c.sid", query.getTypeSid());
|
qw.eq("c.typeSid", query.getTypeSid());
|
||||||
}
|
}
|
||||||
|
qw.apply(StringUtils.isNotBlank(query.getStart()), "a.count >= " + query.getStart() ).
|
||||||
|
apply(StringUtils.isNotBlank(query.getEnd()), "a.count <= " + query.getEnd()
|
||||||
|
);
|
||||||
qw.ne("a.isDelete", "1");
|
qw.ne("a.isDelete", "1");
|
||||||
qw.ne("state","3");
|
qw.ne("a.state","3");
|
||||||
IPage<InventoryAdjustmentDetail> page = PagerUtil.queryToPage(pq);
|
IPage<InventoryAdjustmentDetail> page = PagerUtil.queryToPage(pq);
|
||||||
IPage<InventoryAdjustmentDetailVo> pagging = baseMapper.listPage(page, qw);
|
IPage<InventoryAdjustmentDetailVo> pagging = baseMapper.listPage(page, qw);
|
||||||
|
for (InventoryAdjustmentDetailVo record : pagging.getRecords()) {
|
||||||
|
WarehouseInventoryVo vo=warehouseInventoryService.selInventoryByRackSid(record.getRackSid());
|
||||||
|
record.setUseCount(vo.getUseCount());
|
||||||
|
}
|
||||||
PagerVo<InventoryAdjustmentDetailVo> p = PagerUtil.pageToVo(pagging, null);
|
PagerVo<InventoryAdjustmentDetailVo> p = PagerUtil.pageToVo(pagging, null);
|
||||||
return rb.success().setData(p);
|
return rb.success().setData(p);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||||||
import com.yxt.common.core.vo.Vo;
|
import com.yxt.common.core.vo.Vo;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,5 +40,10 @@ public class InventoryAdjustmentDetailVo implements Vo {
|
|||||||
private String goodsSkuOwnSpec;//商品规格
|
private String goodsSkuOwnSpec;//商品规格
|
||||||
private String count;
|
private String count;
|
||||||
private String unit;
|
private String unit;
|
||||||
|
private BigDecimal useCount;
|
||||||
|
private String brandSid;
|
||||||
|
private String brandName;
|
||||||
|
private String typeSid;
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ public class AvailableCountVo {
|
|||||||
private String locationSid;//分配明细sid
|
private String locationSid;//分配明细sid
|
||||||
private String goodsSkuSid;
|
private String goodsSkuSid;
|
||||||
private String goodsSpuName;
|
private String goodsSpuName;
|
||||||
|
private String goodsSpuSid;
|
||||||
private String goodsSkuTitle;
|
private String goodsSkuTitle;
|
||||||
private String goodsSkuOwnSpec;
|
private String goodsSkuOwnSpec;
|
||||||
|
private String goodsSkuCode;
|
||||||
private String warehouseName;
|
private String warehouseName;
|
||||||
private String warehouseSid;
|
private String warehouseSid;
|
||||||
private String areaName;
|
private String areaName;
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ public interface WarehouseInventoryMapper extends BaseMapper<WarehouseInventory>
|
|||||||
|
|
||||||
GoodsCountVo selCountsBySkuSid(@Param("skuSid") String skuSid);
|
GoodsCountVo selCountsBySkuSid(@Param("skuSid") String skuSid);
|
||||||
List<AvailableCountVo> selAvailableBySkuSid(@Param("skuSid") String skuSid,@Param("orgSid") String orgSid);
|
List<AvailableCountVo> selAvailableBySkuSid(@Param("skuSid") String skuSid,@Param("orgSid") String orgSid);
|
||||||
|
List<AvailableCountVo> selAvailableBySkuSid1(@Param("skuSid") String skuSid,@Param("rackSid")String rackSid,@Param("orgSid") String orgSid);
|
||||||
String selectNum(String billNo);
|
String selectNum(String billNo);
|
||||||
List<WarehouseInventoryHistory> totalInventoryByOrgSid(@Param("orgSid") String orgSid);
|
List<WarehouseInventoryHistory> totalInventoryByOrgSid(@Param("orgSid") String orgSid);
|
||||||
|
WarehouseInventoryVo selInventoryByRackSid(@Param("rackSid") String rackSid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,11 @@
|
|||||||
d.sid as warehouseAreaSid,
|
d.sid as warehouseAreaSid,
|
||||||
b.rackCode as warehouseRackCode,
|
b.rackCode as warehouseRackCode,
|
||||||
b.sid as warehouseRackSid,
|
b.sid as warehouseRackSid,
|
||||||
b.rackName as warehouseRackName
|
b.rackName as warehouseRackName,
|
||||||
|
a.goodsBrandSid as brandSid,
|
||||||
|
a.goodsBrandName as brandName,
|
||||||
|
a.goodsTypeSid as typeSid,
|
||||||
|
a.goodsTypeName as typeName
|
||||||
from warehouse_inventory a
|
from warehouse_inventory a
|
||||||
left join warehouse_rack b on b.sid =a.warehouseRackSid
|
left join warehouse_rack b on b.sid =a.warehouseRackSid
|
||||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||||
@@ -446,7 +450,7 @@
|
|||||||
b.rackName,
|
b.rackName,
|
||||||
b.sid as rackSid,
|
b.sid as rackSid,
|
||||||
b.rackCode,
|
b.rackCode,
|
||||||
sum(a.count) - sum(a.allocateCount) AS useCount,
|
a.count AS useCount,
|
||||||
a.goodsSpuName,
|
a.goodsSpuName,
|
||||||
a.goodsSkuTitle,
|
a.goodsSkuTitle,
|
||||||
a.goodsSkuOwnSpec
|
a.goodsSkuOwnSpec
|
||||||
@@ -457,7 +461,29 @@
|
|||||||
WHERE
|
WHERE
|
||||||
a.goodsSkuSid = #{skuSid} and
|
a.goodsSkuSid = #{skuSid} and
|
||||||
a.useOrgSid=#{orgSid}
|
a.useOrgSid=#{orgSid}
|
||||||
GROUP BY rackSid
|
</select>
|
||||||
|
<select id="selAvailableBySkuSid1" resultType="com.yxt.warehouse.biz.warehouseinventory.AvailableCountVo">
|
||||||
|
SELECT
|
||||||
|
a.sid as inventorySid,
|
||||||
|
a.warehouseName,
|
||||||
|
a.warehouseSid,
|
||||||
|
c.areaName,
|
||||||
|
b.rackName,
|
||||||
|
b.sid as rackSid,
|
||||||
|
b.rackCode,
|
||||||
|
a.count useCount,
|
||||||
|
a.goodsSpuName,
|
||||||
|
a.goodsSkuTitle,
|
||||||
|
a.goodsSkuOwnSpec,
|
||||||
|
a.goodsSkuCode,
|
||||||
|
a.goodsSpuSid
|
||||||
|
FROM
|
||||||
|
warehouse_inventory a
|
||||||
|
LEFT JOIN warehouse_rack b ON a.warehouseRackSid = b.sid
|
||||||
|
LEFT JOIN warehouse_area c ON c.sid = b.locationSid
|
||||||
|
WHERE
|
||||||
|
a.goodsSkuSid = #{skuSid} and
|
||||||
|
a.useOrgSid=#{orgSid} and a.warehouseRackSid=#{rackSid}
|
||||||
</select>
|
</select>
|
||||||
<select id="getRackCountBySid" resultType="com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryRackVo">
|
<select id="getRackCountBySid" resultType="com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryRackVo">
|
||||||
SELECT
|
SELECT
|
||||||
@@ -527,4 +553,13 @@
|
|||||||
warehouse_inventory
|
warehouse_inventory
|
||||||
WHERE useOrgSid=#{orgSid}
|
WHERE useOrgSid=#{orgSid}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selInventoryByRackSid"
|
||||||
|
resultType="com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryVo">
|
||||||
|
SELECT
|
||||||
|
sum(count)-sum(allocateCount) as useCount
|
||||||
|
FROM
|
||||||
|
warehouse_inventory
|
||||||
|
WHERE warehouseRackSid=#{rackSid}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ public class WarehouseInventoryQuery implements Query {
|
|||||||
private String countStart;
|
private String countStart;
|
||||||
private String countEnd;
|
private String countEnd;
|
||||||
private String ifWarning; //0 未设置 1 设置
|
private String ifWarning; //0 未设置 1 设置
|
||||||
|
private String goodsSkuSid; //0 未设置 1 设置
|
||||||
|
private String orgSid; //0 未设置 1 设置
|
||||||
|
private String rackSid; //0 未设置 1 设置
|
||||||
|
|
||||||
@ApiModelProperty("条码")
|
@ApiModelProperty("条码")
|
||||||
private String barCode;
|
private String barCode;
|
||||||
|
|||||||
@@ -627,6 +627,9 @@ public class WarehouseInventoryService extends MybatisBaseService<WarehouseInven
|
|||||||
public List<AvailableCountVo> selAvailableBySkuSid(String skuSid,String orgSid) {
|
public List<AvailableCountVo> selAvailableBySkuSid(String skuSid,String orgSid) {
|
||||||
return baseMapper.selAvailableBySkuSid(skuSid,orgSid);
|
return baseMapper.selAvailableBySkuSid(skuSid,orgSid);
|
||||||
}
|
}
|
||||||
|
public List<AvailableCountVo> selAvailableBySkuSid1(String skuSid,String rackSid,String orgSid) {
|
||||||
|
return baseMapper.selAvailableBySkuSid1(skuSid,rackSid,orgSid);
|
||||||
|
}
|
||||||
public String selectNum(String billNo){
|
public String selectNum(String billNo){
|
||||||
return baseMapper.selectNum(billNo);
|
return baseMapper.selectNum(billNo);
|
||||||
}
|
}
|
||||||
@@ -635,4 +638,9 @@ public class WarehouseInventoryService extends MybatisBaseService<WarehouseInven
|
|||||||
List<WarehouseInventoryHistory> vo=baseMapper.totalInventoryByOrgSid(orgSid);
|
List<WarehouseInventoryHistory> vo=baseMapper.totalInventoryByOrgSid(orgSid);
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
public WarehouseInventoryVo selInventoryByRackSid(String orgSid){
|
||||||
|
WarehouseInventoryVo vo=baseMapper.selInventoryByRackSid(orgSid);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,9 @@ public class WarehouseInventoryVo implements Vo {
|
|||||||
@ApiModelProperty("序列号")
|
@ApiModelProperty("序列号")
|
||||||
private String serialNumber;
|
private String serialNumber;
|
||||||
private String brandName;
|
private String brandName;
|
||||||
|
private String brandSid;
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
private String typeSid;
|
||||||
private String alertUpperLimit;//上限
|
private String alertUpperLimit;//上限
|
||||||
private String warningLowerLimit;//下限
|
private String warningLowerLimit;//下限
|
||||||
private List<WarehouseInventoryVo> children=new ArrayList<>();
|
private List<WarehouseInventoryVo> children=new ArrayList<>();
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ public class WarehouseOutLocationService extends MybatisBaseService<WarehouseOut
|
|||||||
for (WarehouseOutLocationDto dto : dtos) {
|
for (WarehouseOutLocationDto dto : dtos) {
|
||||||
WarehouseInventory warehouseInventory = warehouseInventoryService.getOne(new QueryWrapper<WarehouseInventory>().eq("sid", dto.getInventorySid()));
|
WarehouseInventory warehouseInventory = warehouseInventoryService.getOne(new QueryWrapper<WarehouseInventory>().eq("sid", dto.getInventorySid()));
|
||||||
int b=dto.getCount().compareTo(new BigDecimal(0));
|
int b=dto.getCount().compareTo(new BigDecimal(0));
|
||||||
|
BigDecimal c=warehouseInventory.getCount().subtract(warehouseInventory.getAllocateCount());
|
||||||
|
if(c.compareTo(dto.getCount())==-1){
|
||||||
|
return rb.setMsg("分配量不能大于可用数");
|
||||||
|
}
|
||||||
if(b==0){
|
if(b==0){
|
||||||
WarehouseOutLocation w=baseMapper.selectOne(new QueryWrapper<WarehouseOutLocation>().eq("sid",dto.getSid()));
|
WarehouseOutLocation w=baseMapper.selectOne(new QueryWrapper<WarehouseOutLocation>().eq("sid",dto.getSid()));
|
||||||
if(null!=w){
|
if(null!=w){
|
||||||
|
|||||||
Reference in New Issue
Block a user