优化页面,修正入库逻辑

This commit is contained in:
zgw
2025-12-22 16:44:13 +08:00
parent 34e931cf37
commit 9fc1cc53e9
10 changed files with 697 additions and 576 deletions

View File

@@ -40,7 +40,7 @@ public class ToWcsServiceImpl implements IToWcsService {
@Override @Override
//@Scheduled(fixedDelay=1500) @Scheduled(fixedDelay=1500)
public void pushOutMydoJob() { public void pushOutMydoJob() {
//查询所有未推送的料箱出库作业 //查询所有未推送的料箱出库作业
MydoJob mydoJobParam = new MydoJob(); MydoJob mydoJobParam = new MydoJob();

View File

@@ -110,17 +110,21 @@ public class ToWmsServiceImpl implements IToWmsService {
MydoJob mydoJob1 = mydoJobService.selectMydoJobByTrayCode(requestEnter.getTrayCode()); MydoJob mydoJob1 = mydoJobService.selectMydoJobByTrayCode(requestEnter.getTrayCode());
if (ObjUtil.isNotNull(mydoJob1) && !"1".equals(mydoJob1.getInOrOut())) { if (ObjUtil.isNotNull(mydoJob1) && !"1".equals(mydoJob1.getInOrOut())) {
//空托盘处理 //空托盘处理
String productId = "KTP0001"; if (mydoJob1.getCargoSpaceId()==null){
String cargoSpaceId = getCargoSpaceByProductInfo(productId); String productId = "KTP0001";
if (!StringUtils.isNotBlank(cargoSpaceId)) { String cargoSpaceId = getCargoSpaceByProductInfo(productId);
return AjaxResult.error("无符合条件的货位用于分配,请检查库存区占用情况,物料号:" + productId); if (!StringUtils.isNotBlank(cargoSpaceId)) {
return AjaxResult.error("无符合条件的货位用于分配,请检查库存区占用情况,物料号:" + productId);
}
mydoJob1.setCargoSpaceId(cargoSpaceId);
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(cargoSpaceId);
mydoJob1.setRoadwayId(basCargoSpace.getTheFloor().toString());
mydoJob1.setStatus("3");
mydoJobService.updateMydoJob(mydoJob1);
return AjaxResult.success(mydoJob1);
}else {
return AjaxResult.success(mydoJob1);
} }
mydoJob1.setCargoSpaceId(cargoSpaceId);
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(cargoSpaceId);
mydoJob1.setRoadwayId(basCargoSpace.getTheFloor().toString());
mydoJob1.setStatus("3");
mydoJobService.insertMydoJob(mydoJob1);
return AjaxResult.success(mydoJob1);
} }
//校验 - 条码已经有作业 //校验 - 条码已经有作业
if (ObjUtil.isNotNull(mydoJob1) && "1".equals(mydoJob1.getInOrOut())) { if (ObjUtil.isNotNull(mydoJob1) && "1".equals(mydoJob1.getInOrOut())) {
@@ -169,6 +173,7 @@ public class ToWmsServiceImpl implements IToWmsService {
mydoJobDetail.setInOrOutDId(stockinDetailId); mydoJobDetail.setInOrOutDId(stockinDetailId);
mydoJobDetail.setInOrOutId(inStockinDetail.getStockinId()); mydoJobDetail.setInOrOutId(inStockinDetail.getStockinId());
mydoJobDetailService.insertMydoJobDetail(mydoJobDetail); mydoJobDetailService.insertMydoJobDetail(mydoJobDetail);
trayMsgService.deleteTrayMsgById(trayMsg.getId());
return AjaxResult.success(mydoJob); return AjaxResult.success(mydoJob);
} }
@@ -188,52 +193,52 @@ public class ToWmsServiceImpl implements IToWmsService {
List<BasStock> stocks = basStockService.selectBasStockListByProductId(productId); List<BasStock> stocks = basStockService.selectBasStockListByProductId(productId);
//如果集合空 - 寻找未被占用的存储区组放货 //如果集合空 - 寻找未被占用的存储区组放货
if (stocks.size() == 0) { if (!stocks.isEmpty()) {
for (int i = 1; i <= 45; i++) { //如果物料已经存放在多个货位(区域) - 去重
BasCargoSpace cargospace = new BasCargoSpace(); List<BasStock> stocksNew = stocks.stream().distinct().collect(Collectors.toList());
//存储区 //查询对应货位的区域在【BasCargoSpace】是否有空位 - 在groupCodingNo的分组中是否仍然有状态【1】的货位
String groupCodingNo = String.format("%03d", i); for (BasStock stock : stocksNew) {
cargospace.setGroupCodingNo(groupCodingNo); //获取每种物料的存放货位信息
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stock.getCargoSpaceId());
//获取【groupCodingNo】所有货位 //获取每种物料的存放货位信息 - 存储区
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceList(cargospace); String group = cargoSpace.getGroupCodingNo();
//判断是否全部未占用,即某存储区全部为空位 - 避免物料混放 //获取该存储区组的所有货位
boolean isAllEmpty = cargoSpaces.stream().allMatch(c -> "1".equals(c.getStatus())); List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceListByGroupCodingNo(group);
//区域未占用 - 则分配最内侧货位 //在集合中获取状态为【1】的货位
if (isAllEmpty && cargoSpaces.size() > 0) { for (BasCargoSpace cs : cargoSpaces) {
cargoSpaces.sort(Comparator.comparing(BasCargoSpace::getGroupCoding).reversed()); //货位状态:1(未占用) -> 返回该货位结果
return cargoSpaces.get(0).getCargoSpaceId(); if ("1".equals(cs.getStatus())) {
return cs.getCargoSpaceId();
}
} }
}
}
}
for (int i = 1; i <= 45; i++) {
BasCargoSpace cargospace = new BasCargoSpace();
//存储区
String groupCodingNo = String.format("%03d", i);
cargospace.setGroupCodingNo(groupCodingNo);
//获取【groupCodingNo】所有货位
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceList(cargospace);
//判断是否全部未占用,即某存储区全部为空位 - 避免物料混放
boolean isAllEmpty = cargoSpaces.stream().allMatch(c -> "1".equals(c.getStatus()));
//区域未占用 - 则分配最内侧货位
if (isAllEmpty && cargoSpaces.size() > 0) {
cargoSpaces.sort(Comparator.comparing(BasCargoSpace::getGroupCoding).reversed());
return cargoSpaces.get(0).getCargoSpaceId();
}
} }
//如果物料已经存放在多个货位(区域) - 去重
List<BasStock> stocksNew = stocks.stream().distinct().collect(Collectors.toList());
//查询对应货位的区域在【BasCargoSpace】是否有空位 - 在groupCodingNo的分组中是否仍然有状态【1】的货位
for (BasStock stock : stocksNew) {
//获取每种物料的存放货位信息
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stock.getCargoSpaceId());
//获取每种物料的存放货位信息 - 存储区
String group = cargoSpace.getGroupCodingNo();
//获取该存储区组的所有货位
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceListByGroupCodingNo(group);
//在集合中获取状态为【1】的货位
for (BasCargoSpace cs : cargoSpaces) {
//货位状态:1(未占用) -> 返回该货位结果
if ("1".equals(cs.getStatus())) {
return cs.getCargoSpaceId();
}
}
}
} catch (Exception e) { } catch (Exception e) {
log.error("入库子单获取目标货位失败,异常信息:" + e.getMessage()); log.error("入库子单获取目标货位失败,异常信息:" + e.getMessage());
} }

View File

@@ -2,6 +2,7 @@ package com.ruoyi.bas.cargoSpace.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace; import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -36,7 +37,7 @@ public interface BasCargoSpaceMapper extends BaseMapper<BasCargoSpace>
* @param groupCodingNo 存储区组 * @param groupCodingNo 存储区组
* @return 库存信息集合 * @return 库存信息集合
*/ */
public List<BasCargoSpace> selectBasCargoSpaceListByGroupCodingNo(String groupCodingNo); public List<BasCargoSpace> selectBasCargoSpaceListByGroupCodingNo(@Param("groupCodingNo") String groupCodingNo);
/** /**
* 新增库存信息 * 新增库存信息

View File

@@ -278,8 +278,6 @@ public class MydoJobServiceImpl implements IMydoJobService {
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId()); BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
if (CollUtil.isNotEmpty(mydoJobDetails)) { if (CollUtil.isNotEmpty(mydoJobDetails)) {
List<BasStock> list = new ArrayList<>(); List<BasStock> list = new ArrayList<>();
//查询盘点信息中的异常信息 //查询盘点信息中的异常信息
CheckDifferenceRecord checkDifferenceRecordParam = new CheckDifferenceRecord(); CheckDifferenceRecord checkDifferenceRecordParam = new CheckDifferenceRecord();
checkDifferenceRecordParam.setTrayCode(mydoJob.getTrayCode()); checkDifferenceRecordParam.setTrayCode(mydoJob.getTrayCode());
@@ -307,18 +305,14 @@ public class MydoJobServiceImpl implements IMydoJobService {
//正常库存 //正常库存
list.add(stockByInStockinDetail); list.add(stockByInStockinDetail);
} }
} }
//修改货位状态 //修改货位状态
basCargoSpace.setStatus("2"); basCargoSpace.setStatus("2");
basCargoSpace.setTrayCode(mydoJob.getTrayCode()); basCargoSpace.setTrayCode(mydoJob.getTrayCode());
basCargoSpace.setCargoSpaceId(mydoJob.getCargoSpaceId()); basCargoSpace.setCargoSpaceId(mydoJob.getCargoSpaceId());
basCargoSpaceService.updateBasCargoSpace(basCargoSpace); basCargoSpaceService.updateBasCargoSpace(basCargoSpace);
//插入库存信息 //插入库存信息
basStockService.insertBasStockList(list); basStockService.insertBasStockList(list);
//结束任务 //结束任务
mydoJob.setStatus("4"); mydoJob.setStatus("4");
mydoJob.setFinishTime(DateUtil.formatDateTime(DateUtil.date())); mydoJob.setFinishTime(DateUtil.formatDateTime(DateUtil.date()));

View File

@@ -1,54 +1,53 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.bas.cargoSpace.mapper.BasCargoSpaceMapper"> <mapper namespace="com.ruoyi.bas.cargoSpace.mapper.BasCargoSpaceMapper">
<resultMap type="com.ruoyi.bas.cargoSpace.domain.BasCargoSpace" id="BasCargoSpaceResult"> <resultMap type="com.ruoyi.bas.cargoSpace.domain.BasCargoSpace" id="BasCargoSpaceResult">
<result property="cargoSpaceId" column="cargo_space_id" /> <result property="cargoSpaceId" column="cargo_space_id"/>
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id"/>
<result property="warehouseName" column="warehouse_name" /> <result property="warehouseName" column="warehouse_name"/>
<result property="roadwayId" column="roadway_id" /> <result property="roadwayId" column="roadway_id"/>
<result property="cargoAreaId" column="cargo_area_id" /> <result property="cargoAreaId" column="cargo_area_id"/>
<result property="theType" column="the_type" /> <result property="theType" column="the_type"/>
<result property="theTypeName" column="the_type_name" /> <result property="theTypeName" column="the_type_name"/>
<result property="cargoSpaceName" column="cargo_space_name" /> <result property="cargoSpaceName" column="cargo_space_name"/>
<result property="thePlatoon" column="the_platoon" /> <result property="thePlatoon" column="the_platoon"/>
<result property="theColumn" column="the_column" /> <result property="theColumn" column="the_column"/>
<result property="theFloor" column="the_floor" /> <result property="theFloor" column="the_floor"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="locked" column="locked" /> <result property="locked" column="locked"/>
<result property="trayCode" column="tray_code" /> <result property="trayCode" column="tray_code"/>
<result property="cargoHight" column="cargo_hight" /> <result property="cargoHight" column="cargo_hight"/>
<result property="issDouble" column="iss_double" /> <result property="issDouble" column="iss_double"/>
<result property="groupCodingNo" column="group_coding_no" /> <result property="groupCodingNo" column="group_coding_no"/>
<result property="groupCoding" column="group_coding" /> <result property="groupCoding" column="group_coding"/>
<result property="cargoSpaceLogo" column="cargo_space_logo" /> <result property="cargoSpaceLogo" column="cargo_space_logo"/>
<result property="thisCargoArea" column="this_cargo_area" /> <result property="thisCargoArea" column="this_cargo_area"/>
</resultMap> </resultMap>
<sql id="selectBasCargoSpaceVo"> <sql id="selectBasCargoSpaceVo">
select select bcs.cargo_space_id,
bcs.cargo_space_id, bcs.warehouse_id,
bcs.warehouse_id, bcs.roadway_id,
bcs.roadway_id, bcs.cargo_area_id,
bcs.cargo_area_id, bcs.the_type,
bcs.the_type, bcs.the_type_name,
bcs.the_type_name, bcs.cargo_space_name,
bcs.cargo_space_name, bcs.the_platoon,
bcs.the_platoon, bcs.the_column,
bcs.the_column, bcs.the_floor,
bcs.the_floor, bcs.status,
bcs.status, bcs.locked,
bcs.locked, bcs.tray_code,
bcs.tray_code, bcs.cargo_hight,
bcs.cargo_hight, bcs.iss_double,
bcs.iss_double, bcs.group_coding_no,
bcs.group_coding_no, bcs.group_coding,
bcs.group_coding, bcs.cargo_space_logo,
bcs.cargo_space_logo, bcs.this_cargo_area,
bcs.this_cargo_area, bw.warehouse_name
bw.warehouse_name
from bas_cargo_space bcs from bas_cargo_space bcs
left join bas_warehouse bw on bcs.warehouse_id = bw.warehouse_id left join bas_warehouse bw on bcs.warehouse_id = bw.warehouse_id
@@ -57,58 +56,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBasCargoSpaceList" resultMap="BasCargoSpaceResult"> <select id="selectBasCargoSpaceList" resultMap="BasCargoSpaceResult">
<include refid="selectBasCargoSpaceVo"/> <include refid="selectBasCargoSpaceVo"/>
<where> <where>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and bcs.cargo_space_id like concat('%', #{cargoSpaceId}, '%')</if> <if test="cargoSpaceId != null and cargoSpaceId != ''">and bcs.cargo_space_id like concat('%',
<if test="warehouseId != null and warehouseId != ''"> and bcs.warehouse_id = #{warehouseId}</if> #{cargoSpaceId}, '%')
<if test="roadwayId != null and roadwayId != ''"> and bcs.roadway_id = #{roadwayId}</if> </if>
<if test="cargoAreaId != null and cargoAreaId != ''"> and bcs.cargo_area_id = #{cargoAreaId}</if> <if test="warehouseId != null and warehouseId != ''">and bcs.warehouse_id = #{warehouseId}</if>
<if test="theType != null and theType != ''"> and bcs.the_type = #{theType}</if> <if test="roadwayId != null and roadwayId != ''">and bcs.roadway_id = #{roadwayId}</if>
<if test="theTypeName != null and theTypeName != ''"> and bcs.the_type_name like concat('%', #{theTypeName}, '%')</if> <if test="cargoAreaId != null and cargoAreaId != ''">and bcs.cargo_area_id = #{cargoAreaId}</if>
<if test="cargoSpaceName != null and cargoSpaceName != ''"> and bcs.cargo_space_name like concat('%', #{cargoSpaceName}, '%')</if> <if test="theType != null and theType != ''">and bcs.the_type = #{theType}</if>
<if test="thePlatoon != null "> and bcs.the_platoon = #{thePlatoon}</if> <if test="theTypeName != null and theTypeName != ''">and bcs.the_type_name like concat('%', #{theTypeName},
<if test="theColumn != null "> and bcs.the_column = #{theColumn}</if> '%')
<if test="theFloor != null "> and bcs.the_floor = #{theFloor}</if> </if>
<if test="status != null and status != ''"> and bcs.status = #{status}</if> <if test="cargoSpaceName != null and cargoSpaceName != ''">and bcs.cargo_space_name like concat('%',
<if test="locked != null and locked != ''"> and bcs.locked = #{locked}</if> #{cargoSpaceName}, '%')
<if test="trayCode != null and trayCode != ''"> and bcs.tray_code like concat('%', #{trayCode}, '%')</if> </if>
<if test="cargoHight != null and cargoHight != ''"> and bcs.cargo_hight = #{cargoHight}</if> <if test="thePlatoon != null ">and bcs.the_platoon = #{thePlatoon}</if>
<if test="issDouble != null and issDouble != ''"> and bcs.iss_double = #{issDouble}</if> <if test="theColumn != null ">and bcs.the_column = #{theColumn}</if>
<if test="groupCodingNo != null and groupCodingNo != ''"> and bcs.group_coding_no = #{groupCodingNo}</if> <if test="theFloor != null ">and bcs.the_floor = #{theFloor}</if>
<if test="groupCoding != null and groupCoding != ''"> and bcs.group_coding = #{groupCoding}</if> <if test="status != null and status != ''">and bcs.status = #{status}</if>
<if test="cargoSpaceLogo != null and cargoSpaceLogo != ''"> and bcs.cargo_space_logo = #{cargoSpaceLogo}</if> <if test="locked != null and locked != ''">and bcs.locked = #{locked}</if>
<if test="thisCargoArea != null and thisCargoArea != ''"> and bcs.this_cargo_area = #{thisCargoArea}</if> <if test="trayCode != null and trayCode != ''">and bcs.tray_code like concat('%', #{trayCode}, '%')</if>
<if test="cargoHight != null and cargoHight != ''">and bcs.cargo_hight = #{cargoHight}</if>
<if test="issDouble != null and issDouble != ''">and bcs.iss_double = #{issDouble}</if>
<if test="groupCodingNo != null and groupCodingNo != ''">and bcs.group_coding_no = #{groupCodingNo}</if>
<if test="groupCoding != null and groupCoding != ''">and bcs.group_coding = #{groupCoding}</if>
<if test="cargoSpaceLogo != null and cargoSpaceLogo != ''">and bcs.cargo_space_logo = #{cargoSpaceLogo}
</if>
<if test="thisCargoArea != null and thisCargoArea != ''">and bcs.this_cargo_area = #{thisCargoArea}</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''"> <if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope} ${params.warehouseDataScope}
</if> </if>
</where> </where>
order by case when bcs.status='1' then 0 else 1 end asc, bcs.the_platoon asc, bcs.the_column asc, bcs.the_floor asc order by case when bcs.status='1' then 0 else 1 end asc, bcs.the_platoon asc, bcs.the_column asc, bcs.the_floor
asc
</select> </select>
<select id="selectBasCargoSpaceListByGroupCodingNo" parameterType="string" resultMap="BasCargoSpaceResult"> <select id="selectBasCargoSpaceListByGroupCodingNo" parameterType="string" resultMap="BasCargoSpaceResult">
<include refid="selectBasCargoSpaceVo"/> <include refid="selectBasCargoSpaceVo"/>
<where> where
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and bcs.cargo_space_id like concat('%', #{cargoSpaceId}, '%')</if> group_coding_no = #{groupCodingNo}
<if test="warehouseId != null and warehouseId != ''"> and bcs.warehouse_id = #{warehouseId}</if>
<if test="roadwayId != null and roadwayId != ''"> and bcs.roadway_id = #{roadwayId}</if>
<if test="cargoAreaId != null and cargoAreaId != ''"> and bcs.cargo_area_id = #{cargoAreaId}</if>
<if test="theType != null and theType != ''"> and bcs.the_type = #{theType}</if>
<if test="theTypeName != null and theTypeName != ''"> and bcs.the_type_name like concat('%', #{theTypeName}, '%')</if>
<if test="cargoSpaceName != null and cargoSpaceName != ''"> and bcs.cargo_space_name like concat('%', #{cargoSpaceName}, '%')</if>
<if test="thePlatoon != null "> and bcs.the_platoon = #{thePlatoon}</if>
<if test="theColumn != null "> and bcs.the_column = #{theColumn}</if>
<if test="theFloor != null "> and bcs.the_floor = #{theFloor}</if>
<if test="status != null and status != ''"> and bcs.status = #{status}</if>
<if test="locked != null and locked != ''"> and bcs.locked = #{locked}</if>
<if test="trayCode != null and trayCode != ''"> and bcs.tray_code like concat('%', #{trayCode}, '%')</if>
<if test="cargoHight != null and cargoHight != ''"> and bcs.cargo_hight = #{cargoHight}</if>
<if test="issDouble != null and issDouble != ''"> and bcs.iss_double = #{issDouble}</if>
<if test="groupCodingNo != null and groupCodingNo != ''"> and bcs.group_coding_no = #{groupCodingNo}</if>
<if test="groupCoding != null and groupCoding != ''"> and bcs.group_coding = #{groupCoding}</if>
<if test="cargoSpaceLogo != null and cargoSpaceLogo != ''"> and bcs.cargo_space_logo = #{cargoSpaceLogo}</if>
<if test="thisCargoArea != null and thisCargoArea != ''"> and bcs.this_cargo_area = #{thisCargoArea}</if>
<!-- <if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">-->
<!-- ${params.warehouseDataScope}-->
<!-- </if>-->
</where>
order by group_coding desc order by group_coding desc
</select> </select>
@@ -140,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="groupCoding != null">group_coding,</if> <if test="groupCoding != null">group_coding,</if>
<if test="cargoSpaceLogo != null">cargo_space_logo,</if> <if test="cargoSpaceLogo != null">cargo_space_logo,</if>
<if test="thisCargoArea != null">this_cargo_area,</if> <if test="thisCargoArea != null">this_cargo_area,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cargoSpaceId != null">#{cargoSpaceId},</if> <if test="cargoSpaceId != null">#{cargoSpaceId},</if>
<if test="warehouseId != null and warehouseId != ''">#{warehouseId},</if> <if test="warehouseId != null and warehouseId != ''">#{warehouseId},</if>
@@ -161,7 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="groupCoding != null">#{groupCoding},</if> <if test="groupCoding != null">#{groupCoding},</if>
<if test="cargoSpaceLogo != null">#{cargoSpaceLogo},</if> <if test="cargoSpaceLogo != null">#{cargoSpaceLogo},</if>
<if test="thisCargoArea != null">#{thisCargoArea},</if> <if test="thisCargoArea != null">#{thisCargoArea},</if>
</trim> </trim>
</insert> </insert>
<update id="updateBasCargoSpace" parameterType="BasCargoSpace"> <update id="updateBasCargoSpace" parameterType="BasCargoSpace">
@@ -191,14 +176,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="lockedCargoSpace"> <update id="lockedCargoSpace">
update bas_cargo_space update bas_cargo_space
set locked = #{locked} set locked = #{locked}
where group_coding_no in ( where group_coding_no in (select group_coding_no from bas_cargo_space where cargo_space_id = #{cargoSpaceId})
select group_coding_no from bas_cargo_space where cargo_space_id = #{cargoSpaceId} and group_coding > #{groupCoding}
)
and group_coding > #{groupCoding}
</update> </update>
<delete id="deleteBasCargoSpaceByCargoSpaceId" parameterType="String"> <delete id="deleteBasCargoSpaceByCargoSpaceId" parameterType="String">
delete from bas_cargo_space where cargo_space_id = #{cargoSpaceId} delete
from bas_cargo_space
where cargo_space_id = #{cargoSpaceId}
</delete> </delete>
<delete id="deleteBasCargoSpaceByCargoSpaceIds" parameterType="String"> <delete id="deleteBasCargoSpaceByCargoSpaceIds" parameterType="String">
@@ -209,9 +194,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="selectStatusCount" resultType="java.util.Map"> <select id="selectStatusCount" resultType="java.util.Map">
SELECT SELECT status,
status, COUNT(*) as count
COUNT(*) as count
FROM bas_cargo_space FROM bas_cargo_space
GROUP BY status GROUP BY status
</select> </select>
@@ -219,7 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT TOP 1 cargo_space_id as cargoSpaceId SELECT TOP 1 cargo_space_id as cargoSpaceId
FROM bas_cargo_space FROM bas_cargo_space
WHERE status = '1' WHERE status = '1'
and locked = 'N' and locked = 'N'
<if test="warehouseId != null"> <if test="warehouseId != null">
and warehouse_id = #{warehouseId} and warehouse_id = #{warehouseId}
</if> </if>
@@ -255,24 +239,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join bas_stock bs on bs.cargo_space_id = bcs.cargo_space_id left join bas_stock bs on bs.cargo_space_id = bcs.cargo_space_id
left join bas_product bp on bp.product_id = bs.product_id left join bas_product bp on bp.product_id = bs.product_id
where br.out_locked = 'N' where br.out_locked = 'N'
<if test="warehouseId != null and warehouseId != ''"> and bcs.warehouse_id = #{warehouseId}</if> <if test="warehouseId != null and warehouseId != ''">and bcs.warehouse_id = #{warehouseId}</if>
<if test="roadwayId != null and roadwayId != ''"> and bcs.roadway_id = #{roadwayId}</if> <if test="roadwayId != null and roadwayId != ''">and bcs.roadway_id = #{roadwayId}</if>
<if test="cargoAreaId != null and cargoAreaId != ''"> and bcs.cargo_area_id = #{cargoAreaId}</if> <if test="cargoAreaId != null and cargoAreaId != ''">and bcs.cargo_area_id = #{cargoAreaId}</if>
<if test="theType != null and theType != ''"> and bcs.the_type = #{theType}</if> <if test="theType != null and theType != ''">and bcs.the_type = #{theType}</if>
<if test="theTypeName != null and theTypeName != ''"> and bcs.the_type_name like concat('%', #{theTypeName}, '%')</if> <if test="theTypeName != null and theTypeName != ''">and bcs.the_type_name like concat('%', #{theTypeName},
<if test="cargoSpaceName != null and cargoSpaceName != ''"> and bcs.cargo_space_name like concat('%', #{cargoSpaceName}, '%')</if> '%')
<if test="thePlatoon != null "> and bcs.the_platoon = #{thePlatoon}</if> </if>
<if test="theColumn != null "> and bcs.the_column = #{theColumn}</if> <if test="cargoSpaceName != null and cargoSpaceName != ''">and bcs.cargo_space_name like concat('%',
<if test="theFloor != null "> and bcs.the_floor = #{theFloor}</if> #{cargoSpaceName}, '%')
<if test="status != null and status != ''"> and bcs.status = #{status}</if> </if>
<if test="locked != null and locked != ''"> and bcs.locked = #{locked}</if> <if test="thePlatoon != null ">and bcs.the_platoon = #{thePlatoon}</if>
<if test="trayCode != null and trayCode != ''"> and bcs.tray_code like concat('%', #{trayCode}, '%')</if> <if test="theColumn != null ">and bcs.the_column = #{theColumn}</if>
<if test="cargoHight != null and cargoHight != ''"> and bcs.cargo_hight = #{cargoHight}</if> <if test="theFloor != null ">and bcs.the_floor = #{theFloor}</if>
<if test="issDouble != null and issDouble != ''"> and bcs.iss_double = #{issDouble}</if> <if test="status != null and status != ''">and bcs.status = #{status}</if>
<if test="groupCodingNo != null and groupCodingNo != ''"> and bcs.group_coding_no = #{groupCodingNo}</if> <if test="locked != null and locked != ''">and bcs.locked = #{locked}</if>
<if test="groupCoding != null and groupCoding != ''"> and bcs.group_coding = #{groupCoding}</if> <if test="trayCode != null and trayCode != ''">and bcs.tray_code like concat('%', #{trayCode}, '%')</if>
<if test="cargoSpaceLogo != null and cargoSpaceLogo != ''"> and bcs.cargo_space_logo = #{cargoSpaceLogo}</if> <if test="cargoHight != null and cargoHight != ''">and bcs.cargo_hight = #{cargoHight}</if>
<if test="spare7 != null and spare7 != ''"> and bs.spare7 = #{spare7}</if> <if test="issDouble != null and issDouble != ''">and bcs.iss_double = #{issDouble}</if>
<if test="stockStatus != null and stockStatus != ''"> and bs.stock_status = #{stockStatus}</if> <if test="groupCodingNo != null and groupCodingNo != ''">and bcs.group_coding_no = #{groupCodingNo}</if>
<if test="groupCoding != null and groupCoding != ''">and bcs.group_coding = #{groupCoding}</if>
<if test="cargoSpaceLogo != null and cargoSpaceLogo != ''">and bcs.cargo_space_logo = #{cargoSpaceLogo}</if>
<if test="spare7 != null and spare7 != ''">and bs.spare7 = #{spare7}</if>
<if test="stockStatus != null and stockStatus != ''">and bs.stock_status = #{stockStatus}</if>
</select> </select>
</mapper> </mapper>

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="任务ID" prop="jobId"> <!-- <el-form-item label="任务ID" prop="jobId">
<el-input <el-input
v-model="queryParams.jobId" v-model="queryParams.jobId"
placeholder="请输入任务ID" placeholder="请输入任务ID"
@@ -10,33 +10,19 @@
/> />
</el-form-item>--> </el-form-item>-->
<el-form-item label="任务状态" prop="status"> <el-form-item label="任务状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择任务状态" > <el-select v-model="queryParams.status" placeholder="请选择任务状态">
<el-option <el-option v-for="dict in dict.type.mydo_job_status" :key="dict.value" :label="dict.label"
v-for="dict in dict.type.mydo_job_status" :value="dict.value" />
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="任务号" prop="taskNo"> <el-form-item label="任务号" prop="taskNo">
<el-input <el-input v-model="queryParams.taskNo" placeholder="请输入任务号" clearable @keyup.enter.native="handleQuery" />
v-model="queryParams.taskNo" </el-form-item>
placeholder="请输入任务号" <el-form-item label="托盘条码" prop="trayCode">
clearable <el-input v-model="queryParams.trayCode" placeholder="请输入托盘码" clearable @keyup.enter.native="handleQuery" />
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="托盘码" prop="trayCode">
<el-input
v-model="queryParams.trayCode"
placeholder="请输入托盘码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="执行阶段" prop="executionPhase"> <!-- <el-form-item label="执行阶段" prop="executionPhase">
<el-select v-model="queryParams.executionPhase" placeholder="请选择执行阶段" clearable> <el-select v-model="queryParams.executionPhase" placeholder="请选择执行阶段" clearable>
<el-option <el-option
v-for="dict in dict.type.execution_phase_type" v-for="dict in dict.type.execution_phase_type"
@@ -46,7 +32,7 @@
/> />
</el-select> </el-select>
</el-form-item>--> </el-form-item>-->
<!-- <el-form-item label="任务类型" prop="inOrOut"> <!-- <el-form-item label="任务类型" prop="inOrOut">
<el-select v-model="queryParams.inOrOut" placeholder="请选择任务类型" clearable> <el-select v-model="queryParams.inOrOut" placeholder="请选择任务类型" clearable>
<el-option <el-option
v-for="dict in dict.type.in_job_type" v-for="dict in dict.type.in_job_type"
@@ -57,22 +43,16 @@
</el-select> </el-select>
</el-form-item>--> </el-form-item>-->
<el-form-item label="开始时间" prop="startTime"> <el-form-item label="开始时间" prop="startTime">
<el-date-picker clearable <el-date-picker clearable v-model="queryParams.startTime" type="date" value-format="yyyy-MM-dd"
v-model="queryParams.startTime" placeholder="请选择开始时间">
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择开始时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="结束时间" prop="finishTime"> <el-form-item label="结束时间" prop="finishTime">
<el-date-picker clearable <el-date-picker clearable v-model="queryParams.finishTime" type="date" value-format="yyyy-MM-dd"
v-model="queryParams.finishTime" placeholder="请选择结束时间">
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择结束时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<!-- <el-form-item label="入口" prop="entranceId"> <!-- <el-form-item label="入口" prop="entranceId">
<el-input <el-input
v-model="queryParams.entranceId" v-model="queryParams.entranceId"
placeholder="请输入入口" placeholder="请输入入口"
@@ -80,7 +60,8 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item>--> </el-form-item>-->
<el-form-item label="仓库" prop="warehouseId"><!--仓库--> <!--仓库-->
<!-- <el-form-item label="仓库" prop="warehouseId">
<el-select <el-select
v-model="queryParams.warehouseId" v-model="queryParams.warehouseId"
placeholder="请选择仓库" placeholder="请选择仓库"
@@ -94,156 +75,96 @@
:value="item.warehouseId" :value="item.warehouseId"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-card class="box-card">
<el-col :span="1.5"> <el-row :gutter="10" class="mb8">
<el-button <el-col :span="1.5">
type="danger" <el-button type="danger" plain icon="el-icon-edit" size="mini"
plain @click="handleCompletedManually({ type: 'invalid' })"
icon="el-icon-edit" v-hasPermi="['job:mydoJob:manualInvalidation']">手动作废</el-button>
size="mini" </el-col>
@click="handleCompletedManually({type: 'invalid'})" <el-col :span="1.5">
v-hasPermi="['job:mydoJob:manualInvalidation']" <el-button type="success" plain icon="el-icon-edit" size="mini"
>手动作废</el-button><!--手动作废--> @click="handleCompletedManually({ type: 'completed' })"
</el-col> v-hasPermi="['job:mydoJob:manualCompleted']">手动完成</el-button>
<el-col :span="1.5"> </el-col>
<el-button <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
type="success" </el-row>
plain
icon="el-icon-edit"
size="mini"
@click="handleCompletedManually({type: 'completed'})"
v-hasPermi="['job:mydoJob:manualCompleted']"
>手动完成</el-button><!--手动完成-->
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange" @row-click="handleRowClick" highlight-current-row :current-row="currentRow" <el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange"
max-height="400"> @row-click="handleRowClick" highlight-current-row :current-row="currentRow" max-height="405">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="任务ID" align="left" prop="jobId" fixed width="140" /> <el-table-column label="任务ID" align="center" prop="jobId" width="125" />
<el-table-column label="任务状态" align="left" prop="status"> <el-table-column label="任务状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.mydo_job_status" :value="scope.row.status"/> <dict-tag :options="dict.type.mydo_job_status" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="上线类型" align="left" prop="onLineType">--> <el-table-column label="任务类型" align="center" prop="inOrOut">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <dict-tag :options="dict.type.on_line_type" :value="scope.row.onLineType"/>--> <dict-tag :options="dict.type.in_job_type" :value="scope.row.inOrOut" />
<!-- </template>--> </template>
<!-- </el-table-column>--> </el-table-column>
<el-table-column label="任务类型" align="left" prop="inOrOut"> <el-table-column label="任务号" align="center" prop="taskNo" />
<template slot-scope="scope"> <el-table-column label="托盘码" align="center" prop="trayCode" width="100" />
<dict-tag :options="dict.type.in_job_type" :value="scope.row.inOrOut"/> <el-table-column label="货位" align="center" prop="cargoSpaceName" width="80" />
</template> <!-- <el-table-column label="仓库" align="center" prop="warehouseName" /> -->
</el-table-column> <el-table-column label="创建时间" align="center" prop="createTime" width="135" />
<el-table-column label="任务号" align="left" prop="taskNo" /> <!-- <el-table-column label="开始时间" align="center" prop="startTime" width="135"/> -->
<el-table-column label="托盘码" align="left" prop="trayCode" width="140" /> <el-table-column label="结束时间" align="center" prop="finishTime" width="135" />
<el-table-column label="货位" align="left" prop="cargoSpaceName" width="140" /> </el-table>
<!-- <el-table-column label="优先级" align="left" prop="priority" />-->
<!-- <el-table-column label="执行阶段" align="left" prop="executionPhase">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="订单号" align="left" prop="lineId" />-->
<!-- <el-table-column label="入口" align="left" prop="entranceId" />-->
<el-table-column label="仓库" align="left" prop="warehouseName" />
<el-table-column label="创建时间" align="left" prop="createTime" width="180"/>
<el-table-column label="开始时间" align="left" prop="startTime" width="180"/>
<el-table-column label="结束时间" align="left" prop="finishTime" width="180"/>
</el-table>
<pagination <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
v-show="total>0" @pagination="getList" />
:total="total" </el-card>
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-table v-loading="detailLoading" :data="mydoJobDetailList" @selection-change="handleSelectionChange" <el-card class="box-card" style="margin-top: 20px;">
max-height="300" <div slot="header" class="clearfix">
> <span>任务明细列表</span>
<el-table-column type="selection" width="55" align="center" /> </div>
<el-table-column label="子任务ID" align="left" prop="jobDetailId" width="160" /> <el-table v-loading="detailLoading" :data="mydoJobDetailList" @selection-change="handleSelectionChange"
<el-table-column label="任务ID" align="left" prop="jobId" width="160" /> max-height="300">
<el-table-column label="单据ID" align="left" prop="inOrOutId" width="160" /> <el-table-column label="子任务ID" align="center" prop="jobDetailId" width="135" />
<el-table-column label="子单据ID" align="left" prop="inOrOutDId" width="160" /> <!-- <el-table-column label="任务ID" align="left" prop="jobId" width="160" /> -->
<el-table-column label="物料编码" align="left" prop="productId" width="160" /> <el-table-column label="单据ID" align="center" prop="inOrOutId" width="160" />
<el-table-column label="物料名称" align="left" prop="productName" width="160" /> <el-table-column label="子单据ID" align="center" prop="inOrOutDId" width="160" />
<el-table-column label="批号" align="left" prop="lotNo" /> <el-table-column label="物料编码" align="center" prop="productId" width="160" />
<el-table-column label="入库数量" align="right" prop="inQuantity" /> <el-table-column label="物料名称" align="center" prop="productName" width="160" />
<el-table-column label="生产图号" align="left" prop="cargoNo" width="160"/> <!-- <el-table-column label="批号" align="center" prop="lotNo" /> -->
<el-table-column label="单价" align="left" prop="printDate" /> <el-table-column label="入库数量" align="center" prop="inQuantity" />
<el-table-column label="供应商" align="left" prop="supplierName" width="160"/> <!-- <el-table-column label="生产图号" align="center" prop="cargoNo" width="160"/> -->
<!-- <el-table-column label="来源" align="left" prop="spare1" > <!-- <el-table-column label="单价" align="center" prop="printDate" /> -->
<template slot-scope="scope"> <!-- <el-table-column label="供应商" align="center" prop="supplierName" width="160"/> -->
<dict-tag :options="dict.type.origin_type" :value="scope.row.spare1"/> </el-table>
</template>
</el-table-column>
<el-table-column label="状态" align="left" prop="spare2" >
<template slot-scope="scope">
<dict-tag :options="dict.type.turnover_type" :value="scope.row.spare2"/>
</template>
</el-table-column>
<el-table-column label="套账" align="left" prop="spare3" >
<template slot-scope="scope">
<dict-tag :options="dict.type.account_type" :value="scope.row.spare3"/>
</template>
</el-table-column>
<el-table-column label="用途" align="left" prop="spare4" >
<template slot-scope="scope">
<dict-tag :options="dict.type.purpose_type" :value="scope.row.spare4"/>
</template>
</el-table-column>
<el-table-column label="台次" align="left" prop="spare5" />
<el-table-column label="合同号" align="left" prop="spare6" />
<el-table-column label="件次" align="left" prop="spare7" />
<el-table-column label="质量等级" align="left" prop="spare8" >
<template slot-scope="scope">
<dict-tag :options="dict.type.quality_type" :value="scope.row.spare8"/>
</template>
</el-table-column>
<el-table-column label="管理号" align="left" prop="spare9" />
<el-table-column label="规格" align="left" prop="spec" width="160"/>
<el-table-column label="单位" align="left" prop="unit" /> -->
</el-table> <pagination v-show="detailTotal > 0" :total="detailTotal" :page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize" @pagination="getDetailList" />
<pagination </el-card>
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</div> </div>
</template> </template>
<script> <script>
import { listMydoJob,manualInvalidation,manualCompleted, getMydoJob, delMydoJob, addMydoJob, updateMydoJob } from "@/api/job/inmydoJob" import { listMydoJob, manualInvalidation, manualCompleted, getMydoJob, delMydoJob, addMydoJob, updateMydoJob } from "@/api/job/inmydoJob"
import { listMydoJobDetail } from "@/api/job/mydoJobDetail" import { listMydoJobDetail } from "@/api/job/mydoJobDetail"
import {listWarehouse} from "@/api/bas/warehouse"; import { listWarehouse } from "@/api/bas/warehouse";
export default { export default {
name: "MydoJob", name: "MydoJob",
dicts: ['execution_phase_type', 'in_job_type', 'on_line_type', 'mydo_job_status','product_type','origin_type','account_type','turnover_type','purpose_type','quality_type'], dicts: ['execution_phase_type', 'in_job_type', 'on_line_type', 'mydo_job_status', 'product_type', 'origin_type', 'account_type', 'turnover_type', 'purpose_type', 'quality_type'],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
detailLoading:false, detailLoading: false,
warehouseOptions:[], warehouseOptions: [],
// 选中数组 // 选中数组
ids: [], ids: [],
// 非单个禁用 // 非单个禁用
@@ -258,9 +179,9 @@ export default {
// 任务表表格数据 // 任务表表格数据
mydoJobList: [], mydoJobList: [],
// 子任务表表格数据 // 子任务表表格数据
mydoJobDetailList:[], mydoJobDetailList: [],
// 当前选中行 // 当前选中行
currentRow:null, currentRow: null,
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
@@ -294,15 +215,15 @@ export default {
classId: null, classId: null,
warehouseId: null, warehouseId: null,
faultFlag: null, faultFlag: null,
inOut:"1" inOut: "1"
}, },
queryDetailParams:{ queryDetailParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
jobId: null, jobId: null,
status: null, status: null,
}, },
queryWarehouseParams:{ queryWarehouseParams: {
pageNum: 1, pageNum: 1,
pageSize: 99, pageSize: 99,
}, },
@@ -406,7 +327,7 @@ export default {
return; return;
} }
this.ids = selection.map(item => item.jobId); this.ids = selection.map(item => item.jobId);
this.single = selection.length!==1; this.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
@@ -422,9 +343,9 @@ export default {
return; return;
} }
var data = { var data = {
"jobId": jobIds[0], "jobId": jobIds[0],
} }
if (row.type === 'invalid'){ if (row.type === 'invalid') {
//手动作废 //手动作废
manualInvalidation(data).then(response => { manualInvalidation(data).then(response => {
this.$modal.msgSuccess('操作成功'); this.$modal.msgSuccess('操作成功');
@@ -432,7 +353,7 @@ export default {
}) })
}else if (row.type === 'completed'){ } else if (row.type === 'completed') {
//手动完成 //手动完成
manualCompleted(data).then(response => { manualCompleted(data).then(response => {
this.$modal.msgSuccess('操作成功'); this.$modal.msgSuccess('操作成功');
@@ -479,10 +400,11 @@ export default {
</script> </script>
<style scoped> <style scoped>
.el-table >>> .current-row { .el-table>>>.current-row {
background-color: #f0f9eb; background-color: #f0f9eb;
} }
.el-form-item >>> .el-form-item__label {
.el-form-item>>>.el-form-item__label {
white-space: nowrap; white-space: nowrap;
width: auto; width: auto;
min-width: fit-content; min-width: fit-content;

View File

@@ -1,78 +1,65 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="状态" prop="status"> <!-- 状态 -->
<el-select v-model="queryParams.status" placeholder="请选择状态" > <el-form-item label="作业状态" prop="status"> <!-- 状态 -->
<el-option <el-select v-model="queryParams.status" placeholder="请选择状态">
v-for="dict in dict.type.mydo_job_status" <el-option v-for="dict in dict.type.mydo_job_status" :key="dict.value" :label="dict.label"
:key="dict.value" :value="dict.value" />
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="任务号" prop="taskNo"> <!-- 任务号 --> <el-form-item label="任务号" prop="taskNo"> <!-- 任务号 -->
<el-input <el-input v-model="queryParams.taskNo" placeholder="请输入任务号" clearable @keyup.enter.native="handleQuery" />
v-model="queryParams.taskNo"
placeholder="请输入任务号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="托盘条码" prop="trayCode"> &lt;!&ndash; 托盘条码 &ndash;&gt;-->
<!-- <el-input-->
<!-- v-model="queryParams.trayCode"-->
<!-- placeholder="请输入托盘条码"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="作业类型" prop="inOrOut"> &lt;!&ndash; 作业类型 &ndash;&gt;--> <el-form-item label="托盘条码" prop="trayCode">
<!-- <el-select v-model="queryParams.inOrOut" placeholder="请选择作业类型" clearable>--> <el-input
<!-- <el-option--> v-model="queryParams.trayCode"
<!-- v-for="dict in dict.type.out_job_type"--> placeholder="请输入托盘条码"
<!-- :key="dict.value"--> clearable
<!-- :label="dict.label"--> @keyup.enter.native="handleQuery"
<!-- :value="dict.value"--> />
<!-- />--> </el-form-item>
<!-- </el-select>-->
<!-- </el-form-item>--> <!-- <el-form-item label="作业类型" prop="inOrOut"> &lt;!&ndash; 作业类型 &ndash;&gt;-->
<!-- <el-select v-model="queryParams.inOrOut" placeholder="请选择作业类型" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.out_job_type"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="开始时间" prop="startTime"> <!-- 开始时间 --> <el-form-item label="开始时间" prop="startTime"> <!-- 开始时间 -->
<el-date-picker clearable <el-date-picker clearable v-model="queryParams.startTime" type="date" value-format="yyyy-MM-dd"
v-model="queryParams.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择开始时间"> placeholder="请选择开始时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="结束时间" prop="finishTime"> <!-- 结束时间 --> <el-form-item label="结束时间" prop="finishTime"> <!-- 结束时间 -->
<el-date-picker clearable <el-date-picker clearable v-model="queryParams.finishTime" type="date" value-format="yyyy-MM-dd"
v-model="queryParams.finishTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择结束时间"> placeholder="请选择结束时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<!-- <el-form-item label="仓库" prop="warehouseId"> &lt;!&ndash; 仓库 &ndash;&gt;--> <!-- <el-form-item label="仓库" prop="warehouseId"> &lt;!&ndash; 仓库 &ndash;&gt;-->
<!-- <el-select--> <!-- <el-select-->
<!-- v-model="queryParams.warehouseId"--> <!-- v-model="queryParams.warehouseId"-->
<!-- placeholder="请选择仓库"--> <!-- placeholder="请选择仓库"-->
<!-- clearable--> <!-- clearable-->
<!-- >--> <!-- >-->
<!-- <el-option--> <!-- <el-option-->
<!-- v-for="dict in warehouseOptions"--> <!-- v-for="dict in warehouseOptions"-->
<!-- :key="dict.warehouseId"--> <!-- :key="dict.warehouseId"-->
<!-- :label="dict.warehouseName"--> <!-- :label="dict.warehouseName"-->
<!-- :value="dict.warehouseId"--> <!-- :value="dict.warehouseId"-->
<!-- />--> <!-- />-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <!-- 搜索 --> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <!-- 搜索 -->
@@ -80,112 +67,98 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-card class="box-card">
<el-col :span="1.5"> <el-row :gutter="10" class="mb8">
<el-button <el-col :span="1.5">
type="success" <el-button type="success" plain icon="el-icon-edit" size="mini" @click="OuthandFinish"
plain v-hasPermi="['job:outmydoJob:OuthandFinish']">手动完成</el-button> <!-- 手动完成 -->
icon="el-icon-edit" </el-col>
size="mini" <el-col :span="1.5">
@click="OuthandFinish" <el-button type="danger" plain icon="el-icon-download" size="mini" @click="OuthandInvalidation"
v-hasPermi="['job:outmydoJob:OuthandFinish']" v-hasPermi="['job:outmydoJob:OuthandInvalidation']">手动作废</el-button> <!-- 手动作废 -->
>手动完成</el-button> <!-- 手动完成 --> </el-col>
</el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<el-col :span="1.5"> </el-row>
<el-button
type="danger"
plain
icon="el-icon-download"
size="mini"
@click="OuthandInvalidation"
v-hasPermi="['job:outmydoJob:OuthandInvalidation']"
>手动作废</el-button> <!-- 手动作废 -->
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange" @row-click="handleRowClick" highlight-current-row :current-row="currentRow" max-height="400"> <el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange"
<el-table-column type="selection" width="55" align="center" /> @row-click="handleRowClick" highlight-current-row :current-row="currentRow" max-height="400">
<el-table-column label="任务ID" align="left" prop="jobId" /> <!-- 任务ID --> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="任务状态" align="left" prop="status"> <!-- 任务状态 --> <el-table-column label="任务ID" align="center" prop="jobId" width="120" /> <!-- 任务ID -->
<template slot-scope="scope"> <el-table-column label="任务状态" align="center" prop="status"> <!-- 任务状态 -->
<dict-tag :options="dict.type.mydo_job_status" :value="scope.row.status"/> <template slot-scope="scope">
</template> <dict-tag :options="dict.type.mydo_job_status" :value="scope.row.status" />
</el-table-column> </template>
<!-- <el-table-column :label="$t('outJobManagement.onLineType')" align="left" prop="onLineType"> &lt;!&ndash; 上线类型 &ndash;&gt; </el-table-column>
<!-- <el-table-column :label="$t('outJobManagement.onLineType')" align="left" prop="onLineType"> &lt;!&ndash; 上线类型 &ndash;&gt;
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.on_line_type" :value="scope.row.onLineType"/> <dict-tag :options="dict.type.on_line_type" :value="scope.row.onLineType"/>
</template> </template>
</el-table-column>--> </el-table-column>-->
<el-table-column label="任务类型" align="left" prop="inOrOut"> <!-- 任务类型 --> <el-table-column label="任务类型" align="center" prop="inOrOut"> <!-- 任务类型 -->
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.out_job_type" :value="scope.row.inOrOut"/> <dict-tag :options="dict.type.out_job_type" :value="scope.row.inOrOut" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="任务号" align="left" prop="taskNo" /> <!-- 任务号 --> <el-table-column label="任务号" align="center" prop="taskNo" /> <!-- 任务号 -->
<!-- <el-table-column :label="$t('outJobManagement.customerId')" align="left" prop="customerId" /> &lt;!&ndash; 客户ID &ndash;&gt;--> <!-- <el-table-column :label="$t('outJobManagement.customerId')" align="left" prop="customerId" /> &lt;!&ndash; 客户ID &ndash;&gt;-->
<el-table-column label="托盘码" align="left" prop="trayCode" /> <!-- 托盘码 --> <el-table-column label="托盘码" align="center" prop="trayCode" /> <!-- 托盘码 -->
<!-- <el-table-column :label="$t('outJobManagement.roadwayId')" align="left" prop="roadwayId" /> &lt;!&ndash; 巷道ID &ndash;&gt;--> <!-- <el-table-column :label="$t('outJobManagement.roadwayId')" align="left" prop="roadwayId" /> &lt;!&ndash; 巷道ID &ndash;&gt;-->
<el-table-column label="货位" align="left" prop="cargoSpaceName" /> <!-- 货位ID --> <el-table-column label="货位" align="center" prop="cargoSpaceName" /> <!-- 货位ID -->
<!-- <el-table-column label="订单号" align="left" prop="lineId" /> &lt;!&ndash; 结束时间 &ndash;&gt;--> <!-- <el-table-column label="订单号" align="left" prop="lineId" /> &lt;!&ndash; 结束时间 &ndash;&gt;-->
<!-- <el-table-column label="优先级" align="left" prop="priority" /> &lt;!&ndash; 优先级 &ndash;&gt;--> <!-- <el-table-column label="优先级" align="left" prop="priority" /> &lt;!&ndash; 优先级 &ndash;&gt;-->
<!-- <el-table-column label="执行阶段" align="left" prop="executionPhase"> &lt;!&ndash; 执行阶段 &ndash;&gt;--> <!-- <el-table-column label="执行阶段" align="left" prop="executionPhase"> &lt;!&ndash; 执行阶段 &ndash;&gt;-->
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>--> <!-- <dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- <el-table-column label="仓库" align="left" prop="warehouseName" /> --> <!-- <el-table-column label="仓库" align="left" prop="warehouseName" /> -->
<!-- <el-table-column label="出口" align="left" prop="exitId"/> 出口ID --> <!-- <el-table-column label="出口" align="left" prop="exitId"/> 出口ID -->
<el-table-column label="创建时间" align="left" prop="createTime" width="180"/> <!-- 创建时间 --> <el-table-column label="创建时间" align="center" prop="createTime" width="135" /> <!-- 创建时间 -->
<el-table-column label="开始时间" align="left" prop="startTime" width="180"/> <!-- 开始时间 --> <!-- <el-table-column label="开始时间" align="center" prop="startTime" width="180" /> -->
<el-table-column label="结束时间" align="left" prop="finishTime" width="180"/> <!-- 结束时间 --> <el-table-column label="结束时间" align="center" prop="finishTime" width="135" /> <!-- 结束时间 -->
<!-- <el-table-column :label="$t('outJobManagement.warehouseId')" align="left" prop="warehouseId" /> &lt;!&ndash; 仓库ID &ndash;&gt;--> <!-- <el-table-column :label="$t('outJobManagement.warehouseId')" align="left" prop="warehouseId" /> &lt;!&ndash; 仓库ID &ndash;&gt;-->
<!-- <el-table-column label="仓库ID" align="left" prop="warehouseName" /> &lt;!&ndash; 仓库ID &ndash;&gt;--> <!-- <el-table-column label="仓库ID" align="left" prop="warehouseName" /> &lt;!&ndash; 仓库ID &ndash;&gt;-->
</el-table> </el-table>
<pagination <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
v-show="total>0" @pagination="getList" />
:total="total" </el-card>
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-table v-loading="detailLoading" :data="mydoJobDetailList" @selection-change="handleSelectionChange"> <el-card class="box-card" style="margin-top: 20px;">
<el-table-column type="selection" width="55" align="center" /> <div slot="header" class="clearfix">
<el-table-column label="子任务ID" align="left" prop="jobDetailId" /> <!-- 子任务ID --> <span>任务明细列表</span>
<el-table-column label="库存ID" align="left" prop="stockId" /> <!-- 库存ID --> </div>
<el-table-column label="子单据ID" align="left" prop="inOrOutDId" /> <!-- 子单据ID --> <el-table v-loading="detailLoading" :data="mydoJobDetailList" @selection-change="handleSelectionChange">
<el-table-column label="物料编码" align="left" prop="productId" /> <!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="物料名称" align="left" prop="productName" /> <el-table-column label="子任务ID" align="left" prop="jobDetailId" /> <!-- 子任务ID -->
<el-table-column label="出库数量" align="right" prop="outQuantity" /> <!-- 出库数量 --> <el-table-column label="库存ID" align="left" prop="stockId" /> <!-- 库存ID -->
<el-table-column label="子单据ID" align="left" prop="inOrOutDId" /> <!-- 子单据ID -->
<el-table-column label="物料编码" align="left" prop="productId" />
<el-table-column label="物料名称" align="left" prop="productName" />
<el-table-column label="出库数量" align="right" prop="outQuantity" /> <!-- 出库数量 -->
</el-table> </el-table>
<pagination <pagination v-show="detailTotal > 0" :total="detailTotal" :page.sync="queryDetailParams.pageNum"
v-show="detailTotal>0" :limit.sync="queryDetailParams.pageSize" @pagination="getDetailList" />
:total="detailTotal" </el-card>
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</div> </div>
</template> </template>
<script> <script>
import { listMydoJobOut,handFinish,hangInvalidJob } from "@/api/job/OutmydoJob" import { listMydoJobOut, handFinish, hangInvalidJob } from "@/api/job/OutmydoJob"
import { listMydoJobDetail } from "@/api/job/mydoJobDetail" import { listMydoJobDetail } from "@/api/job/mydoJobDetail"
import {listWarehouse} from "@/api/bas/warehouse"; import { listWarehouse } from "@/api/bas/warehouse";
export default { export default {
name: "MydoJob", name: "MydoJob",
dicts: ['execution_phase_type', 'in_job_type', 'on_line_type', 'mydo_job_status','out_job_type','product_type','origin_type','account_type','turnover_type','purpose_type','quality_type'], dicts: ['execution_phase_type', 'in_job_type', 'on_line_type', 'mydo_job_status', 'out_job_type', 'product_type', 'origin_type', 'account_type', 'turnover_type', 'purpose_type', 'quality_type'],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
detailLoading:false, detailLoading: false,
// 选中数组 // 选中数组
ids: [], ids: [],
// 非单个禁用 // 非单个禁用
@@ -202,9 +175,9 @@ export default {
// 任务表表格数据 // 任务表表格数据
mydoJobList: [], mydoJobList: [],
// 子任务表表格数据 // 子任务表表格数据
mydoJobDetailList:[], mydoJobDetailList: [],
// 当前选中行 // 当前选中行
currentRow:null, currentRow: null,
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
@@ -238,9 +211,9 @@ export default {
classId: null, classId: null,
warehouseId: null, warehouseId: null,
faultFlag: null, faultFlag: null,
inOut:'2' inOut: '2'
}, },
queryDetailParams:{ queryDetailParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
jobId: null, jobId: null,
@@ -283,7 +256,7 @@ export default {
// 如果有数据,自动选中第一行 // 如果有数据,自动选中第一行
if (this.mydoJobList.length > 0) { if (this.mydoJobList.length > 0) {
this.handleRowClick(this.mydoJobList[0]); this.handleRowClick(this.mydoJobList[0]);
}else { } else {
this.mydoJobDetailList = [] this.mydoJobDetailList = []
this.detailLoading = false this.detailLoading = false
} }
@@ -344,7 +317,7 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.jobId) this.ids = selection.map(item => item.jobId)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
@@ -359,7 +332,7 @@ export default {
this.currentRow = row; this.currentRow = row;
// 更新子表格查询参数 // 更新子表格查询参数
this.queryDetailParams.jobId = row.jobId; this.queryDetailParams.jobId = row.jobId;
this.queryDetailParams.status=row.status // 查询子表格数据 this.queryDetailParams.status = row.status // 查询子表格数据
this.getDetailList(); this.getDetailList();
}, },
/** 查询子任务表列表 */ /** 查询子任务表列表 */
@@ -398,7 +371,7 @@ export default {
}).then(() => { }).then(() => {
this.$modal.msgSuccess("手动完成成功"); this.$modal.msgSuccess("手动完成成功");
this.getList(); this.getList();
}).catch(() => {}); }).catch(() => { });
}, },
//手动作废 //手动作废
OuthandInvalidation() { OuthandInvalidation() {
@@ -419,7 +392,7 @@ export default {
}).then(() => { }).then(() => {
this.$modal.msgSuccess("手动作废成功"); this.$modal.msgSuccess("手动作废成功");
this.getList(); this.getList();
}).catch(() => {}); }).catch(() => { });
} }
} }
@@ -427,7 +400,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
.el-table >>> .current-row { .el-table>>>.current-row {
background-color: #f0f9eb; background-color: #f0f9eb;
} }
</style> </style>

View File

@@ -329,9 +329,24 @@ export default {
}; };
}, },
created() { created() {
// 页面初始化时生成符合规范的主单号(RKyyyyMMddHHmmssSS)
this.formData.stockoutId = this.generateRKId()
this.getWarehouseOptions(); this.getWarehouseOptions();
}, },
methods: { methods: {
// 生成 RK 单号(两位毫秒,统一入出库格式)
generateRKId() {
const d = new Date()
const pad2 = (n) => String(n).padStart(2, '0')
const yyyy = d.getFullYear()
const MM = pad2(d.getMonth() + 1)
const dd = pad2(d.getDate())
const HH = pad2(d.getHours())
const mm = pad2(d.getMinutes())
const ss = pad2(d.getSeconds())
const cs = pad2(Math.floor(d.getMilliseconds() / 10))
return `RK${yyyy}${MM}${dd}${HH}${mm}${ss}${cs}`
},
/** 获取仓库选项 */ /** 获取仓库选项 */
getWarehouseOptions() { getWarehouseOptions() {
@@ -564,6 +579,10 @@ export default {
this.$modal.msgError('请选择物资'); this.$modal.msgError('请选择物资');
return; return;
} }
// 若用户重新建单或清空过主单号,保存前保证再次生成
if (!this.formData.stockoutId) {
this.formData.stockoutId = this.generateRKId()
}
const data = { const data = {
outStockout: this.formData, outStockout: this.formData,
detailList: this.materialList detailList: this.materialList

View File

@@ -10,18 +10,9 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item :label="'出库类型'" prop="outType"> <!-- 出库类型 -->
<el-select v-model="queryParams.outType" :placeholder="'请选择出库类型'" clearable>
<el-option
v-for="dict in dict.type.out_bill_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="'单据状态'" prop="status"> <!-- 单据状态 --> <el-form-item :label="'单据状态'" prop="status"> <!-- 单据状态 -->
<el-select v-model="queryParams.status" :placeholder="'请选择单据状态'"> <el-select v-model="queryParams.status" :placeholder="'请选择单据状态'" @change="handleQuery">
<el-option <el-option
v-for="dict in dict.type.out_bill_status" v-for="dict in dict.type.out_bill_status"
:key="dict.value" :key="dict.value"
@@ -30,15 +21,25 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 出库类型 -->
<el-form-item :label="'物料名称'" prop="productName"> <!-- <el-form-item :label="'出库类型'" prop="outType">
<el-select v-model="queryParams.outType" :placeholder="'请选择出库类型'" clearable>
<el-option
v-for="dict in dict.type.out_bill_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item> -->
<!-- <el-form-item :label="'物料名称'" prop="productName">
<el-input <el-input
v-model="queryParams.productName" v-model="queryParams.productName"
:placeholder="'请输入物料名称'" :placeholder="'请输入物料名称'"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item> -->
<el-form-item :label="'创建时间'" prop="dateRange"> <el-form-item :label="'创建时间'" prop="dateRange">
@@ -60,6 +61,16 @@
<!-- 操作按钮 --> <!-- 操作按钮 -->
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['out:outStockout:add']"
>单据新增</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
@@ -90,39 +101,19 @@
v-hasPermi="['out:outStockout:changeStatus']" v-hasPermi="['out:outStockout:changeStatus']"
>{{'单据作废'}}</el-button> <!-- 单据作废 --> >{{'单据作废'}}</el-button> <!-- 单据作废 -->
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-s-promotion"
size="mini"
@click="handleAutoAllot"
v-hasPermi="['out:outStockout:autoAllot']"
>{{'自动分配'}}</el-button> <!-- 自动分配 -->
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-s-tools"
size="mini"
@click="handleManualAllot"
v-hasPermi="['out:outStockout:manualAllot']"
>{{'手动分配'}}</el-button> <!-- 手动分配 -->
</el-col>
</el-row> </el-row>
<!-- 主表数据 --> <!-- 主表数据 -->
<el-table v-loading="loading" :data="outStockoutList" @selection-change="handleSelectionChange" @row-click="handleRowClick" max-height="400"> <el-table v-loading="loading" :data="outStockoutList" @selection-change="handleSelectionChange" max-height="400">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column :label="'出库单编号'" align="left" prop="stockoutId" /> <!-- 出库单编号 --> <el-table-column :label="'出库单编号'" align="center" prop="stockoutId" width="150" /> <!-- 出库单编号 -->
<el-table-column :label="'出库单主题'" align="left" prop="fid" width="260" /> <!-- 出库单主题 --> <el-table-column :label="'出库单主题'" align="center" prop="fid" width="200" /> <!-- 出库单主题 -->
<el-table-column :label="'出库类型'" align="left" prop="outType"> <!-- 出库类型 --> <el-table-column :label="'出库类型'" align="center" prop="outType"> <!-- 出库类型 -->
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.out_bill_type" :value="scope.row.outType"/> <dict-tag :options="dict.type.out_bill_type" :value="scope.row.outType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="'单据状态'" align="left" prop="status"> <!-- 单据状态 --> <el-table-column :label="'单据状态'" align="center" prop="status"> <!-- 单据状态 -->
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.out_bill_status" :value="scope.row.status"/> <dict-tag :options="dict.type.out_bill_status" :value="scope.row.status"/>
</template> </template>
@@ -133,11 +124,22 @@
<dict-tag :options="dict.type.bill_resource" :value="scope.row.stockoutSource"/> <dict-tag :options="dict.type.bill_resource" :value="scope.row.stockoutSource"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="'ERP出库单编号'" align="center" prop="erpStockoutId" /> <!-- ERP出库单编号 --> <!-- <el-table-column :label="'ERP出库单编号'" align="center" prop="erpStockoutId" /> -->
<!-- ERP出库单编号 -->
<el-table-column :label="'客户名称'" align="center" prop="customerNo" /> <!-- 客户名称 --> <el-table-column :label="'客户名称'" align="center" prop="customerNo" /> <!-- 客户名称 -->
<el-table-column :label="'创建时间'" align="left" prop="createDate" /><!-- 创建时间 --> <el-table-column :label="'创建时间'" align="center" prop="createDate" width="135" /><!-- 创建时间 -->
<el-table-column :label="'开始时间'" align="left" prop="startDate" /><!-- 开始时间 --> <el-table-column :label="'开始时间'" align="center" prop="startDate" width="135"/><!-- 开始时间 -->
<el-table-column :label="'确认时间'" align="left" prop="finishDate" /> <!-- 确认时间 --> <el-table-column :label="'确认时间'" align="center" prop="finishDate" width="135"/> <!-- 确认时间 -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="50">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-thumb"
@click="handleView(scope.row)"
>详情</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
@@ -148,30 +150,125 @@
@pagination="getList" @pagination="getList"
/> />
<!-- 子表数据 --> <el-dialog :title="title" :visible.sync="open" width="1050px" append-to-body>
<el-table v-loading="detailLoading" :data="outStockDetailList" style="margin-top: 20px;" @selection-change="handleDetailSelectionChange"> <el-form ref="viewForm" :model="form" :rules="rules" label-width="80px">
<el-table-column type="selection" width="55" align="center" /> <el-card class="box-card" shadow="never">
<el-table-column :label="'出库子单编号'" align="center" prop="stockoutDetailId" width="160" /> <!-- 出库子单编号 --> <div slot="header">主单信息</div>
<el-table-column :label="'物料编码'" align="center" prop="productId" /> <!-- 物资编码 --> <el-row :gutter="20">
<el-table-column :label="'物料名称'" align="center" prop="productName" /> <el-col :span="8">
<el-table-column :label="'计划数量'" align="center" prop="quantity" /> <!-- 计划数量 --> <el-form-item label="出库单号" prop="stockoutId">
<el-table-column :label="'分配数量'" align="center" prop="allotQuantity" /> <!-- 分配数量 --> <el-input v-model="form.stockoutId" :disabled="isView"/>
<el-table-column :label="'实际数量'" align="center" prop="assignNum" /> <!-- 实际数量 --> </el-form-item>
<!-- <el-table-column :label="'来源'" align="center" prop="unit"> </el-col>
<template slot-scope="scope"> <el-col :span="8">
<dict-tag :options="dict.type.origin_type" :value="scope.row.unit"/> <el-form-item label="出库主题" prop="fid">
</template> <el-input v-model="form.fid" :disabled="isView"/>
</el-table-column> --> </el-form-item>
</el-col>
<!-- <el-col :span="8">
<el-form-item label="出库类型" prop="outType">
<el-input v-model="form.outType" :disabled="isView"/>
</el-form-item>
</el-col> -->
<el-col :span="8">
<el-form-item label="单据来源" prop="stockoutSource">
<el-input v-model="form.stockoutSource" :disabled="isView"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="客户名称" prop="customerNo">
<el-input v-model="form.customerNo" :disabled="isView"/>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row :gutter="20"> -->
<!-- <el-col :span="8">
<el-form-item label="单据状态" prop="status">
<el-input v-model="form.status" :disabled="true"/>
</el-form-item>
</el-col> -->
<!-- </el-row> -->
<!-- <el-row :gutter="20">
<el-col :span="8">
<el-form-item label="创建时间" prop="createDate">
<el-input v-model="form.createDate" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="开始时间" prop="startDate">
<el-input v-model="form.startDate" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="确认时间" prop="finishDate">
<el-input v-model="form.finishDate" :disabled="true"/>
</el-form-item>
</el-col>
</el-row> -->
</el-card>
<el-card class="box-card" shadow="never" style="margin-top: 12px;">
<div slot="header" style="display:flex;justify-content:space-between;align-items:center;">
<span>子单信息</span>
<div v-if="isAddMode && !isView">
<el-button type="danger" plain size="mini" @click="handleDeleteDetails">删除物资</el-button>
<el-button type="primary" plain size="mini" @click="openProductSelector">选择物资</el-button>
</div>
</div>
<el-table
v-loading="detailLoading"
:data="outStockDetailList"
@selection-change="handleDetailSelectionChange"
size="mini"
border
style="width: 100%">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="出库子单编号" align="center" prop="stockoutDetailId" width="160" /> -->
<el-table-column label="物料编码" align="center" prop="productId" />
<el-table-column label="物料名称" align="center" prop="productName" />
<el-table-column label="计划数量" align="center" prop="quantity" />
<el-table-column label="分配数量" align="center" prop="allotQuantity" />
<el-table-column label="实际数量" align="center" prop="assignNum" />
</el-table>
</el-card>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" plain @click="handleAutoAllot" v-if="!isAddMode" v-hasPermi="['out:outStockout:autoAllot']">自动分配</el-button>
<el-button type="primary" @click="submitForm" v-if="!isView">确 定</el-button>
<el-button @click="open = false">关 闭</el-button>
</div>
</el-dialog>
<el-dialog title="选择物资" :visible.sync="productSelectVisible" width="900px" append-to-body>
<el-form ref="productForm" :model="queryProductParams" size="small" :inline="true">
<el-form-item label="物料名称" prop="productName">
<el-input v-model="queryProductParams.productName" placeholder="请输入物料名称" clearable />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getProductList">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetProductQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="productOptions" border @selection-change="handleProductSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="物料编码" align="center" prop="productId" />
<el-table-column label="物料名称" align="center" prop="productName" show-overflow-tooltip />
<el-table-column label="物料数量" align="center" prop="quantity" show-overflow-tooltip />
</el-table>
<pagination
v-show="productTotal>0"
:total="productTotal"
:page.sync="queryProductParams.pageNum"
:limit.sync="queryProductParams.pageSize"
@pagination="getProductList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelectProduct">确定</el-button>
<el-button @click="productSelectVisible = false">取消</el-button>
</div>
</el-dialog>
</el-table>
<!-- <pagination-->
<!-- v-show="detailTotal>0"-->
<!-- :total="detailTotal"-->
<!-- :page.sync="detailQueryParams.pageNum"-->
<!-- :limit.sync="detailQueryParams.pageSize"-->
<!-- @pagination="getDetailList"-->
<!-- />-->
<!-- 审核弹窗 --> <!-- 审核弹窗 -->
<el-dialog :title="'审核'" :visible.sync="auditDialogVisible" width="400px" append-to-body> <el-dialog :title="'审核'" :visible.sync="auditDialogVisible" width="400px" append-to-body>
@@ -313,7 +410,7 @@
</template> </template>
<script> <script>
import { listOutStockout,autoAllot,listOut,manualAllot} from "@/api/out/outStockout" import { listOutStockout,autoAllot,listOut,manualAllot, saveOutStock, listProductAndStock} from "@/api/out/outStockout"
import { getOutStockoutDetail,updateOutStockStatus } from "@/api/out/outStockout" import { getOutStockoutDetail,updateOutStockStatus } from "@/api/out/outStockout"
import {listWarehouse} from "@/api/bas/warehouse"; import {listWarehouse} from "@/api/bas/warehouse";
@@ -334,6 +431,21 @@ export default {
outStockoutList: [], outStockoutList: [],
// 子表数据 // 子表数据
outStockDetailList: [], outStockDetailList: [],
isAddMode: false,
// 详情弹窗
open: false,
title: "",
isView: false,
// 详情表单数据
form: {},
rules: {
stockoutId: [
{ required: true, message: "出库单据编号不能为空", trigger: "blur" }
],
fid: [
{ required: true, message: "出库主题不能为空", trigger: "blur" }
]
},
// 选中数据 // 选中数据
selectedRows: [], selectedRows: [],
// 选中的子表数据 // 选中的子表数据
@@ -376,7 +488,7 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
stockoutId: null, stockoutId: null,
outType: null, outType: 1,
customerNo: null, customerNo: null,
customerName: null, customerName: null,
supplierName: null, supplierName: null,
@@ -410,6 +522,15 @@ export default {
lotNo: null, lotNo: null,
productId: null, productId: null,
productName: null productName: null
},
productSelectVisible: false,
productOptions: [],
selectedProducts: [],
productTotal: 0,
queryProductParams: {
pageNum: 1,
pageSize: 10,
productName: null
} }
} }
}, },
@@ -432,6 +553,97 @@ export default {
this.getWarehouseList() this.getWarehouseList()
}, },
methods: { methods: {
handleAdd() {
this.form = {
stockoutId: this.generateRKId(),
fid: null,
outType: 1,
stockoutSource: '自建单',
customerNo: null,
status: 1
}
this.outStockDetailList = []
this.selectedDetailRows = []
this.isView = false
this.isAddMode = true
this.title = "添加出库单据"
this.open = true
},
generateRKId() {
const d = new Date()
const pad2 = (n) => String(n).padStart(2, '0')
const yyyy = d.getFullYear()
const MM = pad2(d.getMonth() + 1)
const dd = pad2(d.getDate())
const HH = pad2(d.getHours())
const mm = pad2(d.getMinutes())
const ss = pad2(d.getSeconds())
const cs = pad2(Math.floor(d.getMilliseconds() / 10))
return `RK${yyyy}${MM}${dd}${HH}${mm}${ss}${cs}`
},
openProductSelector() {
this.getProductList()
this.productSelectVisible = true
},
getProductList() {
listProductAndStock(this.queryProductParams).then(response => {
this.productOptions = response.rows || []
this.productTotal = response.total || 0
})
},
resetProductQuery() {
this.resetForm("productForm")
this.getProductList()
},
handleProductSelectionChange(selection) {
this.selectedProducts = selection
},
confirmSelectProduct() {
const duplicate = this.selectedProducts.filter(sel =>
this.outStockDetailList.some(ex => ex.productId === sel.productId)
)
if (duplicate.length > 0) {
this.$modal.msgError("选择的物料已存在")
return
}
const items = this.selectedProducts.map(item => ({
productId: item.productId,
productName: item.productName,
quantity: item.quantity || item.stockQuantity || 1,
allotQuantity: 0,
assignNum: 0
}))
this.outStockDetailList.push(...items)
this.productSelectVisible = false
},
handleDeleteDetails() {
if (this.selectedDetailRows.length === 0) {
this.$modal.msgWarning("请选择要删除的物料")
return
}
this.outStockDetailList = this.outStockDetailList.filter(item => !this.selectedDetailRows.includes(item))
this.selectedDetailRows = []
},
submitForm() {
this.$refs["viewForm"].validate(valid => {
if (valid) {
const payload = {
outStockout: { ...this.form },
detailList: this.outStockDetailList
}
saveOutStock(payload).then(response => {
if (response.code !== 200) {
this.$modal.msgError(response.msg || "保存失败")
return
}
this.$modal.msgSuccess(response.msg || "新增成功")
this.open = false
this.isAddMode = false
this.getList()
})
}
})
},
/** 获取仓库列表 */ /** 获取仓库列表 */
getWarehouseList() { getWarehouseList() {
listWarehouse(this.warehouseQueryParams).then(response => { listWarehouse(this.warehouseQueryParams).then(response => {
@@ -444,18 +656,12 @@ export default {
/** 查询主表数据 */ /** 查询主表数据 */
getList() { getList() {
this.loading = true this.loading = true
listOutStockout(this.queryParams).then(response => { return listOutStockout(this.queryParams).then(response => {
this.outStockoutList = response.rows this.outStockoutList = response.rows
this.total = response.total this.total = response.total
this.loading = false this.loading = false
// 如果有数据,自动选中第一行 this.outStockDetailList = []
if (this.outStockoutList.length > 0) { this.detailLoading = false
this.handleRowClick(this.outStockoutList[0]);
}else {
this.outStockDetailList = []
this.detailLoading = false
}
}) })
}, },
/** 查询子表数据 */ /** 查询子表数据 */
@@ -497,6 +703,17 @@ export default {
handleRowClick(row) { handleRowClick(row) {
this.getDetailList(row.stockoutGuid,row.status) this.getDetailList(row.stockoutGuid,row.status)
}, },
/** 详情按钮操作:按需加载明细 */
handleView(row) {
this.selectedRows = [row]
this.outStockDetailList = []
this.detailTotal = 0
this.form = { ...row }
this.title = "出库单据详情"
this.isView = true
this.open = true
this.getDetailList(row.stockoutGuid, row.status)
},
/** 多选框选中数据 */ /** 多选框选中数据 */
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectedRows = selection this.selectedRows = selection
@@ -578,7 +795,9 @@ export default {
}else { }else {
this.$modal.msgSuccess(response.msg) this.$modal.msgSuccess(response.msg)
} }
this.getList() this.getList().then(() => {
this.getDetailList(this.selectedRows[0].stockoutGuid, this.selectedRows[0].status)
})
}) })
}, },
/** 手动分配按钮操作 */ /** 手动分配按钮操作 */

View File

@@ -9,22 +9,22 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="入库子单ID" prop="stockinDetailId"> <!-- <el-form-item label="入库子单ID" prop="stockinDetailId">
<el-input <el-input
v-model="queryParams.stockinDetailId" v-model="queryParams.stockinDetailId"
placeholder="请输入入库子单ID" placeholder="请输入入库子单ID"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item> -->
<el-form-item label="仓库ID" prop="warehouseId"> <!-- <el-form-item label="仓库ID" prop="warehouseId">
<el-input <el-input
v-model="queryParams.warehouseId" v-model="queryParams.warehouseId"
placeholder="请输入仓库ID" placeholder="请输入仓库ID"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>