feat: 解包工单功能
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
package org.nl.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 通用工具
|
||||
* @Date: 2023/7/17
|
||||
*/
|
||||
@Slf4j
|
||||
public class CommonUtils {
|
||||
/**
|
||||
* @param inStorageTime 入库时间
|
||||
* @param standingTime 静置时间 / 分钟
|
||||
* @return
|
||||
*/
|
||||
public static boolean isStandingFinish(String inStorageTime, Integer standingTime) {
|
||||
// MDC.put("tag_name", TagNameEnum.STANDING_CHECK.getTag());
|
||||
log.info("判断静置时间->入库时间{},静置时间{}", inStorageTime, standingTime);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime inStorageDateTime = LocalDateTime.parse(inStorageTime, formatter);
|
||||
Duration standingDuration = Duration.ofMinutes(standingTime);
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
LocalDateTime expiryTime = inStorageDateTime.plus(standingDuration);
|
||||
log.info("时间转换:当前时间{}-期望时间{}", currentTime, expiryTime);
|
||||
return currentTime.isAfter(expiryTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 还有几分钟静置完成
|
||||
*
|
||||
* @param inputDateString
|
||||
* @param staticDurationMinutes
|
||||
* @return
|
||||
*/
|
||||
public static String remainStandingFinishTime(String inputDateString, Integer staticDurationMinutes) {
|
||||
// 创建SimpleDateFormat以解析日期时间字符串
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
// 将输入日期时间字符串解析为Date对象
|
||||
Date inputDate = dateFormat.parse(inputDateString);
|
||||
// 获取当前时间
|
||||
Date currentDate = new Date();
|
||||
// 计算距离静置完成还有多少毫秒
|
||||
long timeDifferenceMillis = inputDate.getTime() + (staticDurationMinutes * 60 * 1000) - currentDate.getTime();
|
||||
// 将毫秒转换为分钟
|
||||
double timeDifferenceMinutes = (double) timeDifferenceMillis / (60 * 1000);
|
||||
// 计算预计完成时间
|
||||
Date estimatedCompletionTime = new Date(currentDate.getTime() + timeDifferenceMillis);
|
||||
// 格式化预计完成时间为字符串
|
||||
String estimatedCompletionTimeString = dateFormat.format(estimatedCompletionTime);
|
||||
return "距离静置完成还有 " + String.format("%.2f", timeDifferenceMinutes) + " 分钟" + ", 预计完成时间为:" + estimatedCompletionTimeString;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间是白晚班
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getDayShift() {
|
||||
// 获取当前时间
|
||||
LocalTime currentTime = LocalTime.now();
|
||||
// 设置白班和晚班的时间范围
|
||||
// 白班开始时间:8:00 AM
|
||||
LocalTime dayShiftStart = LocalTime.of(8, 0);
|
||||
// 白班结束时间:5:00 PM
|
||||
LocalTime dayShiftEnd = LocalTime.of(15, 59);
|
||||
// 小夜班开始时间:5:00 PM
|
||||
LocalTime nightShiftStart = LocalTime.of(16, 0);
|
||||
// 小夜班结束时间:11:59 PM
|
||||
LocalTime nightShiftEnd = LocalTime.of(23, 59);
|
||||
|
||||
// 检查当前时间属于哪个班次
|
||||
if (currentTime.isAfter(dayShiftStart) && currentTime.isBefore(dayShiftEnd)) {
|
||||
return "白班";
|
||||
} else if (currentTime.isAfter(nightShiftStart) && currentTime.isBefore(nightShiftEnd)) {
|
||||
return "小夜班";
|
||||
} else {
|
||||
return "大夜班";
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T toJavaObject(String objectString, Class<T> clazz) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(objectString);
|
||||
return jsonObject.toJavaObject(clazz);
|
||||
}
|
||||
|
||||
public static BigDecimal dTOAMinutes(String data1, String data2) {
|
||||
String dateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
|
||||
try {
|
||||
// 解析第一个时间字符串
|
||||
Date date1 = sdf.parse(data1);
|
||||
// 解析第二个时间字符串
|
||||
Date date2 = sdf.parse(data2);
|
||||
// 计算分钟差
|
||||
long differenceInMilliseconds = date2.getTime() - date1.getTime();
|
||||
long differenceInMinutes = differenceInMilliseconds / (60 * 1000);
|
||||
return BigDecimal.valueOf(differenceInMinutes);
|
||||
} catch (ParseException e) {
|
||||
log.error("计算时间差出错-参数:{} - 异常信息:{}", data1+"-"+data2, e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return BigDecimal.valueOf(0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.nl.wms.pda_manage.sch_manage.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pda_manage.sch_manage.service.PdaJBService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 解包
|
||||
* @Author: lyd
|
||||
* @Date: 2025/7/21
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/pda/jb")
|
||||
@Slf4j
|
||||
public class PdaJBController {
|
||||
@Autowired
|
||||
private PdaJBService pdaJBService;
|
||||
@PostMapping("/getOrderList")
|
||||
@Log("获取工单信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getPoint(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaJBService.getOrderList(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/callMaterial")
|
||||
@Log("开工")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> callMaterial(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaJBService.callMaterial(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -52,5 +52,17 @@ public class PdaSchPointController {
|
||||
public ResponseEntity<Object> dissect(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaSchPointService.dissect(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/regionList")
|
||||
@Log("获取区域下拉框数组")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> regionList(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaSchPointService.regionList(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/pointList")
|
||||
@Log("获取点位下拉框数组")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> pointListByRegion(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaSchPointService.pointListByRegion(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.wms.pda_manage.sch_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pda_manage.util.PdaResponse;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2025/7/21
|
||||
*/
|
||||
public interface PdaJBService {
|
||||
PdaResponse getOrderList(JSONObject whereJson);
|
||||
|
||||
PdaResponse callMaterial(JSONObject whereJson);
|
||||
}
|
||||
@@ -46,4 +46,7 @@ public interface PdaSchPointService extends IService<SchBasePoint> {
|
||||
*/
|
||||
PdaResponse dissect(JSONObject whereJson);
|
||||
|
||||
PdaResponse regionList(JSONObject whereJson);
|
||||
|
||||
PdaResponse pointListByRegion(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.wms.pda_manage.sch_manage.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.pda_manage.sch_manage.service.PdaJBService;
|
||||
import org.nl.wms.pda_manage.sch_manage.service.mapper.PdaJBMapper;
|
||||
import org.nl.wms.pda_manage.util.PdaResponse;
|
||||
import org.nl.wms.pm_manage.service.dao.PdmBdWorkorder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2025/7/21
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PdaJBServiceImpl implements PdaJBService {
|
||||
@Autowired
|
||||
private PdaJBMapper pdaJBMapper;
|
||||
@Override
|
||||
public PdaResponse getOrderList(JSONObject whereJson) {
|
||||
List<PdmBdWorkorder> workorders = pdaJBMapper.getUnProductOrderList(whereJson.getString("point_code"));
|
||||
return PdaResponse.requestParamOk(workorders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse callMaterial(JSONObject whereJson) {
|
||||
// 1、创建出库单、明细
|
||||
// 2、创建任务、下发
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,27 @@
|
||||
package org.nl.wms.pda_manage.sch_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.vo.SelectItemVo;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.pda_manage.sch_manage.service.PdaSchPointService;
|
||||
import org.nl.wms.pda_manage.util.PdaResponse;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseRegionService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseRegion;
|
||||
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 手持点位操作 实现类
|
||||
@@ -28,6 +38,10 @@ public class PdaSchPointServiceImpl extends ServiceImpl<SchBasePointMapper, SchB
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService;
|
||||
@Autowired
|
||||
private ISchBaseRegionService regionService;
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
|
||||
@Override
|
||||
public PdaResponse getPoint(JSONObject whereJson) {
|
||||
@@ -60,4 +74,31 @@ public class PdaSchPointServiceImpl extends ServiceImpl<SchBasePointMapper, SchB
|
||||
);
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse regionList(JSONObject whereJson) {
|
||||
List<SelectItemVo> list = regionService.list(new LambdaQueryWrapper<SchBaseRegion>()
|
||||
.eq(SchBaseRegion::getIs_has_workder, true)
|
||||
.orderByAsc(SchBaseRegion::getOrder_seq)).stream().map(p -> SelectItemVo
|
||||
.builder()
|
||||
.text(p.getRegion_name())
|
||||
.value(p.getRegion_code())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
return PdaResponse.requestParamOk(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse pointListByRegion(JSONObject whereJson) {
|
||||
List<SelectItemVo> list = pointService.list(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getIs_has_workder, true)
|
||||
.eq(SchBasePoint::getRegion_code, whereJson.getString("region_code")))
|
||||
.stream().map(p -> SelectItemVo
|
||||
.builder()
|
||||
.text(p.getPoint_name())
|
||||
.value(p.getPoint_code())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
return PdaResponse.requestParamOk(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.wms.pda_manage.sch_manage.service.mapper;
|
||||
|
||||
import org.nl.wms.pm_manage.service.dao.PdmBdWorkorder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2025/7/21
|
||||
*/
|
||||
public interface PdaJBMapper {
|
||||
List<PdmBdWorkorder> getUnProductOrderList(String pointCode);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.pda_manage.sch_manage.service.mapper.PdaJBMapper">
|
||||
<select id="getUnProductOrderList" resultType="org.nl.wms.pm_manage.service.dao.PdmBdWorkorder">
|
||||
SELECT
|
||||
o.*,
|
||||
mm.material_code,
|
||||
mm.material_name
|
||||
FROM
|
||||
`pdm_bd_workorder` o
|
||||
LEFT JOIN md_me_materialbase mm ON mm.material_id = o.material_id
|
||||
WHERE o.workorder_status = '1'
|
||||
AND o.point_code = #{pointCode}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.wms.pm_manage.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.annotation.Limit;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pm_manage.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pm_manage.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pm_manage.service.dto.PdmBdWorkorderQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
||||
@RequestMapping("/api/pdmBdWorkorder")
|
||||
public class PdmBdWorkorderController {
|
||||
|
||||
@Autowired
|
||||
private IPdmBdWorkorderService pdmBdWorkorderService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询工单管理")
|
||||
//@SaCheckPermission("@el.check('pdmBdWorkorder:list')")
|
||||
public ResponseEntity<Object> query(PdmBdWorkorderQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(pdmBdWorkorderService.queryAll(query, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增工单管理")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody PdmBdWorkorder entity) {
|
||||
pdmBdWorkorderService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改工单管理")
|
||||
@Limit(period = 2, count = 1)
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody PdmBdWorkorder entity) {
|
||||
pdmBdWorkorderService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除工单管理")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
pdmBdWorkorderService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/forceFinish")
|
||||
@Log("强制完工")
|
||||
public ResponseEntity<Object> forceFinish(@RequestBody PdmBdWorkorder entity) {
|
||||
pdmBdWorkorderService.forceFinish(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@GetMapping("/getStockMaterial")
|
||||
@Log("获取库存物料")
|
||||
public ResponseEntity<Object> getStockMaterial(PdmBdWorkorderQuery entity, PageQuery pageQuery) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(pdmBdWorkorderService.getStockMaterial(entity, pageQuery)), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.nl.wms.pm_manage.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 工单状态枚举
|
||||
* @Date: 2023/6/16
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WorkOrderStatusEnum {
|
||||
/**
|
||||
* 未生产
|
||||
*/
|
||||
UNPRODUCED("1", "未生产"),
|
||||
/**
|
||||
* 已下发 x
|
||||
*/
|
||||
ISSUED("2", "已下发"),
|
||||
/**
|
||||
* 生产中
|
||||
*/
|
||||
PRODUCING("3", "生产中"),
|
||||
/**
|
||||
* 暂停 x
|
||||
*/
|
||||
STOP("4", "暂停"),
|
||||
/**
|
||||
* 完成
|
||||
*/
|
||||
COMPLETE("5", "完成");
|
||||
private final String code;
|
||||
private final String name;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package org.nl.wms.pm_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pm_manage.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pm_manage.service.dto.PdmBdWorkorderQuery;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description 服务接口
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
public interface IPdmBdWorkorderService extends IService<PdmBdWorkorder> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<PdmBdWorkorder>
|
||||
*/
|
||||
IPage<PdmBdWorkorder> queryAll(PdmBdWorkorderQuery whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param entity /
|
||||
*/
|
||||
void create(PdmBdWorkorder entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param entity /
|
||||
*/
|
||||
void update(PdmBdWorkorder entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 根据工单编码获取工单信息
|
||||
*
|
||||
* @param orderCode 工单号
|
||||
* @return /
|
||||
*/
|
||||
PdmBdWorkorder getByCode(String orderCode);
|
||||
|
||||
/**
|
||||
* 用锁-根据工单编码获取工单信息
|
||||
*
|
||||
* @param orderCode 工单号
|
||||
* @return /
|
||||
*/
|
||||
PdmBdWorkorder getByCodeLock(String orderCode);
|
||||
|
||||
/**
|
||||
* 强制报工完成
|
||||
*
|
||||
* @param entity 工单
|
||||
*/
|
||||
void forceFinish(PdmBdWorkorder entity);
|
||||
|
||||
/**
|
||||
* 分页查询获取库存可用的物料
|
||||
* @param entity
|
||||
* @param pageQuery
|
||||
* @return
|
||||
*/
|
||||
IPage<GroupPlate> getStockMaterial(PdmBdWorkorderQuery entity, PageQuery pageQuery);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package org.nl.wms.pm_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description /
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("pdm_bd_workorder")
|
||||
public class PdmBdWorkorder implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "workorder_id", type = IdType.NONE)
|
||||
private String workorder_id;
|
||||
|
||||
private String workorder_code;
|
||||
|
||||
private BigDecimal plan_qty;
|
||||
|
||||
private BigDecimal real_qty;
|
||||
|
||||
private BigDecimal plan_weight;
|
||||
|
||||
private BigDecimal real_weight;
|
||||
|
||||
private String material_id;
|
||||
|
||||
private String raw_material_code;
|
||||
|
||||
private String produce_order;
|
||||
|
||||
private String batch_no;
|
||||
|
||||
private String team;
|
||||
|
||||
private String produce_date;
|
||||
|
||||
private String vehicle_type;
|
||||
|
||||
private String planproducestart_date;
|
||||
|
||||
private String planproduceend_date;
|
||||
|
||||
private String realproducestart_date;
|
||||
|
||||
private String realproduceend_date;
|
||||
|
||||
private Integer standing_time;
|
||||
|
||||
private String struct_code;
|
||||
private String point_code;
|
||||
|
||||
private String point_name;
|
||||
|
||||
private String region_code;
|
||||
|
||||
private String region_name;
|
||||
|
||||
private String workorder_status;
|
||||
|
||||
private Boolean is_needmove;
|
||||
|
||||
private String workorder_type;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String production_order;
|
||||
|
||||
private String passback_status;
|
||||
|
||||
private String workshop_code;
|
||||
|
||||
private String ext_id;
|
||||
|
||||
private String ext_data;
|
||||
|
||||
private Boolean is_delete;
|
||||
|
||||
private String create_id;
|
||||
|
||||
private String create_name;
|
||||
|
||||
private String create_time;
|
||||
|
||||
private String update_id;
|
||||
|
||||
private String update_name;
|
||||
|
||||
private String update_time;
|
||||
|
||||
private Boolean is_urgent;
|
||||
private String operator;
|
||||
|
||||
private Integer qualified_qty;
|
||||
|
||||
private Integer unqualified_qty;
|
||||
private Integer priority;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String material_name;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String material_code;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String material_spec;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.pm_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.wms.pm_manage.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pm_manage.service.dto.PdmBdWorkorderQuery;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
public interface PdmBdWorkorderMapper extends BaseMapper<PdmBdWorkorder> {
|
||||
|
||||
IPage<PdmBdWorkorder> selectPageLeftJoin(IPage<PdmBdWorkorder> pages, PdmBdWorkorderQuery query);
|
||||
|
||||
IPage<GroupPlate> selectUseMaterialPageLeftJoin(IPage<GroupPlate> pages, PdmBdWorkorderQuery query);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.pm_manage.service.dao.mapper.PdmBdWorkorderMapper">
|
||||
<select id="selectPageLeftJoin" resultType="org.nl.wms.pm_manage.service.dao.PdmBdWorkorder">
|
||||
SELECT wo.*
|
||||
,ma.material_name
|
||||
,ma.material_code
|
||||
,ma.material_spec
|
||||
FROM pdm_bd_workorder wo
|
||||
LEFT JOIN md_me_materialbase ma ON ma.material_id = wo.material_id
|
||||
<where>
|
||||
<if test="query.more_order_status != null and query.more_order_status != ''">
|
||||
workorder_status IN
|
||||
<foreach collection="query.more_order_status" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="query.workorder_code != null and query.workorder_code != ''">
|
||||
AND wo.workorder_code LIKE CONCAT('%', #{query.workorder_code}, '%')
|
||||
</if>
|
||||
<if test="query.point_code != null and query.point_code != ''">
|
||||
AND LOWER(wo.point_code) LIKE LOWER(CONCAT('%', #{query.point_code}, '%'))
|
||||
</if>
|
||||
<if test="query.begin_time != null and query.begin_time != ''">
|
||||
AND wo.create_time <![CDATA[ >= ]]> #{query.begin_time}
|
||||
</if>
|
||||
<if test="query.end_time != null and query.end_time != ''">
|
||||
AND wo.create_time <![CDATA[ <= ]]> #{query.end_time}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY wo.update_time DESC
|
||||
</select>
|
||||
<select id="selectUseMaterialPageLeftJoin" resultType="org.nl.wms.warehouse_manage.service.dao.GroupPlate">
|
||||
SELECT
|
||||
mg.*,
|
||||
ss.struct_code,
|
||||
mm.material_code,
|
||||
mm.material_name
|
||||
FROM
|
||||
`md_pb_groupplate` mg
|
||||
LEFT JOIN st_ivt_structattr ss ON ss.storagevehicle_code = mg.storagevehicle_code
|
||||
LEFT JOIN md_me_materialbase mm ON mm.material_id = mg.material_id
|
||||
WHERE mg.`status` = '01' AND mg.frozen_qty = 0 AND IFNULL(mg.storagevehicle_code,'') <![CDATA[ <> ]]> ''
|
||||
AND IFNULL(ss.struct_code,'') <![CDATA[ <> ]]> ''
|
||||
AND 0 = (SELECT COUNT(*) FROM pdm_bd_workorder po WHERE po.raw_material_code = mg.storagevehicle_code AND po.workorder_status <![CDATA[ <> ]]> '5')
|
||||
<if test="query.stor_id != null and query.stor_id != ''">
|
||||
AND ss.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
<if test="query.blurry != null and query.blurry != ''">
|
||||
AND (mm.material_code LIKE CONCAT('%', #{query.blurry}, '%') OR mm.material_name LIKE CONCAT('%',
|
||||
#{query.blurry}, '%'))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,166 @@
|
||||
package org.nl.wms.pm_manage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description /
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
@Data
|
||||
public class PdmBdWorkorderDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 工单标识
|
||||
*/
|
||||
private String workorder_id;
|
||||
|
||||
/**
|
||||
* 工单编号
|
||||
*/
|
||||
private String workorder_code;
|
||||
|
||||
|
||||
/**
|
||||
* 计划数量
|
||||
*/
|
||||
private BigDecimal plan_qty;
|
||||
|
||||
/**
|
||||
* 实际数量
|
||||
*/
|
||||
private BigDecimal real_qty;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 原材料物料标识
|
||||
*/
|
||||
private String raw_material_id;
|
||||
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
private String vehicle_type;
|
||||
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
private String planproducestart_date;
|
||||
|
||||
/**
|
||||
* 计划结束时间
|
||||
*/
|
||||
private String planproduceend_date;
|
||||
|
||||
/**
|
||||
* 实际开始时间
|
||||
*/
|
||||
private String realproducestart_date;
|
||||
|
||||
/**
|
||||
* 实际结束时间
|
||||
*/
|
||||
private String realproduceend_date;
|
||||
|
||||
/**
|
||||
* 静置时间(分钟)
|
||||
*/
|
||||
private BigDecimal standing_time;
|
||||
|
||||
/**
|
||||
* 点位编码
|
||||
*/
|
||||
private String point_code;
|
||||
|
||||
/**
|
||||
* 点位名称
|
||||
*/
|
||||
private String point_name;
|
||||
|
||||
/**
|
||||
* 区域编码
|
||||
*/
|
||||
private String region_code;
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
private String region_name;
|
||||
|
||||
/**
|
||||
* 工单状态
|
||||
*/
|
||||
private String workorder_status;
|
||||
|
||||
/**
|
||||
* 是否需要AGV搬运
|
||||
*/
|
||||
private String is_needmove;
|
||||
|
||||
/**
|
||||
* 工单类型
|
||||
*/
|
||||
private String workorder_type;
|
||||
|
||||
/**
|
||||
* 回传MES状态
|
||||
*/
|
||||
private String passback_status;
|
||||
|
||||
/**
|
||||
* 车间编码
|
||||
*/
|
||||
private String workshop_code;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_data;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Boolean is_delete;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_id;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_name;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.pm_manage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
@Data
|
||||
public class PdmBdWorkorderQuery implements Serializable {
|
||||
private String workorder_code;
|
||||
private String point_code;
|
||||
private String begin_time;
|
||||
private String end_time;
|
||||
private List<String> more_order_status;
|
||||
private String materialId;
|
||||
private String stor_id;
|
||||
private String blurry;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package org.nl.wms.pm_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.CommonUtils;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.pm_manage.enums.WorkOrderStatusEnum;
|
||||
import org.nl.wms.pm_manage.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pm_manage.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pm_manage.service.dao.mapper.PdmBdWorkorderMapper;
|
||||
import org.nl.wms.pm_manage.service.dto.PdmBdWorkorderQuery;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.system_manage.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description 服务实现
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Lazy
|
||||
public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper, PdmBdWorkorder> implements IPdmBdWorkorderService {
|
||||
|
||||
@Autowired
|
||||
private PdmBdWorkorderMapper pdmBdWorkorderMapper;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private IMdPbGroupplateService groupplateService;
|
||||
|
||||
@Override
|
||||
public IPage<PdmBdWorkorder> queryAll(PdmBdWorkorderQuery query, PageQuery page) {
|
||||
IPage<PdmBdWorkorder> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pages = pdmBdWorkorderMapper.selectPageLeftJoin(pages, query);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(PdmBdWorkorder entity) {
|
||||
List<PdmBdWorkorder> list = this.list(new LambdaQueryWrapper<PdmBdWorkorder>()
|
||||
.eq(PdmBdWorkorder::getStruct_code, entity.getStruct_code())
|
||||
.ne(PdmBdWorkorder::getWorkorder_status, WorkOrderStatusEnum.COMPLETE.getCode()));
|
||||
if (list.size() > 0) {
|
||||
throw new BadRequestException("该位置的物料已经存在工单!");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
String today = DateUtil.format(DateUtil.date(), "yyyyMMdd");
|
||||
// 点位编码和点位名称为父点位
|
||||
entity.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setTeam(CommonUtils.getDayShift());
|
||||
entity.setProduce_date(today);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
pdmBdWorkorderMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(PdmBdWorkorder entity) {
|
||||
PdmBdWorkorder dto = pdmBdWorkorderMapper.selectById(entity.getWorkorder_id());
|
||||
if (dto == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
SchBasePoint point = pointService.getById(entity.getPoint_code());
|
||||
// 使用最新的状态
|
||||
entity.setWorkorder_status(dto.getWorkorder_status());
|
||||
// entity.setUpdate_id(GeneralDefinition.ACS_ID);
|
||||
// entity.setUpdate_name(GeneralDefinition.ACS_NAME);
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
log.info("用户「{}」在PC触发更新工单,更新数据:{},数据库旧数据:{}", SecurityUtils.getCurrentNickName(), entity, dto);
|
||||
pdmBdWorkorderMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
pdmBdWorkorderMapper.deleteBatchIds(ids);
|
||||
}
|
||||
@Override
|
||||
public PdmBdWorkorder getByCode(String orderCode) {
|
||||
if (orderCode == null) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<PdmBdWorkorder> lam = new QueryWrapper<PdmBdWorkorder>().lambda();
|
||||
lam.eq(PdmBdWorkorder::getWorkorder_code, orderCode);
|
||||
return pdmBdWorkorderMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdmBdWorkorder getByCodeLock(String orderCode) {
|
||||
LambdaQueryWrapper<PdmBdWorkorder> lam = new QueryWrapper<PdmBdWorkorder>().lambda();
|
||||
lam.eq(PdmBdWorkorder::getWorkorder_code, orderCode);
|
||||
lam.last("FOR UPDATE");
|
||||
return pdmBdWorkorderMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(PdmBdWorkorder entity) {
|
||||
String workorderCode = entity.getWorkorder_code();
|
||||
String today = DateUtil.format(DateUtil.date(), "yyyyMMdd");
|
||||
if (workorderCode == null) {
|
||||
throw new BadRequestException("工单标识不能为空!");
|
||||
}
|
||||
PdmBdWorkorder bdWorkorder = this.getByCode(workorderCode);
|
||||
if (bdWorkorder == null) {
|
||||
throw new BadRequestException("未找到工单号[" + workorderCode + "]的记录!");
|
||||
}
|
||||
if (isWorkOrderIssuedAndProduceDateToday(bdWorkorder)) {
|
||||
throw new BadRequestException("工单号[" + workorderCode + "]未生产不能完成工!");
|
||||
}
|
||||
if (bdWorkorder.getWorkorder_status().equals(WorkOrderStatusEnum.COMPLETE.getCode())) {
|
||||
throw new BadRequestException("工单号[" + workorderCode + "]已完工,不能重复完工!");
|
||||
}
|
||||
bdWorkorder.setWorkorder_status(WorkOrderStatusEnum.COMPLETE.getCode());
|
||||
bdWorkorder.setRealproduceend_date(DateUtil.now());
|
||||
// TaskUtils.setWorkOrderUpdateByAcs(bdWorkorder);
|
||||
// 统计合不合格数量到工单字段中
|
||||
// int qualified_qty = baseBrickInfoService.getCountQualifiedQty(bdWorkorder.getWorkorder_code());
|
||||
// int unqualified_qty = baseBrickInfoService.getCountUnqualifiedQty(bdWorkorder.getWorkorder_code());
|
||||
// bdWorkorder.setQualified_qty(qualified_qty);
|
||||
// bdWorkorder.setUnqualified_qty(unqualified_qty);
|
||||
this.updateById(bdWorkorder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<GroupPlate> getStockMaterial(PdmBdWorkorderQuery query, PageQuery page) {
|
||||
IPage<GroupPlate> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pages = pdmBdWorkorderMapper.selectUseMaterialPageLeftJoin(pages, query);
|
||||
return pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断工单是否下发、当天工单
|
||||
* 判断逻辑不能过于复杂,因此提取出来
|
||||
*
|
||||
* @param bdWorkorder 工单参数
|
||||
* @return 结果
|
||||
*/
|
||||
private boolean isWorkOrderIssuedAndProduceDateToday(PdmBdWorkorder bdWorkorder) {
|
||||
String today = DateUtil.format(DateUtil.date(), "yyyyMMdd");
|
||||
boolean isWorkOrderIssued = bdWorkorder.getWorkorder_status().equals(WorkOrderStatusEnum.ISSUED.getCode());
|
||||
boolean isProduceDateToday = ObjectUtil.isNotEmpty(bdWorkorder.getProduce_date()) && bdWorkorder.getProduce_date().equals(today);
|
||||
return isWorkOrderIssued && isProduceDateToday;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -172,11 +172,12 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
return this.list();
|
||||
}
|
||||
return pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getRegion_code, region.getRegion_code()));
|
||||
.eq(SchBasePoint::getRegion_code, region.getRegion_code())
|
||||
.eq(SchBasePoint::getIs_has_workder, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeLock(JSONObject points) {
|
||||
JSONArray data = points.getJSONArray("data");
|
||||
Boolean lockType = points.getBoolean("lock_type");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.warehouse_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -32,6 +33,7 @@ public class GroupPlate implements Serializable {
|
||||
* 载具编码
|
||||
*/
|
||||
private String storagevehicle_code;
|
||||
private String storagevehicle_type;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
@@ -113,4 +115,11 @@ public class GroupPlate implements Serializable {
|
||||
* 来源单据类型
|
||||
*/
|
||||
private String ext_type;
|
||||
@TableField(exist = false)
|
||||
private String struct_code;
|
||||
@TableField(exist = false)
|
||||
private String material_code;
|
||||
@TableField(exist = false)
|
||||
private String material_name;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="物料选择"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="1000px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="仓库">
|
||||
<el-select
|
||||
v-model="query.stor_id"
|
||||
clearable
|
||||
placeholder="仓库"
|
||||
class="filter-item"
|
||||
style="width: 210px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storlist"
|
||||
:key="item.stor_id"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称">
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="物料名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="物料规格">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="query.material_spec"-->
|
||||
<!-- clearable-->
|
||||
<!-- size="mini"-->
|
||||
<!-- placeholder="物料名称"-->
|
||||
<!-- @keyup.enter.native="crud.toQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料型号">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="query.material_model"-->
|
||||
<!-- clearable-->
|
||||
<!-- size="mini"-->
|
||||
<!-- placeholder="物料名称"-->
|
||||
<!-- @keyup.enter.native="crud.toQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item :label="queryInfo">-->
|
||||
<!-- <el-button icon="el-icon-sort" circle @click="queryMaterials"></el-button>-->
|
||||
<!-- </el-form-item>-->
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
:cell-style="{'text-align':'center'}"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266','text-align':'center'}"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
@current-change="clickChange"
|
||||
>
|
||||
<el-table-column v-if="!isSingle" type="selection" width="55" />
|
||||
<el-table-column v-if="isSingle" label="选择" width="55">
|
||||
<template slot-scope="scope">
|
||||
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_code" label="物料编码" width="160" />
|
||||
<el-table-column prop="material_name" label="物料名称" width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="struct_code" label="仓位编码" width="160" />
|
||||
<el-table-column prop="storagevehicle_code" label="载具编码" width="160" />
|
||||
<el-table-column prop="qty_unit_name" label="单位" width="160" />
|
||||
<!-- <el-table-column prop="raw_material_code" label="泥料编码" width="160" />-->
|
||||
<!-- <el-table-column prop="material_spec" label="物料规格" width="140" />-->
|
||||
<!-- <el-table-column prop="material_model" label="物料型号" width="140" />-->
|
||||
<!-- <el-table-column prop="pack_method" label="包装方式" width="140" />-->
|
||||
<!-- <el-table-column prop="pack_palletspec" label="包装规则" width="140" />-->
|
||||
<!-- <el-table-column v-if="queryInfo === '库存顺序'" prop="total_material_qty" label="物料总数/块" width="140" />-->
|
||||
<!-- <el-table-column prop="standing_time" label="静置时间(分钟)" width="130px" />-->
|
||||
<el-table-column prop="update_name" label="修改人" />
|
||||
<el-table-column prop="update_time" label="修改时间" width="135" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CRUD, { header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import crudBsrealstorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
|
||||
export default {
|
||||
name: 'MaterialDialog',
|
||||
components: { rrOperation, pagination },
|
||||
dicts: ['is_used'],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '生产任务',
|
||||
url: 'api/pdmBdWorkorder/getStockMaterial',
|
||||
optShow: {},
|
||||
query: {
|
||||
is_used: true
|
||||
}
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isSingle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
flag: {
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tableRadio: null,
|
||||
tableData: [],
|
||||
queryInfo: '物料顺序',
|
||||
queryFlag: false,
|
||||
storlist: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickChange(item) {
|
||||
this.tableRadio = item
|
||||
},
|
||||
open() {
|
||||
crudBsrealstorattr.getStor().then(res => {
|
||||
this.storlist = res
|
||||
})
|
||||
},
|
||||
queryMaterials() {
|
||||
this.queryFlag = !this.queryFlag
|
||||
if (this.queryFlag) {
|
||||
this.queryInfo = '库存顺序'
|
||||
this.crud.url = 'api/pdmBdWorkorder/materials'
|
||||
this.crud.toQuery()
|
||||
} else {
|
||||
this.queryInfo = '物料顺序'
|
||||
this.crud.url = 'api/mdBaseMaterial'
|
||||
this.crud.toQuery()
|
||||
}
|
||||
},
|
||||
handleSelectionChange(val, row) {
|
||||
if (val.length > 1) {
|
||||
this.$refs.table.clearSelection()
|
||||
this.$refs.table.toggleRowSelection(val.pop())
|
||||
} else {
|
||||
this.checkrow = row
|
||||
}
|
||||
},
|
||||
onSelectAll() {
|
||||
this.$refs.table.clearSelection()
|
||||
},
|
||||
close() {
|
||||
this.storlist = []
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
submit() {
|
||||
// 处理单选
|
||||
if (this.isSingle && this.tableRadio) {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged', this.tableRadio, this.flag)
|
||||
return
|
||||
}
|
||||
this.rows = this.$refs.table.selection
|
||||
if (this.rows.length <= 0) {
|
||||
this.$message('请先勾选物料')
|
||||
return
|
||||
}
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged', this.rows, this.flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
699
lms/nladmin-ui/src/views/wms/pm_manage/workerorder/index.vue
Normal file
699
lms/nladmin-ui/src/views/wms/pm_manage/workerorder/index.vue
Normal file
@@ -0,0 +1,699 @@
|
||||
<template>
|
||||
<div v-loading.fullscreen.lock="fullscreenLoading" 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-input
|
||||
v-model="query.workorder_code"
|
||||
clearable
|
||||
placeholder="工单编号"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备编码">
|
||||
<el-input
|
||||
v-model="query.point_code"
|
||||
clearable
|
||||
placeholder="设备编码"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="datetimerange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
@change="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工单状态">
|
||||
<el-select
|
||||
v-model="query.workorder_status"
|
||||
multiple
|
||||
placeholder="工单状态"
|
||||
class="filter-item"
|
||||
clearable
|
||||
@change="handOrderStatus"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.pdm_workorder_status"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<!-- <el-button-->
|
||||
<!-- slot="right"-->
|
||||
<!-- class="filter-item"-->
|
||||
<!-- type="success"-->
|
||||
<!-- icon="el-icon-position"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="!(crud.selections[0]) || crud.selections[1]"-->
|
||||
<!-- @click="submits(crud.selections[0])"-->
|
||||
<!-- >-->
|
||||
<!-- 开工-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- slot="right"-->
|
||||
<!-- class="filter-item"-->
|
||||
<!-- type="success"-->
|
||||
<!-- icon="el-icon-position"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="synchronize()"-->
|
||||
<!-- >-->
|
||||
<!-- 同步-->
|
||||
<!-- </el-button>-->
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="danger"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="!(crud.selections[0]) || crud.selections[1]"
|
||||
@click="forceFinish(crud.selections[0])"
|
||||
>
|
||||
强制完工
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="820px"
|
||||
>
|
||||
<el-form
|
||||
ref="form"
|
||||
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;"
|
||||
:inline="true"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
size="mini"
|
||||
label-width="135px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item v-if="false" label="所属车间">
|
||||
<el-select
|
||||
v-model="form.workshop_code"
|
||||
placeholder="请选择"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in workShopList"
|
||||
:label="item.workshop_name"
|
||||
:value="item.workshop_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="material_name">
|
||||
<el-input v-model="form.material_name" style="width: 240px;" @focus="getMaterial(1)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码">
|
||||
<el-input v-model="form.material_code" style="width: 240px;" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料规格">
|
||||
<el-input v-model="form.material_spec" style="width: 240px;" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="仓位编码">
|
||||
<el-input v-model="form.struct_code" style="width: 240px;" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划数量" prop="plan_qty">
|
||||
<el-input-number
|
||||
v-model.number="form.plan_qty"
|
||||
:disabled="true"
|
||||
:min="1"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划开始时间" prop="planproducestart_date">
|
||||
<el-date-picker
|
||||
v-model="form.planproducestart_date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
style="width: 240px;"
|
||||
placeholder="选择日期时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划结束时间" prop="planproduceend_date">
|
||||
<el-date-picker
|
||||
v-model="form.planproduceend_date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
style="width: 240px;"
|
||||
placeholder="选择日期时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="crud.status.edit" label="实际开始时间">
|
||||
<el-date-picker
|
||||
v-model="form.realproducestart_date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
style="width: 240px;"
|
||||
placeholder="选择日期时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="crud.status.edit" label="实际结束时间">
|
||||
<el-date-picker
|
||||
v-model="form.realproduceend_date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
style="width: 240px;"
|
||||
placeholder="选择日期时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属工序" prop="region_code">
|
||||
<el-select
|
||||
v-model="form.region_code"
|
||||
filterable
|
||||
placeholder="请选择"
|
||||
style="width: 240px;"
|
||||
@change="setRegionName"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in regionList"
|
||||
:key="item.region_code"
|
||||
:label="item.region_code"
|
||||
:value="item.region_code"
|
||||
>
|
||||
<span style="float: left">{{ item.region_name }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.region_code }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工序名称">
|
||||
<el-input v-model="form.region_name" style="width: 240px;" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备编码" prop="point_code">
|
||||
<el-select
|
||||
v-model="form.point_code"
|
||||
filterable
|
||||
placeholder="请选择"
|
||||
style="width: 240px;"
|
||||
@change="setPointName"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in pointList"
|
||||
:key="item.point_code"
|
||||
:label="item.point_code"
|
||||
:value="item.point_code"
|
||||
>
|
||||
<span style="float: left">{{ item.point_name }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.point_code }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称">
|
||||
<el-input v-model="form.point_name" style="width: 240px;" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.region_code === 'FJ'" label="订单号">
|
||||
<el-input
|
||||
v-model="form.order_no"
|
||||
:disabled="form.material_code===null"
|
||||
style="width: 240px;"
|
||||
@focus="getProductionOrder(form.material_id)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="静置时间(分钟)" prop="standing_time">-->
|
||||
<!-- <el-input-number-->
|
||||
<!-- v-model.number="form.standing_time"-->
|
||||
<!-- :min="0"-->
|
||||
<!-- :max="999"-->
|
||||
<!-- style="width: 240px;"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item v-if="crud.status.edit" label="实际数量" prop="real_qty">
|
||||
<el-input-number
|
||||
v-model.number="form.real_qty"
|
||||
:min="0"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="crud.status.edit && form.region_code === 'YZ'" label="计划重量">
|
||||
<el-input-number
|
||||
v-model.number="form.plan_weight"
|
||||
:min="0"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="crud.status.edit && form.region_code === 'YZ'" label="实际重量">
|
||||
<el-input-number
|
||||
v-model.number="form.real_weight"
|
||||
:min="0"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="载具类型">
|
||||
<el-select
|
||||
v-model="form.vehicle_type"
|
||||
clearable
|
||||
:disabled="true"
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.storagevehicle_type"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.region_code === 'YZ'" label="优先级">
|
||||
<el-input-number
|
||||
v-model.number="form.priority"
|
||||
:min="0"
|
||||
:max="99"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="false" label="工单类型" prop="workorder_type">
|
||||
<el-input v-model="form.workorder_type" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="是否自动搬运" prop="is_needmove">-->
|
||||
<!-- <el-radio-group v-model="form.is_needmove" style="width: 240px">-->
|
||||
<!-- <el-radio :label="true">是</el-radio>-->
|
||||
<!-- <el-radio :label="false">否</el-radio>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="是否加急" prop="is_needmove">-->
|
||||
<!-- <el-radio-group v-model="form.is_urgent" style="width: 240px">-->
|
||||
<!-- <el-radio :label="true">是</el-radio>-->
|
||||
<!-- <el-radio :label="false">否</el-radio>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @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
|
||||
prop="workorder_code"
|
||||
label="工单编号"
|
||||
:min-width="flexWidth('workorder_code',crud.data,'工单编号')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="workorder_status"
|
||||
label="工单状态"
|
||||
:min-width="flexWidth('workorder_status',crud.data,'工单状态')"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.pdm_workorder_status[scope.row.workorder_status] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="plan_qty" label="计划数量" :min-width="flexWidth('plan_qty',crud.data,'计划数量')" />
|
||||
<el-table-column prop="real_qty" label="实际数量" :min-width="flexWidth('real_qty',crud.data,'实际数量')" />
|
||||
<!-- <el-table-column prop="region_code" label="区域编码" :min-width="flexWidth('region_code',crud.data,'区域编码')" />-->
|
||||
<el-table-column
|
||||
prop="region_name"
|
||||
label="区域名称"
|
||||
:min-width="flexWidth('region_name',crud.data,'区域名称')"
|
||||
/>
|
||||
<el-table-column prop="point_code" label="设备编码" :min-width="flexWidth('point_code',crud.data,'设备编码')" />
|
||||
<el-table-column prop="point_name" label="设备名称" :min-width="flexWidth('point_name',crud.data,'设备名称')" />
|
||||
<el-table-column
|
||||
prop="material_name"
|
||||
label="物料名称"
|
||||
:min-width="flexWidth('material_name',crud.data,'物料标识')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="material_spec"
|
||||
label="物料规格"
|
||||
:min-width="flexWidth('material_spec',crud.data,'物料标识')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="raw_material_code"
|
||||
label="托盘编码"
|
||||
:min-width="flexWidth('raw_material_code',crud.data,'物料标识')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="vehicle_type"
|
||||
label="载具类型"
|
||||
:min-width="flexWidth('vehicle_type',crud.data,'载具类型', 20)"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.storagevehicle_type[scope.row.vehicle_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="produce_date"
|
||||
label="生产日期"
|
||||
:min-width="flexWidth('produce_date',crud.data,'生产日期')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="planproducestart_date"
|
||||
label="计划开始时间"
|
||||
:min-width="flexWidth('planproducestart_date',crud.data,'计划开始时间')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="planproduceend_date"
|
||||
label="计划结束时间"
|
||||
:min-width="flexWidth('planproduceend_date',crud.data,'计划结束时间')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="realproducestart_date"
|
||||
label="实际开始时间"
|
||||
:min-width="flexWidth('realproducestart_date',crud.data,'实际开始时间')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="realproduceend_date"
|
||||
label="实际结束时间"
|
||||
:min-width="flexWidth('realproduceend_date',crud.data,'实际结束时间')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="standing_time"
|
||||
label="静置时间(分钟)"
|
||||
:min-width="flexWidth('standing_time',crud.data,'静置时间(分钟)')"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="is_needmove"
|
||||
label="是否自动搬运"
|
||||
:min-width="flexWidth('is_needmove',crud.data,'是否自动搬运')"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_needmove ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_urgent" label="是否加急" :min-width="flexWidth('is_urgent',crud.data,'是否加急')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_urgent ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
|
||||
<el-table-column
|
||||
prop="create_time"
|
||||
label="创建时间"
|
||||
:min-width="flexWidth('create_time',crud.data,'创建时间')"
|
||||
/>
|
||||
<el-table-column prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
|
||||
<el-table-column
|
||||
prop="update_time"
|
||||
label="修改时间"
|
||||
:min-width="flexWidth('update_time',crud.data,'修改时间')"
|
||||
/>
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<MaterialDialog
|
||||
:dialog-show.sync="materialDialog"
|
||||
:flag="flag"
|
||||
@tableChanged="tableChanged"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudPdmBdWorkorder from './pdmBdWorkorder'
|
||||
import crudSchBaseRegion from '@/views/wms/sch/region/schBaseRegion'
|
||||
import crudSchBasePoint from '@/views/wms/sch/point/schBasePoint'
|
||||
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'
|
||||
import item from '@/layout/components/Sidebar/Item.vue'
|
||||
import MaterialDialog from '../workerorder/MaterialDialog.vue'
|
||||
|
||||
const defaultForm = {
|
||||
workorder_id: null,
|
||||
workorder_code: null,
|
||||
plan_qty: null,
|
||||
real_qty: null,
|
||||
material_id: null,
|
||||
half_material_code: null,
|
||||
raw_material_code: null,
|
||||
vehicle_type: null,
|
||||
planproducestart_date: null,
|
||||
planproduceend_date: null,
|
||||
realproducestart_date: null,
|
||||
realproduceend_date: null,
|
||||
material_spec: null,
|
||||
material_code: null,
|
||||
material_name: null,
|
||||
standing_time: null,
|
||||
point_code: null,
|
||||
point_name: null,
|
||||
region_code: null,
|
||||
region_name: null,
|
||||
workorder_status: null,
|
||||
is_needmove: true,
|
||||
workorder_type: null,
|
||||
passback_status: null,
|
||||
workshop_code: null,
|
||||
ext_id: null,
|
||||
is_delete: false,
|
||||
is_urgent: false,
|
||||
order_no: null,
|
||||
custer_no: null,
|
||||
pack_method: null,
|
||||
struct_code: null,
|
||||
order_subnum: 0,
|
||||
real_weight: 0,
|
||||
plan_weight: 0,
|
||||
guadansum: 0,
|
||||
ext_data: 0,
|
||||
priority: 1,
|
||||
show: false
|
||||
}
|
||||
export default {
|
||||
name: 'PdmBdWorkorder',
|
||||
dicts: ['storagevehicle_type', 'pdm_workorder_status'],
|
||||
components: { MaterialDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '工单管理',
|
||||
url: 'api/pdmBdWorkorder',
|
||||
idField: 'workorder_id',
|
||||
sort: 'workorder_id,desc',
|
||||
crudMethod: { ...crudPdmBdWorkorder },
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: true,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
rules: {
|
||||
material_code: [
|
||||
{ required: true, message: '物料不能为空', trigger: 'blur' }
|
||||
],
|
||||
plan_qty: [
|
||||
{ required: true, message: '计划数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
planproducestart_date: [
|
||||
{ required: true, message: '计划开始不能为空', trigger: 'change' }
|
||||
],
|
||||
planproduceend_date: [
|
||||
{ required: true, message: '计划结束不能为空', trigger: 'change' }
|
||||
],
|
||||
point_code: [
|
||||
{ required: true, message: '设备编码不能为空', trigger: 'change' }
|
||||
],
|
||||
region_code: [
|
||||
{ required: true, message: '区域编码不能为空', trigger: 'change' }
|
||||
]
|
||||
/* workorder_type: [
|
||||
{ required: true, message: '工单类型不能为空', trigger: 'blur' }
|
||||
]*/
|
||||
},
|
||||
queryTypeOptions: [
|
||||
{ key: 'workorder_code', display_name: '工单编号' },
|
||||
{ key: 'point_code', display_name: '设备编码' }
|
||||
],
|
||||
workShopList: [],
|
||||
regionList: [],
|
||||
pointList: [],
|
||||
custerList: [],
|
||||
regionCodeParam: null,
|
||||
materialDialog: false,
|
||||
orderDialog: false,
|
||||
fullscreenLoading: false,
|
||||
materialCode: null,
|
||||
flag: 1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getWorkShopList()
|
||||
this.getRegionList()
|
||||
this.getCuster()
|
||||
},
|
||||
methods: {
|
||||
item() {
|
||||
return item
|
||||
},
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
[CRUD.HOOK.beforeToCU]() {
|
||||
const extData = this.form.ext_data
|
||||
if (extData !== undefined || extData !== null || extData !== '') {
|
||||
const ext = JSON.parse(extData)
|
||||
this.form.order_no = ext.order_no
|
||||
this.form.order_subnum = ext.custer_no
|
||||
this.form.custer_no = ext.custer_no
|
||||
}
|
||||
},
|
||||
getWorkShopList() { // 获取车间列表
|
||||
|
||||
},
|
||||
getRegionList() { // 获取区域列表
|
||||
const param = {
|
||||
is_has_workder: true
|
||||
}
|
||||
crudSchBaseRegion.getRegionList(param).then(res => {
|
||||
this.regionList = res
|
||||
})
|
||||
},
|
||||
getCuster() { // 获取客户信息
|
||||
crudPdmBdWorkorder.getCuster().then(res => {
|
||||
this.custerList = res
|
||||
})
|
||||
},
|
||||
getPointList() { // 获取点位列表
|
||||
if (this.regionCodeParam) {
|
||||
const param = {
|
||||
region_code: this.regionCodeParam
|
||||
}
|
||||
crudSchBasePoint.getPointList(param).then(res => {
|
||||
this.pointList = res
|
||||
this.regionCodeParam = null
|
||||
})
|
||||
}
|
||||
},
|
||||
getMaterial(flag) {
|
||||
this.materialDialog = true
|
||||
this.flag = flag
|
||||
},
|
||||
getProductionOrder(code) {
|
||||
this.orderDialog = true
|
||||
this.materialCode = code
|
||||
},
|
||||
tableChanged(row, flag) {
|
||||
if (flag === 1) {
|
||||
this.form.material_name = row.material_name
|
||||
this.form.material_id = row.material_id
|
||||
this.form.material_spec = '不存在'
|
||||
this.form.material_code = row.material_code
|
||||
this.form.struct_code = row.struct_code
|
||||
this.form.raw_material_code = row.storagevehicle_code
|
||||
}
|
||||
},
|
||||
clearRecordMesOrder() {
|
||||
this.form.order_no = null
|
||||
this.form.order_subnum = 0
|
||||
this.form.guadansum = 0
|
||||
},
|
||||
recordMesOrder(row) { // 操作mes工单
|
||||
this.clearRecordMesOrder()
|
||||
this.form.order_no = row.forder_NO
|
||||
this.form.order_subnum = row.forder_SUBNUM
|
||||
this.form.guadansum = row.guadansum
|
||||
},
|
||||
setRegionName(data) {
|
||||
// 清空
|
||||
this.form.point_code = null
|
||||
this.form.point_name = null
|
||||
this.regionCodeParam = data
|
||||
var region = this.regionList.find(item => item.region_code === data)
|
||||
this.form.region_name = region.region_name
|
||||
this.getPointList()
|
||||
},
|
||||
setPointName(data) {
|
||||
var point = this.pointList.find(item => item.point_code === data)
|
||||
this.form.point_name = point.point_name
|
||||
this.form.vehicle_type = point.can_vehicle_type
|
||||
},
|
||||
handOrderStatus(value) {
|
||||
this.crud.query.more_order_status = null
|
||||
if (value) {
|
||||
this.crud.query.more_order_status = value.toString()
|
||||
}
|
||||
this.crud.toQuery()
|
||||
},
|
||||
// 下发
|
||||
submits(row) {
|
||||
this.fullscreenLoading = true
|
||||
crudPdmBdWorkorder.submits(row).then(res => {
|
||||
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
}).finally(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
},
|
||||
synchronize() {
|
||||
this.fullscreenLoading = true
|
||||
crudPdmBdWorkorder.orderSynchronize(this.crud.query).then(res => {
|
||||
this.fullscreenLoading = false
|
||||
this.crud.notify('同步成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
}).finally(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
},
|
||||
forceFinish(row) {
|
||||
this.fullscreenLoading = true
|
||||
crudPdmBdWorkorder.forceFinish(row).then(res => {
|
||||
this.crud.notify('报工完成', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
}).finally(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,64 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/pdmBdWorkorder',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/pdmBdWorkorder/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/pdmBdWorkorder',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function submits(param) {
|
||||
return request({
|
||||
url: 'api/pdmBdWorkorder/submits',
|
||||
method: 'post',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
export function forceFinish(param) {
|
||||
return request({
|
||||
url: 'api/pdmBdWorkorder/forceFinish',
|
||||
method: 'post',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
|
||||
export function orderSynchronize(data) {
|
||||
return request({
|
||||
url: 'api/pdmBdWorkorder/synchronize',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function queryMaterials(data) {
|
||||
return request({
|
||||
url: 'api/pdmBdWorkorder/materials',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function getCuster() {
|
||||
return request({
|
||||
url: 'api/pdmBdWorkorder/getCuster',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, submits, forceFinish, orderSynchronize, queryMaterials, getCuster }
|
||||
@@ -238,7 +238,7 @@
|
||||
<el-form-item v-if="form.point_status !== '1'" label="载具类型" prop="vehicle_code">
|
||||
<el-select v-model="form.vehicle_type" placeholder="请选择" clearable style="width: 370px;">
|
||||
<el-option
|
||||
v-for="item in dict.vehicle_type"
|
||||
v-for="item in dict.storagevehicle_type"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
@@ -248,7 +248,7 @@
|
||||
<el-form-item label="可放载具类型" prop="can_vehicle_types">
|
||||
<el-select v-model="form.can_vehicle_types" multiple placeholder="请选择" clearable style="width: 370px;">
|
||||
<el-option
|
||||
v-for="item in dict.vehicle_type"
|
||||
v-for="item in dict.storagevehicle_type"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
@@ -285,9 +285,14 @@
|
||||
<el-table-column prop="point_status_name" label="点位状态" :min-width="flexWidth('point_status_name',crud.data,'点位类型')"/>
|
||||
<!-- <el-table-column prop="point_type" label="点位类型" :min-width="flexWidth('point_type',crud.data,'点位类型')" />-->
|
||||
<!-- <el-table-column prop="point_status" label="点位状态" :min-width="flexWidth('point_status',crud.data,'点位状态')" />-->
|
||||
<el-table-column prop="vehicle_type" label="载具类型" :min-width="flexWidth('vehicle_type',crud.data,'载具类型', 30)">
|
||||
<el-table-column prop="vehicle_type" label="当前载具类型" :min-width="flexWidth('vehicle_type',crud.data,'载具类型', 30)">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
|
||||
{{ dict.label.storagevehicle_type[scope.row.vehicle_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="can_vehicle_type" label="可放载具类型" :min-width="flexWidth('can_vehicle_type',crud.data,'载具类型', 30)">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.storagevehicle_type[scope.row.can_vehicle_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="vehicle_code" label="载具编码" :min-width="flexWidth('vehicle_code',crud.data,'载具编码')" />
|
||||
@@ -395,7 +400,7 @@ const defaultForm = {
|
||||
}
|
||||
export default {
|
||||
name: 'Point',
|
||||
dicts: ['vehicle_type', 'TrueOrFalse'],
|
||||
dicts: ['storagevehicle_type', 'TrueOrFalse'],
|
||||
components: { PointDialog, ViewDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
|
||||
Reference in New Issue
Block a user