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. 5
      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. 423
      warehousing-system/project_web_ui/src/views/component/initial_value/add/locationAdd.vue
  12. 948
      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 type; //货位类型
private String status; //货位状态 private String status; //货位状态
private String storehouse; //所属仓库 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 String approvedRemark; // varchar 50
private List<InStorehouseListing> list; private List<InStorehouseListing> list;
private String purchaseSid;//采购申请单的sid private String purchaseSid;//采购申请单的sid
private String locationId;
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public String getNo() { public String getNo() {
return no; 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.Location;
import com.wh.pojo.LocationType; import com.wh.pojo.LocationType;
import com.wh.pojo.Storehouse; import com.wh.pojo.Storehouse;
import com.wh.pojo.shstorehouse.ShStorehouse;
import com.wh.service.initial.LocationService; import com.wh.service.initial.LocationService;
import com.wh.service.shstorehouse.ShStorehouseService;
import com.wh.vo.PageResult; import com.wh.vo.PageResult;
import com.wh.vo.SysResult; import com.wh.vo.SysResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -18,6 +21,8 @@ public class LocationController {
@Autowired @Autowired
private LocationService locationService; private LocationService locationService;
@Autowired
private ShStorehouseService shStorehouseService;
@GetMapping("list") @GetMapping("list")
public SysResult getLocationList(PageResult pageResult){ public SysResult getLocationList(PageResult pageResult){
@ -27,6 +32,14 @@ public class LocationController {
@PostMapping("addLocation") @PostMapping("addLocation")
public SysResult addLocation(@RequestBody Location location){ 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); locationService.addLocation(location);
return SysResult.success(); 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.PurchasenewProductDto;
import com.wh.pojo.purchasenewproduct.PurchasenewProductVo; import com.wh.pojo.purchasenewproduct.PurchasenewProductVo;
import com.wh.service.api.prodstock.ProdStockService; import com.wh.service.api.prodstock.ProdStockService;
import com.wh.service.initial.LocationService;
import com.wh.service.purchasenew.PurchasenewService; import com.wh.service.purchasenew.PurchasenewService;
import com.wh.service.purchasenewproduct.PurchasenewProductService; import com.wh.service.purchasenewproduct.PurchasenewProductService;
import com.yxt.common.base.service.MybatisBaseService; 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.NotBlank;
import javax.validation.constraints.Positive; import javax.validation.constraints.Positive;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -49,6 +51,8 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
@Autowired @Autowired
private ProdStockService prodStockService; private ProdStockService prodStockService;
@Autowired @Autowired
private LocationService locationService;
@Autowired
private LocationMapper locationMapper; private LocationMapper locationMapper;
@Autowired @Autowired
private PurchasenewService purchasenewService; private PurchasenewService purchasenewService;
@ -64,7 +68,10 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
if(StringUtils.isBlank(inStoreHouseMainDto.getNo())){ if(StringUtils.isBlank(inStoreHouseMainDto.getNo())){
return r.setMsg("申请单编号不能为空"); return r.setMsg("申请单编号不能为空");
} }
if(StringUtils.isBlank(inStoreHouseMainDto.getLocationId())){
return r.setMsg("货位不能为空");
}
Location location = locationService.getLocationById(inStoreHouseMainDto.getLocationId());
QueryWrapper<Purchasenew> purchasenewWrapper = new QueryWrapper<>(); QueryWrapper<Purchasenew> purchasenewWrapper = new QueryWrapper<>();
purchasenewWrapper.eq("purchase_no",inStoreHouseMainDto.getNo()); purchasenewWrapper.eq("purchase_no",inStoreHouseMainDto.getNo());
List<Purchasenew> list1 = purchasenewService.list(purchasenewWrapper); List<Purchasenew> list1 = purchasenewService.list(purchasenewWrapper);
@ -87,6 +94,9 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
for (PurchasenewProductVo purchasenewProductVo : purchasenewProductVos) { for (PurchasenewProductVo purchasenewProductVo : purchasenewProductVos) {
PurchasenewProductDto d=new PurchasenewProductDto(); PurchasenewProductDto d=new PurchasenewProductDto();
BeanUtil.copyProperties(purchasenewProductVo,d); BeanUtil.copyProperties(purchasenewProductVo,d);
d.setStoreHouseName(location.getStorehouse());
d.setStoreHouseSid(location.getStorehouseid());
d.setLocationNumber(location.getName());
products.add(d); products.add(d);
} }
dto.setProducts(products); dto.setProducts(products);
@ -113,7 +123,7 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
//申请单主表信息 //申请单主表信息
baseMapper.insert(in); baseMapper.insert(in);
addListing(in, list); addListing(in, list);
purchasenewService.updateStateToInputBySid(in.getPurchaseSid()); //purchasenewService.updateStateToInputBySid(in.getPurchaseSid());
return ResultBean.fireSuccess().setMsg("添加成功"); return ResultBean.fireSuccess().setMsg("添加成功");
} }
@ -192,8 +202,12 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
if(com.yxt.common.base.utils.StringUtils.isBlank(num)){ if(com.yxt.common.base.utils.StringUtils.isBlank(num)){
// log.info("{}",l.getProName()+"商品数量不能为空"); // log.info("{}",l.getProName()+"商品数量不能为空");
} }
int i=Integer.valueOf(num)+Integer.valueOf(l.getNum()); BigDecimal i=new BigDecimal(num).add(new BigDecimal(l.getNum()));
prodStock.setNum(i+""); prodStock.setNum(l.getNum());
prodStock.setStoreHouseName(l.getStoreHouseName());
prodStock.setStoreHouseSid(l.getStoreHouseSid());
// TODO 当系统调试通后需要做修改 将下一行代码注释去掉
// prodStock.setNum(i.toString());
prodStockService.updateById(prodStock); prodStockService.updateById(prodStock);
} }
@ -238,6 +252,7 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
stockQuery.setProModel(l.getProModel()); stockQuery.setProModel(l.getProModel());
stockQuery.setProName(l.getProName()); stockQuery.setProName(l.getProName());
stockQuery.setProSid(l.getProSid()); stockQuery.setProSid(l.getProSid());
stockQuery.setStoreHouseSid(l.getStoreHouseSid());
pq.setParams(stockQuery); pq.setParams(stockQuery);
PagerVo<ProdStock> proStocks = prodStockService.getProStocks(pq); PagerVo<ProdStock> proStocks = prodStockService.getProStocks(pq);
return proStocks; return proStocks;
@ -323,9 +338,9 @@ public class InStorehouseMainService extends MybatisBaseService<InStorehouseMai
public ResultBean deleteByMainSid(String sid){ public ResultBean deleteByMainSid(String sid){
ResultBean<Object> r = ResultBean.fireFail(); ResultBean<Object> r = ResultBean.fireFail();
List<InStorehouseListing> inStorehouseListings = inStorehouseListingService.selectInStorehouseListingsByMainSid(sid); List<InStorehouseListing> inStorehouseListings = inStorehouseListingService.selectInStorehouseListingsByMainSid(sid);
inStorehouseListings.forEach(i->{ // inStorehouseListings.forEach(i->{
prodStockService.reduceNumByProdSidAndCustSid(i.getProSid(), i.getCusterSid(),i.getNum()); // prodStockService.reduceNumByProdSidAndCustSid(i.getProSid(), i.getCusterSid(),i.getNum());
}); // });
inStorehouseListingService.deleteByMainSid(sid); inStorehouseListingService.deleteByMainSid(sid);
Map<String,Object> params=new HashMap<>(); Map<String,Object> params=new HashMap<>();
params.put("sid",sid); 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 updataLocation(Location location);
void deleteLocation(String name); void deleteLocation(String name);
Location getLocationById(String id);
List<Storehouse> getStorehouse(); List<Storehouse> getStorehouse();
List<LocationType> getType(); 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); locationMapper.deleteById(name);
} }
@Override
public Location getLocationById(String id) {
return locationMapper.selectById(id);
}
@Override @Override
public List<Storehouse> getStorehouse() { public List<Storehouse> getStorehouse() {
return storehouseMapper.selectList(null); 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; 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.mapper.purchasenew.PurchasenewMapper;
import com.wh.pojo.purchasenew.*; import com.wh.pojo.purchasenew.*;
import com.wh.pojo.purchasenewproduct.PurchasenewProduct; import com.wh.pojo.purchasenewproduct.PurchasenewProduct;
import com.wh.pojo.purchasenewproduct.PurchasenewProductDto; import com.wh.pojo.purchasenewproduct.PurchasenewProductDto;
import com.wh.pojo.purchasenewproduct.PurchasenewProductVo; import com.wh.pojo.purchasenewproduct.PurchasenewProductVo;
import com.wh.service.api.instorehouse.InStorehouseMainService; import com.wh.service.api.instorehouse.InStorehouseMainService;
import com.wh.service.api.prodstock.ProdStockService;
import com.wh.service.purchasenewproduct.PurchasenewProductService; import com.wh.service.purchasenewproduct.PurchasenewProductService;
import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.PagerUtil; import com.yxt.common.base.utils.PagerUtil;
@ -31,7 +34,11 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
@Autowired @Autowired
private PurchasenewProductService purchasenewProductService; private PurchasenewProductService purchasenewProductService;
@Autowired @Autowired
private ProdStockService prodStockService;
@Autowired
private InStorehouseMainService inStorehouseMainService; private InStorehouseMainService inStorehouseMainService;
@Autowired
private WhEnterpriseInformationFeign whEnterpriseInformationFeign;
private QueryWrapper<Purchasenew> createQueryWrapper(PurchasenewQuery query) { private QueryWrapper<Purchasenew> createQueryWrapper(PurchasenewQuery query) {
// todo: 这里根据具体业务调整查询条件 // todo: 这里根据具体业务调整查询条件
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); // 多字段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 @Transactional
public ResultBean saveOrUpdateDto(PurchasenewDto dto){ public ResultBean saveOrUpdateDto(PurchasenewDto dto){
ResultBean rb = ResultBean.fireFail(); 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(); String dtoSid = dto.getSid();
List<PurchasenewProductDto> products = dto.getProducts(); List<PurchasenewProductDto> products = dto.getProducts();
if(products.size()==0){ if(products.size()==0){
@ -116,8 +133,8 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
return rb.setMsg("主键信息不能为空"); return rb.setMsg("主键信息不能为空");
} }
Purchasenew entity = fetchBySid(dtoSid); Purchasenew entity = fetchBySid(dtoSid);
String status = entity.getStatus(); int state = entity.getState();
if("2".equals(status)){ if(2==state){
return rb.setMsg("采购订单已经入库不允许修改"); return rb.setMsg("采购订单已经入库不允许修改");
} }
BeanUtil.copyProperties(dto, entity, "id", "sid"); BeanUtil.copyProperties(dto, entity, "id", "sid");
@ -125,6 +142,7 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
//dto.setSid(entity.getSid()); //dto.setSid(entity.getSid());
purchasenewProductService.deleteByPurchaseSid(dtoSid); purchasenewProductService.deleteByPurchaseSid(dtoSid);
addPurchasenewProduct(dto, rb, entity); addPurchasenewProduct(dto, rb, entity);
// TODO 当系统调试通后需要做修改 不能再 执行下一行代码了
return inStorehouseMainService.saveOrUpdateByPurchaseSid(dto,entity.getSid()); return inStorehouseMainService.saveOrUpdateByPurchaseSid(dto,entity.getSid());
} }
@ -135,6 +153,8 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
PurchasenewProduct pp=new PurchasenewProduct(); PurchasenewProduct pp=new PurchasenewProduct();
BeanUtil.copyProperties(p,pp,"id","sid"); BeanUtil.copyProperties(p,pp,"id","sid");
pp.setMainSid(entity.getSid()); pp.setMainSid(entity.getSid());
pp.setStoreHouseName(dto.getStorehouseName());
pp.setStoreHouseSid(dto.getStorehouseId());
l.add(pp); l.add(pp);
}); });
boolean b = purchasenewProductService.saveBatch(l); boolean b = purchasenewProductService.saveBatch(l);
@ -158,11 +178,16 @@ public class PurchasenewService extends MybatisBaseService<PurchasenewMapper, Pu
@Transactional @Transactional
public int delByPurchasenewSids(String[] sids) { public int delByPurchasenewSids(String[] sids) {
for (String sid : sids) { for (String sid : sids) {
Purchasenew entity = fetchBySid(sid);
int state = entity.getState();
if(2==state){
continue;
}
Map<String,Object> params=new HashMap<>(); Map<String,Object> params=new HashMap<>();
params.put("sid",sid); params.put("sid",sid);
baseMapper.deleteByMap(params); baseMapper.deleteByMap(params);
purchasenewProductService.deleteByPurchaseSid(sid); purchasenewProductService.deleteByPurchaseSid(sid);
inStorehouseMainService.deleteByPurchaseSid(sid); // inStorehouseMainService.deleteByPurchaseSid(sid);
} }
return sids.length; return sids.length;
} }

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

@ -82,7 +82,10 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper,
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); // 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
QueryWrapper<ShStorehouse> qw = new QueryWrapper<>(); QueryWrapper<ShStorehouse> qw = new QueryWrapper<>();
if(StringUtils.isNotBlank(query.getCusterName())){ if(StringUtils.isNotBlank(query.getCusterName())){
qw.like("custerName",query.getCusterName()); qw.like("custerName",query.getCusterName());
}
if(StringUtils.isNotBlank(query.getName())){
qw.like("name",query.getName());
} }
if(StringUtils.isNotBlank(query.getCusterSid())){ if(StringUtils.isNotBlank(query.getCusterSid())){
qw.eq("custerSid",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"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <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"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>

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

@ -4,7 +4,13 @@
<!-- <where> ${ew.sqlSegment} </where>--> <!-- <where> ${ew.sqlSegment} </where>-->
<!-- ${ew.customSqlSegment} --> <!-- ${ew.customSqlSegment} -->
<select id="selectPageVo" resultType="com.wh.pojo.purchasenew.PurchasenewVo"> <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>
<select id="selectListAllVo" resultType="com.wh.pojo.purchasenew.PurchasenewVo"> <select id="selectListAllVo" resultType="com.wh.pojo.purchasenew.PurchasenewVo">

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

@ -1,212 +1,211 @@
<template> <template>
<div> <div>
<div class="tab-header webtop"> <div class="tab-header webtop">
<!-- 标题 --> <!-- 标题 -->
<div>{{ viewTitle }}</div> <div>{{ viewTitle }}</div>
<!-- start 添加修改按钮 --> <!-- start 添加修改按钮 -->
<div> <div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button> <el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> <el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div> </div>
<!-- end 添加修改按钮 --> <!-- end 添加修改按钮 -->
<!-- end 详情按钮 --> <!-- end 详情按钮 -->
</div> </div>
<div class="listconadd"> <div class="listconadd">
<el-card class="box-card"> <el-card class="box-card">
<div class="item"> <div class="item">
<span class="item_text">货位名称</span> <span class="item_text">货位名称</span>
<el-input v-model="locationForm.name" placeholder="" class="item_input" clearable /> <el-input v-model="locationForm.name" placeholder="" class="item_input" clearable />
</div> </div>
<div class="item"> <div class="item">
<span class="item_text">货位编号</span> <span class="item_text">货位编号</span>
<el-input v-model="locationForm.locationId" placeholder="" class="item_input" clearable /> <el-input v-model="locationForm.locationId" placeholder="" class="item_input" clearable />
</div> </div>
<div class="item"> <div class="item">
<span class="item_text">货位类型</span> <span class="item_text">货位类型</span>
<el-select v-model="locationForm.type" class="item_input" placeholder="请选择" > <el-select v-model="locationForm.type" class="item_input" placeholder="请选择" >
<el-option <el-option
v-for="(type,i) in typeList" v-for="(type,i) in typeList"
:key="i" :key="i"
:label="type.type" :label="type.type"
:value="type.type" :value="type.type"
> >
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
<div class="item"> <div class="item">
<span class="item_text">所属仓库</span> <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 <el-option
v-for="(storehouse,i) in storehouseList" v-for="(storehouse,i) in storehouseList"
:key="i" :key="i"
:label="storehouse.name" :label="storehouse.name"
:value="storehouse.name"> :value="storehouse.sid">
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
</el-card> </el-card>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
submitdisabled: false, submitdisabled: false,
locationForm: { locationForm: {
name: "", name: "",
locationId: "", locationId: "",
type: "", type: "",
status: "", status: "",
storehouse: "" storehouse: ""
}, },
viewTitle: "【新增】仓库信息", viewTitle: "【新增】仓库信息",
storehouseList: [], storehouseList: [],
typeList: [], typeList: [],
queryInfo: { queryInfo: {
total: 0, total: 0,
size: 10, size: 10,
current: 1, current: 1,
params: { params: {
simpleName:'' simpleName:''
}, },
}, },
} }
}, },
created() { created() {
this.getStorehouse() this.getStorehouse()
this.geType() this.geType()
}, },
methods: { methods: {
saveOrUpdate() { saveOrUpdate() {
if (this.viewTitle === "【新增】仓库信息") return this.addLocation() if (this.viewTitle === "【新增】仓库信息") return this.addLocation()
if (this.viewTitle === "【修改】仓库信息") { if (this.viewTitle === "【修改】仓库信息") {
this.updataLocation() this.updataLocation()
} }
}, },
handleReturn(isreload) { handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist') if (isreload === 'true') this.$emit('reloadlist')
this.clearList() this.clearList()
this.$emit('doback') this.$emit('doback')
}, },
showAdd() { showAdd() {
this.viewTitle = "【新增】仓库信息"; this.viewTitle = "【新增】仓库信息";
this.clearList() this.clearList()
}, },
clearList(){ clearList(){
this.locationForm = { this.locationForm = {
name: "", name: "",
number: "", number: "",
code: "", code: "",
tankNumber:"", tankNumber:"",
tankSid:"", tankSid:"",
} }
}, },
async getStorehouse () { async getStorehouse () {
const { data: result } = await this.$http.get('/v1/shstorehouse/listAll') const { data: result } = await this.$http.get('/v1/shstorehouse/listAll')
if (result.code == 200){ if (result.code == 200){
this.storehouseList = result.data this.storehouseList = result.data
} }
// const { data: result } = await this.$http.post( // const { data: result } = await this.$http.post(
// "/v1/shstorehouse/listPage", // "/v1/shstorehouse/listPage",
// { params: this.queryInfo } // { params: this.queryInfo }
// ); // );
// if (result.code == 200) this.total = result.data.total; // if (result.code == 200) this.total = result.data.total;
// this.storehouseList = result.data.records; // this.storehouseList = result.data.records;
}, },
async geType () { async geType () {
const { data: result } = await this.$http.get('/location/getType') const { data: result } = await this.$http.get('/location/getType')
if (result.status !== 200) return this.$message.error('获取类型列表失败') if (result.status !== 200) return this.$message.error('获取类型列表失败')
this.typeList = result.data this.typeList = result.data
}, },
showEdit(row) { showEdit(row) {
this.viewTitle = "【修改】仓库信息"; this.viewTitle = "【修改】仓库信息";
this.locationForm=row this.locationForm=row
}, },
async addLocation () { async addLocation () {
this.locationForm.status = '空闲' this.locationForm.status = '空闲'
const { data: result } = await this.$http.post('/location/addLocation', this.locationForm) const { data: result } = await this.$http.post('/location/addLocation', this.locationForm)
if (result.status !== 200) return this.$message.error('添加货位失败') if (result.status !== 200) return this.$message.error('添加货位失败')
this.$message.success('成功添加货位') this.$message.success('成功添加货位')
this.handleReturn('true') this.handleReturn('true')
}, },
async updataLocation () { async updataLocation () {
const { data: result } = await this.$http.put('/location/updataLocation', this.locationForm) const { data: result } = await this.$http.put('/location/updataLocation', this.locationForm)
if (result.status !== 200) return this.$message.error('修改货位失败') if (result.status !== 200) return this.$message.error('修改货位失败')
this.$message.success('更新成功') this.$message.success('更新成功')
this.handleReturn('true') this.handleReturn('true')
}, },
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.box-card { .box-card {
margin-left: 60px; margin-left: 60px;
margin-right: 60px; margin-right: 60px;
min-width: 70%; min-width: 70%;
margin-top: 20px; margin-top: 20px;
.item { .item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
margin-top: 15px; margin-top: 15px;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
.item_text { .item_text {
flex: 0.8; flex: 0.8;
font-size: 18px; font-size: 18px;
text-align: right; text-align: right;
} }
.item_input { .item_input {
flex: 4; flex: 4;
font-size: 16px; font-size: 16px;
margin-left: 10px; margin-left: 10px;
margin-right: 80px; margin-right: 80px;
} }
.item_left_input { .item_left_input {
width: 20%; width: 20%;
} }
.item_left_text { .item_left_text {
height: 30px; height: 30px;
margin-left: 20px; margin-left: 20px;
line-height: 30px; line-height: 30px;
color: #018AD2; color: #018AD2;
padding: 0px 15px; padding: 0px 15px;
border: 1.5px solid #018AD2; border: 1.5px solid #018AD2;
border-radius: 5px; border-radius: 5px;
} }
.item_right { .item_right {
flex: 1; flex: 1;
justify-items: center; justify-items: center;
.item_right_list_text { .item_right_list_text {
font-size: 16px; font-size: 16px;
} }
.item_right_list_delect { .item_right_list_delect {
color: #5E94FF; color: #5E94FF;
margin-left: 20px; margin-left: 20px;
font-size: 16px; font-size: 16px;
text-decoration: underline; text-decoration: underline;
} }
} }
} }
} }
</style> </style>

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

@ -1,468 +1,480 @@
<template> <template>
<div> <div>
<div class="tab-header webtop"> <div class="tab-header webtop">
<div>{{ viewTitle }}</div> <div>{{ viewTitle }}</div>
<div> <div>
<el-button type="primary" size="small" @click="saveOrUpdate" <el-button type="primary" size="small" @click="saveOrUpdate"
>保存</el-button >保存</el-button
> >
<el-button type="info" size="small" @click="handleReturn()" <el-button type="info" size="small" @click="handleReturn()"
>返回</el-button >返回</el-button
> >
</div> </div>
</div> </div>
<div class="listconadd"> <div class="listconadd">
<el-form ref="dataForm" :model="purchaseForm" label-position="top" label-width="190px" class="formadd"> <el-form ref="dataForm" :model="purchaseForm" label-position="top" label-width="190px" class="formadd">
<div class="title" style="display: flex;align-items: center;justify-content: space-between;height:40px"> <div class="title" style="display: flex;align-items: center;justify-content: space-between;height:40px">
<div style="margin-left: 15px;">主体信息</div> <div style="margin-left: 15px;">主体信息</div>
</div> </div>
<el-row> <el-row>
<el-col :span="3" class="trightb"> <el-col :span="3" class="trightb">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<span slot="label">订单日期</span> <span slot="label">订单日期</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<!-- <span>{{temp.bankName}}</span> --> <!-- <span>{{temp.bankName}}</span> -->
<el-date-picker v-model="purchaseForm.purchaseDate" type="date" style="width: 100%;" <el-date-picker v-model="purchaseForm.purchaseDate" type="date" style="width: 100%;"
format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="请选择" /> format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="请选择" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3" class="trightb"> <el-col :span="3" class="trightb">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<span slot="label">订单编号</span> <span slot="label">订单编号</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item class="trightb_item" prop="purchaseNo"> <el-form-item class="trightb_item" prop="purchaseNo">
<el-input :disabled="true" v-model="purchaseForm.purchaseNo"></el-input> <el-input :disabled="true" v-model="purchaseForm.purchaseNo"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3" class="trightb"> <el-col :span="3" class="trightb">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<span slot="label">供货商名称</span> <span slot="label">供货商名称</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item prop="supplier" class="trightb_item"> <el-form-item prop="supplier" class="trightb_item">
<el-select v-model="purchaseForm.supplierName" placeholder="请选择" > <el-select v-model="purchaseForm.supplierId" placeholder="请选择" >
<el-option <el-option
v-for="(supplier,i) in supplierList" v-for="(supplier,i) in supplierList"
:key="i" :key="i"
:label="supplier.name" :label="supplier.name"
:value="supplier.name"> :value="supplier.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="3" class="trightb"> <el-col :span="3" class="trightb">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<span slot="label">采购申请人</span> <span slot="label">采购申请人</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<el-input v-model="purchaseForm.purchasePerson" placeholder="采购申请人" clearable /> <el-input v-model="purchaseForm.purchasePerson" placeholder="采购申请人" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3" class="trightb"> <el-col :span="3" class="trightb">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<span slot="label">客户名称</span> <span slot="label">客户名称</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<el-select v-model="purchaseForm.custName" placeholder="请选择" > <el-select v-model="purchaseForm.custId" placeholder="请选择" >
<el-option <el-option
v-for="(custName,i) in custList" v-for="(custName,i) in custList"
:key="i" :key="i"
:label="custName.enterpriseName" :label="custName.enterpriseName"
:value="custName.enterpriseName"> :value="custName.sid">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3" class="trightb"> <el-col :span="3" class="trightb">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<span slot="label">仓库名称</span> <span slot="label">仓库名称</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item class="trightb_item"> <el-form-item class="trightb_item">
<el-select v-model="purchaseForm.storehouseName" placeholder="请选择" > <el-select v-model="purchaseForm.storehouseId" placeholder="请选择" >
<el-option <el-option
v-for="(storehouse,i) in storehouseList" v-for="(storehouse,i) in storehouseList"
:key="i" :key="i"
:label="storehouse.name" :label="storehouse.name"
:value="storehouse.name"> :value="storehouse.sid">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-collapse v-model="activeNames"> <el-collapse v-model="activeNames">
<el-collapse-item name="1"> <el-collapse-item name="1">
<template slot="title" > <template slot="title" >
<span style="margin-left: 15px;">商品信息</span><span class="span" @click.stop="add()">添加</span> <span style="margin-left: 15px;">商品信息</span><span class="span" @click.stop="add()">添加</span>
</template> </template>
<el-table :data="purchaseForm.products" border style="width: 100%;" <el-table :data="purchaseForm.products" border style="width: 100%;"
:row-style="{height: '40px'}"> :row-style="{height: '40px'}">
<!-- <el-table-column type="selection" align="center" width="50"/> --> <!-- <el-table-column type="selection" align="center" width="50"/> -->
<el-table-column label="序号" type="index" width="60" align="center" /> <el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="商品名称" width="120" prop="proName" align="center"> <el-table-column label="商品名称" width="120" prop="proName" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.proName" placeholder="请选择" > <el-select v-model="scope.row.proName" placeholder="请选择" >
<el-option <el-option
v-for="product in productList" v-for="product in productList"
:key="product.name" :key="product.name"
:label="product.name" :label="product.name"
:value="product.name"> :value="product.name">
</el-option> </el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商品品类" width="120" prop="productTypeName" align="center"> <el-table-column label="商品品类" width="120" prop="productTypeName" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.productTypeName" placeholder="商品品类" clearable></el-input> <el-input v-model="scope.row.productTypeName" placeholder="商品品类" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商品品牌" width="120" prop="brandInfoName" align="center"> <el-table-column label="商品品牌" width="120" prop="brandInfoName" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.brandInfoName" placeholder="商品品牌" clearable></el-input> <el-input v-model="scope.row.brandInfoName" placeholder="商品品牌" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="规格(型号)" width="150" prop="proModel" align="center"> <el-table-column label="规格(型号)" width="150" prop="proModel" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.proModel" placeholder="" clearable></el-input> <el-input v-model="scope.row.proModel" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单价" width="140" prop="estimateConfirmedPrice" align="center"> <el-table-column label="单价" width="140" prop="estimateConfirmedPrice" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.estimateConfirmedPrice" @input="limitInput1($event,scope.$index)" placeholder="" clearable></el-input> <el-input v-model="scope.row.estimateConfirmedPrice" @input="limitInput1($event,scope.$index)" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量" width="140" prop="estimateNum" align="center"> <el-table-column label="数量" width="140" prop="estimateNum" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.estimateNum" @input="limitInput2($event,scope.$index)" placeholder="" clearable></el-input> <el-input v-model="scope.row.estimateNum" @input="limitInput2($event,scope.$index)" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="总价值" width="150px" prop="estimateCalculatedValue" align="center"> <el-table-column label="总价值" width="150px" prop="estimateCalculatedValue" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.estimateCalculatedValue" :readonly="true" placeholder="" clearable></el-input> <el-input v-model="scope.row.estimateCalculatedValue" :readonly="true" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="规格单位" width="130" prop="proUnit" align="center"> <el-table-column label="规格单位" width="130" prop="proUnit" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.proUnit" placeholder="" clearable></el-input> <el-input v-model="scope.row.proUnit" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="生成厂家" width="150" prop="manufacturer" align="center"> <el-table-column label="生成厂家" width="150" prop="manufacturer" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.manufacturer" placeholder="" clearable></el-input> <el-input v-model="scope.row.manufacturer" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实际数量" width="100px" prop="realityNum" align="center"> <el-table-column label="实际数量" width="100px" prop="realityNum" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.realityNum" placeholder="" clearable></el-input> <el-input v-model="scope.row.realityNum" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实际重量" width="100px" prop="realityWeight" align="center"> <el-table-column label="实际重量" width="100px" prop="realityWeight" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.realityWeight" placeholder="" clearable></el-input> <el-input v-model="scope.row.realityWeight" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实际质权人确认的单价" width="150px" prop="realityConfirmedPrice" align="center"> <el-table-column label="实际质权人确认的单价" width="150px" prop="realityConfirmedPrice" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.realityConfirmedPrice" placeholder="" clearable></el-input> <el-input v-model="scope.row.realityConfirmedPrice" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实际核算的价值" width="150px" prop="realityCalculatedValue" align="center"> <el-table-column label="实际核算的价值" width="150px" prop="realityCalculatedValue" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.realityCalculatedValue" placeholder="" clearable></el-input> <el-input v-model="scope.row.realityCalculatedValue" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="货位号" width="150px" prop="locationNumber" align="center"> <el-table-column label="货位号" width="150px" prop="locationNumber" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.locationNumber" placeholder="" clearable></el-input> <el-input v-model="scope.row.locationNumber" placeholder="" clearable></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="150"> <el-table-column label="操作" fixed="right" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" size="mini" @click="doCommoditylDel(scope.$index)">删除</el-button> <el-button type="primary" size="mini" @click="doCommoditylDel(scope.$index)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
</el-form> </el-form>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "storehouseAdd", name: "storehouseAdd",
components: { components: {
}, },
data() { data() {
return { return {
viewTitle: "【新增】采购订单", viewTitle: "【新增】采购订单",
purchaseForm: { purchaseForm: {
purchaseId: '', purchaseId: '',
product: '', product: '',
barCode: '', barCode: '',
purchaseDate:'', purchaseDate:'',
purchaseNo:'', purchaseNo:'',
supplier: '', supplier: '',
storehouseName:'', storehouseName:'',
supplierName:'', storehouseId:"",
count: '', supplierName:'',
storehouse: '', supplierId:'',
status: '', count: '',
products:[] storehouse: '',
}, status: '',
supplierList: [], products:[]
storehouseList: [], },
productList: [], supplierList: [],
productList2: [], storehouseList: [],
supplierList: [], productList: [],
custList: [], productList2: [],
selectPurchaseList: [], custList: [],
activeNames: ['1'], selectPurchaseList: [],
rules: { activeNames: ['1'],
product: [ rules: {
{ required: true, message: '请输入商品名', trigger: 'blur' } product: [
], { required: true, message: '请输入商品名', trigger: 'blur' }
supplier: [ ],
{ required: true, message: '请输入供应商', trigger: 'blur' } supplier: [
], { required: true, message: '请输入供应商', trigger: 'blur' }
count: [ ],
{ required: true, message: '请输入商品数量', trigger: 'blur' } count: [
], { required: true, message: '请输入商品数量', trigger: 'blur' }
storehouse: [ ],
{ required: true, message: '请输入所属仓库', trigger: 'blur' } storehouse: [
] { required: true, message: '请输入所属仓库', trigger: 'blur' }
} ]
}; }
}, };
mounted() { },
mounted() {
},
created() { },
this.getProductList() created() {
this.getSupplierList() this.getProductList()
this.getStorehouseList() this.getSupplierList()
this.getcustListList() this.getStorehouseList()
this.openAddPurchaseDialog() this.getcustListList()
}, this.openAddPurchaseDialog()
methods: { },
handleReturn(isreload) { methods: {
if (isreload === "true") this.$emit("reloadlist"); handleReturn(isreload) {
this.clearList() if (isreload === "true") this.$emit("reloadlist");
this.$emit("doback"); this.clearList()
}, this.$emit("doback");
clearList() { },
this.purchaseForm={ clearList() {
purchaseId: '', this.purchaseForm={
product: '', purchaseId: '',
barCode: '', product: '',
purchaseDate:'', barCode: '',
purchaseNo:'', purchaseDate:'',
supplier: '', purchaseNo:'',
storehouseName:'', supplier: '',
supplierName:'', storehouseName:'',
count: '', storehouseId:"",
storehouse: '', supplierName:'',
status: '', supplierId:'',
products:[] count: '',
storehouse: '',
} status: '',
}, products:[]
saveOrUpdate(){
if (this.viewTitle === "【新增】采购订单") return this.addStorehouse(); }
if (this.viewTitle === "【修改】采购订单") { },
this.addStorehouse(); saveOrUpdate(){
} this.storehouseList.forEach((v, i) => {
}, if(v.sid == this.purchaseForm.storehouseId){
showAdd() { this.purchaseForm.storehouseName = v.name
this.viewTitle = "【新增】采购订单"; }
this.clearList() })
this.openAddPurchaseDialog() this.supplierList.forEach((v, i) => {
}, if(v.id == this.purchaseForm.supplierId){
async showEdit(row) { this.purchaseForm.supplierName = v.name
this.viewTitle = "【修改】采购订单"; }
const _this = this })
const { data: result } = await this.$http.get(`/purchasenew/fetchDetailsBySid/${row.sid}`) if (this.viewTitle === "【新增】采购订单") return this.addStorehouse();
if (result.code==200) { if (this.viewTitle === "【修改】采购订单") {
_this.purchaseForm=result.data this.addStorehouse();
} }
}, },
addStorehouse(){ showAdd() {
this.$refs.dataForm.validate(async validate => { this.viewTitle = "【新增】采购订单";
if (!validate) return this.$message.error('请填写必填项') this.clearList()
this.purchaseForm.status = '待审核' this.openAddPurchaseDialog()
const { data: result } = await this.$http.post('/purchasenew/save', this.purchaseForm) },
if (result.code == 200) { async showEdit(row) {
this.$message({ type: 'success', message: result.msg, showClose: true }) this.viewTitle = "【修改】采购订单";
this.handleReturn('true') const _this = this
this.clearList() const { data: result } = await this.$http.get(`/purchasenew/fetchDetailsBySid/${row.sid}`)
} if (result.code==200) {
}) _this.purchaseForm=result.data
}, }
async getSupplierList () { },
const { data: result } = await this.$http.get('/purchase/getSupplier') addStorehouse(){
if (result.status !== 200) return this.$message.error('获取列表失败') this.$refs.dataForm.validate(async validate => {
this.supplierList = result.data if (!validate) return this.$message.error('请填写必填项')
}, this.purchaseForm.status = '待审核'
async getStorehouseList () { const { data: result } = await this.$http.post('/purchasenew/save', this.purchaseForm)
const { data: result } = await this.$http.get("/v1/shstorehouse/listAll") if (result.code == 200) {
if (result.code == 200){ this.$message({ type: 'success', message: result.msg, showClose: true })
this.storehouseList = result.data this.handleReturn('true')
} this.clearList()
}, }
async getProductList () { })
const { data: result } = await this.$http.get('/purchase/getProductList', { params: { name: this.purchaseForm.product } }) },
if (result.status !== 200) return this.$message.error('获取商品列表失败') async getSupplierList () {
this.productList = result.data const { data: result } = await this.$http.get('/purchase/getSupplier')
this.purchaseForm.barCode = this.productList[0].barCode if (result.status !== 200) return this.$message.error('获取列表失败')
}, this.supplierList = result.data
async getcustListList () { },
const { data: result } = await this.$http.get('/v1/shstorehouse/fetchEntList') async getStorehouseList () {
if (result.code == 200){ const { data: result } = await this.$http.get("/v1/shstorehouse/listAll")
this.custList = result.data if (result.code == 200){
} this.storehouseList = result.data
}, }
openAddPurchaseDialog () { },
var now = new Date() async getProductList () {
this.purchaseForm.purchaseNo = 'IP' + now.getTime() const { data: result } = await this.$http.get('/purchase/getProductList', { params: { name: this.purchaseForm.product } })
if (this.productList2.length == 0) this.productList2 = this.productList if (result.status !== 200) return this.$message.error('获取商品列表失败')
this.add() this.productList = result.data
}, this.purchaseForm.barCode = this.productList[0].barCode
add(){ },
this.purchaseForm.products.push({ async getcustListList () {
const { data: result } = await this.$http.get('/v1/shstorehouse/fetchEntList')
}) if (result.code == 200){
}, this.custList = result.data
doCommoditylDel(index) { }
},
const tip = '请确认是否删除所选记录?' openAddPurchaseDialog () {
this.$confirm(tip, '提示', { var now = new Date()
confirmButtonText: '确定', this.purchaseForm.purchaseNo = 'IP' + now.getTime()
cancelButtonText: '取消', if (this.productList2.length == 0) this.productList2 = this.productList
type: 'warning' this.add()
}).then(() => { },
this.purchaseForm.products.splice(index, 1); add(){
}) this.purchaseForm.products.push({
},
getLists(){ })
let arrList=this.purchaseForm.products },
for(let i=0;i<arrList.length;i++){ doCommoditylDel(index) {
if(arrList[i].estimateNum && arrList[i].estimateConfirmedPrice){
let newValue=parseFloat(arrList[i].estimateNum) * parseFloat(arrList[i].estimateConfirmedPrice) || 0 const tip = '请确认是否删除所选记录?'
let getValue=Math.floor(newValue*100)/100 this.$confirm(tip, '提示', {
this.$set(arrList[i], 'estimateCalculatedValue', getValue) confirmButtonText: '确定',
}else{ cancelButtonText: '取消',
this.$set(arrList[i], 'estimateCalculatedValue', '') type: 'warning'
} }).then(() => {
} this.purchaseForm.products.splice(index, 1);
}, })
limitInput1(value, index) { },
this.purchaseForm.products[index].estimateConfirmedPrice = getLists(){
("" + value) // let arrList=this.purchaseForm.products
.replace(/[^\d^\.]+/g, "") // for(let i=0;i<arrList.length;i++){
.replace(/^0+(\d)/, "$1") // 00 if(arrList[i].estimateNum && arrList[i].estimateConfirmedPrice){
.replace(/^\./, "0.") // 0. let newValue=parseFloat(arrList[i].estimateNum) * parseFloat(arrList[i].estimateConfirmedPrice) || 0
.match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 02 let getValue=Math.floor(newValue*100)/100
this.getLists() this.$set(arrList[i], 'estimateCalculatedValue', getValue)
}, }else{
limitInput2(value, index) { this.$set(arrList[i], 'estimateCalculatedValue', '')
this.purchaseForm.products[index].estimateNum = }
("" + value) // }
.replace(/[^\d^\.]+/g, "") // },
.replace(/^0+(\d)/, "$1") // 00 limitInput1(value, index) {
.replace(/^\./, "0.") // 0. this.purchaseForm.products[index].estimateConfirmedPrice =
.match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 02 ("" + value) //
this.getLists() .replace(/[^\d^\.]+/g, "") //
}, .replace(/^0+(\d)/, "$1") // 00
}, .replace(/^\./, "0.") // 0.
}; .match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 02
</script> this.getLists()
},
<style scoped> limitInput2(value, index) {
/deep/ .el-collapse-item__header { this.purchaseForm.products[index].estimateNum =
height: 40px; ("" + value) //
font-weight: bold; .replace(/[^\d^\.]+/g, "") //
font-size: 16px; .replace(/^0+(\d)/, "$1") // 00
text-align: left; .replace(/^\./, "0.") // 0.
color: #ffffff; .match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 02
background-color: #0294d7; this.getLists()
} },
},
/deep/ .el-collapse-item__content { };
padding-bottom: 0; </script>
}
.trightb { <style scoped>
display: flex; /deep/ .el-collapse-item__header {
align-items: center; height: 40px;
text-align: center; font-weight: bold;
justify-content: center; font-size: 16px;
} text-align: left;
color: #ffffff;
.trightb_item { background-color: #0294d7;
padding-top: 5px; }
}
/deep/ .el-collapse-item__content {
.span { padding-bottom: 0;
margin-left: 50px; }
font-size: 15px; .trightb {
font-weight: 400; display: flex;
} align-items: center;
.formadd { text-align: center;
padding: 10px 40px 0 40px; justify-content: center;
font-size: 16px; }
}
.formadd .title { .trightb_item {
font-weight: bold; padding-top: 5px;
font-size: 16px; }
background-color: #0294d7;
text-align: left; .span {
color: #ffffff; margin-left: 50px;
} font-size: 15px;
.first_row{ font-weight: 400;
border-top: 1px solid #e0e3eb; }
} .formadd {
.formadd .el-row { padding: 10px 40px 0 40px;
display: flex; font-size: 16px;
flex-wrap: wrap; }
border-left: 1px solid #e0e3eb; .formadd .title {
} font-weight: bold;
.formadd .el-row .el-col { font-size: 16px;
border-right: 1px solid #e0e3eb; background-color: #0294d7;
border-bottom: 1px solid #e0e3eb; text-align: left;
padding: 0 15px; color: #ffffff;
min-height: 42px; }
line-height: 1; .first_row{
} border-top: 1px solid #e0e3eb;
.formadd .el-row .el-col .el-form-item { }
margin-bottom: 0; .formadd .el-row {
line-height: 42px; display: flex;
} flex-wrap: wrap;
.addinputw { border-left: 1px solid #e0e3eb;
width: 80%; }
line-height: 42px; .formadd .el-row .el-col {
} border-right: 1px solid #e0e3eb;
.el-input__inner { border-bottom: 1px solid #e0e3eb;
height: 36px; padding: 0 15px;
} min-height: 42px;
</style> line-height: 1;
}
.formadd .el-row .el-col .el-form-item {
margin-bottom: 0;
line-height: 42px;
}
.addinputw {
width: 80%;
line-height: 42px;
}
.el-input__inner {
height: 36px;
}
</style>

Loading…
Cancel
Save