Browse Source

完善问题

master
djz236@163.com 2 years ago
parent
commit
97853696b5
  1. 1
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Location.java
  2. 9
      warehousing-system/project/wh-common/src/main/java/com/wh/pojo/api/InStoreHouseMainDto.java
  3. 13
      warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java
  4. 29
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java
  5. 2
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationService.java
  6. 5
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java
  7. 31
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/purchasenew/PurchasenewService.java
  8. 3
      warehousing-system/project/wh-manage/src/main/java/com/wh/service/shstorehouse/ShStorehouseService.java
  9. 2
      warehousing-system/project/wh-manage/src/main/resources/logback-spring.xml
  10. 8
      warehousing-system/project/wh-manage/src/main/resources/mappers/PurchasenewMapper.xml
  11. 5
      warehousing-system/project_web_ui/src/views/component/initial_value/add/locationAdd.vue
  12. 28
      warehousing-system/project_web_ui/src/views/component/instorehouse/add/purchaseAdd.vue

1
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/Location.java

@ -18,4 +18,5 @@ public class Location {
private String type; //货位类型
private String status; //货位状态
private String storehouse; //所属仓库
private String storehouseid;
}

9
warehousing-system/project/wh-common/src/main/java/com/wh/pojo/api/InStoreHouseMainDto.java

@ -24,6 +24,15 @@ public class InStoreHouseMainDto {
private String approvedRemark; // varchar 50
private List<InStorehouseListing> list;
private String purchaseSid;//采购申请单的sid
private String locationId;
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public String getNo() {
return no;

13
warehousing-system/project/wh-manage/src/main/java/com/wh/controller/initial/LocationController.java

@ -3,9 +3,12 @@ package com.wh.controller.initial;
import com.wh.pojo.Location;
import com.wh.pojo.LocationType;
import com.wh.pojo.Storehouse;
import com.wh.pojo.shstorehouse.ShStorehouse;
import com.wh.service.initial.LocationService;
import com.wh.service.shstorehouse.ShStorehouseService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -18,6 +21,8 @@ public class LocationController {
@Autowired
private LocationService locationService;
@Autowired
private ShStorehouseService shStorehouseService;
@GetMapping("list")
public SysResult getLocationList(PageResult pageResult){
@ -27,6 +32,14 @@ public class LocationController {
@PostMapping("addLocation")
public SysResult addLocation(@RequestBody Location location){
if(StringUtils.isBlank(location.getStorehouseid())){
return SysResult.fail();
}
ShStorehouse shStorehouse = shStorehouseService.fetchBySid(location.getStorehouseid());
if(shStorehouse==null){
return SysResult.fail();
}
location.setStorehouse(shStorehouse.getName());
locationService.addLocation(location);
return SysResult.success();
}

29
warehousing-system/project/wh-manage/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java

@ -20,6 +20,7 @@ import com.wh.pojo.purchasenewproduct.PurchasenewProduct;
import com.wh.pojo.purchasenewproduct.PurchasenewProductDto;
import com.wh.pojo.purchasenewproduct.PurchasenewProductVo;
import com.wh.service.api.prodstock.ProdStockService;
import com.wh.service.initial.LocationService;
import com.wh.service.purchasenew.PurchasenewService;
import com.wh.service.purchasenewproduct.PurchasenewProductService;
import com.yxt.common.base.service.MybatisBaseService;
@ -35,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Positive;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -49,6 +51,8 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
@Autowired
private ProdStockService prodStockService;
@Autowired
private LocationService locationService;
@Autowired
private LocationMapper locationMapper;
@Autowired
private PurchasenewService purchasenewService;
@ -64,7 +68,10 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
if(StringUtils.isBlank(inStoreHouseMainDto.getNo())){
return r.setMsg("申请单编号不能为空");
}
if(StringUtils.isBlank(inStoreHouseMainDto.getLocationId())){
return r.setMsg("货位不能为空");
}
Location location = locationService.getLocationById(inStoreHouseMainDto.getLocationId());
QueryWrapper<Purchasenew> purchasenewWrapper = new QueryWrapper<>();
purchasenewWrapper.eq("purchase_no",inStoreHouseMainDto.getNo());
List<Purchasenew> list1 = purchasenewService.list(purchasenewWrapper);
@ -87,6 +94,9 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
for (PurchasenewProductVo purchasenewProductVo : purchasenewProductVos) {
PurchasenewProductDto d=new PurchasenewProductDto();
BeanUtil.copyProperties(purchasenewProductVo,d);
d.setStoreHouseName(location.getStorehouse());
d.setStoreHouseSid(location.getStorehouseid());
d.setLocationNumber(location.getName());
products.add(d);
}
dto.setProducts(products);
@ -113,7 +123,7 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
//申请单主表信息
baseMapper.insert(in);
addListing(in, list);
purchasenewService.updateStateToInputBySid(in.getPurchaseSid());
//purchasenewService.updateStateToInputBySid(in.getPurchaseSid());
return ResultBean.fireSuccess().setMsg("添加成功");
}
@ -192,8 +202,12 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
if(com.yxt.common.base.utils.StringUtils.isBlank(num)){
// log.info("{}",l.getProName()+"商品数量不能为空");
}
int i=Integer.valueOf(num)+Integer.valueOf(l.getNum());
prodStock.setNum(i+"");
BigDecimal i=new BigDecimal(num).add(new BigDecimal(l.getNum()));
prodStock.setNum(l.getNum());
prodStock.setStoreHouseName(l.getStoreHouseName());
prodStock.setStoreHouseSid(l.getStoreHouseSid());
// TODO 当系统调试通后需要做修改 将下一行代码注释去掉
// prodStock.setNum(i.toString());
prodStockService.updateById(prodStock);
}
@ -238,6 +252,7 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
stockQuery.setProModel(l.getProModel());
stockQuery.setProName(l.getProName());
stockQuery.setProSid(l.getProSid());
stockQuery.setStoreHouseSid(l.getStoreHouseSid());
pq.setParams(stockQuery);
PagerVo<ProdStock> proStocks = prodStockService.getProStocks(pq);
return proStocks;
@ -323,9 +338,9 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
public ResultBean deleteByMainSid(String sid){
ResultBean<Object> r = ResultBean.fireFail();
List<InStorehouseListing> inStorehouseListings = inStorehouseListingService.selectInStorehouseListingsByMainSid(sid);
inStorehouseListings.forEach(i->{
prodStockService.reduceNumByProdSidAndCustSid(i.getProSid(), i.getCusterSid(),i.getNum());
});
// inStorehouseListings.forEach(i->{
// prodStockService.reduceNumByProdSidAndCustSid(i.getProSid(), i.getCusterSid(),i.getNum());
// });
inStorehouseListingService.deleteByMainSid(sid);
Map<String,Object> params=new HashMap<>();
params.put("sid",sid);

2
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationService.java

@ -15,7 +15,7 @@ public interface LocationService {
void updataLocation(Location location);
void deleteLocation(String name);
Location getLocationById(String id);
List<Storehouse> getStorehouse();
List<LocationType> getType();

5
warehousing-system/project/wh-manage/src/main/java/com/wh/service/initial/LocationServiceImpl.java

@ -54,6 +54,11 @@ public class LocationServiceImpl implements LocationService{
locationMapper.deleteById(name);
}
@Override
public Location getLocationById(String id) {
return locationMapper.selectById(id);
}
@Override
public List<Storehouse> getStorehouse() {
return storehouseMapper.selectList(null);

31
warehousing-system/project/wh-manage/src/main/java/com/wh/service/purchasenew/PurchasenewService.java

@ -5,12 +5,15 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.wh.feign.enterpriseinformation.WhEnterpriseInformationFeign;
import com.wh.feign.enterpriseinformation.WhEnterpriseInformationVo;
import com.wh.mapper.purchasenew.PurchasenewMapper;
import com.wh.pojo.purchasenew.*;
import com.wh.pojo.purchasenewproduct.PurchasenewProduct;
import com.wh.pojo.purchasenewproduct.PurchasenewProductDto;
import com.wh.pojo.purchasenewproduct.PurchasenewProductVo;
import com.wh.service.api.instorehouse.InStorehouseMainService;
import com.wh.service.api.prodstock.ProdStockService;
import com.wh.service.purchasenewproduct.PurchasenewProductService;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.PagerUtil;
@ -31,7 +34,11 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
@Autowired
private PurchasenewProductService purchasenewProductService;
@Autowired
private ProdStockService prodStockService;
@Autowired
private InStorehouseMainService inStorehouseMainService;
@Autowired
private WhEnterpriseInformationFeign whEnterpriseInformationFeign;
private QueryWrapper<Purchasenew> createQueryWrapper(PurchasenewQuery query) {
// todo: 这里根据具体业务调整查询条件
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
@ -65,6 +72,16 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
@Transactional
public ResultBean saveOrUpdateDto(PurchasenewDto dto){
ResultBean rb = ResultBean.fireFail();
String custId = dto.getCustId();
ResultBean<List<WhEnterpriseInformationVo>> listResultBean = whEnterpriseInformationFeign.EnterpriseList();
List<WhEnterpriseInformationVo> data = listResultBean.getData();
data.forEach(d->{
String enterpriseName = d.getEnterpriseName();
String sid = d.getSid();
if(sid.equals(custId)){
dto.setCustName(enterpriseName);
}
});
String dtoSid = dto.getSid();
List<PurchasenewProductDto> products = dto.getProducts();
if(products.size()==0){
@ -116,8 +133,8 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
return rb.setMsg("主键信息不能为空");
}
Purchasenew entity = fetchBySid(dtoSid);
String status = entity.getStatus();
if("2".equals(status)){
int state = entity.getState();
if(2==state){
return rb.setMsg("采购订单已经入库不允许修改");
}
BeanUtil.copyProperties(dto, entity, "id", "sid");
@ -125,6 +142,7 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
//dto.setSid(entity.getSid());
purchasenewProductService.deleteByPurchaseSid(dtoSid);
addPurchasenewProduct(dto, rb, entity);
// TODO 当系统调试通后需要做修改 不能再 执行下一行代码了
return inStorehouseMainService.saveOrUpdateByPurchaseSid(dto,entity.getSid());
}
@ -135,6 +153,8 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
PurchasenewProduct pp=new PurchasenewProduct();
BeanUtil.copyProperties(p,pp,"id","sid");
pp.setMainSid(entity.getSid());
pp.setStoreHouseName(dto.getStorehouseName());
pp.setStoreHouseSid(dto.getStorehouseId());
l.add(pp);
});
boolean b = purchasenewProductService.saveBatch(l);
@ -158,11 +178,16 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
@Transactional
public int delByPurchasenewSids(String[] sids) {
for (String sid : sids) {
Purchasenew entity = fetchBySid(sid);
int state = entity.getState();
if(2==state){
continue;
}
Map<String,Object> params=new HashMap<>();
params.put("sid",sid);
baseMapper.deleteByMap(params);
purchasenewProductService.deleteByPurchaseSid(sid);
inStorehouseMainService.deleteByPurchaseSid(sid);
// inStorehouseMainService.deleteByPurchaseSid(sid);
}
return sids.length;
}

3
warehousing-system/project/wh-manage/src/main/java/com/wh/service/shstorehouse/ShStorehouseService.java

@ -84,6 +84,9 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper,
if(StringUtils.isNotBlank(query.getCusterName())){
qw.like("custerName",query.getCusterName());
}
if(StringUtils.isNotBlank(query.getName())){
qw.like("name",query.getName());
}
if(StringUtils.isNotBlank(query.getCusterSid())){
qw.eq("custerSid",query.getCusterSid());
}

2
warehousing-system/project/wh-manage/src/main/resources/logback-spring.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="log.base" value="logs/supervise-dispatchcenter" />
<property name="log.base" value="logs/supervise-warehousing" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>

8
warehousing-system/project/wh-manage/src/main/resources/mappers/PurchasenewMapper.xml

@ -4,7 +4,13 @@
<!-- <where> ${ew.sqlSegment} </where>-->
<!-- ${ew.customSqlSegment} -->
<select id="selectPageVo" resultType="com.wh.pojo.purchasenew.PurchasenewVo">
SELECT * FROM purchasenew <where> ${ew.sqlSegment} </where> order by id desc
SELECT sid, purchase_date,purchase_no,
purchase_person,purchase_person_sid,cust_id,
cust_name,supplier_name,
supplier_id, storehouse_name,
storehouse_id,
IF(state=1,'未入库','已入库') state
FROM purchasenew <where> ${ew.sqlSegment} </where> order by id desc
</select>
<select id="selectListAllVo" resultType="com.wh.pojo.purchasenew.PurchasenewVo">

5
warehousing-system/project_web_ui/src/views/component/initial_value/add/locationAdd.vue

@ -38,12 +38,12 @@
</div>
<div class="item">
<span class="item_text">所属仓库</span>
<el-select v-model="locationForm.storehouse" class="item_input" placeholder="请选择" >
<el-select v-model="locationForm.storehouseid" class="item_input" placeholder="请选择" >
<el-option
v-for="(storehouse,i) in storehouseList"
:key="i"
:label="storehouse.name"
:value="storehouse.name">
:value="storehouse.sid">
</el-option>
</el-select>
</div>
@ -209,4 +209,3 @@
}
</style>

28
warehousing-system/project_web_ui/src/views/component/instorehouse/add/purchaseAdd.vue

@ -46,12 +46,12 @@
</el-col>
<el-col :span="5">
<el-form-item prop="supplier" class="trightb_item">
<el-select v-model="purchaseForm.supplierName" placeholder="请选择" >
<el-select v-model="purchaseForm.supplierId" placeholder="请选择" >
<el-option
v-for="(supplier,i) in supplierList"
:key="i"
:label="supplier.name"
:value="supplier.name">
:value="supplier.id">
</el-option>
</el-select>
</el-form-item>
@ -76,12 +76,12 @@
</el-col>
<el-col :span="6">
<el-form-item class="trightb_item">
<el-select v-model="purchaseForm.custName" placeholder="请选择" >
<el-select v-model="purchaseForm.custId" placeholder="请选择" >
<el-option
v-for="(custName,i) in custList"
:key="i"
:label="custName.enterpriseName"
:value="custName.enterpriseName">
:value="custName.sid">
</el-option>
</el-select>
</el-form-item>
@ -94,12 +94,12 @@
</el-col>
<el-col :span="5">
<el-form-item class="trightb_item">
<el-select v-model="purchaseForm.storehouseName" placeholder="请选择" >
<el-select v-model="purchaseForm.storehouseId" placeholder="请选择" >
<el-option
v-for="(storehouse,i) in storehouseList"
:key="i"
:label="storehouse.name"
:value="storehouse.name">
:value="storehouse.sid">
</el-option>
</el-select>
</el-form-item>
@ -224,7 +224,9 @@
purchaseNo:'',
supplier: '',
storehouseName:'',
storehouseId:"",
supplierName:'',
supplierId:'',
count: '',
storehouse: '',
status: '',
@ -234,7 +236,6 @@
storehouseList: [],
productList: [],
productList2: [],
supplierList: [],
custList: [],
selectPurchaseList: [],
activeNames: ['1'],
@ -279,7 +280,9 @@
purchaseNo:'',
supplier: '',
storehouseName:'',
storehouseId:"",
supplierName:'',
supplierId:'',
count: '',
storehouse: '',
status: '',
@ -288,6 +291,16 @@
}
},
saveOrUpdate(){
this.storehouseList.forEach((v, i) => {
if(v.sid == this.purchaseForm.storehouseId){
this.purchaseForm.storehouseName = v.name
}
})
this.supplierList.forEach((v, i) => {
if(v.id == this.purchaseForm.supplierId){
this.purchaseForm.supplierName = v.name
}
})
if (this.viewTitle === "【新增】采购订单") return this.addStorehouse();
if (this.viewTitle === "【修改】采购订单") {
this.addStorehouse();
@ -465,4 +478,3 @@
}
</style>
Loading…
Cancel
Save