Merge remote-tracking branch 'origin/master'

master
夜笙歌 12 months ago
commit 2c9281be86

@ -5,6 +5,7 @@ import com.hw.common.core.constant.ServiceNameConstants;
import com.hw.common.core.domain.R; import com.hw.common.core.domain.R;
import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo; import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesBaseProcessInfo;
import com.hw.mes.api.domain.MesBaseStationInfo; import com.hw.mes.api.domain.MesBaseStationInfo;
import com.hw.mes.api.domain.vo.MesBaseMaterialInfoVo; import com.hw.mes.api.domain.vo.MesBaseMaterialInfoVo;
import com.hw.mes.api.factory.RemoteMesFallbackFactory; import com.hw.mes.api.factory.RemoteMesFallbackFactory;
@ -59,4 +60,13 @@ public interface RemoteMesService {
@GetMapping("/barcode/getBarcodeByBindBarcode/{bindBarcode}") @GetMapping("/barcode/getBarcodeByBindBarcode/{bindBarcode}")
public R<MesBaseBarcodeInfo> getBarcodeByBindBarcode(@PathVariable("bindBarcode") String bindBarcode, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<MesBaseBarcodeInfo> getBarcodeByBindBarcode(@PathVariable("bindBarcode") String bindBarcode, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
*
*
* @param source
* @return
*/
@GetMapping("/processInfo/getProcesses")
public R<List<MesBaseProcessInfo>> getProcesses(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
} }

@ -0,0 +1,167 @@
package com.hw.mes.api.domain;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/**
* mes_base_process_info
*
* @author Yinq
* @date 2024-01-24
*/
public class MesBaseProcessInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long processId;
/**
*
*/
@Excel(name = "工序编号")
private String processCode;
/**
*
*/
@Excel(name = "工序名称")
private String processName;
/**
* 1-2-
*/
@Excel(name = "工序类别" , readConverterExp = "1=生产工序,2=质检工序")
private String processType;
/**
* ()
*/
@Excel(name = "标准工时(分钟)")
private Long productionTime;
/**
*
*/
@Excel(name = "标准工时(分钟)工序所在楼层")
private Integer processFloor;
/**
*
*/
@Excel(name = "激活标识")
private String activeFlag;
private Long processOrder;
/**
* 线
*/
private List<MesBaseProcessProdline> mesBaseProcessProdlineList;
/** 工序关联人员信息 */
private List<MesBaseProcessUser> mesBaseProcessUserList;
public List<MesBaseProcessUser> getMesBaseProcessUserList() {
return mesBaseProcessUserList;
}
public void setMesBaseProcessUserList(List<MesBaseProcessUser> mesBaseProcessUserList) {
this.mesBaseProcessUserList = mesBaseProcessUserList;
}
public void setProcessId(Long processId) {
this.processId = processId;
}
public Long getProcessId() {
return processId;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
public String getProcessCode() {
return processCode;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getProcessName() {
return processName;
}
public void setProcessType(String processType) {
this.processType = processType;
}
public String getProcessType() {
return processType;
}
public void setProductionTime(Long productionTime) {
this.productionTime = productionTime;
}
public Long getProductionTime() {
return productionTime;
}
public Integer getProcessFloor() {
return processFloor;
}
public void setProcessFloor(Integer processFloor) {
this.processFloor = processFloor;
}
public void setActiveFlag(String activeFlag) {
this.activeFlag = activeFlag;
}
public String getActiveFlag() {
return activeFlag;
}
public List<MesBaseProcessProdline> getMesBaseProcessProdlineList() {
return mesBaseProcessProdlineList;
}
public void setMesBaseProcessProdlineList(List<MesBaseProcessProdline> mesBaseProcessProdlineList) {
this.mesBaseProcessProdlineList = mesBaseProcessProdlineList;
}
public Long getProcessOrder() {
return processOrder;
}
public void setProcessOrder(Long processOrder) {
this.processOrder = processOrder;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("processId" , getProcessId())
.append("processCode" , getProcessCode())
.append("processName" , getProcessName())
.append("processType" , getProcessType())
.append("productionTime" , getProductionTime())
.append("activeFlag" , getActiveFlag())
.append("remark" , getRemark())
.append("createBy" , getCreateBy())
.append("createTime" , getCreateTime())
.append("updateBy" , getUpdateBy())
.append("updateTime" , getUpdateTime())
.append("mesBaseProcessProdlineList" , getMesBaseProcessProdlineList())
.toString();
}
}

@ -0,0 +1,51 @@
package com.hw.mes.api.domain;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 线 mes_base_process_prodline
*
* @author Yinq
* @date 2024-01-24
*/
public class MesBaseProcessProdline extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 工序ID关联工序信息主键 */
private Long processId;
/** 所属产线ID关联产线主键 */
private Long prodlineId;
public void setProcessId(Long processId)
{
this.processId = processId;
}
public Long getProcessId()
{
return processId;
}
public void setProdlineId(Long prodlineId)
{
this.prodlineId = prodlineId;
}
public Long getProdlineId()
{
return prodlineId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("processId", getProcessId())
.append("prodlineId", getProdlineId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -0,0 +1,77 @@
package com.hw.mes.api.domain;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* mes_base_process_user
*
* @author Yinq
* @date 2024-01-29
*/
public class MesBaseProcessUser extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 工序ID关联工序主键 */
private Long processId;
/** 用户ID关联用户主键 */
private Long userId;
/** 用户名称关联sys_user的user_name */
@Excel(name = "用户名称")
private String userName;
private Long routeId;
public void setProcessId(Long processId)
{
this.processId = processId;
}
public Long getProcessId()
{
return processId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public Long getRouteId() {
return routeId;
}
public void setRouteId(Long routeId) {
this.routeId = routeId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("processId", getProcessId())
.append("userId", getUserId())
.append("userName", getUserName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -0,0 +1,124 @@
package com.hw.mes.api.domain;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 线 mes_base_prodline_info
*
* @author Yinq
* @date 2024-01-24
*/
public class MesBaseProdlineInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long prodlineId;
/** 产线编号 */
@Excel(name = "产线编号")
private String prodlineCode;
/** 产线名称 */
@Excel(name = "产线名称")
private String prodlineName;
/** 产线类型 */
@Excel(name = "产线类型")
private String prodlineType;
/** 所属工厂ID */
@Excel(name = "所属工厂ID")
private Long factoryId;
/** 所属工厂名称 */
@Excel(name = "所属工厂名称")
private String factoryName;
/** 是否标识 */
@Excel(name = "是否标识")
private String isFlag;
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public void setProdlineId(Long prodlineId)
{
this.prodlineId = prodlineId;
}
public Long getProdlineId()
{
return prodlineId;
}
public void setProdlineCode(String prodlineCode)
{
this.prodlineCode = prodlineCode;
}
public String getProdlineCode()
{
return prodlineCode;
}
public void setProdlineName(String prodlineName)
{
this.prodlineName = prodlineName;
}
public String getProdlineName()
{
return prodlineName;
}
public void setProdlineType(String prodlineType)
{
this.prodlineType = prodlineType;
}
public String getProdlineType()
{
return prodlineType;
}
public void setFactoryId(Long factoryId)
{
this.factoryId = factoryId;
}
public Long getFactoryId()
{
return factoryId;
}
public void setIsFlag(String isFlag)
{
this.isFlag = isFlag;
}
public String getIsFlag()
{
return isFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("prodlineId", getProdlineId())
.append("prodlineCode", getProdlineCode())
.append("prodlineName", getProdlineName())
.append("prodlineType", getProdlineType())
.append("factoryId", getFactoryId())
.append("isFlag", getIsFlag())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -61,6 +61,8 @@ public class MesBaseStationInfo extends BaseEntity {
@Excel(name = "激活标识") @Excel(name = "激活标识")
private String activeFlag; private String activeFlag;
private String ipAddress;
public String getProcessName() { public String getProcessName() {
return processName; return processName;
} }
@ -125,6 +127,14 @@ public class MesBaseStationInfo extends BaseEntity {
return activeFlag; return activeFlag;
} }
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -4,6 +4,7 @@ import com.hw.common.core.domain.R;
import com.hw.mes.api.RemoteMesService; import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo; import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesBaseProcessInfo;
import com.hw.mes.api.domain.MesBaseStationInfo; import com.hw.mes.api.domain.MesBaseStationInfo;
import com.hw.mes.api.domain.vo.MesBaseMaterialInfoVo; import com.hw.mes.api.domain.vo.MesBaseMaterialInfoVo;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -45,6 +46,11 @@ public class RemoteMesFallbackFactory implements FallbackFactory<RemoteMesServic
public R<MesBaseBarcodeInfo> getBarcodeByBindBarcode(String bindBarcode, String source) { public R<MesBaseBarcodeInfo> getBarcodeByBindBarcode(String bindBarcode, String source) {
return R.fail("获取绑定条码信息失败:" + throwable.getMessage()); return R.fail("获取绑定条码信息失败:" + throwable.getMessage());
} }
@Override
public R<List<MesBaseProcessInfo>> getProcesses(String source) {
return R.fail("获取工序列表信息失败:" + throwable.getMessage());
}
}; };
} }
} }

@ -12,5 +12,7 @@ public class PrinterVo {
public String printType; public String printType;
public List<List<PrintContentVo>> printContents; // public List<List<PrintContentVo>> printContents;
public List<PrintContentVo> printContentVos;
} }

@ -59,14 +59,14 @@ public class LoginUser implements Serializable
private SysUser sysUser; private SysUser sysUser;
/** /**
* ID * ID
*/ */
private Long stationId; private Long processId;
/** /**
* *
*/ */
private String stationCode; private Integer processFloor;
public String getToken() public String getToken()
{ {
@ -158,19 +158,19 @@ public class LoginUser implements Serializable
this.sysUser = sysUser; this.sysUser = sysUser;
} }
public Long getStationId() { public Long getProcessId() {
return stationId; return processId;
} }
public void setStationId(Long stationId) { public void setProcessId(Long processId) {
this.stationId = stationId; this.processId = processId;
} }
public String getStationCode() { public Integer getProcessFloor() {
return stationCode; return processFloor;
} }
public void setStationCode(String stationCode) { public void setProcessFloor(Integer processFloor) {
this.stationCode = stationCode; this.processFloor = processFloor;
} }
} }

@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletRequest;
import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.constant.SecurityConstants;
import com.hw.mes.api.RemoteMesService; import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseProcessInfo;
import com.hw.mes.api.domain.MesBaseStationInfo; import com.hw.mes.api.domain.MesBaseStationInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -43,8 +44,8 @@ public class TokenController
{ {
// 用户登录 // 用户登录
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
userInfo.setStationId(form.getStationId()); userInfo.setProcessId(form.getProcessId());
userInfo.setStationCode(form.getStationCode()); userInfo.setProcessFloor(form.getProcessFloor());
// 获取登录token // 获取登录token
return R.ok(tokenService.createToken(userInfo)); return R.ok(tokenService.createToken(userInfo));
} }
@ -107,4 +108,16 @@ public class TokenController
return R.ok(resultR.getData()); return R.ok(resultR.getData());
} }
/**
*
* @return
*/
@GetMapping("getProcesses")
public R<?> getProcesses()
{
R<List<MesBaseProcessInfo>> resultR = remoteMesService.getProcesses(SecurityConstants.INNER);
return R.ok(resultR.getData());
}
} }

@ -19,14 +19,14 @@ public class LoginBody
/** /**
* ID * ID
*/ */
private Long stationId; private Long processId;
/** /**
* *
*/ */
private String stationCode; private Integer processFloor;
public String getUsername() public String getUsername()
{ {
@ -48,19 +48,20 @@ public class LoginBody
this.password = password; this.password = password;
} }
public Long getStationId() {
return stationId; public Long getProcessId() {
return processId;
} }
public void setStationId(Long stationId) { public void setProcessId(Long processId) {
this.stationId = stationId; this.processId = processId;
} }
public String getStationCode() { public Integer getProcessFloor() {
return stationCode; return processFloor;
} }
public void setStationCode(String stationCode) { public void setProcessFloor(Integer processFloor) {
this.stationCode = stationCode; this.processFloor = processFloor;
} }
} }

@ -51,10 +51,10 @@ public class SecurityConstants
/** /**
* ID * ID
*/ */
public static final String DETAILS_STATION_ID = "station_id"; public static final String DETAILS_PROCESS_ID = "process_id";
/** /**
* *
*/ */
public static final String DETAILS_STATION_CODE = "station_code"; public static final String DETAILS_PROCESS_FLOOR = "process_floor";
} }

@ -97,24 +97,24 @@ public class SecurityContextHolder
} }
public static Long getStationId() public static Long getProcessId()
{ {
return Convert.toLong(get(SecurityConstants.DETAILS_STATION_ID), 0L); return Convert.toLong(get(SecurityConstants.DETAILS_PROCESS_ID), 0L);
} }
public static void setStationId(String stationId) public static void setProcessId(String processId)
{ {
set(SecurityConstants.DETAILS_STATION_ID, stationId); set(SecurityConstants.DETAILS_PROCESS_ID, processId);
} }
public static String getStationCode() public static Integer getProcessFloor()
{ {
return get(SecurityConstants.DETAILS_STATION_CODE); return Convert.toInt(get(SecurityConstants.DETAILS_PROCESS_FLOOR),0);
} }
public static void setStationCode(String stationCode) public static void setProcessFloor(String processFloor)
{ {
set(SecurityConstants.DETAILS_STATION_CODE, stationCode); set(SecurityConstants.DETAILS_PROCESS_FLOOR, processFloor);
} }
} }

@ -123,24 +123,24 @@ public class JwtUtils
/** /**
* ID * ID
* *
* @param claims * @param claims
* @return ID * @return ID
*/ */
public static String getStationId(Claims claims) public static String getProcessId(Claims claims)
{ {
return getValue(claims, SecurityConstants.DETAILS_STATION_ID); return getValue(claims, SecurityConstants.DETAILS_PROCESS_ID);
} }
/** /**
* *
* *
* @param claims * @param claims
* @return * @return
*/ */
public static String getStationCode(Claims claims) public static String getProcessFloor(Claims claims)
{ {
return getValue(claims, SecurityConstants.DETAILS_STATION_CODE); return getValue(claims, SecurityConstants.DETAILS_PROCESS_FLOOR);
} }
} }

@ -31,8 +31,8 @@ public class HeaderInterceptor implements AsyncHandlerInterceptor
SecurityContextHolder.setUserId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USER_ID)); SecurityContextHolder.setUserId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USER_ID));
SecurityContextHolder.setUserName(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USERNAME)); SecurityContextHolder.setUserName(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USERNAME));
SecurityContextHolder.setUserKey(ServletUtils.getHeader(request, SecurityConstants.USER_KEY)); SecurityContextHolder.setUserKey(ServletUtils.getHeader(request, SecurityConstants.USER_KEY));
SecurityContextHolder.setStationId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_STATION_ID)); SecurityContextHolder.setProcessId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_PROCESS_ID));
SecurityContextHolder.setStationCode(ServletUtils.getHeader(request, SecurityConstants.DETAILS_STATION_CODE)); SecurityContextHolder.setProcessFloor(ServletUtils.getHeader(request, SecurityConstants.DETAILS_PROCESS_FLOOR));
String token = SecurityUtils.getToken(); String token = SecurityUtils.getToken();
if (StringUtils.isNotEmpty(token)) if (StringUtils.isNotEmpty(token))

@ -61,8 +61,8 @@ public class TokenService
claimsMap.put(SecurityConstants.USER_KEY, token); claimsMap.put(SecurityConstants.USER_KEY, token);
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName); claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName);
claimsMap.put(SecurityConstants.DETAILS_STATION_ID, loginUser.getStationId()); claimsMap.put(SecurityConstants.DETAILS_PROCESS_ID, loginUser.getProcessId());
claimsMap.put(SecurityConstants.DETAILS_STATION_CODE, loginUser.getStationCode()); claimsMap.put(SecurityConstants.DETAILS_PROCESS_FLOOR, loginUser.getProcessFloor());
// 接口返回信息 // 接口返回信息
Map<String, Object> rspMap = new HashMap<String, Object>(); Map<String, Object> rspMap = new HashMap<String, Object>();

@ -41,19 +41,19 @@ public class SecurityUtils
} }
/** /**
* ID * ID
*/ */
public static Long getStationId() public static Long getProcessId()
{ {
return SecurityContextHolder.getStationId(); return SecurityContextHolder.getProcessId();
} }
/** /**
* *
*/ */
public static String getStationCode() public static Integer getProcessFloor()
{ {
return SecurityContextHolder.getStationCode(); return SecurityContextHolder.getProcessFloor();
} }
/** /**

@ -69,8 +69,8 @@ public class AuthFilter implements GlobalFilter, Ordered
} }
String userid = JwtUtils.getUserId(claims); String userid = JwtUtils.getUserId(claims);
String username = JwtUtils.getUserName(claims); String username = JwtUtils.getUserName(claims);
String stationId = JwtUtils.getStationId(claims); String processId = JwtUtils.getProcessId(claims);
String stationCode = JwtUtils.getStationCode(claims); String processFloor = JwtUtils.getProcessFloor(claims);
if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username))
{ {
return unauthorizedResponse(exchange, "令牌验证失败"); return unauthorizedResponse(exchange, "令牌验证失败");
@ -80,8 +80,8 @@ public class AuthFilter implements GlobalFilter, Ordered
addHeader(mutate, SecurityConstants.USER_KEY, userkey); addHeader(mutate, SecurityConstants.USER_KEY, userkey);
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid); addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username); addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);
addHeader(mutate, SecurityConstants.DETAILS_STATION_ID, stationId); addHeader(mutate, SecurityConstants.DETAILS_PROCESS_ID, processId);
addHeader(mutate, SecurityConstants.DETAILS_STATION_CODE, stationCode); addHeader(mutate, SecurityConstants.DETAILS_PROCESS_FLOOR, processFloor);
// 内部请求来源参数清除 // 内部请求来源参数清除
removeHeader(mutate, SecurityConstants.FROM_SOURCE); removeHeader(mutate, SecurityConstants.FROM_SOURCE);
return chain.filter(exchange.mutate().request(mutate.build()).build()); return chain.filter(exchange.mutate().request(mutate.build()).build());

@ -4,7 +4,10 @@ import java.util.List;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.annotation.InnerAuth;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseProcessInfo;
import com.hw.mes.api.domain.MesBaseStationInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -17,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log; import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType; import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions; import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesBaseProcessInfo;
import com.hw.mes.service.IMesBaseProcessInfoService; import com.hw.mes.service.IMesBaseProcessInfoService;
import com.hw.common.core.web.controller.BaseController; import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult; import com.hw.common.core.web.domain.AjaxResult;
@ -137,4 +139,17 @@ public class MesBaseProcessInfoController extends BaseController
{ {
return toAjax(mesBaseProcessInfoService.deleteMesBaseProcessInfoByProcessIds(processIds)); return toAjax(mesBaseProcessInfoService.deleteMesBaseProcessInfoByProcessIds(processIds));
} }
/**
*
*/
@InnerAuth
@GetMapping("/getProcesses")
public AjaxResult getProcesses(MesBaseProcessInfo mesBaseProcessInfo)
{
List<MesBaseProcessInfo> list = mesBaseProcessInfoService.selectMesBaseProcessInfoList(mesBaseProcessInfo);
return success(list);
}
} }

@ -5,6 +5,7 @@ import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseProdlineInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -17,7 +18,6 @@ import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log; import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType; import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions; import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesBaseProdlineInfo;
import com.hw.mes.service.IMesBaseProdlineInfoService; import com.hw.mes.service.IMesBaseProdlineInfoService;
import com.hw.common.core.web.controller.BaseController; import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult; import com.hw.common.core.web.domain.AjaxResult;

@ -1,12 +1,15 @@
package com.hw.mes.controller; package com.hw.mes.controller;
import java.util.List; import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.constant.MesConstants; import com.hw.common.core.constant.MesConstants;
import com.hw.mes.domain.MesBaseRouteProcess;
import com.hw.mes.domain.MesProductOrder; import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.service.IMesProductOrderService; import com.hw.mes.domain.vo.MesProductPlanDeleteVo;
import com.hw.mes.domain.vo.MesProductPlanEditVo;
import com.hw.mes.service.IMesBaseProcessInfoService;
import com.hw.mes.service.IMesBaseRouteProcessService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -39,6 +42,12 @@ public class MesProductPlanController extends BaseController
@Autowired @Autowired
private IMesProductPlanService mesProductPlanService; private IMesProductPlanService mesProductPlanService;
@Autowired
private IMesBaseProcessInfoService mesBaseProcessInfoService;
@Autowired
private IMesBaseRouteProcessService mesBaseRouteProcessService;
/** /**
* *
*/ */
@ -56,10 +65,10 @@ public class MesProductPlanController extends BaseController
* @param mesProductPlan * @param mesProductPlan
* @return * @return
*/ */
@GetMapping("/getProductPlan") @GetMapping("/selectProductPlans")
public AjaxResult getProductPlan(MesProductPlan mesProductPlan) public AjaxResult selectProductPlans(MesProductPlan mesProductPlan)
{ {
List<MesProductPlan> list = mesProductPlanService.selectMesProductPlanList(mesProductPlan); List<MesProductPlan> list = mesProductPlanService.selectMesProductPlanJoinProcessList(mesProductPlan);
return success(list); return success(list);
} }
@ -135,9 +144,9 @@ public class MesProductPlanController extends BaseController
@RequiresPermissions("mes:productplan:add") @RequiresPermissions("mes:productplan:add")
@Log(title = "生产派工", businessType = BusinessType.INSERT) @Log(title = "生产派工", businessType = BusinessType.INSERT)
@PostMapping("/orderAddMesProductPlanList") @PostMapping("/orderAddMesProductPlanList")
public AjaxResult orderAddMesProductPlanList(@RequestBody List<MesProductPlan> mesProductPlanList) public AjaxResult orderAddMesProductPlanList(@RequestBody MesProductPlanEditVo productPlanEditVo)
{ {
return toAjax(mesProductPlanService.orderAddMesProductPlanList(mesProductPlanList)); return toAjax(mesProductPlanService.orderAddMesProductPlanList(productPlanEditVo));
} }
/** /**
@ -171,4 +180,38 @@ public class MesProductPlanController extends BaseController
return toAjax(mesProductPlanService.productOrderRecall(mesProductOrder)); return toAjax(mesProductPlanService.productOrderRecall(mesProductOrder));
} }
/**
*
* @param mesBaseRouteProcess
* @return
*/
@GetMapping(value = "/getBaseRouteProcesses")
public AjaxResult getBaseRouteProcesses(MesBaseRouteProcess mesBaseRouteProcess)
{
return success(mesBaseRouteProcessService.selectMesBaseRouteProcessJoinList(mesBaseRouteProcess));
}
/**
* 线
* @param routeId 线ID
* @return
*/
@GetMapping(value = "/getProcessUsers/{routeId}")
public AjaxResult getProcessUsers(@PathVariable("routeId") Long routeId)
{
return success(mesBaseProcessInfoService.getProcessUsersByRouteId(routeId));
}
/**
*
* @param mesProductPlanDeleteVo VO
* @return
*/
@PostMapping(value = "/deleteProductPlansByDispatchCode")
public AjaxResult deleteProductPlansByDispatchCode(@RequestBody MesProductPlanDeleteVo mesProductPlanDeleteVo)
{
return success(mesProductPlanService.deleteProductPlansByDispatchCode(mesProductPlanDeleteVo));
}
} }

@ -1,143 +1,153 @@
package com.hw.mes.domain; //package com.hw.mes.domain;
//
import java.util.List; //import java.util.List;
//
import org.apache.commons.lang3.builder.ToStringBuilder; //import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; //import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel; //import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity; //import com.hw.common.core.web.domain.BaseEntity;
//
/** ///**
* mes_base_process_info // * 工序信息对象 mes_base_process_info
* // *
* @author Yinq // * @author Yinq
* @date 2024-01-24 // * @date 2024-01-24
*/ // */
public class MesBaseProcessInfo extends BaseEntity { //public class MesBaseProcessInfo extends BaseEntity {
private static final long serialVersionUID = 1L; // private static final long serialVersionUID = 1L;
//
/** // /**
* // * 主键标识
*/ // */
private Long processId; // private Long processId;
//
/** // /**
* // * 工序编号
*/ // */
@Excel(name = "工序编号") // @Excel(name = "工序编号")
private String processCode; // private String processCode;
//
/** // /**
* // * 工序名称
*/ // */
@Excel(name = "工序名称") // @Excel(name = "工序名称")
private String processName; // private String processName;
//
/** // /**
* 1-2- // * 工序类别1-生产工序2-质检工序)
*/ // */
@Excel(name = "工序类别" , readConverterExp = "1=生产工序,2=质检工序") // @Excel(name = "工序类别" , readConverterExp = "1=生产工序,2=质检工序")
private String processType; // private String processType;
//
/** // /**
* () // * 标准工时(分钟)
*/ // */
@Excel(name = "标准工时(分钟)") // @Excel(name = "标准工时(分钟)")
private Long productionTime; // private Long productionTime;
//
/** // /**
* // * 激活标识
*/ // */
@Excel(name = "激活标识") // @Excel(name = "激活标识")
private String activeFlag; // private String activeFlag;
//
/** // private Long processOrder;
* 线 //
*/ // /**
private List<MesBaseProcessProdline> mesBaseProcessProdlineList; // * 工序关联产线信息
// */
/** 工序关联人员信息 */ // private List<MesBaseProcessProdline> mesBaseProcessProdlineList;
private List<MesBaseProcessUser> mesBaseProcessUserList; //
// /** 工序关联人员信息 */
public List<MesBaseProcessUser> getMesBaseProcessUserList() { // private List<MesBaseProcessUser> mesBaseProcessUserList;
return mesBaseProcessUserList; //
} // public List<MesBaseProcessUser> getMesBaseProcessUserList() {
// return mesBaseProcessUserList;
public void setMesBaseProcessUserList(List<MesBaseProcessUser> mesBaseProcessUserList) { // }
this.mesBaseProcessUserList = mesBaseProcessUserList; //
} // public void setMesBaseProcessUserList(List<MesBaseProcessUser> mesBaseProcessUserList) {
// this.mesBaseProcessUserList = mesBaseProcessUserList;
public void setProcessId(Long processId) { // }
this.processId = processId; //
} // public void setProcessId(Long processId) {
// this.processId = processId;
public Long getProcessId() { // }
return processId; //
} // public Long getProcessId() {
// return processId;
public void setProcessCode(String processCode) { // }
this.processCode = processCode; //
} // public void setProcessCode(String processCode) {
// this.processCode = processCode;
public String getProcessCode() { // }
return processCode; //
} // public String getProcessCode() {
// return processCode;
public void setProcessName(String processName) { // }
this.processName = processName; //
} // public void setProcessName(String processName) {
// this.processName = processName;
public String getProcessName() { // }
return processName; //
} // public String getProcessName() {
// return processName;
public void setProcessType(String processType) { // }
this.processType = processType; //
} // public void setProcessType(String processType) {
// this.processType = processType;
public String getProcessType() { // }
return processType; //
} // public String getProcessType() {
// return processType;
public void setProductionTime(Long productionTime) { // }
this.productionTime = productionTime; //
} // public void setProductionTime(Long productionTime) {
// this.productionTime = productionTime;
public Long getProductionTime() { // }
return productionTime; //
} // public Long getProductionTime() {
// return productionTime;
public void setActiveFlag(String activeFlag) { // }
this.activeFlag = activeFlag; //
} // public void setActiveFlag(String activeFlag) {
// this.activeFlag = activeFlag;
public String getActiveFlag() { // }
return activeFlag; //
} // public String getActiveFlag() {
// return activeFlag;
public List<MesBaseProcessProdline> getMesBaseProcessProdlineList() { // }
return mesBaseProcessProdlineList; //
} // public List<MesBaseProcessProdline> getMesBaseProcessProdlineList() {
// return mesBaseProcessProdlineList;
public void setMesBaseProcessProdlineList(List<MesBaseProcessProdline> mesBaseProcessProdlineList) { // }
this.mesBaseProcessProdlineList = mesBaseProcessProdlineList; //
} // public void setMesBaseProcessProdlineList(List<MesBaseProcessProdline> mesBaseProcessProdlineList) {
// this.mesBaseProcessProdlineList = mesBaseProcessProdlineList;
@Override // }
public String toString() { //
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) // public Long getProcessOrder() {
.append("processId" , getProcessId()) // return processOrder;
.append("processCode" , getProcessCode()) // }
.append("processName" , getProcessName()) //
.append("processType" , getProcessType()) // public void setProcessOrder(Long processOrder) {
.append("productionTime" , getProductionTime()) // this.processOrder = processOrder;
.append("activeFlag" , getActiveFlag()) // }
.append("remark" , getRemark()) //
.append("createBy" , getCreateBy()) // @Override
.append("createTime" , getCreateTime()) // public String toString() {
.append("updateBy" , getUpdateBy()) // return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("updateTime" , getUpdateTime()) // .append("processId" , getProcessId())
.append("mesBaseProcessProdlineList" , getMesBaseProcessProdlineList()) // .append("processCode" , getProcessCode())
.toString(); // .append("processName" , getProcessName())
} // .append("processType" , getProcessType())
} // .append("productionTime" , getProductionTime())
// .append("activeFlag" , getActiveFlag())
// .append("remark" , getRemark())
// .append("createBy" , getCreateBy())
// .append("createTime" , getCreateTime())
// .append("updateBy" , getUpdateBy())
// .append("updateTime" , getUpdateTime())
// .append("mesBaseProcessProdlineList" , getMesBaseProcessProdlineList())
// .toString();
// }
//}

@ -1,52 +1,52 @@
package com.hw.mes.domain; //package com.hw.mes.domain;
//
import org.apache.commons.lang3.builder.ToStringBuilder; //import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; //import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel; //import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity; //import com.hw.common.core.web.domain.BaseEntity;
//
/** ///**
* 线 mes_base_process_prodline // * 工序关联产线对象 mes_base_process_prodline
* // *
* @author Yinq // * @author Yinq
* @date 2024-01-24 // * @date 2024-01-24
*/ // */
public class MesBaseProcessProdline extends BaseEntity //public class MesBaseProcessProdline extends BaseEntity
{ //{
private static final long serialVersionUID = 1L; // private static final long serialVersionUID = 1L;
//
/** 工序ID关联工序信息主键 */ // /** 工序ID关联工序信息主键 */
private Long processId; // private Long processId;
//
/** 所属产线ID关联产线主键 */ // /** 所属产线ID关联产线主键 */
private Long prodlineId; // private Long prodlineId;
//
public void setProcessId(Long processId) // public void setProcessId(Long processId)
{ // {
this.processId = processId; // this.processId = processId;
} // }
//
public Long getProcessId() // public Long getProcessId()
{ // {
return processId; // return processId;
} // }
public void setProdlineId(Long prodlineId) // public void setProdlineId(Long prodlineId)
{ // {
this.prodlineId = prodlineId; // this.prodlineId = prodlineId;
} // }
//
public Long getProdlineId() // public Long getProdlineId()
{ // {
return prodlineId; // return prodlineId;
} // }
//
@Override // @Override
public String toString() { // public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) // return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("processId", getProcessId()) // .append("processId", getProcessId())
.append("prodlineId", getProdlineId()) // .append("prodlineId", getProdlineId())
.append("createBy", getCreateBy()) // .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) // .append("createTime", getCreateTime())
.toString(); // .toString();
} // }
} //}

@ -1,66 +1,77 @@
package com.hw.mes.domain; //package com.hw.mes.domain;
//
import org.apache.commons.lang3.builder.ToStringBuilder; //import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; //import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel; //import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity; //import com.hw.common.core.web.domain.BaseEntity;
//
/** ///**
* mes_base_process_user // * 工序关联人员对象 mes_base_process_user
* // *
* @author Yinq // * @author Yinq
* @date 2024-01-29 // * @date 2024-01-29
*/ // */
public class MesBaseProcessUser extends BaseEntity //public class MesBaseProcessUser extends BaseEntity
{ //{
private static final long serialVersionUID = 1L; // private static final long serialVersionUID = 1L;
//
/** 工序ID关联工序主键 */ // /** 工序ID关联工序主键 */
private Long processId; // private Long processId;
//
/** 用户ID关联用户主键 */ // /** 用户ID关联用户主键 */
private Long userId; // private Long userId;
//
/** 用户名称关联sys_user的user_name */ // /** 用户名称关联sys_user的user_name */
@Excel(name = "用户名称") // @Excel(name = "用户名称")
private String userName; // private String userName;
//
public void setProcessId(Long processId) // private Long routeId;
{ //
this.processId = processId; //
} // public void setProcessId(Long processId)
// {
public Long getProcessId() // this.processId = processId;
{ // }
return processId; //
} // public Long getProcessId()
public void setUserId(Long userId) // {
{ // return processId;
this.userId = userId; // }
} // public void setUserId(Long userId)
// {
public Long getUserId() // this.userId = userId;
{ // }
return userId; //
} // public Long getUserId()
public void setUserName(String userName) // {
{ // return userId;
this.userName = userName; // }
} // public void setUserName(String userName)
// {
public String getUserName() // this.userName = userName;
{ // }
return userName; //
} // public String getUserName()
// {
@Override // return userName;
public String toString() { // }
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) //
.append("processId", getProcessId()) // public Long getRouteId() {
.append("userId", getUserId()) // return routeId;
.append("userName", getUserName()) // }
.append("createBy", getCreateBy()) //
.append("createTime", getCreateTime()) // public void setRouteId(Long routeId) {
.toString(); // this.routeId = routeId;
} // }
} //
// @Override
// public String toString() {
// return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
// .append("processId", getProcessId())
// .append("userId", getUserId())
// .append("userName", getUserName())
// .append("createBy", getCreateBy())
// .append("createTime", getCreateTime())
// .toString();
// }
//}

@ -1,124 +1,124 @@
package com.hw.mes.domain; //package com.hw.mes.domain;
//
import org.apache.commons.lang3.builder.ToStringBuilder; //import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; //import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel; //import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity; //import com.hw.common.core.web.domain.BaseEntity;
//
/** ///**
* 线 mes_base_prodline_info // * 产线信息对象 mes_base_prodline_info
* // *
* @author Yinq // * @author Yinq
* @date 2024-01-24 // * @date 2024-01-24
*/ // */
public class MesBaseProdlineInfo extends BaseEntity //public class MesBaseProdlineInfo extends BaseEntity
{ //{
private static final long serialVersionUID = 1L; // private static final long serialVersionUID = 1L;
//
/** 主键标识 */ // /** 主键标识 */
private Long prodlineId; // private Long prodlineId;
//
/** 产线编号 */ // /** 产线编号 */
@Excel(name = "产线编号") // @Excel(name = "产线编号")
private String prodlineCode; // private String prodlineCode;
//
/** 产线名称 */ // /** 产线名称 */
@Excel(name = "产线名称") // @Excel(name = "产线名称")
private String prodlineName; // private String prodlineName;
//
/** 产线类型 */ // /** 产线类型 */
@Excel(name = "产线类型") // @Excel(name = "产线类型")
private String prodlineType; // private String prodlineType;
//
/** 所属工厂ID */ // /** 所属工厂ID */
@Excel(name = "所属工厂ID") // @Excel(name = "所属工厂ID")
private Long factoryId; // private Long factoryId;
//
/** 所属工厂名称 */ // /** 所属工厂名称 */
@Excel(name = "所属工厂名称") // @Excel(name = "所属工厂名称")
private String factoryName; // private String factoryName;
//
/** 是否标识 */ // /** 是否标识 */
@Excel(name = "是否标识") // @Excel(name = "是否标识")
private String isFlag; // private String isFlag;
//
public String getFactoryName() { // public String getFactoryName() {
return factoryName; // return factoryName;
} // }
//
public void setFactoryName(String factoryName) { // public void setFactoryName(String factoryName) {
this.factoryName = factoryName; // this.factoryName = factoryName;
} // }
//
public void setProdlineId(Long prodlineId) // public void setProdlineId(Long prodlineId)
{ // {
this.prodlineId = prodlineId; // this.prodlineId = prodlineId;
} // }
//
public Long getProdlineId() // public Long getProdlineId()
{ // {
return prodlineId; // return prodlineId;
} // }
public void setProdlineCode(String prodlineCode) // public void setProdlineCode(String prodlineCode)
{ // {
this.prodlineCode = prodlineCode; // this.prodlineCode = prodlineCode;
} // }
//
public String getProdlineCode() // public String getProdlineCode()
{ // {
return prodlineCode; // return prodlineCode;
} // }
public void setProdlineName(String prodlineName) // public void setProdlineName(String prodlineName)
{ // {
this.prodlineName = prodlineName; // this.prodlineName = prodlineName;
} // }
//
public String getProdlineName() // public String getProdlineName()
{ // {
return prodlineName; // return prodlineName;
} // }
public void setProdlineType(String prodlineType) // public void setProdlineType(String prodlineType)
{ // {
this.prodlineType = prodlineType; // this.prodlineType = prodlineType;
} // }
//
public String getProdlineType() // public String getProdlineType()
{ // {
return prodlineType; // return prodlineType;
} // }
public void setFactoryId(Long factoryId) // public void setFactoryId(Long factoryId)
{ // {
this.factoryId = factoryId; // this.factoryId = factoryId;
} // }
//
public Long getFactoryId() // public Long getFactoryId()
{ // {
return factoryId; // return factoryId;
} // }
public void setIsFlag(String isFlag) // public void setIsFlag(String isFlag)
{ // {
this.isFlag = isFlag; // this.isFlag = isFlag;
} // }
//
public String getIsFlag() // public String getIsFlag()
{ // {
return isFlag; // return isFlag;
} // }
//
@Override // @Override
public String toString() { // public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) // return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("prodlineId", getProdlineId()) // .append("prodlineId", getProdlineId())
.append("prodlineCode", getProdlineCode()) // .append("prodlineCode", getProdlineCode())
.append("prodlineName", getProdlineName()) // .append("prodlineName", getProdlineName())
.append("prodlineType", getProdlineType()) // .append("prodlineType", getProdlineType())
.append("factoryId", getFactoryId()) // .append("factoryId", getFactoryId())
.append("isFlag", getIsFlag()) // .append("isFlag", getIsFlag())
.append("remark", getRemark()) // .append("remark", getRemark())
.append("createBy", getCreateBy()) // .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) // .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) // .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) // .append("updateTime", getUpdateTime())
.toString(); // .toString();
} // }
} //}

@ -37,6 +37,13 @@ public class MesBaseRouteProcess extends BaseEntity {
@Excel(name = "工艺路线顺序") @Excel(name = "工艺路线顺序")
private Long processOrder; private Long processOrder;
private String processName;
private String processType;
private Long productionTime;
public void setRouteProcessId(Long routeProcessId) { public void setRouteProcessId(Long routeProcessId) {
this.routeProcessId = routeProcessId; this.routeProcessId = routeProcessId;
} }
@ -69,6 +76,30 @@ public class MesBaseRouteProcess extends BaseEntity {
return processOrder; return processOrder;
} }
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getProcessType() {
return processType;
}
public void setProcessType(String processType) {
this.processType = processType;
}
public Long getProductionTime() {
return productionTime;
}
public void setProductionTime(Long productionTime) {
this.productionTime = productionTime;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -3,6 +3,8 @@ package com.hw.mes.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Date; import java.util.Date;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -94,6 +96,9 @@ public class MesProductPlan extends BaseEntity
@Excel(name = "用户ID") @Excel(name = "用户ID")
private Long userId; private Long userId;
private String userName;
/** 单位生产时间(单位s) */ /** 单位生产时间(单位s) */
@Excel(name = "单位生产时间(单位s)") @Excel(name = "单位生产时间(单位s)")
private Long productionTime; private Long productionTime;
@ -171,6 +176,8 @@ public class MesProductPlan extends BaseEntity
private BigDecimal dispatchedAmount; private BigDecimal dispatchedAmount;
private String processType;
public Long getSaleOrderId() { public Long getSaleOrderId() {
return saleOrderId; return saleOrderId;
@ -345,6 +352,15 @@ public class MesProductPlan extends BaseEntity
{ {
return userId; return userId;
} }
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public void setProductionTime(Long productionTime) public void setProductionTime(Long productionTime)
{ {
this.productionTime = productionTime; this.productionTime = productionTime;
@ -479,6 +495,14 @@ public class MesProductPlan extends BaseEntity
this.materialName = materialName; this.materialName = materialName;
} }
public String getProcessType() {
return processType;
}
public void setProcessType(String processType) {
this.processType = processType;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -511,4 +535,17 @@ public class MesProductPlan extends BaseEntity
.append("mesProductPlanDetailList", getMesProductPlanDetailList()) .append("mesProductPlanDetailList", getMesProductPlanDetailList())
.toString(); .toString();
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MesProductPlan that = (MesProductPlan) o;
return Objects.equals(planId, that.planId);
}
@Override
public int hashCode() {
return Objects.hash(planId);
}
} }

@ -0,0 +1,33 @@
package com.hw.mes.domain.vo;
import com.hw.mes.domain.MesProductPlan;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
* @Description: VO
* @ClassName: ProductPlanDeleteVo
* @Author : xins
* @Date :2024-07-12 15:04
* @Version :1.0
*/
@Data
public class MesProductPlanDeleteVo {
//派工数量
@NotNull(message = "生产工单ID必须输入")
private Long productOrderId;
//派工单号
@NotBlank(message = "派工单号必须输入")
private String dispatchCode;
//派工数量
@NotNull(message = "派工数量必须输入")
private BigDecimal dispatchAmount;
}

@ -0,0 +1,34 @@
package com.hw.mes.domain.vo;
import com.hw.mes.domain.MesProductPlan;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
* @Description: VO
* @ClassName: ProductPlanEditVo
* @Author : xins
* @Date :2024-07-11 10:18
* @Version :1.0
*/
@Data
public class MesProductPlanEditVo {
//生产工单ID
@NotNull(message = "生产工单Id必须输入")
private Long productOrderId;
//此次生产派工数量
private BigDecimal dispatchAmount;
//保存的生产计划
@NotNull(message = "没有修改的生产派工提交")
private List<MesProductPlan> mesProductPlanList;
//待删除的生产计划ID
private Long[] toDeletedPlanIds;
}

@ -1,9 +1,11 @@
package com.hw.mes.mapper; package com.hw.mes.mapper;
import com.hw.mes.api.domain.MesBaseProcessInfo;
import com.hw.mes.api.domain.MesBaseProcessProdline;
import com.hw.mes.api.domain.MesBaseProcessUser;
import java.util.List; import java.util.List;
import com.hw.mes.domain.MesBaseProcessInfo;
import com.hw.mes.domain.MesBaseProcessProdline;
import com.hw.mes.domain.MesBaseProcessUser;
/** /**
* Mapper * Mapper

@ -0,0 +1,62 @@
package com.hw.mes.mapper;
import com.hw.mes.api.domain.MesBaseProcessUser;
import java.util.List;
/**
* Mapper
*
* @author xins
* @date 2024-07-09
*/
public interface MesBaseProcessUserMapper
{
/**
*
*
* @param processId
* @return
*/
public MesBaseProcessUser selectMesBaseProcessUserByProcessId(Long processId);
/**
*
*
* @param mesBaseProcessUser
* @return
*/
public List<MesBaseProcessUser> selectMesBaseProcessUserList(MesBaseProcessUser mesBaseProcessUser);
/**
*
*
* @param mesBaseProcessUser
* @return
*/
public int insertMesBaseProcessUser(MesBaseProcessUser mesBaseProcessUser);
/**
*
*
* @param mesBaseProcessUser
* @return
*/
public int updateMesBaseProcessUser(MesBaseProcessUser mesBaseProcessUser);
/**
*
*
* @param processId
* @return
*/
public int deleteMesBaseProcessUserByProcessId(Long processId);
/**
*
*
* @param processIds
* @return
*/
public int deleteMesBaseProcessUserByProcessIds(Long[] processIds);
}

@ -1,7 +1,8 @@
package com.hw.mes.mapper; package com.hw.mes.mapper;
import com.hw.mes.api.domain.MesBaseProdlineInfo;
import java.util.List; import java.util.List;
import com.hw.mes.domain.MesBaseProdlineInfo;
/** /**
* 线Mapper * 线Mapper

@ -58,4 +58,14 @@ public interface MesBaseRouteProcessMapper
* @return * @return
*/ */
public int deleteMesBaseRouteProcessByRouteProcessIds(Long[] routeProcessIds); public int deleteMesBaseRouteProcessByRouteProcessIds(Long[] routeProcessIds);
/**
* 线Join mes_base_process_info
*
* @param mesBaseRouteProcess 线
* @return 线
*/
public List<MesBaseRouteProcess> selectMesBaseRouteProcessJoinList(MesBaseRouteProcess mesBaseRouteProcess);
} }

@ -59,4 +59,15 @@ public interface MesBaseStationInfoMapper
* @return * @return
*/ */
public int deleteMesBaseStationInfoByStationIds(Long[] stationIds); public int deleteMesBaseStationInfoByStationIds(Long[] stationIds);
/**
*
*
* @param ipAddress IP
* @return
*/
public MesBaseStationInfo selectMesBaseStationInfoByStationIp(String ipAddress);
} }

@ -104,4 +104,26 @@ public interface MesProductPlanMapper
* @return * @return
*/ */
public MesProductPlan selectOnlyMesProductPlanByPlanCode(String planCode); public MesProductPlan selectOnlyMesProductPlanByPlanCode(String planCode);
/**
* ,Join process
*
* @param mesProductPlan
* @return
*/
public List<MesProductPlan> selectMesProductPlanJoinProcessList(MesProductPlan mesProductPlan);
/**
*
*
* @param dispatchCode
* @return
*/
public int deleteMesProductPlanByDispatchCode(String dispatchCode);
} }

@ -53,6 +53,12 @@ public interface IMesBaseBarcodeInfoService
*/ */
public int generateNoPurchaseRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo); public int generateNoPurchaseRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo);
/**
*
* @param mesBaseBarcodeInfo
*/
public int generateRegularRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo);
/** /**
* *
* *

@ -1,7 +1,10 @@
package com.hw.mes.service; package com.hw.mes.service;
import java.util.List; import java.util.List;
import com.hw.mes.domain.MesBaseProcessInfo;
import com.hw.mes.api.domain.MesBaseProcessInfo;
import com.hw.mes.api.domain.MesBaseProcessUser;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Service * Service
@ -73,4 +76,12 @@ public interface IMesBaseProcessInfoService
* @return * @return
*/ */
public int deleteMesBaseProcessInfoByProcessId(Long processId); public int deleteMesBaseProcessInfoByProcessId(Long processId);
/**
* 线ID
*
* @param routeId
*/
public List<MesBaseProcessUser> getProcessUsersByRouteId(Long routeId);
} }

@ -1,7 +1,8 @@
package com.hw.mes.service; package com.hw.mes.service;
import com.hw.mes.api.domain.MesBaseProdlineInfo;
import java.util.List; import java.util.List;
import com.hw.mes.domain.MesBaseProdlineInfo;
/** /**
* 线Service * 线Service

@ -58,4 +58,13 @@ public interface IMesBaseRouteProcessService
* @return * @return
*/ */
public int deleteMesBaseRouteProcessByRouteProcessId(Long routeProcessId); public int deleteMesBaseRouteProcessByRouteProcessId(Long routeProcessId);
/**
* 线,Join mes_base_process
*
* @param mesBaseRouteProcess 线
* @return 线
*/
public List<MesBaseRouteProcess> selectMesBaseRouteProcessJoinList(MesBaseRouteProcess mesBaseRouteProcess);
} }

@ -9,6 +9,8 @@ import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.domain.MesProductPlan; import com.hw.mes.domain.MesProductPlan;
import com.hw.mes.domain.vo.MesAssignTaskVo; import com.hw.mes.domain.vo.MesAssignTaskVo;
import com.hw.mes.domain.vo.MesMaterialScanVo; import com.hw.mes.domain.vo.MesMaterialScanVo;
import com.hw.mes.domain.vo.MesProductPlanDeleteVo;
import com.hw.mes.domain.vo.MesProductPlanEditVo;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
@ -35,6 +37,16 @@ public interface IMesProductPlanService
*/ */
public List<MesProductPlan> selectMesProductPlanList(MesProductPlan mesProductPlan); public List<MesProductPlan> selectMesProductPlanList(MesProductPlan mesProductPlan);
/**
* ,join process
*
* @param mesProductPlan
* @return
*/
public List<MesProductPlan> selectMesProductPlanJoinProcessList(MesProductPlan mesProductPlan);
/** /**
* *
* *
@ -86,10 +98,10 @@ public interface IMesProductPlanService
/** /**
* List * List
* *
* @param mesProductPlanList * @param mesProductPlanEditVo VO
* @return * @return
*/ */
public int orderAddMesProductPlanList(List<MesProductPlan> mesProductPlanList); public int orderAddMesProductPlanList(MesProductPlanEditVo mesProductPlanEditVo);
/** /**
@ -137,4 +149,13 @@ public interface IMesProductPlanService
* @return * @return
*/ */
List<HashMap<String, Object>> selectMaterialInstallationCircumstance(Map hashMap); List<HashMap<String, Object>> selectMaterialInstallationCircumstance(Map hashMap);
/**
*
*
* @param mesProductPlanDeleteVo VO
* @return
*/
public int deleteProductPlansByDispatchCode(MesProductPlanDeleteVo mesProductPlanDeleteVo);
} }

@ -5,15 +5,19 @@ import java.util.List;
import com.hw.common.core.exception.ServiceException; import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesBaseProcessUser; import com.hw.mes.api.domain.MesBaseProcessInfo;
import com.hw.mes.api.domain.MesBaseProcessProdline;
import com.hw.mes.api.domain.MesBaseProcessUser;
import com.hw.mes.mapper.MesBaseProcessUserMapper;
import com.hw.mes.mapper.MesBaseRouteProcessMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.hw.mes.domain.MesBaseProcessProdline;
import com.hw.mes.mapper.MesBaseProcessInfoMapper; import com.hw.mes.mapper.MesBaseProcessInfoMapper;
import com.hw.mes.domain.MesBaseProcessInfo;
import com.hw.mes.service.IMesBaseProcessInfoService; import com.hw.mes.service.IMesBaseProcessInfoService;
/** /**
@ -23,11 +27,17 @@ import com.hw.mes.service.IMesBaseProcessInfoService;
* @date 2024-01-24 * @date 2024-01-24
*/ */
@Service @Service
public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService {
{
@Autowired @Autowired
private MesBaseProcessInfoMapper mesBaseProcessInfoMapper; private MesBaseProcessInfoMapper mesBaseProcessInfoMapper;
@Autowired
private MesBaseRouteProcessMapper mesBaseRouteProcessMapper;
@Autowired
private MesBaseProcessUserMapper mesBaseProcessUserMapper;
/** /**
* *
* *
@ -35,8 +45,7 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
* @return * @return
*/ */
@Override @Override
public MesBaseProcessInfo selectMesBaseProcessInfoByProcessId(Long processId) public MesBaseProcessInfo selectMesBaseProcessInfoByProcessId(Long processId) {
{
return mesBaseProcessInfoMapper.selectMesBaseProcessInfoByProcessId(processId); return mesBaseProcessInfoMapper.selectMesBaseProcessInfoByProcessId(processId);
} }
@ -47,8 +56,7 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
* @return * @return
*/ */
@Override @Override
public MesBaseProcessInfo selectMesBaseProcessInfoUserByProcessId(Long processId) public MesBaseProcessInfo selectMesBaseProcessInfoUserByProcessId(Long processId) {
{
return mesBaseProcessInfoMapper.selectMesBaseProcessInfoUserByProcessId(processId); return mesBaseProcessInfoMapper.selectMesBaseProcessInfoUserByProcessId(processId);
} }
@ -59,8 +67,7 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
* @return * @return
*/ */
@Override @Override
public List<MesBaseProcessInfo> selectMesBaseProcessInfoList(MesBaseProcessInfo mesBaseProcessInfo) public List<MesBaseProcessInfo> selectMesBaseProcessInfoList(MesBaseProcessInfo mesBaseProcessInfo) {
{
return mesBaseProcessInfoMapper.selectMesBaseProcessInfoList(mesBaseProcessInfo); return mesBaseProcessInfoMapper.selectMesBaseProcessInfoList(mesBaseProcessInfo);
} }
@ -72,8 +79,7 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
*/ */
@Transactional @Transactional
@Override @Override
public int insertMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo) public int insertMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo) {
{
mesBaseProcessInfo.setCreateTime(DateUtils.getNowDate()); mesBaseProcessInfo.setCreateTime(DateUtils.getNowDate());
int rows = mesBaseProcessInfoMapper.insertMesBaseProcessInfo(mesBaseProcessInfo); int rows = mesBaseProcessInfoMapper.insertMesBaseProcessInfo(mesBaseProcessInfo);
//insertMesBaseProcessProdline(mesBaseProcessInfo); //insertMesBaseProcessProdline(mesBaseProcessInfo);
@ -88,8 +94,7 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
*/ */
@Transactional @Transactional
@Override @Override
public int updateMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo) public int updateMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo) {
{
mesBaseProcessInfo.setUpdateTime(DateUtils.getNowDate()); mesBaseProcessInfo.setUpdateTime(DateUtils.getNowDate());
mesBaseProcessInfoMapper.deleteMesBaseProcessProdlineByProcessId(mesBaseProcessInfo.getProcessId()); mesBaseProcessInfoMapper.deleteMesBaseProcessProdlineByProcessId(mesBaseProcessInfo.getProcessId());
try { try {
@ -108,8 +113,7 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
*/ */
@Transactional @Transactional
@Override @Override
public int updateMesBaseProcessInfoUser(MesBaseProcessInfo mesBaseProcessInfo) public int updateMesBaseProcessInfoUser(MesBaseProcessInfo mesBaseProcessInfo) {
{
mesBaseProcessInfo.setUpdateTime(DateUtils.getNowDate()); mesBaseProcessInfo.setUpdateTime(DateUtils.getNowDate());
mesBaseProcessInfoMapper.deleteMesBaseProcessUserByProcessId(mesBaseProcessInfo.getProcessId()); mesBaseProcessInfoMapper.deleteMesBaseProcessUserByProcessId(mesBaseProcessInfo.getProcessId());
try { try {
@ -128,8 +132,7 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
*/ */
@Transactional @Transactional
@Override @Override
public int deleteMesBaseProcessInfoByProcessIds(Long[] processIds) public int deleteMesBaseProcessInfoByProcessIds(Long[] processIds) {
{
mesBaseProcessInfoMapper.deleteMesBaseProcessProdlineByProcessIds(processIds); mesBaseProcessInfoMapper.deleteMesBaseProcessProdlineByProcessIds(processIds);
return mesBaseProcessInfoMapper.deleteMesBaseProcessInfoByProcessIds(processIds); return mesBaseProcessInfoMapper.deleteMesBaseProcessInfoByProcessIds(processIds);
} }
@ -142,8 +145,7 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
*/ */
@Transactional @Transactional
@Override @Override
public int deleteMesBaseProcessInfoByProcessId(Long processId) public int deleteMesBaseProcessInfoByProcessId(Long processId) {
{
mesBaseProcessInfoMapper.deleteMesBaseProcessProdlineByProcessId(processId); mesBaseProcessInfoMapper.deleteMesBaseProcessProdlineByProcessId(processId);
return mesBaseProcessInfoMapper.deleteMesBaseProcessInfoByProcessId(processId); return mesBaseProcessInfoMapper.deleteMesBaseProcessInfoByProcessId(processId);
} }
@ -153,22 +155,18 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
* *
* @param mesBaseProcessInfo * @param mesBaseProcessInfo
*/ */
public void insertMesBaseProcessProdline(MesBaseProcessInfo mesBaseProcessInfo) public void insertMesBaseProcessProdline(MesBaseProcessInfo mesBaseProcessInfo) {
{
List<MesBaseProcessProdline> mesBaseProcessProdlineList = mesBaseProcessInfo.getMesBaseProcessProdlineList(); List<MesBaseProcessProdline> mesBaseProcessProdlineList = mesBaseProcessInfo.getMesBaseProcessProdlineList();
Long processId = mesBaseProcessInfo.getProcessId(); Long processId = mesBaseProcessInfo.getProcessId();
if (StringUtils.isNotNull(mesBaseProcessProdlineList)) if (StringUtils.isNotNull(mesBaseProcessProdlineList)) {
{
List<MesBaseProcessProdline> list = new ArrayList<MesBaseProcessProdline>(); List<MesBaseProcessProdline> list = new ArrayList<MesBaseProcessProdline>();
for (MesBaseProcessProdline mesBaseProcessProdline : mesBaseProcessProdlineList) for (MesBaseProcessProdline mesBaseProcessProdline : mesBaseProcessProdlineList) {
{
mesBaseProcessProdline.setProcessId(processId); mesBaseProcessProdline.setProcessId(processId);
mesBaseProcessProdline.setCreateBy(SecurityUtils.getUsername()); mesBaseProcessProdline.setCreateBy(SecurityUtils.getUsername());
mesBaseProcessProdline.setCreateTime(DateUtils.getNowDate()); mesBaseProcessProdline.setCreateTime(DateUtils.getNowDate());
list.add(mesBaseProcessProdline); list.add(mesBaseProcessProdline);
} }
if (list.size() > 0) if (list.size() > 0) {
{
mesBaseProcessInfoMapper.batchMesBaseProcessProdline(list); mesBaseProcessInfoMapper.batchMesBaseProcessProdline(list);
} }
} }
@ -179,22 +177,34 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
* *
* @param mesBaseProcessInfo * @param mesBaseProcessInfo
*/ */
public void insertMesBaseProcessUser(MesBaseProcessInfo mesBaseProcessInfo) public void insertMesBaseProcessUser(MesBaseProcessInfo mesBaseProcessInfo) {
{
List<MesBaseProcessUser> mesBaseProcessUserList = mesBaseProcessInfo.getMesBaseProcessUserList(); List<MesBaseProcessUser> mesBaseProcessUserList = mesBaseProcessInfo.getMesBaseProcessUserList();
Long processId = mesBaseProcessInfo.getProcessId(); Long processId = mesBaseProcessInfo.getProcessId();
if (StringUtils.isNotNull(mesBaseProcessUserList)) if (StringUtils.isNotNull(mesBaseProcessUserList)) {
{
List<MesBaseProcessUser> list = new ArrayList<>(); List<MesBaseProcessUser> list = new ArrayList<>();
for (MesBaseProcessUser mesBaseProcessUser : mesBaseProcessUserList) for (MesBaseProcessUser mesBaseProcessUser : mesBaseProcessUserList) {
{
mesBaseProcessUser.setProcessId(processId); mesBaseProcessUser.setProcessId(processId);
list.add(mesBaseProcessUser); list.add(mesBaseProcessUser);
} }
if (list.size() > 0) if (list.size() > 0) {
{
mesBaseProcessInfoMapper.batchMesBaseProcessUser(list); mesBaseProcessInfoMapper.batchMesBaseProcessUser(list);
} }
} }
} }
/**
* 线ID
*
* @param routeId
*/
@Override
public List<MesBaseProcessUser> getProcessUsersByRouteId(Long routeId) {
MesBaseProcessUser queryBaseProcessUser = new MesBaseProcessUser();
queryBaseProcessUser.setRouteId(routeId);
return mesBaseProcessUserMapper.selectMesBaseProcessUserList(queryBaseProcessUser);
}
} }

@ -2,10 +2,10 @@ package com.hw.mes.service.impl;
import java.util.List; import java.util.List;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.mes.api.domain.MesBaseProdlineInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesBaseProdlineInfoMapper; import com.hw.mes.mapper.MesBaseProdlineInfoMapper;
import com.hw.mes.domain.MesBaseProdlineInfo;
import com.hw.mes.service.IMesBaseProdlineInfoService; import com.hw.mes.service.IMesBaseProdlineInfoService;
/** /**

@ -93,4 +93,18 @@ public class MesBaseRouteProcessServiceImpl implements IMesBaseRouteProcessServi
{ {
return mesBaseRouteProcessMapper.deleteMesBaseRouteProcessByRouteProcessId(routeProcessId); return mesBaseRouteProcessMapper.deleteMesBaseRouteProcessByRouteProcessId(routeProcessId);
} }
/**
* 线,Join mes_base_process
*
* @param mesBaseRouteProcess 线
* @return 线
*/
@Override
public List<MesBaseRouteProcess> selectMesBaseRouteProcessJoinList(MesBaseRouteProcess mesBaseRouteProcess)
{
return mesBaseRouteProcessMapper.selectMesBaseRouteProcessJoinList(mesBaseRouteProcess);
}
} }

@ -9,14 +9,18 @@ import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.exception.ServiceException; import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.SocketUtils; import com.hw.common.core.utils.SocketUtils;
import com.hw.common.core.utils.ip.IpUtils;
import com.hw.common.core.utils.uuid.Seq; import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseStationInfo;
import com.hw.mes.config.MesConfig; import com.hw.mes.config.MesConfig;
import com.hw.mes.domain.*; import com.hw.mes.domain.*;
import com.hw.mes.domain.vo.MesAssignTaskVo; import com.hw.mes.domain.vo.MesAssignTaskVo;
import com.hw.mes.domain.vo.MesMaterialScanVo; import com.hw.mes.domain.vo.MesMaterialScanVo;
import com.hw.mes.domain.vo.MesProductPlanDeleteVo;
import com.hw.mes.domain.vo.MesProductPlanEditVo;
import com.hw.mes.mapper.*; import com.hw.mes.mapper.*;
import com.hw.mes.service.IMesBaseAttachInfoService; import com.hw.mes.service.IMesBaseAttachInfoService;
import com.hw.mes.service.IMesProductOrderService; import com.hw.mes.service.IMesProductOrderService;
@ -63,6 +67,9 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
@Autowired @Autowired
private MesMaterialAssignInfoMapper mesMaterialAssignInfoMapper; private MesMaterialAssignInfoMapper mesMaterialAssignInfoMapper;
@Autowired
private MesProductOrderMapper mesProductOrderMapper;
@Autowired @Autowired
private MesConfig mesConfig; private MesConfig mesConfig;
@ -88,6 +95,32 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
return mesProductPlanMapper.selectMesProductPlanList(mesProductPlan); return mesProductPlanMapper.selectMesProductPlanList(mesProductPlan);
} }
/**
* ,join process
*
* @param mesProductPlan
* @return
*/
@Override
public List<MesProductPlan> selectMesProductPlanJoinProcessList(MesProductPlan mesProductPlan) {
return mesProductPlanMapper.selectMesProductPlanJoinProcessList(mesProductPlan);
}
/**
*
*
* @param mesProductPlan
* @return
*/
// @Override
// public List<MesProductPlan> selectMesProductPlanGroupList(MesProductPlan mesProductPlan) {
// List<MesProductPlan> productPlans = mesProductPlanMapper.selectMesProductPlanList(mesProductPlan);
// return "";
// }
/** /**
* *
* *
@ -98,24 +131,12 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
@Override @Override
public int insertMesProductPlan(MesProductPlan mesProductPlan) { public int insertMesProductPlan(MesProductPlan mesProductPlan) {
if (mesProductPlan.getDispatchAmount().compareTo(BigDecimal.ZERO) > 0) { if (mesProductPlan.getDispatchAmount().compareTo(BigDecimal.ZERO) > 0) {
if (mesProductPlan.getProcessId().equals(42L)) {//折弯工序,计划数量可以跟派工数量不相同
if (mesProductPlan.getPlanAmount() == null) {
throw new ServiceException("四楼折弯工序请输入计划数量");
}
} else {//非折弯工序,计划数量需与派工数量相同
mesProductPlan.setPlanAmount(mesProductPlan.getDispatchAmount()); mesProductPlan.setPlanAmount(mesProductPlan.getDispatchAmount());
}
mesProductPlan.setCreateBy(SecurityUtils.getUsername()); mesProductPlan.setCreateBy(SecurityUtils.getUsername());
mesProductPlan.setCreateTime(DateUtils.getNowDate()); mesProductPlan.setCreateTime(DateUtils.getNowDate());
mesProductPlan.setPlanCode(Seq.getId(Seq.planCodeSeqType, Seq.planCodeCode)); mesProductPlan.setPlanCode(Seq.getId(Seq.planCodeSeqType, Seq.planCodeCode));
int rows = mesProductPlanMapper.insertMesProductPlan(mesProductPlan); int rows = mesProductPlanMapper.insertMesProductPlan(mesProductPlan);
//更新工单已派工数量
MesProductOrder mesProductOrder = new MesProductOrder();
mesProductOrder.setProductOrderId(mesProductPlan.getProductOrderId());
mesProductOrder.setDispatchAmount(mesProductPlan.getDispatchedAmount());
mesProductOrderService.updateMesProductOrder(mesProductOrder);
// insertMesProductPlanDetail(mesProductPlan);
return rows; return rows;
} }
return 0; return 0;
@ -197,15 +218,55 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
/** /**
* List * List
* *
* @param mesProductPlanList * @param mesProductPlanEditVo VO
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int orderAddMesProductPlanList(List<MesProductPlan> mesProductPlanList) { public int orderAddMesProductPlanList(MesProductPlanEditVo mesProductPlanEditVo) {
for (MesProductPlan mesProductPlan : mesProductPlanList) { String userName = SecurityUtils.getUsername();
this.insertMesProductPlan(mesProductPlan); Date currentDate = new Date();
List<MesProductPlan> mesProductPlanList = mesProductPlanEditVo.getMesProductPlanList();
Long[] toDeletedPlanIds = mesProductPlanEditVo.getToDeletedPlanIds();
if (toDeletedPlanIds != null && toDeletedPlanIds.length > 0) {
for (Long toDeletedPlanId : toDeletedPlanIds) {
MesProductPlan toDeletedProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(toDeletedPlanId);
if (!toDeletedProductPlan.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_TO_DISPATCH)
&& !toDeletedProductPlan.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)) {
throw new ServiceException("有派工已经开始,不能删除");
} }
}
mesProductPlanMapper.deleteMesProductPlanByPlanIds(toDeletedPlanIds);
}
for (MesProductPlan mesProductPlan : mesProductPlanList) {
Long planId = mesProductPlan.getPlanId();
if (planId != null) {
mesProductPlan.setUpdateBy(userName);
mesProductPlan.setUpdateTime(currentDate);
mesProductPlanMapper.updateMesProductPlan(mesProductPlan);
} else {
mesProductPlan.setPlanAmount(mesProductPlan.getDispatchAmount());
mesProductPlan.setCreateBy(SecurityUtils.getUsername());
mesProductPlan.setCreateTime(DateUtils.getNowDate());
mesProductPlan.setPlanCode(Seq.getId(Seq.planCodeSeqType, Seq.planCodeCode));
mesProductPlanMapper.insertMesProductPlan(mesProductPlan);
}
}
//更新工单已派工数量
MesProductOrder mesProductOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(mesProductPlanEditVo.getProductOrderId());
BigDecimal dispatchedAmount = mesProductOrder.getDispatchAmount() == null ? BigDecimal.ZERO : mesProductOrder.getDispatchAmount();
BigDecimal planAmount = mesProductOrder.getPlanAmount();
BigDecimal updateDispatchAmount = dispatchedAmount.add(mesProductPlanEditVo.getDispatchAmount());
if (updateDispatchAmount.compareTo(planAmount) > 0) {
throw new ServiceException("派工数量大于计划数量,请重新派工");
}
mesProductOrder.setDispatchAmount(updateDispatchAmount);
mesProductOrder.setUpdateTime(currentDate);
mesProductOrder.setUpdateBy(userName);
mesProductOrderService.updateMesProductOrder(mesProductOrder);
return 1; return 1;
} }
@ -278,11 +339,17 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
*/ */
@Override @Override
public List<MesProductPlan> selectMesProductPlanJoinList(MesProductPlan mesProductPlan) { public List<MesProductPlan> selectMesProductPlanJoinList(MesProductPlan mesProductPlan) {
Long stationId = SecurityUtils.getStationId(); Long processId = SecurityUtils.getProcessId();
mesProductPlan.setStationId(stationId); Long userId = SecurityUtils.getUserId();
if(!SecurityUtils.isAdmin(userId)) {
mesProductPlan.setUserId(userId);
}
mesProductPlan.setProcessId(processId);
// String ipAddress = IpUtils.getIpAddr();
// MesBaseStationInfo mesBaseStationInfo = mesBase
// queryBaseStation.set
List<MesProductPlan> mesProductPlans = mesProductPlanMapper.selectMesProductPlanJoinList(mesProductPlan); return mesProductPlanMapper.selectMesProductPlanJoinList(mesProductPlan);
return mesProductPlans;
// return mesProductPlans.stream(). // return mesProductPlans.stream().
// filter(e -> e.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED) || // filter(e -> e.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED) ||
// e.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_STARTED)).collect(Collectors.toList()); // e.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_STARTED)).collect(Collectors.toList());
@ -361,7 +428,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
} }
String barcodeType = baseBarcodeInfo.getBarcodeType(); String barcodeType = baseBarcodeInfo.getBarcodeType();
if(!barcodeType.equals(MesConstants.MES_BARCODE_TYPE_RAW)){ if (!barcodeType.equals(MesConstants.MES_BARCODE_TYPE_RAW)) {
throw new ServiceException("此条码为非原材料条码"); throw new ServiceException("此条码为非原材料条码");
} }
@ -498,6 +565,42 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
} }
/**
*
*
* @param mesProductPlanDeleteVo VO
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteProductPlansByDispatchCode(MesProductPlanDeleteVo mesProductPlanDeleteVo) {
String dispatchCode = mesProductPlanDeleteVo.getDispatchCode();
BigDecimal dispatchAmount = mesProductPlanDeleteVo.getDispatchAmount();
MesProductPlan queryProductPlan = new MesProductPlan();
queryProductPlan.setDispatchCode(dispatchCode);
List<MesProductPlan> mesProductPlans = mesProductPlanMapper.selectMesProductPlanList(queryProductPlan);
if (mesProductPlans == null || mesProductPlans.isEmpty()) {
throw new ServiceException("此派工单已经删除");
}
List<MesProductPlan> filterProductPlans = mesProductPlans.stream().filter
(mesProductPlan -> !mesProductPlan.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_TO_DISPATCH) &&
!mesProductPlan.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)).collect(Collectors.toList());
if (!filterProductPlans.isEmpty()) {
throw new ServiceException("此派工单已经有工序开始,不能删除");
}
mesProductPlanMapper.deleteMesProductPlanByDispatchCode(dispatchCode);
MesProductOrder mesProductOrder = mesProductOrderService.selectMesProductOrderByProductOrderId(mesProductPlanDeleteVo.getProductOrderId());
BigDecimal dispatchedAmount = mesProductOrder.getDispatchAmount();
mesProductOrder.setDispatchAmount(dispatchedAmount.subtract(dispatchAmount));
mesProductOrder.setUpdateBy(SecurityUtils.getUsername());
mesProductOrder.setUpdateTime(new Date());
return mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
// public String executeAssignTaskResultTask() { // public String executeAssignTaskResultTask() {
// ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); // ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
// boolean running = true; // boolean running = true;

@ -119,6 +119,7 @@
<if test="bindTime != null ">and bbi.bind_time = #{bindTime}</if> <if test="bindTime != null ">and bbi.bind_time = #{bindTime}</if>
<if test="updateBy != null and updateBy != ''">and bbi.update_by = #{updateBy}</if> <if test="updateBy != null and updateBy != ''">and bbi.update_by = #{updateBy}</if>
<if test="updateTime != null ">and bbi.update_time = #{updateTime}</if> <if test="updateTime != null ">and bbi.update_time = #{updateTime}</if>
<if test="barcodeTypeStr != null and barcodeTypeStr != ''">and bbi.barcode_type in (${barcodeTypeStr})</if>
</where> </where>
order by bbi.barcode_id desc order by bbi.barcode_id desc
</select> </select>

@ -9,6 +9,7 @@
<result property="processCode" column="process_code"/> <result property="processCode" column="process_code"/>
<result property="processName" column="process_name"/> <result property="processName" column="process_name"/>
<result property="processType" column="process_type"/> <result property="processType" column="process_type"/>
<result property="processFloor" column="process_floor"/>
<result property="productionTime" column="production_time"/> <result property="productionTime" column="production_time"/>
<result property="activeFlag" column="active_flag"/> <result property="activeFlag" column="active_flag"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
@ -50,6 +51,7 @@
process_code, process_code,
process_name, process_name,
process_type, process_type,
process_floor,
production_time, production_time,
active_flag, active_flag,
remark, remark,
@ -80,6 +82,7 @@
a.process_code, a.process_code,
a.process_name, a.process_name,
a.process_type, a.process_type,
a.process_floor,
a.production_time, a.production_time,
a.active_flag, a.active_flag,
a.remark, a.remark,
@ -102,6 +105,7 @@
a.process_code, a.process_code,
a.process_name, a.process_name,
a.process_type, a.process_type,
a.process_floor,
a.production_time, a.production_time,
a.active_flag, a.active_flag,
a.remark, a.remark,
@ -126,6 +130,7 @@
<if test="processCode != null">process_code,</if> <if test="processCode != null">process_code,</if>
<if test="processName != null and processName != ''">process_name,</if> <if test="processName != null and processName != ''">process_name,</if>
<if test="processType != null and processType != ''">process_type,</if> <if test="processType != null and processType != ''">process_type,</if>
<if test="processFloor != null and processFloor != ''">process_floor,</if>
<if test="productionTime != null">production_time,</if> <if test="productionTime != null">production_time,</if>
<if test="activeFlag != null and activeFlag != ''">active_flag,</if> <if test="activeFlag != null and activeFlag != ''">active_flag,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
@ -138,6 +143,7 @@
<if test="processCode != null">#{processCode},</if> <if test="processCode != null">#{processCode},</if>
<if test="processName != null and processName != ''">#{processName},</if> <if test="processName != null and processName != ''">#{processName},</if>
<if test="processType != null and processType != ''">#{processType},</if> <if test="processType != null and processType != ''">#{processType},</if>
<if test="processFloor != null and processFloor != ''">#{processFloor},</if>
<if test="productionTime != null">#{productionTime},</if> <if test="productionTime != null">#{productionTime},</if>
<if test="activeFlag != null and activeFlag != ''">#{activeFlag},</if> <if test="activeFlag != null and activeFlag != ''">#{activeFlag},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
@ -154,6 +160,7 @@
<if test="processCode != null">process_code = #{processCode},</if> <if test="processCode != null">process_code = #{processCode},</if>
<if test="processName != null and processName != ''">process_name = #{processName},</if> <if test="processName != null and processName != ''">process_name = #{processName},</if>
<if test="processType != null and processType != ''">process_type = #{processType},</if> <if test="processType != null and processType != ''">process_type = #{processType},</if>
<if test="processFloor != null and processFloor != ''">process_floor = #{processFloor},</if>
<if test="productionTime != null">production_time = #{productionTime},</if> <if test="productionTime != null">production_time = #{productionTime},</if>
<if test="activeFlag != null and activeFlag != ''">active_flag = #{activeFlag},</if> <if test="activeFlag != null and activeFlag != ''">active_flag = #{activeFlag},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>

@ -0,0 +1,73 @@
<?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="com.hw.mes.mapper.MesBaseProcessUserMapper">
<resultMap type="MesBaseProcessUser" id="MesBaseProcessUserResult">
<result property="processId" column="process_id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="routeId" column="route_id" />
</resultMap>
<sql id="selectMesBaseProcessUserVo">
select process_id, user_id, user_name, create_by, create_time from mes_base_process_user mbpu
</sql>
<select id="selectMesBaseProcessUserList" parameterType="MesBaseProcessUser" resultMap="MesBaseProcessUserResult">
<include refid="selectMesBaseProcessUserVo"/>
<where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="routeId != null "> and exists (select 1 from mes_base_route_process mbrp where mbrp.process_id=mbpu.process_id and mbrp.route_id = #{routeId} )</if>
</where>
</select>
<select id="selectMesBaseProcessUserByProcessId" parameterType="Long" resultMap="MesBaseProcessUserResult">
<include refid="selectMesBaseProcessUserVo"/>
where process_id = #{processId}
</select>
<insert id="insertMesBaseProcessUser" parameterType="MesBaseProcessUser">
insert into mes_base_process_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="processId != null">process_id,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="processId != null">#{processId},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateMesBaseProcessUser" parameterType="MesBaseProcessUser">
update mes_base_process_user
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where process_id = #{processId}
</update>
<delete id="deleteMesBaseProcessUserByProcessId" parameterType="Long">
delete from mes_base_process_user where process_id = #{processId}
</delete>
<delete id="deleteMesBaseProcessUserByProcessIds" parameterType="String">
delete from mes_base_process_user where process_id in
<foreach item="processId" collection="array" open="(" separator="," close=")">
#{processId}
</foreach>
</delete>
</mapper>

@ -14,6 +14,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="processName" column="process_name" />
<result property="processType" column="process_type" />
<result property="productionTime" column="production_time" />
</resultMap> </resultMap>
<sql id="selectMesBaseRouteProcessVo"> <sql id="selectMesBaseRouteProcessVo">
@ -88,4 +92,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{routeProcessId} #{routeProcessId}
</foreach> </foreach>
</delete> </delete>
<select id="selectMesBaseRouteProcessJoinList" parameterType="MesBaseRouteProcess" resultMap="MesBaseRouteProcessResult">
select mbrp.route_process_id, mbrp.route_id, mbrp.process_id, mbrp.process_order,
mbpi.process_name,mbpi.process_type,mbpi.production_time
from mes_base_route_process mbrp left join mes_base_process_info mbpi on mbrp.process_id=mbpi.process_id
<where>
<if test="routeId != null "> and mbrp.route_id = #{routeId}</if>
<if test="processId != null "> and mbrp.process_id = #{processId}</if>
<if test="processOrder != null "> and mbrp.process_order = #{processOrder}</if>
<if test="remark != null and remark != ''"> and rmbrp.emark = #{remark}</if>
</where>
</select>
</mapper> </mapper>

@ -13,6 +13,7 @@
<result property="floor" column="floor"/> <result property="floor" column="floor"/>
<result property="productionTime" column="production_time"/> <result property="productionTime" column="production_time"/>
<result property="activeFlag" column="active_flag"/> <result property="activeFlag" column="active_flag"/>
<result property="ipAddress" column="ip_address"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
@ -29,6 +30,7 @@
mbsi.floor, mbsi.floor,
mbsi.production_time, mbsi.production_time,
mbsi.active_flag, mbsi.active_flag,
mbsi.ip_address,
mbsi.remark, mbsi.remark,
mbsi.create_by, mbsi.create_by,
mbsi.create_time, mbsi.create_time,
@ -123,4 +125,10 @@
#{stationId} #{stationId}
</foreach> </foreach>
</delete> </delete>
<select id="selectMesBaseStationInfoByStationIp" parameterType="String" resultMap="MesBaseStationInfoResult">
<include refid="selectMesBaseStationInfoVo"/>
where ip_address = #{ipAddress}
</select>
</mapper> </mapper>

@ -21,6 +21,7 @@
<result property="lastProcessName" column="lastProcessName"/> <result property="lastProcessName" column="lastProcessName"/>
<result property="stationId" column="station_id"/> <result property="stationId" column="station_id"/>
<result property="userId" column="user_id"/> <result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="productionTime" column="production_time"/> <result property="productionTime" column="production_time"/>
<result property="dispatchAmount" column="dispatch_amount"/> <result property="dispatchAmount" column="dispatch_amount"/>
<result property="planAmount" column="plan_amount"/> <result property="planAmount" column="plan_amount"/>
@ -41,6 +42,7 @@
<result property="materialCode" column="material_code"/> <result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/> <result property="materialName" column="material_name"/>
<result property="processName" column="process_name"/> <result property="processName" column="process_name"/>
<result property="processType" column="process_type"/>
<result property="stationName" column="station_name"/> <result property="stationName" column="station_name"/>
<result property="sopId" column="sop_id"/> <result property="sopId" column="sop_id"/>
<result property="orderCode" column="order_code"/> <result property="orderCode" column="order_code"/>
@ -331,14 +333,15 @@
<select id="selectMesProductPlanJoinList" parameterType="MesProductPlan" resultMap="MesProductPlanResult"> <select id="selectMesProductPlanJoinList" parameterType="MesProductPlan" resultMap="MesProductPlanResult">
select mpp.plan_id, mpp.product_order_id, mpp.sale_order_id,mpp.saleorder_code,mpp.plan_code, mpp.dispatch_code, mpp.material_id, select mpp.plan_id, mpp.product_order_id, mpp.sale_order_id,mpp.saleorder_code,mpp.plan_code, mpp.dispatch_code, mpp.material_id,
mpp.material_bom_id, mpp.process_id, mpp.process_order, mpp.last_process_id, mpp.material_bom_id, mpp.process_id, mpp.process_order, mpp.last_process_id,mpp.user_id,
mpp.station_id, mpp.dispatch_amount, mpp.plan_amount, mpp.complete_amount, mpp.plan_begin_time, mpp.plan_end_time, mpp.station_id, mpp.dispatch_amount, mpp.plan_amount, mpp.complete_amount, mpp.plan_begin_time, mpp.plan_end_time,
mpp.real_begin_time, mpp.real_end_time, mpp.real_begin_time, mpp.real_end_time,
mpp.attach_id, mpp.plan_status, mpo.plan_delivery_date,mbmi.material_code,mbmi.material_name mpp.attach_id, mpp.plan_status, mpo.plan_delivery_date,mbmi.material_code,mbmi.material_name
from mes_product_plan mpp left join mes_product_order mpo on mpp.product_order_id = mpo.product_order_id from mes_product_plan mpp left join mes_product_order mpo on mpp.product_order_id = mpo.product_order_id
left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id
<where> <where>
<if test="stationId != null ">and mpp.station_id = #{stationId}</if> <if test="processId != null ">and mpp.process_id = #{processId}</if>
<if test="userId != null ">and mpp.user_id = #{userId}</if>
<if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</if> <if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</if>
</where> </where>
order by mpo.plan_delivery_date order by mpo.plan_delivery_date
@ -381,4 +384,76 @@
where a.plan_code = #{planCode} where a.plan_code = #{planCode}
</select> </select>
<select id="selectMesProductPlanJoinProcessList" parameterType="MesProductPlan" resultMap="MesProductPlanResult">
select mpp.plan_id,
mpp.product_order_id,
mpp.plan_code,
mpp.dispatch_code,
mpp.material_id,
mpp.material_bom_id,
mpp.process_id,
bpi.process_name,
bpi.process_type,
mpp.process_order,
mpp.last_process_id,
mpp.final_process_flag,
mpp.station_id,
mpp.user_id,
mpp.user_name,
mpp.production_time,
mpp.dispatch_amount,
mpp.plan_amount,
mpp.complete_amount,
mpp.plan_begin_time,
mpp.plan_end_time,
mpp.real_begin_time,
mpp.real_end_time,
mpp.attach_id,
mpp.sop_id,
mpp.plan_status,
mpp.is_flag,
mpp.remark,
mpp.create_by,
mpp.create_time,
mpp.update_by,
mpp.update_time
from mes_product_plan mpp
left join mes_base_process_info bpi on bpi.process_id = mpp.process_id
<where>
<if test="productOrderId != null ">and mpp.product_order_id = #{productOrderId}</if>
<if test="planCode != null and planCode != ''">and mpp.plan_code = #{planCode}</if>
<if test="dispatchCode != null and dispatchCode != ''">and mpp.dispatch_code = #{dispatchCode}</if>
<if test="materialId != null ">and mpp.material_id = #{materialId}</if>
<if test="materialBomId != null ">and mpp.material_bom_id = #{materialBomId}</if>
<if test="processId != null ">and mpp.process_id = #{processId}</if>
<if test="processOrder != null ">and mpp.process_order = #{processOrder}</if>
<if test="lastProcessId != null ">and mpp.last_process_id = #{lastProcessId}</if>
<if test="stationId != null ">and mpp.station_id = #{stationId}</if>
<if test="userId != null ">and mpp.user_id = #{userId}</if>
<if test="productionTime != null ">and mpp.production_time = #{productionTime}</if>
<if test="planAmount != null ">and mpp.plan_amount = #{planAmount}</if>
<if test="completeAmount != null ">and mpp.complete_amount = #{completeAmount}</if>
<if test="planBeginTime != null ">and mpp.plan_begin_time = #{planBeginTime}</if>
<if test="planEndTime != null ">and mpp.plan_end_time = #{planEndTime}</if>
<if test="realBeginTime != null ">and mpp.real_begin_time = #{realBeginTime}</if>
<if test="realEndTime != null ">and mpp.real_end_time = #{realEndTime}</if>
<if test="attachId != null and attachId != ''">and mpp.attach_id = #{attachId}</if>
<if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</if>
<if test="isFlag != null and isFlag != ''">and mpp.is_flag = #{isFlag}</if>
</where>
</select>
<delete id="deleteMesProductPlanByDispatchCode" parameterType="String">
delete
from mes_product_plan
where dispatch_code = #{dispatchCode}
</delete>
</mapper> </mapper>

@ -481,7 +481,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
/** /**
* *
* * stock_total
* wms_raw_stockstock_totalwms_raw_stockwms_raw_stock
* wms_raw_outstock_detail * wms_raw_outstock_detail
* *
* @param wmsRawOutstock * @param wmsRawOutstock
@ -941,6 +942,9 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
/**todo需要最终确认一下。在申请领柜体后wcs会调度agv将对应库位的柜体运输到柜体拆分区然后更新rawoutstock的materialbatch为其物料条码*/ /**todo需要最终确认一下。在申请领柜体后wcs会调度agv将对应库位的柜体运输到柜体拆分区然后更新rawoutstock的materialbatch为其物料条码*/
String bindBarcode = baseBarcodeInfo.getBindBarcode(); String bindBarcode = baseBarcodeInfo.getBindBarcode();
if (StringUtils.isEmpty(bindBarcode)) {
throw new ServiceException("此柜体还未绑定");
}
WmsRawOutstock queryRawOutstock = new WmsRawOutstock(); WmsRawOutstock queryRawOutstock = new WmsRawOutstock();
queryRawOutstock.setMaterialBatch(bindBarcode); queryRawOutstock.setMaterialBatch(bindBarcode);
List<WmsRawOutstock> wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock); List<WmsRawOutstock> wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock);

@ -1,7 +1,7 @@
import request from '@/utils/request' import request from '@/utils/request'
// 登录方法 // 登录方法
export function login(username, password, code, uuid, stationId,stationCode) { export function login(username, password, code, uuid, processId,processFloor) {
return request({ return request({
url: '/auth/login', url: '/auth/login',
headers: { headers: {
@ -9,7 +9,7 @@ export function login(username, password, code, uuid, stationId,stationCode) {
repeatSubmit: false repeatSubmit: false
}, },
method: 'post', method: 'post',
data: {username, password, code, uuid, stationId,stationCode} data: {username, password, code, uuid, processId,processFloor}
}) })
} }
@ -61,7 +61,7 @@ export function getCodeImg() {
}) })
} }
// 获取验证码 // 获取工位
export function getStations() { export function getStations() {
return request({ return request({
headers: { headers: {
@ -71,3 +71,15 @@ export function getStations() {
method: 'get', method: 'get',
}) })
} }
// 获取工序列表
export function getProcesses() {
return request({
headers: {
isToken: false
},
url: '/auth/getProcesses',
method: 'get',
})
}

@ -138,3 +138,13 @@ export function addNoPurchaseBarcode(data) {
data: data data: data
}) })
} }
// 新增固定原材料条码信息
export function addRegularBarcode(data) {
return request({
url: '/mes/barcode/addRegularBarcode',
method: 'post',
data: data
})
}

@ -61,9 +61,9 @@ export function orderAddMesProductPlanList(data) {
} }
// 查询生产派工列表 // 查询生产派工列表
export function getProductPlan(query) { export function selectProductPlans(query) {
return request({ return request({
url: '/mes/productplan/getProductPlan', url: '/mes/productplan/selectProductPlans',
method: 'get', method: 'get',
params: query params: query
}) })
@ -96,3 +96,32 @@ export function getDispatchSOPAttachList(planId) {
method: 'get' method: 'get'
}) })
} }
// 获取工艺路线的所有工艺步骤
export function getBaseRouteProcesses(query) {
return request({
url: '/mes/productplan/getBaseRouteProcesses' ,
method: 'get',
params: query
})
}
// 获取工艺路线所有工序及关联生产人员信息
export function getProcessUsers(routeId) {
return request({
url: '/mes/productplan/getProcessUsers/' + routeId,
method: 'get'
})
}
// 删除生产派工
export function deleteProductPlansByDispatchCode(data) {
return request({
url: '/mes/productplan/deleteProductPlansByDispatchCode/',
method: 'post',
data: data
})
}

@ -42,10 +42,10 @@ const user = {
const password = userInfo.password const password = userInfo.password
const code = userInfo.code const code = userInfo.code
const uuid = userInfo.uuid const uuid = userInfo.uuid
const stationId = userInfo.stationId || '' const processId = userInfo.processId || ''
const stationCode = userInfo.stationCode || '' const processFloor = userInfo.processFloor || ''
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login(username, password, code, uuid,stationId,stationCode).then(res => { login(username, password, code, uuid,processId,processFloor).then(res => {
let data = res.data let data = res.data
setToken(data.access_token) setToken(data.access_token)
commit('SET_TOKEN', data.access_token) commit('SET_TOKEN', data.access_token)

@ -22,6 +22,8 @@ export const monitorSerialData = {
async connectSerial(callback) { async connectSerial(callback) {
if ('serial' in navigator) {
console.log("serial support")
try { try {
// 请求串口访问权限 // 请求串口访问权限
this.serialPort = await navigator.serial.requestPort(); this.serialPort = await navigator.serial.requestPort();
@ -42,17 +44,18 @@ export const monitorSerialData = {
// console.log("---"+value); // console.log("---"+value);
// const data = this.decoder.decode(value); // const data = this.decoder.decode(value);
this.processReceivedData(value,callback); this.processReceivedData(value, callback);
} }
} catch (error) { } catch (error) {
console.error('连接或读取串口时发生错误:', error); console.error('连接或读取串口时发生错误:', error);
} finally{ } finally {
this.reader.releaseLock(); this.reader.releaseLock();
await this.serialPort.close(); await this.serialPort.close();
} }
}
}, },
processReceivedData(data,callback) { processReceivedData(data, callback) {
// 假设条码数据以回车符或换行符结束 // 假设条码数据以回车符或换行符结束
const barcodeEnd = /\r|\n/; const barcodeEnd = /\r|\n/;
// console.log("---:" + data) // console.log("---:" + data)

@ -23,14 +23,14 @@
<svg-icon slot="prefix" class="el-input__icon input-icon" icon-class="password"/> <svg-icon slot="prefix" class="el-input__icon input-icon" icon-class="password"/>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item v-if="isStationId" prop="stationId"> <el-form-item v-if="isStationId" prop="processId">
<el-select v-model="loginForm.stationId" placeholder="请选择工位" style="width: 100%" @change="changeStation"> <el-select v-model="loginForm.processId" placeholder="请选择工序" style="width: 100%" @change="changeProcess">
<el-option v-for="item in options" :key="item.stationId" :label="item.stationName" <el-option v-for="item in options" :key="item.processId" :label="item.processName"
:value="item.stationId"></el-option> :value="item.processId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="工位编号" prop="stationCode" v-if="false"> <el-form-item label="工位编号" prop="processFloor" v-if="false">
<el-input v-model="loginForm.stationCode"/> <el-input v-model="loginForm.processFloor"/>
</el-form-item> </el-form-item>
<el-form-item v-if="captchaEnabled" prop="code"> <el-form-item v-if="captchaEnabled" prop="code">
<el-input <el-input
@ -71,7 +71,7 @@
</template> </template>
<script> <script>
import {getCodeImg, getStations} from "@/api/login"; import {getCodeImg, getProcesses} from "@/api/login";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import {encrypt, decrypt} from '@/utils/jsencrypt' import {encrypt, decrypt} from '@/utils/jsencrypt'
@ -84,8 +84,8 @@ export default {
username: "admin", username: "admin",
password: "admin123", password: "admin123",
rememberMe: false, rememberMe: false,
stationId: '', processId: '',
stationCode:'', processFloor:'',
code: "", code: "",
uuid: "" uuid: ""
}, },
@ -96,6 +96,9 @@ export default {
password: [ password: [
{required: true, trigger: "blur", message: "请输入您的密码"} {required: true, trigger: "blur", message: "请输入您的密码"}
], ],
processId: [
{required: true, trigger: "blur", message: "请选择工序"}
],
code: [{required: true, trigger: "change", message: "请输入验证码"}] code: [{required: true, trigger: "change", message: "请输入验证码"}]
}, },
loading: false, loading: false,
@ -112,6 +115,11 @@ export default {
processId: 11, processId: 11,
route: '/board/firstFloor' route: '/board/firstFloor'
}, },
{
floor: 1,
processId: 12,
route: '/board/firstFloor'
},
{ {
floor: 4, floor: 4,
processId: 41, processId: 41,
@ -157,10 +165,9 @@ export default {
created() { created() {
this.getCode(); this.getCode();
this.getCookie(); this.getCookie();
// this.loginForm.stationId = this.$route?.query?.station || '';
if (this.$route?.query?.isStationId === 'true') { if (this.$route?.query?.isStationId === 'true') {
this.isStationId = true this.isStationId = true
getStations().then(e => { getProcesses().then(e => {
this.options = e.data this.options = e.data
}) })
} }
@ -199,8 +206,8 @@ export default {
Cookies.remove('rememberMe'); Cookies.remove('rememberMe');
} }
this.$store.dispatch("Login", this.loginForm).then(() => { this.$store.dispatch("Login", this.loginForm).then(() => {
let data = this.options.find(v=>v.stationId === this.loginForm.stationId) || {} let data = this.options.find(v=>v.processId === this.loginForm.processId) || {}
let routeData = this.floorData.find(v=>v.floor === data.floor && v.processId === data.processId) || {} let routeData = this.floorData.find(v=>v.floor === data.processFloor && v.processId === data.processId) || {}
if(routeData.route){ if(routeData.route){
sessionStorage.setItem("FLOORDATA", JSON.stringify(routeData)) sessionStorage.setItem("FLOORDATA", JSON.stringify(routeData))
} }
@ -219,9 +226,9 @@ export default {
}, },
changeStation(stationId){ changeProcess(processId){
let station = this.options.find(v=>v.stationId === stationId) let process = this.options.find(v=>v.processId === processId)
this.loginForm.stationCode = station.stationCode; this.loginForm.processFloor = process.processFloor;
} }
} }
}; };

@ -10,7 +10,11 @@
<el-form-item label="成品编码:">{{ form.materialCode }}</el-form-item> <el-form-item label="成品编码:">{{ form.materialCode }}</el-form-item>
<el-form-item label="计划开始时间:">{{ parseTime(form.planBeginTime) }}</el-form-item> <el-form-item label="计划开始时间:">{{ parseTime(form.planBeginTime) }}</el-form-item>
<el-form-item label="计划数量/已派工数量/完成数量:" label-width="220px"> <el-form-item label="计划数量/已派工数量/完成数量:" label-width="220px">
{{ form.planAmount }}/{{ form.dispatchAmount }}/{{ form.completeAmount }} {{
form.planAmount
}}/{{
form.dispatchAmount == null || form.dispatchAmount === undefined ? 0 : form.dispatchAmount
}}/{{ form.completeAmount }}
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -28,65 +32,112 @@
<el-button icon="el-icon-plus" size="mini" type="primary" @click="handleAddMesProductPlan"> <el-button icon="el-icon-plus" size="mini" type="primary" @click="handleAddMesProductPlan">
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesProductPlan"
:disabled="single">删除
</el-button>
</el-col>
</el-row> </el-row>
<el-table ref="mesProductPlan" :data="mesProductPlanList" <el-table ref="mesProductPlan" :data="mesProductPlanList"
:row-class-name="rowMesProductPlanIndex" @selection-change="handleMesProductPlanSelectionChange"> :row-class-name="rowMesProductPlanIndex" @selection-change="handleMesProductPlanSelectionChange"
<el-table-column align="center" type="selection" width="50"/> :tree-props="{children: 'children'}"
<el-table-column align="center" label="序号" prop="index" width="50" v-if="false"/> style="width: 100%;margin-bottom: 20px;"
<el-table-column align="center" label="派工单号" prop="dispatchCode" width="290"> row-key="id"
border
default-expand-all
>
<el-table-column
width="80"
type=""
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.dispatchCode" :disabled="true"/> <el-button type="danger" icon="el-icon-delete" @click="handleDeleteMesProductPlan(scope)"
v-if="scope.row.deleteFlag != null && scope.row.deleteFlag == '1'"></el-button>
</template>
</el-table-column>
<el-table-column
width="80"
type=""
>
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-plus" @click="addProcessUser(scope)"
v-if="scope.row.children != null && scope.row.children !== undefined"></el-button>
</template>
</el-table-column>
<el-table-column
width="50"
>
<!-- <template slot-scope="scope">-->
<!-- <el-button type="primary" icon="el-icon-plus" @click="add(scope)"></el-button>-->
<!-- </template>-->
</el-table-column>
<el-table-column align="center" label="派工单号" prop="dispatchCode" width="230">
<template slot-scope="scope">
<el-input v-model="scope.row.dispatchCode" :disabled="true"
v-if="scope.row.children != null && scope.row.children !== undefined"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="工序" prop="processName" width="140"> <el-table-column align="center" label="工序" prop="processName" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.processName" :disabled="true"/> <el-input v-model="scope.row.processName" :disabled="true"
v-if="scope.row.children != null && scope.row.children !== undefined"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="步骤" prop="processOrder"> <el-table-column align="center" label="步骤" prop="processOrder">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.processOrder" :disabled="true"/> <el-input v-model="scope.row.processOrder" :disabled="true"
</template> v-if="scope.row.children != null && scope.row.children !== undefined"/>
</el-table-column>
<el-table-column align="center" label="工位" prop="stationName" width="140">
<template slot-scope="scope">
<el-input v-model="scope.row.stationName" :disabled="true"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="派工数量" prop="dispatchAmount" width="100"> <el-table-column align="center" label="派工数量" prop="dispatchAmount" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.dispatchAmount" :disabled="scope.row.oldRowFlag"/> <el-input v-model="scope.row.dispatchAmount" :disabled="scope.row.oldRowFlag"
v-if="scope.row.children != null && scope.row.children !== undefined"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="计划数量" prop="planAmount" width="100">
<el-table-column align="center" label="用户" prop="userId" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.planAmount" :disabled="scope.row.oldRowFlag || scope.row.processId!==PROCESS_ID.BENDING_PROCESS_ID"/> <el-select v-model="scope.row.userId" placeholder="请选择用户"
v-if="scope.row.children == null || scope.row.children === undefined"
:disabled="scope.row.planId != null && scope.row.planId !== undefined && scope.row.planId !== ''"
>
<el-option
v-for="item in processUsers[scope.row.processId]"
:key="item.userId"
:label="item.userName"
:value="item.userId"
></el-option>
</el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="派工标准工时" prop="productionTime" width="100">
<el-table-column align="center" label="派工标准工时(小时)" prop="productionTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.productionTime" :disabled="scope.row.oldRowFlag"/> <el-input-number style="width:150px;" :min="0" v-model="scope.row.productionTime" :disabled="scope.row.children != null && scope.row.children !== undefined"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="计划开始时间" prop="planBeginTime" width="230"> <el-table-column align="center" label="计划开始时间" prop="planBeginTime" width="230">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker v-model="scope.row.planBeginTime" :disabled="scope.row.oldRowFlag" clearable <el-date-picker v-model="scope.row.planBeginTime" style="width:200px;"
:disabled="scope.row.children != null && scope.row.children !== undefined"
clearable
placeholder="请选择计划开始时间" placeholder="请选择计划开始时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/> type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="计划完成时间" prop="planEndTime" width="230"> <el-table-column align="center" label="计划完成时间" prop="planEndTime" width="230">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker v-model="scope.row.planEndTime" :disabled="scope.row.oldRowFlag" clearable <el-date-picker v-model="scope.row.planEndTime" style="width:200px;"
:disabled="scope.row.children != null && scope.row.children !== undefined"
clearable
placeholder="请选择计划完成时间" placeholder="请选择计划完成时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/> type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="状态" prop="planStatus" width="150"> <el-table-column align="center" label="状态" prop="planStatus" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.planStatus" :disabled="true" placeholder="请选择状态"> <el-select v-model="scope.row.planStatus" :disabled="true" placeholder="请选择状态">
@ -99,6 +150,8 @@
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="100"> <el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -106,6 +159,7 @@
size="mini" size="mini"
type="primary" type="primary"
@click="handleDrawing(scope.row)" @click="handleDrawing(scope.row)"
v-if="scope.row.children != null && scope.row.children !== undefined"
>图纸 >图纸
</el-button> </el-button>
<el-button <el-button
@ -113,10 +167,25 @@
size="mini" size="mini"
type="success" type="success"
@click="handleSOP(scope.row)" @click="handleSOP(scope.row)"
v-if="scope.row.children != null && scope.row.children !== undefined"
>SOP >SOP
</el-button> </el-button>
<el-button
icon="el-icon-delete"
size="mini"
type="danger"
@click="handleDeleteDispatchUser(scope.row)"
v-if="(scope.row.children == null || scope.row.children == undefined)
&& (scope.row.planStatus === PLAN_STATUS.STARTED || scope.row.planStatus === PLAN_STATUS.DISPATCHED)"
>删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form> </el-form>
<el-form label-width="100px"> <el-form label-width="100px">
@ -179,7 +248,7 @@
<!-- 上传提示 --> <!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="isShowTip"> <div class="el-upload__tip" slot="tip" v-if="isShowTip">
请上传 请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b></template> <template v-if="fileSize"> <b style="color: #f67c7c">{{ fileSize }}MB</b></template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template> <template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
的文件 的文件
</div> </div>
@ -268,19 +337,43 @@
<script> <script>
import {getProductOrder, updateProductOrder} from "@//api/mes/productOrder"; import {getProductOrder, updateProductOrder} from "@//api/mes/productOrder";
import { import {
delProductplan, deleteProductPlansByDispatchCode,
getDispatchCode, getDispatchDrawingList, getDispatchSOPAttachList, getDispatchCode, getDispatchDrawingList, getDispatchSOPAttachList,
getProductPlan, selectProductPlans,
orderAddMesProductPlanList, orderAddMesProductPlanList,
updateProductplan, updateProductplan,
getBaseRouteProcesses,
getProcessUsers,
uploadFile uploadFile
} from "@//api/mes/productplan"; } from "@//api/mes/productplan";
import {getStationByRouteId} from "@//api/mes/baseRoute"; import {deepClone} from "@//utils/index";
import {getToken} from "@//utils/auth"; import {getToken} from "@//utils/auth";
let id = 0
let deepSearch = (arr, target) => {
let results = []
arr.forEach(element => {
console.log(element)
id = Math.max(id, element.id)
if (element.id === target) {
results.push(element)
} else if (Array.isArray(element.children)) {
results = results.concat(deepSearch(element.children, target))
}
// if (Array.isArray(element.children)) {
// results = results.concat(deepSearch(element.children, target))
// } else if (element.id === target) {
// results.push(element)
// }
})
return results
}
export default { export default {
name: "productPlanEdit", name: "productPlanEdit",
dicts: ['product_status'], dicts: ['product_status', 'mes_dispatch_flag'],
props: { props: {
value: [String, Object, Array, Number], value: [String, Object, Array, Number],
// //
@ -326,6 +419,9 @@ export default {
columns: [], columns: [],
// //
mesProductPlanList: [], mesProductPlanList: [],
//ID
toDeletedPlanIds: [],
// //
info: {}, info: {},
// //
@ -368,7 +464,22 @@ export default {
}, },
PROCESS_ID: { PROCESS_ID: {
BENDING_PROCESS_ID: 42 BENDING_PROCESS_ID: 42
} },
PROCESS_TYPE: {
MANUAL: '1',
AUTO: '3',
},
PLAN_STATUS: {
TO_DISPATCH: '0',//
DISPATCHED: '1',//
STARTED: '2',//
FINISHED: '3' //
},
id: 1,
processUsers: []
}; };
}, },
created() { created() {
@ -377,17 +488,143 @@ export default {
// //
getProductOrder(productOrderId).then(res => { getProductOrder(productOrderId).then(res => {
this.form = res.data; this.form = res.data;
this.getProcessUsers(productOrderId);
}); });
getProductPlan({productOrderId: productOrderId}).then(res => {
res.data.forEach(e => {
// false=true=
e.oldRowFlag = true;
this.mesProductPlanList.push(e);
})
})
} }
}, },
methods: { methods: {
getProcessUsers(productOrderId) {
getProcessUsers(this.form.dispatchId).then(res => {
res.data.forEach(processUser => {
if (!this.processUsers[processUser.processId]) {
this.processUsers[processUser.processId] = [];
}
this.processUsers[processUser.processId].push(processUser);
});
selectProductPlans({productOrderId: productOrderId}).then(res => {
this.groupProductPlans(res.data)
// res.data.forEach(e => {
// // false=true=
// e.oldRowFlag = true;
// this.mesProductPlanList.push(e);
// })
})
});
},
groupProductPlans(productPlans) {
const groupedProductPlans = {};
productPlans.forEach(productPlan => {
const key = `${productPlan.dispatchCode}-${productPlan.processId}`;
if (!groupedProductPlans[key]) {
groupedProductPlans[key] = [];
}
groupedProductPlans[key].push(productPlan);
});
let firstDispatch = {};
for (let dispatchCodeProcessId in groupedProductPlans) {
let productPlansByDispatch = groupedProductPlans[dispatchCodeProcessId];
// console.log(processId + ": " + JSON.stringify(groupedProductPlans[processId]));
let obj = {};
let dispatchCode = dispatchCodeProcessId.split("-")[0];
if(!firstDispatch[dispatchCode]){
firstDispatch[dispatchCode] = "1";
obj.deleteFlag = "1";
}
obj.id = this.id
this.id = this.id + 1;
let i = 0;
productPlansByDispatch.forEach(groupedProductPlan => {
groupedProductPlan.id = this.id;
groupedProductPlan.productionTime = groupedProductPlan.productionTime/60/60;
this.id = this.id + 1;
if (i === 0) {
obj.dispatchCode = groupedProductPlan.dispatchCode;
obj.dispatchAmount = groupedProductPlan.dispatchAmount;
obj.processId = groupedProductPlan.processId;
obj.processName = groupedProductPlan.processName;
obj.lastProcessId = groupedProductPlan.lastProcessId;
obj.processType = groupedProductPlan.processType;
obj.processOrder = groupedProductPlan.processOrder;
obj.planBeginTime = this.form.planBeginTime;
obj.planEndTime = this.form.planEndTime;
obj.planStatus = groupedProductPlan.planStatus;
// obj.dispatchAmount = this.form.planAmount - this.form.dispatchAmount;
obj.materialId = this.form.materialId;
obj.materialBomId = this.form.materialBomId;
obj.productOrderId = this.form.productOrderId;
obj.saleOrderId = this.form.saleOrderId;
obj.saleorderCode = this.form.saleorderCode;
// false=true=
obj.oldRowFlag = true;
i++;
}
});
obj.children = productPlansByDispatch;
this.mesProductPlanList.push(obj);
}
// console.log(JSON.stringify(this.mesProductPlanList))
this.getId(this.mesProductPlanList);
},
getId(arr) {
arr.forEach(element => {
this.id = this.id + 1;
if (Array.isArray(element.children)) {
this.getId(element.children)
}
})
},
addProcessUser(scope) {
let data = deepSearch(this.mesProductPlanList, scope.row.id)?.[0]
let id = this.id + 1
this.id += 1;
if (Array.isArray(data.children)) {
this.$set(data.children, data.children.length, {
id: id,
processId: scope.row.processId,
planStatus: this.PLAN_STATUS.DISPATCHED,
userId: ""
})
} else {
this.$set(data, 'children', [
{
id: id,
processId: scope.row.processId,
planStatus: this.PLAN_STATUS.DISPATCHED,
userId: "",
}
])
}
this.id += 1
// this.show = false
// this.show = true
},
isAssetTypeAnImage(ext) { isAssetTypeAnImage(ext) {
let suffix = ext.lastIndexOf("."); let suffix = ext.lastIndexOf(".");
let name = ext.substr(suffix + 1); let name = ext.substr(suffix + 1);
@ -395,90 +632,146 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
let dataList = this.mesProductPlanList.filter(plan => !plan.oldRowFlag); // let dataList = this.mesProductPlanList.filter(plan => !plan.oldRowFlag);
if (dataList.length === 0) { // if (dataList.length === 0) {
this.close(); // this.close();
// return;
// }
let dataList = this.mesProductPlanList;
let toUpdatedProductPlans = [];
let undispathDesc;
for (let i = 0; i < dataList.length; i++) {
let e = dataList[i];
let dispatchFlag = false;
undispathDesc = "派工单号为[" + e.dispatchCode + "],工序为[" + e.processName + "],请选择用户派工";
if (!e.children || e.children.length <= 0) {
this.$modal.msgError(undispathDesc);
return; return;
} }
for (let j = 0; j < e.children.length; j++) {
let processUser = e.children[j];
let toUpdatedProductPlan = deepClone(e);
if (processUser.userId && processUser.userId !== '') {
toUpdatedProductPlan.userId = processUser.userId;
toUpdatedProductPlan.planBeginTime = processUser.planBeginTime;
toUpdatedProductPlan.planEndTime = processUser.planEndTime;
toUpdatedProductPlan.planId = processUser.planId;
toUpdatedProductPlan.children = null;
let productionTimeHour = processUser.productionTime;
let productionTimeSecond = productionTimeHour*60*60;
toUpdatedProductPlan.productionTime = productionTimeSecond;
toUpdatedProductPlans.push(toUpdatedProductPlan);
dispatchFlag = true;
} else {
this.$modal.msgError(undispathDesc);
return;
}
}
}
if (toUpdatedProductPlans.length <= 0) {
this.$modal.msgError("无派工信息提交");
return;
}
// ( + <= ) // ( + <= )
// processIdplanAmountplanAmount // processIdplanAmountplanAmount
const sumList = dataList.reduce((result, {processId, dispatchAmount}) => { let dispatchAmountErrorMsg = "";
const sumList = dataList.reduce((result, planData) => {
let processId = planData.processId;
let newFlag = planData.newFlag;
let dispatchAmount = planData.dispatchAmount;
if(newFlag && newFlag === "1"){
dispatchAmount = dispatchAmount == null || dispatchAmount === '' ? 0 : dispatchAmount;
const numericAmount = parseInt(dispatchAmount, 10); const numericAmount = parseInt(dispatchAmount, 10);
if (!this.isPositiveInteger(numericAmount)) { if (!this.isPositiveInteger(numericAmount) || numericAmount <= 0) {
this.$modal.msgError("派工数量须为大于等于0的正整数"); dispatchAmountErrorMsg = "派工数量须为大于等于0的正整数";
return; }
if (!result[processId]) {
result[processId] = 0;
} }
result[processId] = (result[processId] || 0) + numericAmount; result[processId] = (result[processId] || 0) + numericAmount;
}
return result; return result;
}, {}); }, {});
if (dispatchAmountErrorMsg !== "") {
this.$modal.msgError(dispatchAmountErrorMsg);
return;
}
//,()
const uniqueSum = new Set(Object.values(sumList)); const uniqueSum = new Set(Object.values(sumList));
let currentDispatchAmount = 0;
if (uniqueSum.size === 1) { if (uniqueSum.size === 1) {
const finalSum = Array.from(uniqueSum)[0]; const finalSum = Array.from(uniqueSum)[0];
let dispatchedAmount = this.form.dispatchAmount + finalSum; currentDispatchAmount = finalSum;
let dispatchedAmount = this.form.dispatchAmount + finalSum;//
if (dispatchedAmount > this.form.planAmount) { if (dispatchedAmount > this.form.planAmount) {
this.$modal.msgError("每个工序的派工数量之和需小于等于该工单计划数量!"); this.$modal.msgError("每个工序的派工数量之和需小于等于该工单计划数量!");
return; return;
} }
dataList.forEach(e => { } else if(uniqueSum.size >1){
e.dispatchedAmount = dispatchedAmount;
}
)
} else {
this.$modal.msgError("每个工序的派工数量之和需相等!"); this.$modal.msgError("每个工序的派工数量之和需相等!");
return; return;
} }
orderAddMesProductPlanList(dataList).then(res => {
// console.log(JSON.stringify(toUpdatedProductPlans));
// alert(this.toDeletedPlanIds)
// return;
orderAddMesProductPlanList(
{productOrderId:this.form.productOrderId,dispatchAmount:currentDispatchAmount,mesProductPlanList: toUpdatedProductPlans, toDeletedPlanIds: this.toDeletedPlanIds})
.then(res => {
this.$modal.msgSuccess(res.msg); this.$modal.msgSuccess(res.msg);
this.close(); this.close();
}); });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDeleteMesProductPlan() { handleDeleteMesProductPlan(scope) {
let productPlan = this.checkedMesProductPlanList[0]; let dispatchCode = scope.row.dispatchCode;
this.$modal.confirm('是否确认删除生产派工编号为"' + productPlan.dispatchCode + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除生产派工单号为"' + dispatchCode + '"的数据项?').then(function () {
return true; return true;
}).then(() => { }).then(() => {
if (productPlan.planId === undefined || productPlan.planId === null) { if (scope.row.newFlag != null || scope.row.newFlag === '1') {
// //
const mesProductPlanDetailList = this.mesProductPlanList; this.mesProductPlanList = this.mesProductPlanList.filter(function (item) {
this.mesProductPlanList = mesProductPlanDetailList.filter(function (item) { return scope.row.dispatchCode !== item.dispatchCode
return productPlan.dispatchCode !== item.dispatchCode
}); });
} else { } else {
// //
const delList = this.mesProductPlanList; let dispatchSum = 0; //
let dispatchSum = 0;
try { try {
const planIds = delList.filter(function (item) { const planIds = this.mesProductPlanList.filter(function (item) {
return productPlan.dispatchCode === item.dispatchCode return scope.row.dispatchCode === item.dispatchCode
}).map(item => { }).map(item => {
if (item.planStatus !== '1') { if (item.planStatus !== this.PLAN_STATUS.DISPATCHED && item.planStatus!== this.PLAN_STATUS.TO_DISPATCH) {
throw Error("只能删除未派工状态的生产派工单!"); throw Error("只能删除还未开始过状态的生产派工单!");
}
if (item.processId === productPlan.processId) {
dispatchSum = dispatchSum + item.planAmount;
} }
dispatchSum = item.dispatchAmount;//
return item.planId; return item.planId;
}); });
dispatchSum = this.form.dispatchAmount - dispatchSum;
delProductplan(planIds).then(res => { deleteProductPlansByDispatchCode({productOrderId:this.form.productOrderId,dispatchCode:dispatchCode,dispatchAmount:dispatchSum}).then(res => {
// this.mesProductPlanList = this.mesProductPlanList.filter(function (item) {
updateProductOrder({ return dispatchCode !== item.dispatchCode
productOrderId: this.form.productOrderId,
dispatchAmount: dispatchSum
})
getProductOrder(this.form.productOrderId).then(res => {
this.form = res.data;
});
});
const mesProductPlanDetailList = this.mesProductPlanList;
this.mesProductPlanList = mesProductPlanDetailList.filter(function (item) {
return productPlan.dispatchCode !== item.dispatchCode
}); });
this.form.dispatchAmount = this.form.dispatchAmount - dispatchSum;
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
});
} catch (e) { } catch (e) {
this.$modal.msgError(e); this.$modal.msgError(e);
} }
@ -545,34 +838,56 @@ export default {
let dispatchCode = ""; let dispatchCode = "";
getDispatchCode().then(res => { getDispatchCode().then(res => {
dispatchCode = res.msg; dispatchCode = res.msg;
getStationByRouteId(this.form.dispatchId).then(res => { getBaseRouteProcesses({routeId: this.form.dispatchId}).then(res => {
if (res.data.length === 0) { // if (res.data.length === 0) {
this.$modal.msgError("工艺路线未维护工位信息!"); // this.$modal.msgError("线");
} // }
let lastProcessId = null; let lastProcessId = null;
let i = 0;
res.data.forEach((e, index) => { res.data.forEach((e, index) => {
let obj = {}; let obj = {};
if(i===0){
obj.deleteFlag = "1";
i++;
}
obj.id = this.id
this.id = this.id + 1;
obj.dispatchCode = dispatchCode; obj.dispatchCode = dispatchCode;
obj.processId = e.processId; obj.processId = e.processId;
obj.processName = e.processName; obj.processName = e.processName;
obj.processType = e.processType;
obj.processOrder = e.processOrder; obj.processOrder = e.processOrder;
obj.stationId = e.stationId;
obj.stationName = e.stationName;
obj.productionTime = 0; obj.productionTime = 0;
obj.planBeginTime = this.form.planBeginTime; obj.planBeginTime = this.form.planBeginTime;
obj.planEndTime = this.form.planEndTime; obj.planEndTime = this.form.planEndTime;
obj.planStatus = '1'; obj.planStatus = '1';
// multiStationFlag // obj.dispatchAmount = this.form.planAmount - this.form.dispatchAmount;
if (e.multiStationFlag > 1) { obj.dispatchFlag = null;
obj.dispatchAmount = 0;//productplanobj.planAmountplanamount=dispatchamountthis.form.planAmountorderthis.form.dispatchAmountorder
} else {
obj.dispatchAmount = this.form.planAmount - this.form.dispatchAmount;
}
obj.materialId = this.form.materialId; obj.materialId = this.form.materialId;
obj.materialBomId = this.form.materialBomId; obj.materialBomId = this.form.materialBomId;
obj.productOrderId = this.form.productOrderId; obj.productOrderId = this.form.productOrderId;
obj.saleOrderId = this.form.saleOrderId; obj.saleOrderId = this.form.saleOrderId;
obj.saleorderCode = this.form.saleorderCode; obj.saleorderCode = this.form.saleorderCode;
obj.newFlag = "1";//
// e.mesBaseProcessUserList.forEach((mesBaseProcessUser, index) => {
// mesBaseProcessUser.id = this.id + 1;
// mesBaseProcessUser.dispatchFlag = null;
// mesBaseProcessUser.planBeginTime = null;
// mesBaseProcessUser.planEndTime = null;
// this.id = this.id + 1;
// });
obj.children = [{
id: this.id,
processId: obj.processId,
planStatus: this.PLAN_STATUS.DISPATCHED
}]
this.id += 1;
// ID // ID
if (lastProcessId == null) { if (lastProcessId == null) {
obj.lastProcessId = 0; obj.lastProcessId = 0;
@ -586,9 +901,13 @@ export default {
obj.oldRowFlag = false; obj.oldRowFlag = false;
this.mesProductPlanList.push(obj); this.mesProductPlanList.push(obj);
}) })
this.getId(this.mesProductPlanList)
}) })
}) })
}, },
isPositiveInteger(value) { isPositiveInteger(value) {
// 使 // 使
return /^[0-9]\d*$/.test(value); return /^[0-9]\d*$/.test(value);
@ -724,8 +1043,20 @@ export default {
handleExceed() { handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} !`); this.$modal.msgError(`上传文件数量不能超过 ${this.limit} !`);
}, },
handleDeleteDispatchUser(row) {
this.mesProductPlanList.forEach(mesProductPlan => {
mesProductPlan.children = mesProductPlan.children.filter(item => item.id !== row.id);
});
if (row.planId != null && row.planId !== '') {
this.toDeletedPlanIds.push(row.planId);
}
}, },
}
,
mounted() { mounted() {
} }
} }

Loading…
Cancel
Save