fix:优化大屏
This commit is contained in:
@@ -7,6 +7,9 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattrDto;
|
import org.nl.wms.basedata_manage.service.dao.BsrealStorattrDto;
|
||||||
|
import org.nl.wms.bigscreen_manage.service.dto.IvtAnalyse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dsh
|
* @author dsh
|
||||||
@@ -16,4 +19,6 @@ import org.nl.wms.basedata_manage.service.dao.BsrealStorattrDto;
|
|||||||
public interface BsrealStorattrMapper extends BaseMapper<BsrealStorattr> {
|
public interface BsrealStorattrMapper extends BaseMapper<BsrealStorattr> {
|
||||||
|
|
||||||
IPage<BsrealStorattrDto> queryAllByPage(Page<BsrealStorattrDto> page, @Param("search") String search);
|
IPage<BsrealStorattrDto> queryAllByPage(Page<BsrealStorattrDto> page, @Param("search") String search);
|
||||||
|
|
||||||
|
List<IvtAnalyse> sumMaterQty(String storCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,23 @@
|
|||||||
</where>
|
</where>
|
||||||
ORDER BY stor.update_time Desc
|
ORDER BY stor.update_time Desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="sumMaterQty" resultType="org.nl.wms.bigscreen_manage.service.dto.IvtAnalyse">
|
||||||
|
SELECT
|
||||||
|
st_ivt_structattr.stor_code,
|
||||||
|
md_me_materialbase.material_id,
|
||||||
|
md_me_materialbase.material_name,
|
||||||
|
SUM( qty ) as sum_qty
|
||||||
|
FROM
|
||||||
|
st_ivt_structattr
|
||||||
|
LEFT JOIN md_pb_groupplate ON st_ivt_structattr.storagevehicle_code = md_pb_groupplate.storagevehicle_code
|
||||||
|
LEFT JOIN md_me_materialbase ON md_me_materialbase.material_id = md_pb_groupplate.material_id
|
||||||
|
WHERE
|
||||||
|
st_ivt_structattr.storagevehicle_code IS NOT NULL
|
||||||
|
and md_pb_groupplate.material_id is not null
|
||||||
|
and stor_code = #{storCode}
|
||||||
|
GROUP BY
|
||||||
|
stor_code,material_id
|
||||||
|
ORDER BY sum_qty
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ package org.nl.wms.bigscreen_manage.controller;
|
|||||||
|
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.base.TableDataInfo;
|
||||||
import org.nl.common.logging.annotation.Log;
|
import org.nl.common.logging.annotation.Log;
|
||||||
import org.nl.wms.bigscreen_manage.service.BigScreenService;
|
import org.nl.wms.bigscreen_manage.service.BigScreenService;
|
||||||
|
import org.nl.wms.pda_manage.util.PdaResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,14 +34,17 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class BigScreenController {
|
public class BigScreenController {
|
||||||
|
|
||||||
// @Autowired
|
@Autowired
|
||||||
private BigScreenService bigScreenService;
|
private BigScreenService bigScreenService;
|
||||||
|
|
||||||
@PostMapping("/getData")
|
@PostMapping("/getData")
|
||||||
@Log("大屏数据")
|
@Log("大屏数据")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
public ResponseEntity<Object> getData(@RequestBody List<String> stors) {
|
public ResponseEntity<Object> getData(@RequestBody JSONObject stors) {
|
||||||
return new ResponseEntity<>(bigScreenService.getData(stors), HttpStatus.OK);
|
List<String> list = new ArrayList<>();
|
||||||
|
list.add("GW");
|
||||||
|
List<JSONObject> data = bigScreenService.getData(list);
|
||||||
|
return new ResponseEntity<>(PdaResponse.requestParamOk(data.get(0)), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.nl.wms.bigscreen_manage.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IvtAnalyse {
|
||||||
|
private String stor_code;
|
||||||
|
private String material_id;
|
||||||
|
private String material_name;
|
||||||
|
private Integer sum_qty;
|
||||||
|
}
|
||||||
@@ -1,383 +1,365 @@
|
|||||||
//package org.nl.wms.bigscreen_manage.service.impl;
|
package org.nl.wms.bigscreen_manage.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateField;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
|
||||||
|
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||||
|
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||||
|
import org.nl.wms.basedata_manage.service.dao.mapper.BsrealStorattrMapper;
|
||||||
|
import org.nl.wms.bigscreen_manage.service.BigScreenService;
|
||||||
|
import org.nl.wms.bigscreen_manage.service.dto.IvtAnalyse;
|
||||||
|
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||||
|
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||||
|
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||||
|
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||||
|
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||||
|
import org.nl.wms.warehouse_manage.service.IOutBillService;
|
||||||
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInv;
|
||||||
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInvDis;
|
||||||
|
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvDisMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 大屏显示 实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Liuxy
|
||||||
|
* @since 2025-06-24
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BigScreenServiceImpl implements BigScreenService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStructattrService iStructattrService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IOutBillService iOutBillService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BsrealStorattrMapper screenMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseTaskService iSchBaseTaskService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<JSONObject> getData(List<String> stors) {
|
||||||
|
// String storCode = "GW";
|
||||||
|
List result = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isEmpty(stors)){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
for (String storCode : stors) {
|
||||||
|
JSONObject item = new JSONObject();
|
||||||
|
//1.【货位使用】数据
|
||||||
|
item.put("pointUse", pointUse(storCode));
|
||||||
|
// //2.【实时库存分析】数据
|
||||||
|
item.put("ivtAnalyse", ivtAnalyse(storCode));
|
||||||
|
//3.【出入库趋势】数据
|
||||||
|
item.put("inAndOutTrend", inAndOutTrend(storCode));
|
||||||
|
// //4.【今日出入库】数据
|
||||||
|
item.put("toDayInAndOut", toDayInAndOut(storCode));
|
||||||
|
// //5.【今日出入库】数据
|
||||||
|
item.put("realTask", realTask(storCode));
|
||||||
|
//6.【未完成单据】数据
|
||||||
|
item.put("unIos", unIos(storCode));
|
||||||
|
result.add(item);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/**
|
||||||
//
|
//
|
||||||
//import cn.hutool.core.date.DateField;
|
// * 货位使用
|
||||||
//import cn.hutool.core.date.DateTime;
|
|
||||||
//import cn.hutool.core.date.DateUtil;
|
|
||||||
//import cn.hutool.core.util.NumberUtil;
|
|
||||||
//import cn.hutool.core.util.ObjectUtil;
|
|
||||||
//import com.alibaba.fastjson.JSONObject;
|
|
||||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
//import org.nl.common.utils.MapOf;
|
|
||||||
//import org.nl.wms.basedata_manage.service.IStructattrService;
|
|
||||||
//import org.nl.wms.basedata_manage.service.dao.Structattr;
|
|
||||||
//import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto;
|
|
||||||
//import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
|
||||||
//import org.nl.wms.bigscreen_manage.service.BigScreenService;
|
|
||||||
//import org.nl.wms.pda_manage.util.PdaResponse;
|
|
||||||
//import org.nl.wms.sch_manage.enums.TaskStatus;
|
|
||||||
//import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
|
||||||
//import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
|
||||||
//import org.nl.wms.system_manage.service.dict.dao.mapper.SysDictMapper;
|
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
//import org.springframework.stereotype.Service;
|
|
||||||
//import org.springframework.util.CollectionUtils;
|
|
||||||
//
|
|
||||||
//import java.util.ArrayList;
|
|
||||||
//import java.util.List;
|
|
||||||
//import java.util.stream.Collectors;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * <p>
|
|
||||||
// * 大屏显示 实现类
|
|
||||||
// * </p>
|
|
||||||
// *
|
|
||||||
// * @author Liuxy
|
|
||||||
// * @since 2025-06-24
|
|
||||||
// */
|
|
||||||
//@Service
|
|
||||||
//public class BigScreenServiceImpl implements BigScreenService {
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 仓位服务
|
|
||||||
// */
|
|
||||||
// @Autowired
|
|
||||||
// private IStructattrService iStructattrService;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 载具扩展属性mapper服务
|
|
||||||
// */
|
|
||||||
// @Autowired
|
|
||||||
// private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 任务服务
|
|
||||||
// */
|
|
||||||
// @Autowired
|
|
||||||
// private ISchBaseTaskService iSchBaseTaskService;
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public List<JSONObject> getData(List<String> stors) {
|
|
||||||
//// String storCode = "GW";
|
|
||||||
// List result = new ArrayList<>();
|
|
||||||
// if (CollectionUtils.isEmpty(stors)){
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
// for (String storCode : stors) {
|
|
||||||
// JSONObject item = new JSONObject();
|
|
||||||
// //1.【货位使用】数据
|
|
||||||
// item.put("pointUse", pointUse(storCode));
|
|
||||||
//// //2.【实时库存分析】数据
|
|
||||||
// item.put("ivtAnalyse", ivtAnalyse(storCode));
|
|
||||||
// //3.【出入库趋势】数据
|
|
||||||
// item.put("inAndOutTrend", inAndOutTrend(storCode));
|
|
||||||
//// //4.【今日出入库】数据
|
|
||||||
// item.put("toDayInAndOut", toDayInAndOut(storCode));
|
|
||||||
//// //5.【今日出入库】数据
|
|
||||||
// item.put("realTask", realTask(storCode));
|
|
||||||
// //6.【未完成单据】数据
|
|
||||||
// item.put("unIos", unIos(storCode));
|
|
||||||
// }
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
// /**
|
|
||||||
////
|
|
||||||
//// * 货位使用
|
|
||||||
//// *
|
|
||||||
//// * @return JSONObject {
|
|
||||||
//// * total_qty: 总货位数
|
|
||||||
//// * use_qty: 已用货位
|
|
||||||
//// * emp_qty: 空余货位
|
|
||||||
//// * use_percentage: 百分比(使用货位百分比)
|
|
||||||
//// * }
|
|
||||||
//// */
|
|
||||||
// private JSONObject pointUse(String storCode) {
|
|
||||||
// // 返回数据
|
|
||||||
// JSONObject result = new JSONObject();
|
|
||||||
// // 查询所有未删除且启用仓位
|
|
||||||
// int emp_qty = iStructattrService.count(
|
|
||||||
// new QueryWrapper<Structattr>().lambda()
|
|
||||||
// .eq(Structattr::getIs_used, Boolean.TRUE)
|
|
||||||
// .eq(Structattr::getStor_code, storCode)
|
|
||||||
// .isNull(Structattr::getStoragevehicle_code));
|
|
||||||
// int use_qty = iStructattrService.count(
|
|
||||||
// new QueryWrapper<Structattr>().lambda()
|
|
||||||
// .eq(Structattr::getIs_used, Boolean.TRUE)
|
|
||||||
// .eq(Structattr::getStor_code, storCode)
|
|
||||||
// .isNotNull(Structattr::getStoragevehicle_code));
|
|
||||||
// int total_qty = iStructattrService.count(
|
|
||||||
// new QueryWrapper<Structattr>().lambda()
|
|
||||||
// .eq(Structattr::getIs_used, Boolean.TRUE)
|
|
||||||
// .eq(Structattr::getStor_code, storCode));
|
|
||||||
// // 总货位数
|
|
||||||
// result.put("total_qty", total_qty);
|
|
||||||
// // 已用货位数
|
|
||||||
// result.put("use_qty", use_qty);
|
|
||||||
// // 空余货位
|
|
||||||
// result.put("emp_qty", emp_qty);
|
|
||||||
// // 使用货位百分比
|
|
||||||
// double use_percentage = NumberUtil.mul(NumberUtil.div(use_qty, total_qty), 100);
|
|
||||||
// result.put("use_percentage", NumberUtil.round(use_percentage, 2));
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 实时库存分析
|
|
||||||
// *
|
// *
|
||||||
// * @return JSONObject {
|
// * @return JSONObject {
|
||||||
// * total_qty: 总数
|
// * total_qty: 总货位数
|
||||||
// * data: [
|
// * use_qty: 已用货位
|
||||||
// * material_name: 物料名称
|
// * emp_qty: 空余货位
|
||||||
// * ivt_qty: 库存数量
|
// * use_percentage: 百分比(使用货位百分比)
|
||||||
// * percentage: 百分比
|
|
||||||
// * ]
|
|
||||||
// * }
|
// * }
|
||||||
// */
|
// */
|
||||||
// private JSONObject ivtAnalyse(String storCode) {
|
private JSONObject pointUse(String storCode) {
|
||||||
// // 返回数据
|
// 返回数据
|
||||||
// JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
// // 查询所有库存
|
// 查询所有未删除且启用仓位
|
||||||
// List<StructattrVechielDto> vechielDtos = iStructattrService.collectVechicle(MapOf.of("stor_code", storCode));
|
int emp_qty = iStructattrService.count(
|
||||||
// // 总数
|
new QueryWrapper<Structattr>().lambda()
|
||||||
// double total_qty = ivtList.stream()
|
.eq(Structattr::getIs_used, Boolean.TRUE)
|
||||||
// .map(row -> row.getDoubleValue("canuse_qty"))
|
.eq(Structattr::getStor_code, storCode)
|
||||||
// .reduce(Double::sum).orElse(0.0);
|
.isNull(Structattr::getStoragevehicle_code));
|
||||||
// result.put("total_qty", NumberUtil.round(total_qty, 2));
|
int use_qty = iStructattrService.count(
|
||||||
//
|
new QueryWrapper<Structattr>().lambda()
|
||||||
// // 查询排名前五的物料库存
|
.eq(Structattr::getIs_used, Boolean.TRUE)
|
||||||
// List<JSONObject> topFiveList;
|
.eq(Structattr::getStor_code, storCode)
|
||||||
// List<JSONObject> otherList = null;
|
.isNotNull(Structattr::getStoragevehicle_code));
|
||||||
// if (ivtList.size() < 5) {
|
int total_qty = iStructattrService.count(
|
||||||
// topFiveList = ivtList;
|
new QueryWrapper<Structattr>().lambda()
|
||||||
// } else {
|
.eq(Structattr::getIs_used, Boolean.TRUE)
|
||||||
// topFiveList = ivtList.subList(0, 5);
|
.eq(Structattr::getStor_code, storCode));
|
||||||
// otherList = ivtList.subList(5, ivtList.size());
|
// 总货位数
|
||||||
// }
|
result.put("total_qty", total_qty);
|
||||||
// // 组织数据(物料前五)
|
// 已用货位数
|
||||||
// for (JSONObject json : topFiveList) {
|
result.put("use_qty", use_qty);
|
||||||
// // 库存数量
|
// 空余货位
|
||||||
// json.put("ivt_qty", NumberUtil.round(json.getDoubleValue("canuse_qty"), 2));
|
result.put("emp_qty", emp_qty);
|
||||||
// // 百分比
|
// 使用货位百分比
|
||||||
// double percentage = NumberUtil.mul(NumberUtil.div(json.getDoubleValue("canuse_qty"), total_qty), 100);
|
double use_percentage = NumberUtil.mul(NumberUtil.div(use_qty, total_qty), 100);
|
||||||
// json.put("percentage", NumberUtil.round(percentage, 2));
|
result.put("use_percentage", NumberUtil.round(use_percentage, 2));
|
||||||
// }
|
return result;
|
||||||
//
|
}
|
||||||
// // 计算其他物料
|
|
||||||
// if (ObjectUtil.isNotEmpty(otherList)) {
|
/**
|
||||||
// JSONObject jsonOther = new JSONObject();
|
* 实时库存分析
|
||||||
// jsonOther.put("material_name", "其他");
|
*
|
||||||
// double ivt_qty = otherList.stream()
|
* @return JSONObject {
|
||||||
// .map(row -> row.getDoubleValue("canuse_qty"))
|
* total_qty: 总数
|
||||||
// .reduce(Double::sum).orElse(0.0);
|
* data: [
|
||||||
// jsonOther.put("ivt_qty", NumberUtil.round(ivt_qty, 2));
|
* material_name: 物料名称
|
||||||
// // 百分比
|
* ivt_qty: 库存数量
|
||||||
// double percentage = NumberUtil.mul(NumberUtil.div(ivt_qty, total_qty), 100);
|
* percentage: 百分比
|
||||||
// jsonOther.put("percentage", NumberUtil.round(percentage, 2));
|
* ]
|
||||||
// topFiveList.add(jsonOther);
|
* }
|
||||||
// }
|
*/
|
||||||
//
|
private JSONObject ivtAnalyse(String storCode) {
|
||||||
// result.put("data", topFiveList);
|
JSONObject result = new JSONObject();
|
||||||
// return result;
|
List<IvtAnalyse> list = screenMapper.sumMaterQty(storCode);
|
||||||
// }
|
int sum = list.stream().mapToInt(IvtAnalyse::getSum_qty).sum();
|
||||||
//
|
result.put("total_qty", sum);
|
||||||
// /**
|
List<JSONObject> topFiveList = new ArrayList<>();
|
||||||
// * 出入库趋势
|
int i = 0;
|
||||||
// *
|
int top5 = 0;
|
||||||
// * @return JSONObject {
|
for (IvtAnalyse json : list) {
|
||||||
// * in: [{date:日期,qty:数量}]
|
if (i==5){break;}
|
||||||
// * out: [{date:日期,qty:数量}]
|
JSONObject item = new JSONObject();
|
||||||
// * }
|
item.put("ivt_qty", json.getSum_qty());
|
||||||
// */
|
item.put("material_name", json.getMaterial_name());
|
||||||
// private JSONObject inAndOutTrend() {
|
double percentage = NumberUtil.mul(json.getSum_qty()/sum, 100);
|
||||||
// // 获取七天天数集合
|
item.put("percentage", NumberUtil.round(percentage, 2));
|
||||||
// DateTime dateTime = DateUtil.offsetDay(DateUtil.parseDate(DateUtil.today()), -6);
|
topFiveList.add(item);
|
||||||
// List<String> dateList = DateUtil.rangeToList(dateTime, DateUtil.parse(DateUtil.today()), DateField.DAY_OF_YEAR).stream()
|
i++;
|
||||||
// .map(DateTime::toString)
|
top5 = top5+json.getSum_qty();
|
||||||
// .map(row -> row.substring(0, 10))
|
}
|
||||||
// .collect(Collectors.toList());
|
if (sum>top5){
|
||||||
// // 查询七天内的出入库数据
|
JSONObject other = new JSONObject();
|
||||||
// List<IOStorInv> allIosList = iOutBillService.list(
|
other.put("ivt_qty", sum-top5);
|
||||||
// new QueryWrapper<IOStorInv>().lambda()
|
other.put("material_name", "其他物料");
|
||||||
// .in(IOStorInv::getBiz_date, dateList)
|
other.put("percentage", NumberUtil.round(1-top5/sum, 2));
|
||||||
// .eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
topFiveList.add(other);
|
||||||
// .eq(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
}
|
||||||
// );
|
result.put("data", topFiveList);
|
||||||
//
|
return result;
|
||||||
// // 查询入库单据
|
}
|
||||||
// List<IOStorInv> inIosList = allIosList.stream()
|
|
||||||
// .filter(row -> row.getIo_type().equals(IOSEnum.IO_TYPE.code("入库")))
|
/**
|
||||||
// .collect(Collectors.toList());
|
* 出入库趋势
|
||||||
// // 查询出库单据
|
*
|
||||||
// List<IOStorInv> outIosList = allIosList.stream()
|
* @return JSONObject {
|
||||||
// .filter(row -> row.getIo_type().equals(IOSEnum.IO_TYPE.code("出库")))
|
* in: [{date:日期,qty:数量}]
|
||||||
// .collect(Collectors.toList());
|
* out: [{date:日期,qty:数量}]
|
||||||
// // 组织数据
|
* }
|
||||||
// List<JSONObject> inList = new ArrayList<>();
|
*/
|
||||||
// List<JSONObject> outList = new ArrayList<>();
|
private JSONObject inAndOutTrend(String storCode) {
|
||||||
// for (String date : dateList) {
|
// 获取七天天数集合
|
||||||
// // 处理入库数量
|
DateTime dateTime = DateUtil.offsetDay(DateUtil.parseDate(DateUtil.today()), -6);
|
||||||
// JSONObject jsonIn = new JSONObject();
|
List<String> dateList = DateUtil.rangeToList(dateTime, DateUtil.parse(DateUtil.today()), DateField.DAY_OF_YEAR).stream()
|
||||||
// jsonIn.put("date", date);
|
.map(DateTime::toString)
|
||||||
// double in_qty = inIosList.stream()
|
.map(row -> row.substring(0, 10))
|
||||||
// .filter(row -> row.getBiz_date().equals(date))
|
.collect(Collectors.toList());
|
||||||
// .map(row -> row.getTotal_qty().doubleValue())
|
// 查询七天内的出入库数据
|
||||||
// .reduce(Double::sum).orElse(0.00);
|
List<IOStorInv> allIosList = iOutBillService.list(
|
||||||
// jsonIn.put("qty", NumberUtil.round(in_qty, 2));
|
new QueryWrapper<IOStorInv>().lambda()
|
||||||
// inList.add(jsonIn);
|
.in(IOStorInv::getBiz_date, dateList)
|
||||||
//
|
.eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||||
// // 处理出库数据
|
.eq(IOStorInv::getStor_code, storCode)
|
||||||
// JSONObject jsonOut = new JSONObject();
|
.eq(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||||
// jsonOut.put("date", date);
|
);
|
||||||
// double out_qty = outIosList.stream()
|
// 查询入库单据
|
||||||
// .filter(row -> row.getBiz_date().equals(date))
|
List<IOStorInv> inIosList = allIosList.stream()
|
||||||
// .map(row -> row.getTotal_qty().doubleValue())
|
.filter(row -> row.getIo_type().equals(IOSEnum.IO_TYPE.code("入库")))
|
||||||
// .reduce(Double::sum).orElse(0.00);
|
.collect(Collectors.toList());
|
||||||
// jsonOut.put("qty", NumberUtil.round(out_qty, 2));
|
// 查询出库单据
|
||||||
// outList.add(jsonOut);
|
List<IOStorInv> outIosList = allIosList.stream()
|
||||||
// }
|
.filter(row -> row.getIo_type().equals(IOSEnum.IO_TYPE.code("出库")))
|
||||||
//
|
.collect(Collectors.toList());
|
||||||
// JSONObject result = new JSONObject();
|
// 组织数据
|
||||||
// result.put("in", inList);
|
List<JSONObject> inList = new ArrayList<>();
|
||||||
// result.put("out", outList);
|
List<JSONObject> outList = new ArrayList<>();
|
||||||
// return result;
|
for (String date : dateList) {
|
||||||
// }
|
// 处理入库数量
|
||||||
//
|
JSONObject jsonIn = new JSONObject();
|
||||||
// /**
|
jsonIn.put("date", date);
|
||||||
// * 今日出入库
|
double in_qty = inIosList.stream()
|
||||||
// *
|
.filter(row -> row.getBiz_date().equals(date))
|
||||||
// * @return JSONObject {
|
.map(row -> row.getTotal_qty().doubleValue())
|
||||||
// * in: {total_qty:总数量,vehicle_qty:托盘数量}
|
.reduce(Double::sum).orElse(0.00);
|
||||||
// * out: {total_qty:总数量,vehicle_qty:托盘数量}
|
jsonIn.put("qty", NumberUtil.round(in_qty, 2));
|
||||||
// * }
|
inList.add(jsonIn);
|
||||||
// */
|
|
||||||
// private JSONObject toDayInAndOut() {
|
// 处理出库数据
|
||||||
// // 查询今天出入库单据
|
JSONObject jsonOut = new JSONObject();
|
||||||
// List<IOStorInv> inList = iOutBillService.list(
|
jsonOut.put("date", date);
|
||||||
// new QueryWrapper<IOStorInv>().lambda()
|
double out_qty = outIosList.stream()
|
||||||
// .eq(IOStorInv::getBiz_date, DateUtil.today())
|
.filter(row -> row.getBiz_date().equals(date))
|
||||||
// .eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
.map(row -> row.getTotal_qty().doubleValue())
|
||||||
// .eq(IOStorInv::getIo_type, IOSEnum.IO_TYPE.code("入库"))
|
.reduce(Double::sum).orElse(0.00);
|
||||||
// .eq(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
jsonOut.put("qty", NumberUtil.round(out_qty, 2));
|
||||||
// );
|
outList.add(jsonOut);
|
||||||
// // 查询今天出库单据
|
}
|
||||||
// List<IOStorInv> outList = iOutBillService.list(
|
|
||||||
// new QueryWrapper<IOStorInv>().lambda()
|
JSONObject result = new JSONObject();
|
||||||
// .eq(IOStorInv::getBiz_date, DateUtil.today())
|
result.put("in", inList);
|
||||||
// .eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
result.put("out", outList);
|
||||||
// .eq(IOStorInv::getIo_type, IOSEnum.IO_TYPE.code("出库"))
|
return result;
|
||||||
// .eq(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
}
|
||||||
// );
|
|
||||||
//
|
/**
|
||||||
// // 入库
|
* 今日出入库
|
||||||
// JSONObject jsonIn = new JSONObject();
|
*
|
||||||
// // 总数量
|
* @return JSONObject {
|
||||||
// double total_qty_in = inList.stream()
|
* in: {total_qty:总数量,vehicle_qty:托盘数量}
|
||||||
// .map(row -> row.getTotal_qty().doubleValue())
|
* out: {total_qty:总数量,vehicle_qty:托盘数量}
|
||||||
// .reduce(Double::sum).orElse(0.0);
|
* }
|
||||||
// jsonIn.put("total_qty", NumberUtil.round(total_qty_in, 2));
|
*/
|
||||||
//
|
private JSONObject toDayInAndOut(String storCode) {
|
||||||
// // 托盘数
|
// 查询今天出入库单据
|
||||||
// List<IOStorInvDis> inDisList = new ArrayList<>();
|
List<IOStorInv> inList = iOutBillService.list(
|
||||||
// if (ObjectUtil.isNotEmpty(inList)) {
|
new QueryWrapper<IOStorInv>().lambda()
|
||||||
// inDisList = ioStorInvDisMapper.selectList(
|
.eq(IOStorInv::getBiz_date, DateUtil.today())
|
||||||
// new QueryWrapper<IOStorInvDis>().lambda()
|
.eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||||
// .in(IOStorInvDis::getIostorinv_id, inList.stream()
|
.eq(IOStorInv::getStor_code, storCode)
|
||||||
// .map(IOStorInv::getIostorinv_id)
|
.eq(IOStorInv::getIo_type, IOSEnum.IO_TYPE.code("入库"))
|
||||||
// .collect(Collectors.toList())
|
.eq(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||||
// )
|
);
|
||||||
// );
|
// 查询今天出库单据
|
||||||
// }
|
List<IOStorInv> outList = iOutBillService.list(
|
||||||
// jsonIn.put("vehicle_qty", inDisList.size());
|
new QueryWrapper<IOStorInv>().lambda()
|
||||||
//
|
.eq(IOStorInv::getBiz_date, DateUtil.today())
|
||||||
// // 出库
|
.eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||||
// JSONObject jsonOut = new JSONObject();
|
.eq(IOStorInv::getStor_code, storCode)
|
||||||
// // 总数量
|
.eq(IOStorInv::getIo_type, IOSEnum.IO_TYPE.code("出库"))
|
||||||
// double total_qty_out = outList.stream()
|
.eq(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||||
// .map(row -> row.getTotal_qty().doubleValue())
|
);
|
||||||
// .reduce(Double::sum).orElse(0.0);
|
|
||||||
// jsonOut.put("total_qty", NumberUtil.round(total_qty_out, 2));
|
// 入库
|
||||||
// // 托盘数
|
JSONObject jsonIn = new JSONObject();
|
||||||
// List<IOStorInvDis> outDisList = new ArrayList<>();
|
// 总数量
|
||||||
// if (ObjectUtil.isNotEmpty(outList)) {
|
double total_qty_in = inList.stream()
|
||||||
// outDisList = ioStorInvDisMapper.selectList(
|
.map(row -> row.getTotal_qty().doubleValue())
|
||||||
// new QueryWrapper<IOStorInvDis>().lambda()
|
.reduce(Double::sum).orElse(0.0);
|
||||||
// .in(IOStorInvDis::getIostorinv_id, outList.stream()
|
jsonIn.put("total_qty", NumberUtil.round(total_qty_in, 2));
|
||||||
// .map(IOStorInv::getIostorinv_id)
|
|
||||||
// .collect(Collectors.toList())
|
// 托盘数
|
||||||
// )
|
List<IOStorInvDis> inDisList = new ArrayList<>();
|
||||||
// );
|
if (ObjectUtil.isNotEmpty(inList)) {
|
||||||
// }
|
inDisList = ioStorInvDisMapper.selectList(
|
||||||
// jsonOut.put("vehicle_qty", outDisList.size());
|
new QueryWrapper<IOStorInvDis>().lambda()
|
||||||
//
|
.in(IOStorInvDis::getIostorinv_id, inList.stream()
|
||||||
// JSONObject result = new JSONObject();
|
.map(IOStorInv::getIostorinv_id)
|
||||||
// result.put("in", jsonIn);
|
.collect(Collectors.toList())
|
||||||
// result.put("out", jsonOut);
|
)
|
||||||
// return result;
|
);
|
||||||
// }
|
}
|
||||||
//
|
jsonIn.put("vehicle_qty", inDisList.size());
|
||||||
// /**
|
|
||||||
// * 实时任务
|
// 出库
|
||||||
// *
|
JSONObject jsonOut = new JSONObject();
|
||||||
// * @return List<SchBaseTask> {
|
// 总数量
|
||||||
// * 任务实体列
|
double total_qty_out = outList.stream()
|
||||||
// * }
|
.map(row -> row.getTotal_qty().doubleValue())
|
||||||
// */
|
.reduce(Double::sum).orElse(0.0);
|
||||||
// private List<SchBaseTask> realTask() {
|
jsonOut.put("total_qty", NumberUtil.round(total_qty_out, 2));
|
||||||
// List<SchBaseTask> list = iSchBaseTaskService.list(
|
// 托盘数
|
||||||
// new QueryWrapper<SchBaseTask>().lambda()
|
List<IOStorInvDis> outDisList = new ArrayList<>();
|
||||||
// .in(SchBaseTask::getTask_status, TaskStatus.CREATE.getCode()
|
if (ObjectUtil.isNotEmpty(outList)) {
|
||||||
// , TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode()
|
outDisList = ioStorInvDisMapper.selectList(
|
||||||
// )
|
new QueryWrapper<IOStorInvDis>().lambda()
|
||||||
// .eq(SchBaseTask::getIs_delete, IOSConstant.IS_DELETE_NO)
|
.in(IOStorInvDis::getIostorinv_id, outList.stream()
|
||||||
// );
|
.map(IOStorInv::getIostorinv_id)
|
||||||
// list.stream().forEach(item -> {
|
.collect(Collectors.toList())
|
||||||
// if (item.getTask_status().equals(TaskStatus.CREATE.getCode())) {
|
)
|
||||||
// item.setTask_status(TaskStatus.CREATE.getName());
|
);
|
||||||
// }
|
}
|
||||||
// if (item.getTask_status().equals(TaskStatus.ISSUED.getCode())) {
|
jsonOut.put("vehicle_qty", outDisList.size());
|
||||||
// item.setTask_status(TaskStatus.ISSUED.getName());
|
|
||||||
// }
|
JSONObject result = new JSONObject();
|
||||||
// if (item.getTask_status().equals(TaskStatus.EXECUTING.getCode())) {
|
result.put("in", jsonIn);
|
||||||
// item.setTask_status(TaskStatus.EXECUTING.getName());
|
result.put("out", jsonOut);
|
||||||
// }
|
return result;
|
||||||
// });
|
}
|
||||||
//
|
|
||||||
// return list;
|
/**
|
||||||
// }
|
* 实时任务
|
||||||
//
|
*
|
||||||
// /**
|
* @return List<SchBaseTask> {
|
||||||
// * 未完成单据
|
* 任务实体列
|
||||||
// *
|
* }
|
||||||
// * @return List<IOStorInv>{
|
*/
|
||||||
// * 出入库实体类
|
private List<SchBaseTask> realTask(String storCode) {
|
||||||
// * }
|
List<SchBaseTask> list = iSchBaseTaskService.list(
|
||||||
// */
|
new QueryWrapper<SchBaseTask>().lambda()
|
||||||
// private List<IOStorInv> unIos() {
|
.in(SchBaseTask::getTask_status, TaskStatus.CREATE.getCode()
|
||||||
// List<Dict> dicts = sysDictMapper.selectList(
|
, TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode()
|
||||||
// new QueryWrapper<Dict>().lambda()
|
)
|
||||||
// .in(Dict::getCode, "ST_INV_IN_TYPE", "ST_INV_OUT_TYPE")
|
.eq(SchBaseTask::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||||
// );
|
);
|
||||||
//
|
list.stream().forEach(item -> {
|
||||||
// List<IOStorInv> list = iOutBillService.list(
|
if (item.getTask_status().equals(TaskStatus.CREATE.getCode())) {
|
||||||
// new QueryWrapper<IOStorInv>().lambda()
|
item.setTask_status(TaskStatus.CREATE.getName());
|
||||||
// .eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
}
|
||||||
// .ne(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
if (item.getTask_status().equals(TaskStatus.ISSUED.getCode())) {
|
||||||
// );
|
item.setTask_status(TaskStatus.ISSUED.getName());
|
||||||
// list.stream().forEach(item -> {
|
}
|
||||||
// item.setIo_type(item.getIo_type().equals(IOSEnum.IO_TYPE.code("入库")) ? IOSConstant.IOS_IO_TYPE_IN : IOSConstant.IOS_IO_TYPE_OUT);
|
if (item.getTask_status().equals(TaskStatus.EXECUTING.getCode())) {
|
||||||
// if (item.getBill_status().equals(IOSEnum.BILL_STATUS.code("生成"))) {
|
item.setTask_status(TaskStatus.EXECUTING.getName());
|
||||||
// item.setBill_status("生成");
|
}
|
||||||
// }
|
});
|
||||||
// if (item.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配中"))) {
|
|
||||||
// item.setBill_status("分配中");
|
return list;
|
||||||
// }
|
}
|
||||||
// if (item.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完"))) {
|
|
||||||
// item.setBill_status("分配完");
|
/**
|
||||||
// }
|
* 未完成单据
|
||||||
// Dict dict = dicts.stream()
|
*
|
||||||
// .filter(row -> row.getValue().equals(item.getBill_type()))
|
* @return List<IOStorInv>{
|
||||||
// .findFirst().orElse(null);
|
* 出入库实体类
|
||||||
// item.setBill_type(dict.getLabel());
|
* }
|
||||||
// });
|
*/
|
||||||
// return list;
|
private List<IOStorInv> unIos(String storCode) {
|
||||||
// }
|
|
||||||
//}
|
List<IOStorInv> list = iOutBillService.list(
|
||||||
|
new QueryWrapper<IOStorInv>().lambda()
|
||||||
|
.eq(IOStorInv::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||||
|
.eq(IOStorInv::getStor_code, storCode)
|
||||||
|
.ne(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||||
|
);
|
||||||
|
list.stream().forEach(item -> {
|
||||||
|
item.setIo_type(item.getIo_type().equals(IOSEnum.IO_TYPE.code("入库"))?"入库":"出库");
|
||||||
|
if (item.getBill_status().equals(IOSEnum.BILL_STATUS.code("生成"))) {
|
||||||
|
item.setBill_status("生成");
|
||||||
|
}
|
||||||
|
if (item.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配中"))) {
|
||||||
|
item.setBill_status("分配中");
|
||||||
|
}
|
||||||
|
if (item.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完"))) {
|
||||||
|
item.setBill_status("分配完");
|
||||||
|
}
|
||||||
|
item.setBill_type("dict.getLabel()");
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
280
nladmin-ui/src/views/wms/basedata/storagevehicleinfo/index2.vue
Normal file
280
nladmin-ui/src/views/wms/basedata/storagevehicleinfo/index2.vue
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<div v-if="crud.props.searchToggle">
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline"
|
||||||
|
label-position="right"
|
||||||
|
label-width="80px"
|
||||||
|
label-suffix=":"
|
||||||
|
>
|
||||||
|
<el-form-item label="载具类型">
|
||||||
|
<el-select
|
||||||
|
v-model="query.storagevehicle_type"
|
||||||
|
clearable
|
||||||
|
class="filter-item"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="crud.toQuery"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.storagevehicle_type"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模糊搜索">
|
||||||
|
<el-input
|
||||||
|
v-model="query.storagevehicle_code"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="载具号、载具名称"
|
||||||
|
style="width: 200px;"
|
||||||
|
class="filter-item"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<rrOperation />
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission" />
|
||||||
|
<!--表单组件-->
|
||||||
|
<el-dialog
|
||||||
|
:before-close="crud.cancelCU"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:title="crud.status.title"
|
||||||
|
:visible.sync="crud.status.cu > 0"
|
||||||
|
width="450px"
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
|
||||||
|
<el-form-item label="载具类型" prop="storagevehicle_type">
|
||||||
|
<el-select
|
||||||
|
v-model="form.storagevehicle_type"
|
||||||
|
class="filter-item"
|
||||||
|
placeholder="请选择"
|
||||||
|
:disabled="crud.status.edit > 0"
|
||||||
|
style="width: 200px;"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.storagevehicle_type"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="载具编码" prop="storagevehicle_code">
|
||||||
|
<el-input v-model="form.storagevehicle_code" style="width: 200px;" :disabled="crud.status.edit > 0" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="载具名称" prop="storagevehicle_name">
|
||||||
|
<el-input v-model="form.storagevehicle_name" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="载具重量" prop="weigth">
|
||||||
|
<el-input-number v-model="form.weigth" :precision="1" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否启用">
|
||||||
|
<el-radio v-model="form.is_used" label="0">否</el-radio>
|
||||||
|
<el-radio v-model="form.is_used" label="1">是</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="info" @click="crud.cancelCU">取消</el-button>
|
||||||
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
:data="crud.data"
|
||||||
|
size="mini"
|
||||||
|
style="width: 100%;"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column v-if="false" prop="storagevehicle_id" label="载具标识" />
|
||||||
|
<el-table-column prop="storagevehicle_type_name" label="载具类型" :formatter="formattType" />
|
||||||
|
<el-table-column prop="storagevehicle_code" label="载具编码" />
|
||||||
|
<el-table-column prop="storagevehicle_name" label="载具名称" />
|
||||||
|
<el-table-column prop="pcsn" label="绑定物料" />
|
||||||
|
<el-table-column prop="weigth" label="托盘重量" />
|
||||||
|
<el-table-column label="是否启用" align="center" prop="is_used">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.is_used"
|
||||||
|
active-color="#409EFF"
|
||||||
|
inactive-color="#F56C6C"
|
||||||
|
active-value="1"
|
||||||
|
inactive-value="0"
|
||||||
|
@change="changeEnabled(scope.row, scope.row.is_used)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="create_name" label="创建人" />
|
||||||
|
<el-table-column prop="create_time" label="创建时间" width="150px" />
|
||||||
|
<el-table-column
|
||||||
|
v-permission="['admin','storagevehicleinfo:edit','storagevehicleinfo:del']"
|
||||||
|
label="操作"
|
||||||
|
width="150px"
|
||||||
|
align="center"
|
||||||
|
fixed="right"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudStoragevehicleinfo from '@/views/wms/basedata/storagevehicleinfo/storagevehicleinfo'
|
||||||
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
|
||||||
|
const defaultForm = {
|
||||||
|
storagevehicle_id: null,
|
||||||
|
storagevehicle_code: null,
|
||||||
|
storagevehicle_name: null,
|
||||||
|
one_code: null,
|
||||||
|
two_code: null,
|
||||||
|
rfid_code: null,
|
||||||
|
create_id: null,
|
||||||
|
create_name: null,
|
||||||
|
create_time: null,
|
||||||
|
update_optid: null,
|
||||||
|
update_optname: null,
|
||||||
|
update_time: null,
|
||||||
|
is_delete: null,
|
||||||
|
is_used: '1',
|
||||||
|
storagevehicle_type: null,
|
||||||
|
weigth: null,
|
||||||
|
vehicle_width: null,
|
||||||
|
vehicle_long: null,
|
||||||
|
vehicle_height: null,
|
||||||
|
overstruct_type: null,
|
||||||
|
occupystruct_qty: null,
|
||||||
|
ext_id: null,
|
||||||
|
qty: null,
|
||||||
|
pcsn: null
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
name: 'Storagevehicleinfo',
|
||||||
|
dicts: ['storagevehicle_type', 'is_used'],
|
||||||
|
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '载具',
|
||||||
|
url: 'api/storagevehicleinfo',
|
||||||
|
idField: 'storagevehicle_id',
|
||||||
|
sort: 'storagevehicle_id,desc',
|
||||||
|
crudMethod: { ...crudStoragevehicleinfo },
|
||||||
|
optShow: {
|
||||||
|
add: true,
|
||||||
|
edit: false,
|
||||||
|
del: false,
|
||||||
|
download: false,
|
||||||
|
reset: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
var numberOne = (rule, value, callback) => {
|
||||||
|
const numReg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/
|
||||||
|
const numRe = new RegExp(numReg)
|
||||||
|
if (!numRe.test(value)) {
|
||||||
|
callback(new Error('只能输入数字'))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
resultCodeArr: [],
|
||||||
|
permission: {},
|
||||||
|
classes1: [],
|
||||||
|
rules: {
|
||||||
|
is_delete: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
is_used: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
storagevehicle_type: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
storagevehicle_code: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
storagevehicle_name: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
overstruct_type: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
num: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' },
|
||||||
|
{ validator: numberOne }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
hand(value) {
|
||||||
|
this.crud.toQuery()
|
||||||
|
},
|
||||||
|
// 改变状态
|
||||||
|
changeEnabled(data, val) {
|
||||||
|
this.$confirm('此操作将 "' + this.dict.label.is_used[val] + '" ' + data.storagevehicle_code + ', 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
crudStoragevehicleinfo.edit(data).then(res => {
|
||||||
|
this.crud.notify(this.dict.label.is_used[val] + '成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
}).catch(() => {
|
||||||
|
if (data.is_used === '0') {
|
||||||
|
data.is_used = '1'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.is_used === '1') {
|
||||||
|
data.is_used = '0'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
if (data.is_used === '0') {
|
||||||
|
data.is_used = '1'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.is_used === '1') {
|
||||||
|
data.is_used = '0'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
formattType(row) {
|
||||||
|
return this.dict.label.storagevehicle_type[row.storagevehicle_type]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user