createby和updateby保存的地方有username改为nickname
原材料出库记录查询完善
原材料入库记录查询完善
限制一个用户多端登录
车间申请领料按bom内物料和非bom内物料搜索
四楼折弯和焊接工序可以领料和打印条码
一楼各工序可以打印条码和成品出入库
五楼质检工序生成成品条码前必须质检通过
master
xs 7 months ago
parent a25c247ac1
commit 66a3fcf09c

@ -1,6 +1,7 @@
package com.hw.auth.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.hw.common.core.constant.CacheConstants;
import com.hw.common.core.constant.Constants;
@ -38,11 +39,17 @@ public class SysLoginService
@Autowired
private RedisService redisService;
// 是否允许账户多终端同时登录true允许 false不允许
@Value("${token.soloLogin}")
private boolean soloLogin;
/**
*
*/
public LoginUser login(String username, String password)
{
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password))
{
@ -98,6 +105,19 @@ public class SysLoginService
}
passwordService.validate(user, password);
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
if (!soloLogin)
{
// 如果用户不允许多终端同时登录,清除缓存信息
String userIdKey = Constants.LOGIN_USERID_KEY + user.getUserId();
String userKey = redisService.getCacheObject(userIdKey);
if (StringUtils.isNotEmpty(userKey))
{
redisService.deleteObject(userIdKey);
redisService.deleteObject(userKey);
}
}
return userInfo;
}

@ -132,4 +132,10 @@ public class Constants
*/
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.hw.common.core.utils.file" };
/**
* redis key
*/
public static final String LOGIN_USERID_KEY = "login_userid:";
}

@ -50,4 +50,6 @@ public class SystemConstants {
public static final Long PROCESS_ACTIVITY_ID_DEVICE_ALARM = 1071L;//设备报警处理
public static final Long PROCESS_ACTIVITY_ID_STOCK_NOTENOUGH = 5011L;//物料库存告警
public static final Long PROCESS_ACTIVITY_ID_PRODUCE_PAUSE = 7011L;//车间暂停通知
}

@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.hw.common.core.constant.CacheConstants;
import com.hw.common.core.constant.SecurityConstants;
@ -18,6 +19,7 @@ import com.hw.common.core.utils.uuid.IdUtils;
import com.hw.common.redis.service.RedisService;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.system.api.model.LoginUser;
import com.hw.common.core.constant.Constants;
/**
* token
@ -29,6 +31,10 @@ public class TokenService
{
private static final Logger log = LoggerFactory.getLogger(TokenService.class);
// 是否允许账户多终端同时登录true允许 false不允许
@Value("${token.soloLogin}")
private boolean soloLogin;
@Autowired
private RedisService redisService;
@ -168,10 +174,42 @@ public class TokenService
// 根据uuid将loginUser缓存
String userKey = getTokenKey(loginUser.getToken());
redisService.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
if (!soloLogin)
{
// 缓存用户唯一标识,防止同一帐号,同时登录
String userIdKey = getUserIdKey(loginUser.getSysUser().getUserId());
redisService.setCacheObject(userIdKey, userKey, expireTime, TimeUnit.MINUTES);
}
}
private String getTokenKey(String token)
{
return ACCESS_TOKEN + token;
}
/**
*
*/
public void delLoginUser(String token, Long userId)
{
if (StringUtils.isNotEmpty(token))
{
String userKey = getTokenKey(token);
redisService.deleteObject(userKey);
}
if (!soloLogin && StringUtils.isNotNull(userId))
{
String userIdKey = getUserIdKey(userId);
redisService.deleteObject(userIdKey);
}
}
private String getUserIdKey(Long userId)
{
return Constants.LOGIN_USERID_KEY + userId;
}
}

@ -210,7 +210,7 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
newestBillsMaintInstance.setDmsBillsMaintDetailList(dmsBillsMaintDetails);
}
Long maintLevel = newestBillsMaintInstance.getMaintLevel();
if (maintLevel == 1){
if (maintLevel == 1) {
newestBillsMaintInstance.setMaintLevelName("日常保养");
}
return newestBillsMaintInstance;
@ -235,7 +235,9 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
// String userName = SecurityUtils.getUsername();
if (maintStatus.equals(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_TO_MAINT)) {//待保养
dmsBillsMaintInstance.setMaintStatus(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_MAINTING);
@ -266,7 +268,6 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
}
/**
*
*
@ -291,7 +292,8 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
DmsBillsMaintDetail queryMaintDetail = new DmsBillsMaintDetail();
queryMaintDetail.setMaintInstanceId(maintInstanceId);
@ -314,7 +316,7 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
}
//更新保养工单明细项目信息
for(DmsBillsMaintDetailProject dmsBillsMaintDetailProject:dmsBillsMaintDetailProjects){
for (DmsBillsMaintDetailProject dmsBillsMaintDetailProject : dmsBillsMaintDetailProjects) {
dmsBillsMaintDetailProject.setMaintProjectStatus(DmsConstants.DMS_MAINT_PROJECT_STATUS_COMPLETE);
dmsBillsMaintDetailProject.setCreateTime(currentDate);
dmsBillsMaintDetail.setCreateBy(userName);

@ -262,7 +262,8 @@ public class BaseLineMonitorServiceImpl implements IBaseLineMonitorService {
baseLineLoss.setLineLossName(lineMonitor.getMonitorName());
baseLineLoss.setMonitorType(lineMonitor.getMonitorType());
baseLineLoss.setLineLossStatus(lineMonitor.getMonitorStatus());
baseLineLoss.setCreateBy(SecurityUtils.getUsername());
baseLineLoss.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
baseLineLoss.setCreateTime(new Date());
baseLineLossMapper.insertBaseLineLoss(baseLineLoss);
}

@ -109,7 +109,8 @@ public class BaseMonitorInfo1ServiceImpl implements IBaseMonitorInfo1Service {
}
baseMonitorInfo.setCreateTime(DateUtils.getNowDate());
baseMonitorInfo.setCreateBy(SecurityUtils.getUsername());
baseMonitorInfo.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return baseMonitorInfoMapper.insertBaseMonitorInfo(baseMonitorInfo);
}
@ -181,7 +182,8 @@ public class BaseMonitorInfo1ServiceImpl implements IBaseMonitorInfo1Service {
baseLineLoss.setLineLossName(monitorInfo.getMonitorName());
baseLineLoss.setMonitorType(monitorInfo.getMonitorType());
baseLineLoss.setLineLossStatus(monitorInfo.getMonitorStatus());
baseLineLoss.setCreateBy(SecurityUtils.getUsername());
baseLineLoss.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
baseLineLoss.setCreateTime(new Date());
baseLineLossMapper.insertBaseLineLoss(baseLineLoss);
}
@ -226,7 +228,8 @@ public class BaseMonitorInfo1ServiceImpl implements IBaseMonitorInfo1Service {
e.printStackTrace();
}
baseMonitorInfo.setUpdateTime(DateUtils.getNowDate());
baseMonitorInfo.setUpdateBy(SecurityUtils.getUsername());
baseMonitorInfo.setUpdateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return baseMonitorInfoMapper.updateBaseMonitorInfo(baseMonitorInfo);
}
@ -269,7 +272,8 @@ public class BaseMonitorInfo1ServiceImpl implements IBaseMonitorInfo1Service {
this.insertOrUpdateBaseTypeRelation(baseMonitorInfo.getMonitorId(), baseMonitorInfo.getBuildId(),
baseMonitorInfo.getBusinessId(), baseMonitorInfo.getSubentryId());
baseMonitorInfo.setUpdateTime(DateUtils.getNowDate());
baseMonitorInfo.setUpdateBy(SecurityUtils.getUsername());
baseMonitorInfo.setUpdateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
baseMonitorInfoMapper.updateBaseMonitorInfo(baseMonitorInfo);
}
}

@ -105,7 +105,8 @@ public class BaseMonitorInfoServiceImpl implements IBaseMonitorInfoService {
System.out.println("新增计量设备信息异常:" + e.getMessage());
}
baseMonitorInfo.setCreateTime(DateUtils.getNowDate());
baseMonitorInfo.setCreateBy(SecurityUtils.getUsername());
baseMonitorInfo.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return baseMonitorInfoMapper.insertBaseMonitorInfo(baseMonitorInfo);
}
@ -146,7 +147,8 @@ public class BaseMonitorInfoServiceImpl implements IBaseMonitorInfoService {
e.printStackTrace();
}
baseMonitorInfo.setUpdateTime(DateUtils.getNowDate());
baseMonitorInfo.setUpdateBy(SecurityUtils.getUsername());
baseMonitorInfo.setUpdateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return baseMonitorInfoMapper.updateBaseMonitorInfo(baseMonitorInfo);
}
@ -400,7 +402,8 @@ public class BaseMonitorInfoServiceImpl implements IBaseMonitorInfoService {
baseLineLoss.setLineLossName(monitorInfo.getMonitorName());
baseLineLoss.setMonitorType(monitorInfo.getMonitorType());
baseLineLoss.setLineLossStatus(monitorInfo.getMonitorStatus());
baseLineLoss.setCreateBy(SecurityUtils.getUsername());
baseLineLoss.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
baseLineLoss.setCreateTime(new Date());
baseLineLossMapper.insertBaseLineLoss(baseLineLoss);
}

@ -99,7 +99,8 @@ public class BasePublicManageServiceImpl implements IBasePublicManageService {
publicUserRecord.setPublicEnergyConsumption(basePublicUser.getPublicExpend());
publicUserRecord.setOwnerEnergyConsumption(basePublicUser.getUserExpend());
publicUserRecord.setEnergyType(Long.parseLong(basePublicManage.getPublicShareType()));
publicUserRecord.setCreatedBy(SecurityUtils.getUsername());
publicUserRecord.setCreatedBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
publicUserRecord.setCreatedTime(DateUtils.getNowDate());
basePublicUserRecordMapper.insertBasePublicUserRecord(publicUserRecord);
}

@ -76,7 +76,8 @@ public class BasePublicUserServiceImpl implements IBasePublicUserService {
//@DS("#header.poolName")
@Override
public int insertBasePublicUser(BasePublicUser basePublicUser) {
basePublicUser.setCreateBy(SecurityUtils.getUsername());
basePublicUser.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
basePublicUser.setCreateTime(DateUtils.getNowDate());
int rows = basePublicUserMapper.insertBasePublicUser(basePublicUser);
insertPublicUserMonitor(basePublicUser);

@ -93,7 +93,8 @@ public class RecordAlarmDataController extends BaseController {
RecordAlarmData recordAlarmData = new RecordAlarmData();
recordAlarmData.setObjId(id);
recordAlarmData.setAlarmStatus(0L);
recordAlarmData.setOperationName(SecurityUtils.getUsername());
recordAlarmData.setOperationName(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
recordAlarmData.setOperationTime(new Date());
recordAlarmDataService.updateRecordAlarmData(recordAlarmData);
}

@ -58,7 +58,8 @@ public class MesImportController extends BaseController {
@PostMapping(("/BOMImportData"))
public AjaxResult BOMImportData(MultipartFile file, boolean updateSupport)
{
String operName = SecurityUtils.getUsername();
String operName = SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
String message = mesImportService.BOMImportData(file, updateSupport, operName);
return success(message);
}

@ -1,6 +1,7 @@
package com.hw.mes.domain;
import java.math.BigDecimal;
import java.util.Objects;
import com.hw.common.core.utils.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
@ -289,4 +290,18 @@ public class MesMaterialBom extends TreeEntity {
this.setCreateTime(source.getCreateTime());
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MesMaterialBom that = (MesMaterialBom) o;
return Objects.equals(materialBomId, that.materialBomId);
}
@Override
public int hashCode() {
return Objects.hash(materialBomId);
}
}

@ -0,0 +1,208 @@
package com.hw.mes.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.math.BigDecimal;
import java.util.List;
/**
* qms_check_result_detail
*
* @author xins
* @date 2024-01-23
*/
public class QmsCheckResultDetail extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 质检结果详情ID */
private Long checkResultDetailId;
/** 质检结果ID关联质检结果主键 */
@Excel(name = "质检结果ID关联质检结果主键")
private Long checkResultId;
/** 物料条码 */
@Excel(name = "物料条码")
private String materialBarcode;
/** 物料ID关联物料主键 */
@Excel(name = "物料ID关联物料主键")
private Long materialId;
/** 检验规则ID(冗余,与质检结果中值相同),关联检验规则主键 */
@Excel(name = "检验规则ID(冗余,与质检结果中值相同),关联检验规则主键")
private Long checkRuleId;
/** 冗余,检验规则类型(1来料检验,2,半成品检验3成品检验,4工序检验) */
@Excel(name = "冗余,检验规则类型(1来料检验,2,半成品检验3成品检验,4工序检验)")
private String checkRuleType;
/** 冗余,检验规则名称 */
@Excel(name = "冗余,检验规则名称")
private String checkRuleName;
/** 冗余,检验方式(1,全检2,抽检) */
@Excel(name = "冗余,检验方式(1,全检2,抽检)")
private String checkMode;
/** 冗余,抽检比例 */
@Excel(name = "冗余,抽检比例")
private BigDecimal checkSample;
/** 检验状态(0待检验,1检验中,2质检通过,3质检不通过) */
@Excel(name = "检验状态(0待检验,1检验中,2质检通过,3质检不通过)")
private String checkStatus;
private String materialCode;
private String materialName;
private String poNo;
private String saleorderCode;
public void setCheckResultDetailId(Long checkResultDetailId)
{
this.checkResultDetailId = checkResultDetailId;
}
public Long getCheckResultDetailId()
{
return checkResultDetailId;
}
public void setCheckResultId(Long checkResultId)
{
this.checkResultId = checkResultId;
}
public Long getCheckResultId()
{
return checkResultId;
}
public void setMaterialBarcode(String materialBarcode)
{
this.materialBarcode = materialBarcode;
}
public String getMaterialBarcode()
{
return materialBarcode;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getCheckRuleId() {
return checkRuleId;
}
public void setCheckRuleId(Long checkRuleId) {
this.checkRuleId = checkRuleId;
}
public String getCheckRuleType() {
return checkRuleType;
}
public void setCheckRuleType(String checkRuleType) {
this.checkRuleType = checkRuleType;
}
public String getCheckRuleName() {
return checkRuleName;
}
public void setCheckRuleName(String checkRuleName) {
this.checkRuleName = checkRuleName;
}
public String getCheckMode() {
return checkMode;
}
public void setCheckMode(String checkMode) {
this.checkMode = checkMode;
}
public BigDecimal getCheckSample() {
return checkSample;
}
public void setCheckSample(BigDecimal checkSample) {
this.checkSample = checkSample;
}
public void setCheckStatus(String checkStatus)
{
this.checkStatus = checkStatus;
}
public String getCheckStatus()
{
return checkStatus;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getPoNo() {
return poNo;
}
public void setPoNo(String poNo) {
this.poNo = poNo;
}
public String getSaleorderCode() {
return saleorderCode;
}
public void setSaleorderCode(String saleorderCode) {
this.saleorderCode = saleorderCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("checkResultDetailId", getCheckResultDetailId())
.append("checkResultId", getCheckResultId())
.append("materialBarcode", getMaterialBarcode())
.append("materialId", getMaterialId())
.append("checkRuleId", getCheckRuleId())
.append("checkRuleType", getCheckRuleType())
.append("checkRuleName", getCheckRuleName())
.append("checkMode", getCheckMode())
.append("checkSample", getCheckSample())
.append("checkStatus", getCheckStatus())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,26 @@
package com.hw.mes.mapper;
import com.hw.mes.domain.QmsCheckResultDetail;
import java.util.List;
/**
* Mapper
*
* @author xins
* @date 2024-01-23
*/
public interface QmsCheckResultDetailMapper
{
/**
*
*
* @param qmsCheckResultDetail
* @return
*/
public List<QmsCheckResultDetail> selectQmsCheckResultDetailList(QmsCheckResultDetail qmsCheckResultDetail);
}

@ -66,7 +66,8 @@ public class MesBaseAttachInfoServiceImpl implements IMesBaseAttachInfoService
@Override
public int insertMesBaseAttachInfo(MesBaseAttachInfo mesBaseAttachInfo)
{
mesBaseAttachInfo.setCreateBy(SecurityUtils.getUsername());
mesBaseAttachInfo.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesBaseAttachInfo.setCreateTime(DateUtils.getNowDate());
mesBaseAttachInfoMapper.insertMesBaseAttachInfo(mesBaseAttachInfo);
return mesBaseAttachInfo.getAttachId().intValue();

@ -89,6 +89,9 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
@Autowired
private MesPrdBarcodeInfoMapper mesPrdBarcodeInfoMapper;
@Autowired
private QmsCheckResultDetailMapper qmsCheckResultDetailMapper;
@Autowired
private MesConfig mesConfig;
@ -172,7 +175,8 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
public void generateRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Long purchaseOrderId = mesBaseBarcodeInfo.getPurchaseOrderId();
Long materialId = mesBaseBarcodeInfo.getMaterialId();
@ -368,7 +372,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
//五楼自检工序根据原材料条码生成成品条码
if (StringUtils.isNotEmpty(mesBaseBarcodeInfo.getSingleFlag()) &&
mesBaseBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_YES)) {
String rawMaterialBarcode = mesBaseBarcodeInfo.getProductBarcode();
String rawMaterialBarcode = mesBaseBarcodeInfo.getProductBarcode();//原材料条码
MesBaseBarcodeInfo rawBarcode = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(rawMaterialBarcode);
if (rawBarcode == null) {
@ -379,6 +383,25 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
throw new ServiceException("此条码为非原材料条码,不能生成成品条码");
}
//判断质检状态
QmsCheckResultDetail queryCheckResultDetail = new QmsCheckResultDetail();
queryCheckResultDetail.setMaterialBarcode(rawMaterialBarcode);
List<QmsCheckResultDetail> qmsCheckResultDetails = qmsCheckResultDetailMapper.selectQmsCheckResultDetailList(queryCheckResultDetail);
if (qmsCheckResultDetails == null || qmsCheckResultDetails.isEmpty()) {
throw new ServiceException("此物料还未质检,不能生成成品条码");
}
QmsCheckResultDetail qmsCheckResultDetail = qmsCheckResultDetails.get(0);
String checkStatus = qmsCheckResultDetail.getCheckStatus() == null ? "" : qmsCheckResultDetail.getCheckStatus();
if (checkStatus.equals("0")) {
throw new ServiceException("此物料待检验,不能生成成品条码");
} else if (checkStatus.equals("1")) {
throw new ServiceException("此物料检验中,不能生成成品条码");
} else if (checkStatus.equals("3")) {
throw new ServiceException("此物料质检不通过,不能生成成品条码");
}
if (rawMaterialBarcode.contains(Seq.mesPurchaseVirtualBarcodeCode)) {//采购合并虚拟条码
barcode = Seq.getId(Seq.mesPurchaseVirtualProductBarcodeSeqType, Seq.mesPurchaseVirtualProductBarcodeCode);
} else if (rawMaterialBarcode.contains(Seq.mesInternalVirtualBarcodeCode)) {//内部生产合并虚拟条码
@ -400,7 +423,6 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
// throw new ServiceException("生产明细还未结束");
// }
String rawBarCodePlanCode = rawBarcodeMesProductPlanDetail.getPlanCode();
String rawBarCodePlanDetailCode = rawBarcodeMesProductPlanDetail.getPlanDetailCode();
@ -422,6 +444,10 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
+ ",原材料条码派工单号:" + rawBarcodeProductPlan.getDispatchCode());
}
mesBaseBarcodeInfo.setPalletInfoCode(rawBarcode.getPalletInfoCode());//重新绑定托盘号
mesBaseBarcodeInfo.setBindStatus(MesConstants.MES_BARCODE_BIND_STATUS_BINDING);
@ -910,14 +936,14 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
//先根据之前的成品条码信息获取托盘信息
MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(oriProductBarcode);
log.info("1:"+productBarcodeInfo.toString());
log.info("1:" + productBarcodeInfo.toString());
if (productBarcodeInfo == null) {
allErrorMsgBuilder.append("成品/配对码").append(oriProductBarcode).append("不存在;");
}
if(productBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_BIND)){
if (productBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_BIND)) {
productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(productBarcodeInfo.getBindBarcode());
log.info("2:"+productBarcodeInfo.toString());
log.info("2:" + productBarcodeInfo.toString());
if (productBarcodeInfo == null) {
allErrorMsgBuilder.append("成品/配对码[").append(oriProductBarcode).append("]的成品不存在;");
}
@ -927,7 +953,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
querySaleOrderRelate.setBindBarcode(productBarcodeInfo.getBarcodeInfo());
List<MesSaleOrderRelate> mesSaleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelate);
if(mesSaleOrderRelates!=null && !mesSaleOrderRelates.isEmpty()){
if (mesSaleOrderRelates != null && !mesSaleOrderRelates.isEmpty()) {
allErrorMsgBuilder.append("此条码[").append(oriProductBarcode).append("]已经生成过原材料条码;");
}
@ -951,26 +977,26 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
allErrorMsgBuilder.append(this.checkInternalMesBaseBarcode(productBarcodeInfo.getBarcodeInfo(), productBarcodeInfo, mesBaseBarcodeInfo));
String materialName = productBarcodeInfo.getMaterialName();
materialName = materialName.substring(0,materialNameLength);
materialName = materialName.substring(0, materialNameLength);
materialNameBuilder.append(splitCharacter).append(materialName);
}
barcodeInfo = Seq.getId(Seq.mesInternalVirtualBarcodeSeqType, Seq.mesInternalVirtualBarcodeCode);
String mergeMaterialName = materialNameBuilder.toString().replaceFirst(splitCharacter,"");
String mergeMaterialName = materialNameBuilder.toString().replaceFirst(splitCharacter, "");
//新建虚拟物料
materialId = this.insertNewVirtualMaterial(barcodeInfo,mergeMaterialName, userName, currentDate);
materialId = this.insertNewVirtualMaterial(barcodeInfo, mergeMaterialName, userName, currentDate);
} else {
MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(productBarcodes);
if (productBarcodeInfo == null) {
allErrorMsgBuilder.append("此成品/配对码不存在;");
}
if(productBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_BIND)){
if (productBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_BIND)) {
productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(productBarcodeInfo.getBindBarcode());
log.info("2:"+productBarcodeInfo.toString());
log.info("2:" + productBarcodeInfo.toString());
if (productBarcodeInfo == null) {
allErrorMsgBuilder.append("成品/配对码[").append(productBarcodes).append("]的成品不存在;");
}
@ -985,7 +1011,6 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
allErrorMsgBuilder.append(this.checkInternalMesBaseBarcode(productBarcodeInfo.getBarcodeInfo(), productBarcodeInfo, mesBaseBarcodeInfo));
productBarcodeInfoList.add(productBarcodeInfo);
@ -1087,8 +1112,6 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
// }
//四楼到五楼,主要是多个成品合并到一个托盘后生成原材料条码需要保存以下信息,一个成品的保不保存无所谓
MesSaleOrderRelate saleOrderRelate = new MesSaleOrderRelate();
saleOrderRelate.setBarcodeInfo(barcodeInfo);
@ -1452,7 +1475,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
mesOrderBindMapper.updateMesOrderBind(dbOrderBind);
String materialName = mesSaleOrderRelate.getMaterialName();
materialName = materialName.substring(0,materialNameLength);
materialName = materialName.substring(0, materialNameLength);
materialNameBuilder.append(splitCharacter).append(materialName);
// materialCodes.add(mesPurchaseOrderVo.getMaterialCode());
}
@ -1461,12 +1484,12 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
throw new ServiceException(errorMsgBuilder.toString());
}
String mergeMaterialName = materialNameBuilder.toString().replaceFirst(splitCharacter,"");
String mergeMaterialName = materialNameBuilder.toString().replaceFirst(splitCharacter, "");
String barcodeInfo = Seq.getId(Seq.mesPurchaseVirtualBarcodeSeqType, Seq.mesPurchaseVirtualBarcodeCode);
//新建虚拟物料
Long materialId = this.insertNewVirtualMaterial(barcodeInfo, mergeMaterialName,userName, currentDate);
Long materialId = this.insertNewVirtualMaterial(barcodeInfo, mergeMaterialName, userName, currentDate);
//创建虚拟销售订单,保存对应的销售订单列表
MesSaleOrder virtualSaleOrder = this.insertNewVirtualSaleOrder(materialId, barcodeInfo, mesBaseBarcodeInfo.getSaleorderCode(), mesSaleOrderRelateList, userName, currentDate);
@ -1507,7 +1530,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
public long insertNewVirtualMaterial(String barcodeInfo, String materialName,String userName, Date currentDate) {
public long insertNewVirtualMaterial(String barcodeInfo, String materialName, String userName, Date currentDate) {
//虚拟成品和虚拟原材料用一个物料
MesBaseMaterialInfo mesBaseMaterialInfo = new MesBaseMaterialInfo();
mesBaseMaterialInfo.setMaterialCode(barcodeInfo);
@ -1591,7 +1614,6 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
mesMaterialBomMapper.insertMesMaterialBom(virtualMaterialBom);
toUpdatedMaterialBoms.forEach(umb -> {
MesMaterialBom queryChildBom = new MesMaterialBom();
queryChildBom.setParentId(umb.getMaterialBomId());
@ -1689,13 +1711,13 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
StringBuilder materialNameBuilder = new StringBuilder();
for(MesSaleOrderRelate mesSaleOrderRelate:mesSaleOrderRelateList){
for (MesSaleOrderRelate mesSaleOrderRelate : mesSaleOrderRelateList) {
String materialName = mesSaleOrderRelate.getMaterialName();
materialName = materialName.substring(0,materialNameLength);
materialName = materialName.substring(0, materialNameLength);
materialNameBuilder.append(splitCharacter).append(materialName);
}
String mergeMaterialName = materialNameBuilder.toString().replaceFirst(splitCharacter,"");
String mergeMaterialName = materialNameBuilder.toString().replaceFirst(splitCharacter, "");
mesBaseBarcodeInfo.setAmount(new BigDecimal(mesSaleOrderRelateList.size()));
//数据库中的合并信息
@ -1829,7 +1851,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
public StringBuilder handleInsertSaleOrderRelates(List<MesSaleOrderRelate> toInsertedSaleOrderRelateList, MesBaseBarcodeInfo baseBarcodeInfo,
MesMaterialBom virtualMaterialBom, String userName, Date currentDate) {
StringBuilder errorMsgBuilder = new StringBuilder();
if(toInsertedSaleOrderRelateList==null || toInsertedSaleOrderRelateList.isEmpty()){
if (toInsertedSaleOrderRelateList == null || toInsertedSaleOrderRelateList.isEmpty()) {
return errorMsgBuilder;
}
@ -1927,11 +1949,12 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
/**
*
*
* @param mesPrdBarcodeInfo
* @return
*/
@Override
public List<MesPrdBarcodeInfo> selectMesPrdBarcodeInfoList(MesPrdBarcodeInfo mesPrdBarcodeInfo){
public List<MesPrdBarcodeInfo> selectMesPrdBarcodeInfoList(MesPrdBarcodeInfo mesPrdBarcodeInfo) {
return mesPrdBarcodeInfoMapper.selectMesPrdBarcodeInfoList(mesPrdBarcodeInfo);
}

@ -130,7 +130,8 @@ public class MesBaseMaterialInfoServiceImpl implements IMesBaseMaterialInfoServi
}
mesBaseMaterialInfo.setUpdateTime(DateUtils.getNowDate());
mesBaseMaterialInfo.setUpdateBy(SecurityUtils.getUsername());
mesBaseMaterialInfo.setUpdateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
if (StringUtils.isNotEmpty(mesBaseMaterialInfo.getBatchFlag())
&& !mesBaseMaterialInfo.getBatchFlag().equals(MesConstants.IS_BATCH)) {
mesBaseMaterialInfo.setBatchAmount(BigDecimal.ONE);

@ -87,7 +87,8 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService {
@Override
public int insertMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo) {
mesBasePalletInfo.setCreateTime(DateUtils.getNowDate());
mesBasePalletInfo.setCreateBy(SecurityUtils.getUsername());
mesBasePalletInfo.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return mesBasePalletInfoMapper.insertMesBasePalletInfo(mesBasePalletInfo);
}
@ -100,7 +101,8 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService {
@Override
public int updateMesBasePalletInfo(MesBasePalletInfo mesBasePalletInfo) {
mesBasePalletInfo.setUpdateTime(DateUtils.getNowDate());
mesBasePalletInfo.setUpdateBy(SecurityUtils.getUsername());
mesBasePalletInfo.setUpdateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return mesBasePalletInfoMapper.updateMesBasePalletInfo(mesBasePalletInfo);
}
@ -165,7 +167,8 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService {
}
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
String oriPalletInfoCode="";
if (mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_BIND)) {

@ -162,7 +162,8 @@ public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
List<MesBaseProcessProdline> list = new ArrayList<MesBaseProcessProdline>();
for (MesBaseProcessProdline mesBaseProcessProdline : mesBaseProcessProdlineList) {
mesBaseProcessProdline.setProcessId(processId);
mesBaseProcessProdline.setCreateBy(SecurityUtils.getUsername());
mesBaseProcessProdline.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesBaseProcessProdline.setCreateTime(DateUtils.getNowDate());
list.add(mesBaseProcessProdline);
}

@ -61,7 +61,8 @@ public class MesBaseRouteServiceImpl implements IMesBaseRouteService
public int insertMesBaseRoute(MesBaseRoute mesBaseRoute)
{
mesBaseRoute.setCreateTime(DateUtils.getNowDate());
mesBaseRoute.setCreateBy(SecurityUtils.getUsername());
mesBaseRoute.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
int rows = mesBaseRouteMapper.insertMesBaseRoute(mesBaseRoute);
insertMesBaseRouteProcess(mesBaseRoute);
return rows;
@ -78,7 +79,7 @@ public class MesBaseRouteServiceImpl implements IMesBaseRouteService
public int updateMesBaseRoute(MesBaseRoute mesBaseRoute)
{
mesBaseRoute.setUpdateTime(DateUtils.getNowDate());
mesBaseRoute.setUpdateBy(SecurityUtils.getUsername());
mesBaseRoute.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesBaseRouteMapper.deleteMesBaseRouteProcessByRouteId(mesBaseRoute.getRouteId());
insertMesBaseRouteProcess(mesBaseRoute);
return mesBaseRouteMapper.updateMesBaseRoute(mesBaseRoute);
@ -128,7 +129,7 @@ public class MesBaseRouteServiceImpl implements IMesBaseRouteService
{
mesBaseRouteProcess.setRouteId(routeId);
mesBaseRouteProcess.setCreateTime(DateUtils.getNowDate());
mesBaseRouteProcess.setCreateBy(SecurityUtils.getUsername());
mesBaseRouteProcess.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
list.add(mesBaseRouteProcess);
}
if (list.size() > 0)

@ -58,7 +58,8 @@ public class MesBaseStationInfoServiceImpl implements IMesBaseStationInfoService
@Override
public int insertMesBaseStationInfo(MesBaseStationInfo mesBaseStationInfo) {
mesBaseStationInfo.setCreateTime(DateUtils.getNowDate());
mesBaseStationInfo.setCreateBy(SecurityUtils.getUsername());
mesBaseStationInfo.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return mesBaseStationInfoMapper.insertMesBaseStationInfo(mesBaseStationInfo);
}

@ -55,7 +55,8 @@ public class MesBaseSupplierInfoServiceImpl implements IMesBaseSupplierInfoServi
public int insertMesBaseSupplierInfo(MesBaseSupplierInfo mesBaseSupplierInfo)
{
mesBaseSupplierInfo.setCreateTime(DateUtils.getNowDate());
mesBaseSupplierInfo.setCreateBy(SecurityUtils.getUsername());
mesBaseSupplierInfo.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return mesBaseSupplierInfoMapper.insertMesBaseSupplierInfo(mesBaseSupplierInfo);
}
@ -69,7 +70,7 @@ public class MesBaseSupplierInfoServiceImpl implements IMesBaseSupplierInfoServi
public int updateMesBaseSupplierInfo(MesBaseSupplierInfo mesBaseSupplierInfo)
{
mesBaseSupplierInfo.setUpdateTime(DateUtils.getNowDate());
mesBaseSupplierInfo.setUpdateBy(SecurityUtils.getUsername());
mesBaseSupplierInfo.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return mesBaseSupplierInfoMapper.updateMesBaseSupplierInfo(mesBaseSupplierInfo);
}

@ -439,7 +439,8 @@ public class MesImportImpl implements IMesImportService {
applyProcess.setMaterialName(materialName);
applyProcess.setWfProcessId(WfConstants.WF_PURCHASE_REQUISITION_PROCESS_ID);
applyProcess.setProcessActivityId(WfConstants.WF_PURCHASE_ACTIVITY_CREATE_ID);
applyProcess.setCreateBy(SecurityUtils.getUsername());
applyProcess.setCreateBy(SecurityUtils.getLoginUser() == null ?
SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
applyProcess.setCreateTime(DateUtils.getNowDate());
//新增采购申请流程
mesPurchaseApplyProcessService.insertRaisePurchaseApplyProcess(applyProcess);

@ -1,6 +1,10 @@
package com.hw.mes.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -16,8 +20,7 @@ import com.hw.mes.service.IMesMaterialBomService;
* @date 2024-01-30
*/
@Service
public class MesMaterialBomServiceImpl implements IMesMaterialBomService
{
public class MesMaterialBomServiceImpl implements IMesMaterialBomService {
@Autowired
private MesMaterialBomMapper mesMaterialBomMapper;
@ -28,8 +31,7 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
* @return BOM
*/
@Override
public MesMaterialBom selectMesMaterialBomByMaterialBomId(Long materialBomId)
{
public MesMaterialBom selectMesMaterialBomByMaterialBomId(Long materialBomId) {
return mesMaterialBomMapper.selectMesMaterialBomByMaterialBomId(materialBomId);
}
@ -40,8 +42,7 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
* @return BOM
*/
@Override
public List<MesMaterialBom> selectMesMaterialBomList(MesMaterialBom mesMaterialBom)
{
public List<MesMaterialBom> selectMesMaterialBomList(MesMaterialBom mesMaterialBom) {
return mesMaterialBomMapper.selectMesMaterialBomList(mesMaterialBom);
}
@ -52,14 +53,13 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
* @return
*/
@Override
public int insertMesMaterialBom(MesMaterialBom mesMaterialBom)
{
public int insertMesMaterialBom(MesMaterialBom mesMaterialBom) {
isTopFlag(mesMaterialBom);
mesMaterialBom.setCreateTime(DateUtils.getNowDate());
MesMaterialBom info = mesMaterialBomMapper.selectMesMaterialBomByMaterialBomId(mesMaterialBom.getParentId());
if (StringUtils.isNull(info)){
if (StringUtils.isNull(info)) {
mesMaterialBom.setAncestors(mesMaterialBom.getParentId().toString());
}else {
} else {
mesMaterialBom.setAncestors(info.getAncestors() + "," + mesMaterialBom.getParentId());
}
return mesMaterialBomMapper.insertMesMaterialBom(mesMaterialBom);
@ -72,8 +72,7 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
* @return
*/
@Override
public int updateMesMaterialBom(MesMaterialBom mesMaterialBom)
{
public int updateMesMaterialBom(MesMaterialBom mesMaterialBom) {
isTopFlag(mesMaterialBom);
mesMaterialBom.setUpdateTime(DateUtils.getNowDate());
return mesMaterialBomMapper.updateMesMaterialBom(mesMaterialBom);
@ -86,8 +85,7 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
* @return
*/
@Override
public int deleteMesMaterialBomByMaterialBomIds(Long[] materialBomIds)
{
public int deleteMesMaterialBomByMaterialBomIds(Long[] materialBomIds) {
//遍历删除子集物料BOM
MesMaterialBom materialBom = new MesMaterialBom();
materialBom.setAncestors(String.valueOf(materialBomIds[0]));
@ -105,8 +103,7 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
* @return
*/
@Override
public int deleteMesMaterialBomByMaterialBomId(Long materialBomId)
{
public int deleteMesMaterialBomByMaterialBomId(Long materialBomId) {
return mesMaterialBomMapper.deleteMesMaterialBomByMaterialBomId(materialBomId);
}
@ -117,15 +114,53 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
* @return BOM
*/
@Override
public List<MesMaterialBom> selectMesMaterialBomJoinList(MesMaterialBom mesMaterialBom)
{
public List<MesMaterialBom> selectMesMaterialBomJoinList(MesMaterialBom mesMaterialBom) {
mesMaterialBom.setMaterialSpec(StringUtils.isNotEmpty(mesMaterialBom.getMaterialSpec())
? mesMaterialBom.getMaterialSpec().replaceAll("\\s+", "") : "");
return mesMaterialBomMapper.selectMesMaterialBomJoinList(mesMaterialBom);
List<MesMaterialBom> materialBomList = mesMaterialBomMapper.selectMesMaterialBomJoinList(mesMaterialBom);
if (materialBomList != null && !materialBomList.isEmpty()) {
if (StringUtils.isNotEmpty(mesMaterialBom.getMaterialCode()) || StringUtils.isNotEmpty(mesMaterialBom.getMaterialName())
|| StringUtils.isNotEmpty(mesMaterialBom.getMaterialSpec())) {
List<MesMaterialBom> totalMesMaterialBomList = new ArrayList<>();
for (MesMaterialBom mmb : materialBomList) {
MesMaterialBom queryMaterialBom = new MesMaterialBom();
if (mmb.getParentId() == null || mmb.getParentId().equals(0L)) {
queryMaterialBom.setParentId(mmb.getMaterialBomId());
} else {
queryMaterialBom.setMaterialBomId(mmb.getParentId());
}
List<MesMaterialBom> parentOrChildBomList = mesMaterialBomMapper.selectMesMaterialBomJoinList(queryMaterialBom);
if (parentOrChildBomList != null && !parentOrChildBomList.isEmpty()) {
totalMesMaterialBomList.addAll(parentOrChildBomList);
}
}
if (totalMesMaterialBomList != null && !totalMesMaterialBomList.isEmpty()) {
// 使用 Stream API 获取并集
List<MesMaterialBom> union = Stream.concat(materialBomList.stream(), totalMesMaterialBomList.stream())
.collect(Collectors.collectingAndThen(
Collectors.toMap(
MesMaterialBom::getMaterialBomId,
item -> item,
(existing, replacement) -> existing // 如果有重复,保留第一个
),
map -> new ArrayList<>(map.values())
));
return union;
}
}
}
return materialBomList;
}
/**
* BOM
*
* @param materialId
* @return
*/
@ -139,6 +174,7 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
/**
* BOM
*
* @param materialBomId BOM
* @return
*/
@ -150,11 +186,12 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
/**
* BOM
*
* @param mesMaterialBom
* @return
*/
public MesMaterialBom recursionSelectTopMaterialBom(MesMaterialBom mesMaterialBom) {
if (StringUtils.isNull(mesMaterialBom) || mesMaterialBom.getTopFlag() == 1L){
if (StringUtils.isNull(mesMaterialBom) || mesMaterialBom.getTopFlag() == 1L) {
//返回顶级BOM信息
return mesMaterialBom;
}
@ -165,13 +202,14 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
/**
* SET
* BOM
*
* @param mesMaterialBom
*/
private void isTopFlag(MesMaterialBom mesMaterialBom){
private void isTopFlag(MesMaterialBom mesMaterialBom) {
// 顶级标识1=是0=否
if (StringUtils.isNull(mesMaterialBom.getParentId()) || mesMaterialBom.getParentId() == 0L){
if (StringUtils.isNull(mesMaterialBom.getParentId()) || mesMaterialBom.getParentId() == 0L) {
mesMaterialBom.setTopFlag(1L);
}else {
} else {
mesMaterialBom.setTopFlag(0L);
}
}

@ -182,7 +182,7 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
}
mesProductOrder.setUpdateBy(SecurityUtils.getUsername());
mesProductOrder.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesProductOrder.setUpdateTime(DateUtils.getNowDate());
return mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
@ -407,7 +407,7 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
productOrder.setProductOrderId(mesProductOrder.getProductOrderId());
productOrder.setOrderStatus(MesConstants.PAUSE);
productOrder.setUpdateTime(new Date());
productOrder.setUpdateBy(SecurityUtils.getUsername());
productOrder.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return mesProductOrderMapper.updateMesProductOrder(productOrder);
}
@ -432,7 +432,7 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
productOrder.setProductOrderId(mesProductOrder.getProductOrderId());
productOrder.setOrderStatus(MesConstants.BEGIN);
productOrder.setUpdateTime(new Date());
productOrder.setUpdateBy(SecurityUtils.getUsername());
productOrder.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return mesProductOrderMapper.updateMesProductOrder(productOrder);
}

@ -1,6 +1,9 @@
package com.hw.mes.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.SystemConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
@ -14,10 +17,13 @@ import com.hw.mes.domain.vo.MesProductPlanDetailPauseVo;
import com.hw.mes.domain.vo.MesProductPlanDetailVo;
import com.hw.mes.mapper.*;
import com.hw.mes.service.IMesProductPlanDetailService;
import com.hw.system.api.RemoteSysCommonService;
import com.hw.system.api.domain.common.SysPointRouter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
@ -59,6 +65,9 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
@Autowired
private MesProduceStatisticsDetailMapper mesProduceStatisticsDetailMapper;
@Resource
private RemoteSysCommonService remoteSysCommonService;
@Autowired
private MesConfig mesConfig;
@ -154,7 +163,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
return 0;
} else {
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
List<MesProductPlanDetail> newMesProductPlanDetails = new ArrayList<>();
BigDecimal planAmount = mesProductPlan.getPlanAmount();
@ -203,7 +212,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Long userId = SecurityUtils.getUserId();
startProductOrder(dbProductPlan, currentDate, userName);
@ -788,12 +797,37 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
throw new ServiceException(String.format("此生产计划明细已经%s,不能暂停!", planDetailStatusPrompt));
}
Date currentDate = new Date();
String nickName = SecurityUtils.getLoginUser()==null?SecurityUtils.getUsername():SecurityUtils.getLoginUser().getNickname();
mesProductPlanDetail.setPlanDetailStatus(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_PAUSE);
mesProductPlanDetail.setUpdateTime(new Date());
mesProductPlanDetail.setUpdateBy(SecurityUtils.getUsername());
mesProductPlanDetail.setUpdateTime(currentDate);
mesProductPlanDetail.setUpdateBy(nickName);
String remark = "生产计划编号:"+mesProductPlanDetail.getPlanCode()+",用户:"+mesProductPlanDetail.getUserName()+",已暂停。";
this.saveSysPointRouter(mesProductPlanDetail.getPlanDetailId(),remark,nickName,currentDate);
return mesProductPlanDetailMapper.updateMesProductPlanDetail(mesProductPlanDetail);
}
private void saveSysPointRouter(Long productPlanDetailId, String remark,String nickName, Date currentDate) {
SysPointRouter sysPointRouter = new SysPointRouter();
sysPointRouter.setModuleCode("MES");
sysPointRouter.setPointType(SystemConstants.SYS_ROUTER_POINT_TYPE_ALARM);
sysPointRouter.setRouterAddress("/mes/info/productplan");
JSONObject routerAddressDetailJson = new JSONObject();
routerAddressDetailJson.put("productPlanDetailId", productPlanDetailId);
sysPointRouter.setRouterAddressDetail(routerAddressDetailJson.toString());
sysPointRouter.setEmailFlag("1");
sysPointRouter.setRemark(remark);
sysPointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_PRODUCE_PAUSE);
sysPointRouter.setCreateBy(nickName);
sysPointRouter.setCreateTime(currentDate);
List<SysPointRouter> sysPointRouterList = new ArrayList<>();
sysPointRouterList.add(sysPointRouter);
remoteSysCommonService.insertSysPointRouterPort(sysPointRouterList, SecurityConstants.INNER);
}
/**
*

@ -135,7 +135,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
mesProductPlan.setSaleOrderId(0L);
}
mesProductPlan.setPlanAmount(mesProductPlan.getDispatchAmount());
mesProductPlan.setCreateBy(SecurityUtils.getUsername());
mesProductPlan.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesProductPlan.setCreateTime(DateUtils.getNowDate());
mesProductPlan.setPlanCode(Seq.getId(Seq.planCodeSeqType, Seq.planCodeCode));
int rows = mesProductPlanMapper.insertMesProductPlan(mesProductPlan);
@ -155,7 +155,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
@Transactional
@Override
public int updateMesProductPlan(MesProductPlan mesProductPlan) {
mesProductPlan.setUpdateBy(SecurityUtils.getUsername());
mesProductPlan.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesProductPlan.setUpdateTime(DateUtils.getNowDate());
mesProductPlanMapper.deleteMesProductPlanDetailByPlanId(mesProductPlan.getPlanId());
insertMesProductPlanDetail(mesProductPlan);
@ -257,7 +257,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
@Override
@Transactional(rollbackFor = Exception.class)
public int orderAddMesProductPlanList(MesProductPlanEditVo mesProductPlanEditVo) {
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
/**plan

@ -51,7 +51,7 @@ public class MesPurchaseApplyProcessDetailServiceImpl implements IMesPurchaseApp
*/
@Override
public int insertMesPurchaseApplyProcessDetail(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail) {
mesPurchaseApplyProcessDetail.setCreateBy(SecurityUtils.getUsername());
mesPurchaseApplyProcessDetail.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesPurchaseApplyProcessDetail.setCreateTime(DateUtils.getNowDate());
return mesPurchaseApplyProcessDetailMapper.insertMesPurchaseApplyProcessDetail(mesPurchaseApplyProcessDetail);
}
@ -64,7 +64,7 @@ public class MesPurchaseApplyProcessDetailServiceImpl implements IMesPurchaseApp
*/
@Override
public int updateMesPurchaseApplyProcessDetail(MesPurchaseApplyProcessDetail mesPurchaseApplyProcessDetail) {
mesPurchaseApplyProcessDetail.setUpdateBy(SecurityUtils.getUsername());
mesPurchaseApplyProcessDetail.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesPurchaseApplyProcessDetail.setUpdateTime(DateUtils.getNowDate());
return mesPurchaseApplyProcessDetailMapper.updateMesPurchaseApplyProcessDetail(mesPurchaseApplyProcessDetail);
}

@ -92,7 +92,7 @@ public class MesPurchaseApplyProcessServiceImpl implements IMesPurchaseApplyProc
@Transactional
@Override
public int updateMesPurchaseApplyProcess(MesPurchaseApplyProcess mesPurchaseApplyProcess) {
mesPurchaseApplyProcess.setUpdateBy(SecurityUtils.getUsername());
mesPurchaseApplyProcess.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesPurchaseApplyProcess.setUpdateTime(DateUtils.getNowDate());
return mesPurchaseApplyProcessMapper.updateMesPurchaseApplyProcess(mesPurchaseApplyProcess);
}

@ -175,7 +175,7 @@ public class MesPurchaseApplyServiceImpl implements IMesPurchaseApplyService {
StringBuilder failureMsg = new StringBuilder();
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
MesPurchaseApply mesPurchaseApply = new MesPurchaseApply();
mesPurchaseApply.setTaskCode(Seq.getId(Seq.mesPurchaseApplySeqType, Seq.mesPurchaseApplyCode));
mesPurchaseApply.setSyncStatus(MesConstants.MES_PURCHASE_APPALY_SYNC_NO);

@ -197,7 +197,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
List<MesOrderBind> dbMesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind);
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
String materialCode = mesPurchaseOrder.getMaterialCode();
String materialName = mesPurchaseOrder.getMaterialName();
@ -351,7 +351,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
List<MesPurchaseOrder> mesPurchaseOrderList = mesSaleOrder.getMesPurchaseOrderList();
for (MesPurchaseOrder mesPurchaseOrder : mesPurchaseOrderList) {
Long purchaseOrderId = mesPurchaseOrder.getPurchaseOrderId();
@ -438,7 +438,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
MesOrderBind bind = bindList.get(0);
if(purchaseOrder.getUpdateAmount().compareTo(BigDecimal.ZERO)>0){
bind.setBindAmount(purchaseOrder.getUpdateAmount());
bind.setUpdateBy(SecurityUtils.getUsername());
bind.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
bind.setUpdateTime(DateUtils.getNowDate());
mesOrderBindMapper.updateMesOrderBind(bind);
}else{

@ -62,7 +62,7 @@ public class MesRaiseCapitalBomServiceImpl implements IMesRaiseCapitalBomService
@Override
public int insertMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom) {
isTopFlag(mesRaiseCapitalBom);
mesRaiseCapitalBom.setCreateBy(SecurityUtils.getUsername());
mesRaiseCapitalBom.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesRaiseCapitalBom.setCreateTime(DateUtils.getNowDate());
MesRaiseCapitalBom info = mesRaiseCapitalBomMapper.selectMesRaiseCapitalBomByRaiseCapitalId(mesRaiseCapitalBom.getParentId());
if (StringUtils.isNull(info)){
@ -95,7 +95,7 @@ public class MesRaiseCapitalBomServiceImpl implements IMesRaiseCapitalBomService
*/
@Override
public int updateMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom) {
mesRaiseCapitalBom.setUpdateBy(SecurityUtils.getUsername());
mesRaiseCapitalBom.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
mesRaiseCapitalBom.setUpdateTime(DateUtils.getNowDate());
//记录修改前内容
Long raiseCapitalId = mesRaiseCapitalBom.getRaiseCapitalId();

@ -187,7 +187,7 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
Long newSaleOrderId = mesSaleOrderTransferVo.getNewSaleOrderId();
BigDecimal transferAmount = mesSaleOrderTransferVo.getTransferAmount();
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
if (oldSaleOrderId != null && !oldSaleOrderId.equals(0L)) {
MesSaleOrder oldSaleOrder = mesSaleOrderMapper.selectMesSaleOrderBySaleOrderId(oldSaleOrderId);
oldSaleOrder.setTransferOutAmount(transferAmount);
@ -301,7 +301,7 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
List<MesSaleOrderMaterial> toInsertedMesSaleOrderMaterialList = new ArrayList<>();
// List<MesSaleOrderMaterial> toUpdatedMesSaleOrderMateriaList = new ArrayList<>();
Date currentDate = new Date();
String nickName = SecurityUtils.getLoginUser().getNickname();
String nickName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
for (MesSaleOrderMaterial mesSaleOrderMaterial : mesSaleOrderMaterialList) {
if (mesSaleOrderMaterial.getUsedAmount() != null && mesSaleOrderMaterial.getUsedAmount().compareTo(BigDecimal.ZERO) > 0) {
BigDecimal realOutstockAmount = mesSaleOrderMaterial.getRealOutstockAmount();

@ -184,6 +184,7 @@
from mes_material_bom mmb left join mes_base_material_info mbmi on mmb.material_id=mbmi.material_id
<where>
<if test="materialBomId != null ">and mmb.material_bom_id = #{materialBomId}</if>
<if test="parentId != null ">and mmb.parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''">and mmb.ancestors like concat(#{ancestors}, '%')</if>
<if test="materialId != null ">and mmb.material_id = #{materialId}</if>

@ -0,0 +1,51 @@
<?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.QmsCheckResultDetailMapper">
<resultMap type="QmsCheckResultDetail" id="QmsCheckResultDetailResult">
<result property="checkResultDetailId" column="check_result_detail_id" />
<result property="checkResultId" column="check_result_id" />
<result property="materialBarcode" column="material_barcode" />
<result property="materialId" column="material_id" />
<result property="checkRuleId" column="check_rule_id" />
<result property="checkRuleType" column="check_rule_type" />
<result property="checkRuleName" column="check_rule_name" />
<result property="checkMode" column="check_mode" />
<result property="checkSample" column="check_sample" />
<result property="checkStatus" column="check_status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
</resultMap>
<sql id="selectQmsCheckResultDetailVo">
select check_result_detail_id, check_result_id, material_barcode, material_id, check_rule_id, check_rule_type, check_rule_name, check_mode, check_sample, check_status, remark, create_by, create_time, update_by, update_time from qms_check_result_detail
</sql>
<select id="selectQmsCheckResultDetailList" parameterType="QmsCheckResultDetail" resultMap="QmsCheckResultDetailResult">
select check_result_detail_id,material_barcode,check_status from qms_check_result_detail
<where>
<if test="checkResultId != null "> and check_result_id = #{checkResultId}</if>
<if test="materialBarcode != null and materialBarcode != ''"> and material_barcode = #{materialBarcode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="checkRuleId != null "> and check_rule_id = #{checkRuleId}</if>
<if test="checkRuleType != null and checkRuleType != ''"> and check_rule_type = #{checkRuleType}</if>
<if test="checkRuleName != null and checkRuleName != ''"> and check_rule_name like concat('%', #{checkRuleName}, '%')</if>
<if test="checkMode != null and checkMode != ''"> and check_mode = #{checkMode}</if>
<if test="checkSample != null "> and check_sample = #{checkSample}</if>
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if>
</where>
</select>
</mapper>

@ -3,6 +3,8 @@ package com.hw.qms.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.annotation.InnerAuth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -30,8 +32,7 @@ import com.hw.common.core.web.page.TableDataInfo;
*/
@RestController
@RequestMapping("/checkresultdetail")
public class QmsCheckResultDetailController extends BaseController
{
public class QmsCheckResultDetailController extends BaseController {
@Autowired
private IQmsCheckResultDetailService qmsCheckResultDetailService;
@ -40,8 +41,7 @@ public class QmsCheckResultDetailController extends BaseController
*/
@RequiresPermissions("qms:checkresultdetail:list")
@GetMapping("/list")
public TableDataInfo list(QmsCheckResultDetail qmsCheckResultDetail)
{
public TableDataInfo list(QmsCheckResultDetail qmsCheckResultDetail) {
startPage();
List<QmsCheckResultDetail> list = qmsCheckResultDetailService.selectQmsCheckResultDetailList(qmsCheckResultDetail);
return getDataTable(list);
@ -53,8 +53,7 @@ public class QmsCheckResultDetailController extends BaseController
@RequiresPermissions("qms:checkresultdetail:export")
@Log(title = "质检结果详情", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QmsCheckResultDetail qmsCheckResultDetail)
{
public void export(HttpServletResponse response, QmsCheckResultDetail qmsCheckResultDetail) {
List<QmsCheckResultDetail> list = qmsCheckResultDetailService.selectQmsCheckResultDetailList(qmsCheckResultDetail);
ExcelUtil<QmsCheckResultDetail> util = new ExcelUtil<QmsCheckResultDetail>(QmsCheckResultDetail.class);
util.exportExcel(response, list, "质检结果详情数据");
@ -65,8 +64,7 @@ public class QmsCheckResultDetailController extends BaseController
*/
@RequiresPermissions("qms:checkresultdetail:query")
@GetMapping(value = "/{checkResultDetailId}")
public AjaxResult getInfo(@PathVariable("checkResultDetailId") Long checkResultDetailId)
{
public AjaxResult getInfo(@PathVariable("checkResultDetailId") Long checkResultDetailId) {
return success(qmsCheckResultDetailService.selectQmsCheckResultDetailByCheckResultDetailId(checkResultDetailId));
}
@ -76,8 +74,7 @@ public class QmsCheckResultDetailController extends BaseController
@RequiresPermissions("qms:checkresultdetail:add")
@Log(title = "质检结果详情", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QmsCheckResultDetail qmsCheckResultDetail)
{
public AjaxResult add(@RequestBody QmsCheckResultDetail qmsCheckResultDetail) {
return toAjax(qmsCheckResultDetailService.insertQmsCheckResultDetail(qmsCheckResultDetail));
}
@ -87,8 +84,7 @@ public class QmsCheckResultDetailController extends BaseController
@RequiresPermissions("qms:checkresultdetail:edit")
@Log(title = "质检结果详情", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QmsCheckResultDetail qmsCheckResultDetail)
{
public AjaxResult edit(@RequestBody QmsCheckResultDetail qmsCheckResultDetail) {
return toAjax(qmsCheckResultDetailService.updateQmsCheckResultDetail(qmsCheckResultDetail));
}
@ -98,8 +94,18 @@ public class QmsCheckResultDetailController extends BaseController
@RequiresPermissions("qms:checkresultdetail:remove")
@Log(title = "质检结果详情", businessType = BusinessType.DELETE)
@DeleteMapping("/{checkResultDetailIds}")
public AjaxResult remove(@PathVariable Long[] checkResultDetailIds)
{
public AjaxResult remove(@PathVariable Long[] checkResultDetailIds) {
return toAjax(qmsCheckResultDetailService.deleteQmsCheckResultDetailByCheckResultDetailIds(checkResultDetailIds));
}
/**
*
*/
@InnerAuth
@GetMapping(value = "/getCheckResultDetailByBarcode/{barcode}")
public AjaxResult getCheckResultDetailByBarcode(@PathVariable("barcode") String barcode) {
return success(qmsCheckResultDetailService.getCheckResultDetailByBarcode(barcode));
}
}

@ -74,4 +74,12 @@ public interface IQmsCheckResultDetailService
* @return
*/
public QmsCheckResultDetailVo getCheckResultDetailVo(Long checkResultDetailId);
/**
*
* @param barcode
* @return
*/
public QmsCheckResultDetail getCheckResultDetailByBarcode(String barcode);
}

@ -56,7 +56,7 @@ public class QmsCheckProjectServiceImpl implements IQmsCheckProjectService
@Override
public int insertQmsCheckProject(QmsCheckProject qmsCheckProject)
{
qmsCheckProject.setCreateBy(SecurityUtils.getUsername());
qmsCheckProject.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
qmsCheckProject.setCreateTime(DateUtils.getNowDate());
return qmsCheckProjectMapper.insertQmsCheckProject(qmsCheckProject);
}

@ -57,7 +57,7 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
public List<QmsCheckResultDetail> selectQmsCheckResultDetailList(QmsCheckResultDetail qmsCheckResultDetail) {
List<QmsCheckResultDetail> qmsCheckResultDetails = qmsCheckResultDetailMapper.selectQmsCheckResultDetailList(qmsCheckResultDetail);
for (QmsCheckResultDetail q:qmsCheckResultDetails){
for (QmsCheckResultDetail q : qmsCheckResultDetails) {
QmsCheckResultDetailProject qmsCheckResultDetailProject = new QmsCheckResultDetailProject();
qmsCheckResultDetailProject.setCheckResultDetailId(q.getCheckResultDetailId());
List<QmsCheckResultDetailProject> qmsCheckResultDetailProjects = qmsCheckResultDetailProjectMapper.selectQmsCheckResultDetailProjectList(qmsCheckResultDetailProject);
@ -66,7 +66,6 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
return qmsCheckResultDetails;
}
/**
@ -79,7 +78,7 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
@Override
public int insertQmsCheckResultDetail(QmsCheckResultDetail qmsCheckResultDetail) {
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
qmsCheckResultDetail.setCreateTime(currentDate);
qmsCheckResultDetail.setCreateBy(userName);
QmsCheckResultDetail returnCheckResultDetail = handleQmsCheckResultDetailProject(qmsCheckResultDetail);
@ -102,7 +101,7 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
@Transactional
@Override
public int updateQmsCheckResultDetail(QmsCheckResultDetail qmsCheckResultDetail) {
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
qmsCheckResultDetail.setUpdateTime(currentDate);
qmsCheckResultDetail.setUpdateBy(userName);
@ -144,8 +143,6 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
}
/**
* >=<=//todo 后续可修改在服务端不判断)
*
@ -360,4 +357,21 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
}
/**
*
* @param barcode
* @return
*/
@Override
public QmsCheckResultDetail getCheckResultDetailByBarcode(String barcode) {
QmsCheckResultDetail queryCheckResultDetail = new QmsCheckResultDetail();
queryCheckResultDetail.setMaterialBarcode(barcode);
List<QmsCheckResultDetail> qmsCheckResultDetails = qmsCheckResultDetailMapper.selectQmsCheckResultDetailList(queryCheckResultDetail);
if (qmsCheckResultDetails != null && !qmsCheckResultDetails.isEmpty()) {
return qmsCheckResultDetails.get(0);
} else {
return new QmsCheckResultDetail();
}
}
}

@ -160,7 +160,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService {
qmsCheckResult.setSaleorderCode(mesBaseBarcodeInfo.getSaleorderCode());
qmsCheckResult.setPoNo(mesBaseBarcodeInfo.getPoNo());
qmsCheckResult.setCheckStatus(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_CHECKED);
qmsCheckResult.setCreateBy(SecurityUtils.getUsername());
qmsCheckResult.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
qmsCheckResult.setCreateTime(new Date());
qmsCheckResultMapper.insertQmsCheckResult(qmsCheckResult);
@ -192,7 +192,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService {
@Override
public int auditQmsCheckResult(QmsCheckResult qmsCheckResult) {
qmsCheckResult.setUpdateTime(DateUtils.getNowDate());
qmsCheckResult.setUpdateBy(SecurityUtils.getUsername());
qmsCheckResult.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return qmsCheckResultMapper.updateQmsCheckResult(qmsCheckResult);
}

@ -79,7 +79,7 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
@Transactional
@Override
public int insertQmsCheckRule(QmsCheckRule qmsCheckRule) {
qmsCheckRule.setCreateBy(SecurityUtils.getUsername());
qmsCheckRule.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
qmsCheckRule.setCreateTime(DateUtils.getNowDate());
if (qmsCheckRule.getCheckMode().equals(QmsConstants.QMS_CHECK_MODE)) {
qmsCheckRule.setCheckSample(null);
@ -99,7 +99,7 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
@Transactional
@Override
public int updateQmsCheckRule(QmsCheckRule qmsCheckRule) {
qmsCheckRule.setUpdateBy(SecurityUtils.getUsername());
qmsCheckRule.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
qmsCheckRule.setUpdateTime(DateUtils.getNowDate());
if (qmsCheckRule.getCheckMode().equals(QmsConstants.QMS_CHECK_MODE)) {
qmsCheckRule.setCheckSample(null);

@ -150,7 +150,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
qmsQualityInstanceActivity.setProcessStepOrder(1l);
qmsQualityInstanceActivity.setStartTime(DateUtils.getNowDate());
qmsQualityInstanceActivity.setHandleUserId(SecurityUtils.getUserId());
qmsQualityInstanceActivity.setHandleBy(SecurityUtils.getUsername());
qmsQualityInstanceActivity.setHandleBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
insertQmsCheckInstanceFile(qmsQualityInstanceActivity, qmsQualityInstance.getFileUrls());
qmsQualityInstanceActivities.add(qmsQualityInstanceActivity);

@ -75,7 +75,7 @@ public class SysPointRouterController extends BaseController {
@Log(title = "提示路由信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysPointRouter sysPointRouter) {
sysPointRouter.setCreateBy(SecurityUtils.getUsername());
sysPointRouter.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(sysPointRouterService.insertSysPointRouter(sysPointRouter));
}
@ -86,7 +86,7 @@ public class SysPointRouterController extends BaseController {
@Log(title = "提示路由信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysPointRouter sysPointRouter) {
sysPointRouter.setUpdateBy(SecurityUtils.getUsername());
sysPointRouter.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(sysPointRouterService.updateSysPointRouter(sysPointRouter));
}

@ -51,7 +51,7 @@ public class HwPrinterInfoServiceImpl implements IHwPrinterInfoService {
*/
@Override
public int insertHwPrinterInfo(HwPrinterInfo hwPrinterInfo) {
hwPrinterInfo.setCreateBy(SecurityUtils.getUsername());
hwPrinterInfo.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
hwPrinterInfo.setCreateTime(DateUtils.getNowDate());
return hwPrinterInfoMapper.insertHwPrinterInfo(hwPrinterInfo);
}
@ -64,7 +64,7 @@ public class HwPrinterInfoServiceImpl implements IHwPrinterInfoService {
*/
@Override
public int updateHwPrinterInfo(HwPrinterInfo hwPrinterInfo) {
hwPrinterInfo.setUpdateBy(SecurityUtils.getUsername());
hwPrinterInfo.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
hwPrinterInfo.setUpdateTime(DateUtils.getNowDate());
return hwPrinterInfoMapper.updateHwPrinterInfo(hwPrinterInfo);
}

@ -81,7 +81,7 @@ public class SysDeptController extends BaseController
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(SecurityUtils.getUsername());
dept.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(deptService.insertDept(dept));
}
@ -107,7 +107,7 @@ public class SysDeptController extends BaseController
{
return error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(SecurityUtils.getUsername());
dept.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(deptService.updateDept(dept));
}

@ -121,7 +121,7 @@ public class SysMenuController extends BaseController
{
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
}
menu.setUpdateBy(SecurityUtils.getUsername());
menu.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(menuService.updateMenu(menu));
}

@ -65,7 +65,7 @@ public class SysNoticeController extends BaseController
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice)
{
notice.setCreateBy(SecurityUtils.getUsername());
notice.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(noticeService.insertNotice(notice));
}
@ -77,7 +77,7 @@ public class SysNoticeController extends BaseController
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
{
notice.setUpdateBy(SecurityUtils.getUsername());
notice.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(noticeService.updateNotice(notice));
}

@ -83,7 +83,7 @@ public class SysPostController extends BaseController
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(SecurityUtils.getUsername());
post.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(postService.insertPost(post));
}
@ -103,7 +103,7 @@ public class SysPostController extends BaseController
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(SecurityUtils.getUsername());
post.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(postService.updatePost(post));
}

@ -92,7 +92,7 @@ public class SysRoleController extends BaseController
{
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setCreateBy(SecurityUtils.getUsername());
role.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(roleService.insertRole(role));
}
@ -115,7 +115,7 @@ public class SysRoleController extends BaseController
{
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(SecurityUtils.getUsername());
role.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(roleService.updateRole(role));
}
@ -142,7 +142,7 @@ public class SysRoleController extends BaseController
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(SecurityUtils.getUsername());
role.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(roleService.updateRoleStatus(role));
}

@ -124,7 +124,7 @@ public class SysUserController extends BaseController
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream());
String operName = SecurityUtils.getUsername();
String operName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
String message = userService.importUser(userList, updateSupport, operName);
return success(message);
}
@ -240,7 +240,7 @@ public class SysUserController extends BaseController
{
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setCreateBy(SecurityUtils.getUsername());
user.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user));
}
@ -267,7 +267,7 @@ public class SysUserController extends BaseController
{
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(SecurityUtils.getUsername());
user.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(userService.updateUser(user));
}
@ -297,7 +297,7 @@ public class SysUserController extends BaseController
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(SecurityUtils.getUsername());
user.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(userService.resetPwd(user));
}
@ -311,7 +311,7 @@ public class SysUserController extends BaseController
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(SecurityUtils.getUsername());
user.setUpdateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return toAjax(userService.updateUserStatus(user));
}

@ -71,6 +71,7 @@
<if test="routerAddress != null and routerAddress != ''">router_address,</if>
<if test="routerAddressDetail != null">router_address_detail,</if>
<if test="routerFlag != null">router_flag,</if>
<if test="emailFlag != null">email_flag,</if>
<if test="remark != null">remark,</if>
<if test="processActivityId != null">process_activity_id,</if>
<if test="createBy != null">create_by,</if>
@ -84,6 +85,7 @@
<if test="routerAddress != null and routerAddress != ''">#{routerAddress},</if>
<if test="routerAddressDetail != null">#{routerAddressDetail},</if>
<if test="routerFlag != null">#{routerFlag},</if>
<if test="emailFlag != null">#{emailFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="processActivityId != null">#{processActivityId},</if>
<if test="createBy != null">#{createBy},</if>
@ -131,7 +133,7 @@
<select id="selectEmailNotifySysPointRouterList" parameterType="SysPointRouter" resultMap="SysPointRouterResult">
<include refid="selectSysPointRouterVo"/>
<where>
email_flag ='1' and sent_email_flag = '0'
email_flag ='1' and (sent_email_flag = '0' or sent_email_flag is null)
</where>
order by create_time desc
</select>

@ -81,7 +81,7 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
@Override
public int insertWmsBaseLocation(WmsBaseLocation wmsBaseLocation) {
wmsBaseLocation.setCreateTime(DateUtils.getNowDate());
wmsBaseLocation.setCreateBy(SecurityUtils.getUsername());
wmsBaseLocation.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
WmsBaseWarehouse warehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(wmsBaseLocation.getWarehouseId());
wmsBaseLocation.setWarehouseFloor(warehouse.getWarehouseFloor());
return wmsBaseLocationMapper.insertWmsBaseLocation(wmsBaseLocation);
@ -274,7 +274,7 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
@Override
public void batchInsertWarehouseBarCodes(String locationCode, Long[] materialIds, String[] barcodeInfos) {
if (StringUtils.isNotEmpty(barcodeInfos)) {
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
List<WmsLocationBarcode> list = new ArrayList<>();
for (int i = 0; i < barcodeInfos.length; i++) {

@ -186,7 +186,7 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
WmsRawInstock wmsRawInstock = new WmsRawInstock();
wmsRawInstock.setTaskCode(Seq.getId(Seq.rawInstockSeqType, Seq.rawInstockSeqCode));
wmsRawInstock.setWarehouseId(baseLocation.getWarehouseId());
@ -370,7 +370,7 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
wmsRawInstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
wmsRawInstock.setReturnFlag("1");//返回标识只能有一个returnflag为1的。
wmsRawInstock.setPlanDetailCode(wmsRawBackVo.getPlanDetailCode());
wmsRawInstock.setApplyBy(SecurityUtils.getUsername());
wmsRawInstock.setApplyBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
wmsRawInstock.setApplyDate(new Date());
//wcs轮询后执行完成要插入库存完整标识为否

@ -231,7 +231,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
String auditReason = wmsRawOutstockAuditVo.getAuditReason();
String taskCode = wmsRawOutstockAuditVo.getTaskCode();
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
WmsRawOutstock queryRawOutstock = new WmsRawOutstock();
queryRawOutstock.setTaskCode(taskCode);
@ -276,7 +276,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
WmsRawOutstock wmsRawOutstock = new WmsRawOutstock();
wmsRawOutstock.setAuditStatus(auditStatus);
wmsRawOutstock.setAuditReason(auditReason);
wmsRawOutstock.setAuditBy(SecurityUtils.getUsername());
wmsRawOutstock.setAuditBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
wmsRawOutstock.setAuditDate(new Date());
wmsRawOutstock.setTaskCode(taskCode);
int rows = wmsRawOutstockMapper.auditWmsRawOutstockByTaskCode(wmsRawOutstock);
@ -375,7 +375,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
wmsRawOutstock.setRealOutstockAmount(updatedOutstockAmount);
if (updatedOutstockAmount.compareTo(planOutstockAmount) == 0) {//如果已出完
@ -548,7 +548,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
List<WmsRawOutstock> toInsertedRawOutstocks = new ArrayList<>();
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
String taskCode = Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode);
//传入的申请领料list遍历
rawOutstockDetails.forEach(rawOutstockDetail -> {
@ -753,7 +753,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
Map<String, List<WmsRawStock>> rawStockListMap = rawStockList.stream()
.collect(Collectors.groupingBy(WmsRawStock::getLocationCode));
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
//选择出库库位
@ -1093,7 +1093,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
wmsRawOutstock.setEndStationCode(wmsConfig.getFifthAssembleStationCode());//目标位置,五楼组装区域
wmsRawOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_AUTO);
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_INSTALL);
wmsRawOutstock.setApplyBy(SecurityUtils.getUsername());
wmsRawOutstock.setApplyBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
wmsRawOutstock.setApplyDate(new Date());
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
@ -1231,7 +1231,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
BigDecimal outstockAmount = wmsRawOutstock.getOutstockAmount();
String batchCode = baseBarcodeInfo.getBatchCode();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
wmsRawOutstock.setTaskCode(Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode));
@ -1345,7 +1345,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(baseLocation.getWarehouseId());
if (!baseWarehouse.getWarehouseInstockType().equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {
throw new ServiceException("原材料仓库才能退货出库");

@ -339,7 +339,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
//更新退库记录执行状态
wmsRawReturn.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
wmsRawReturn.setLocationCode(locationCode);
@ -485,7 +485,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
List<WmsRawReturn> toInsertedRawReturns = new ArrayList<>();
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
String taskCode = Seq.getId(Seq.rawReturnSeqType, Seq.rawReturnCode);
for (WmsRawReturn rawReturn : wmsRawReturns) {
@ -628,7 +628,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
}
BigDecimal returnAmount = wmsRawReturn.getReturnAmount();
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
wmsRawReturn.setTaskCode(Seq.getId(Seq.rawReturnSeqType, Seq.rawReturnCode));

@ -67,7 +67,7 @@ public class WmsWarehouseMaterialServiceImpl implements IWmsWarehouseMaterialSer
@Override
public int insertWmsWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial) {
wmsWarehouseMaterial.setCreateTime(DateUtils.getNowDate());
wmsWarehouseMaterial.setCreateBy(SecurityUtils.getUsername());
wmsWarehouseMaterial.setCreateBy(SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname());
return wmsWarehouseMaterialMapper.insertWmsWarehouseMaterial(wmsWarehouseMaterial);
}
@ -128,7 +128,7 @@ public class WmsWarehouseMaterialServiceImpl implements IWmsWarehouseMaterialSer
@Override
public void batchInsertWarehouseMaterial(Long warehouseId, Integer warehouseFloor, Long[] materialIds) {
if (StringUtils.isNotEmpty(materialIds)) {
String userName = SecurityUtils.getUsername();
String userName = SecurityUtils.getLoginUser() == null ? SecurityUtils.getUsername() : SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
// 新增仓库的物料配置信息
List<WmsWarehouseMaterial> list = new ArrayList<WmsWarehouseMaterial>();

@ -185,7 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select wri.task_code, wri.warehouse_id, wri.location_code, wri.po_no, wri.operation_type, wri.instock_type, wri.material_id,
wri.material_barcode, wri.material_batch_code, wri.pallet_info_code, wri.instock_amount, wri.execute_status,
wri.erp_status, wri.erp_amount, wri.apply_by, wri.apply_date, wri.machine_name, wri.quality_status, wri.update_by, wri.update_date,
wri.begin_time, wri.end_time,mbmi.material_code,mbmi.material_name
wri.begin_time, wri.end_time,mbmi.material_code,mbmi.material_name,mbmi.material_spec
from wms_raw_instock wri left join mes_base_material_info mbmi on wri.material_id=mbmi.material_id
<where>

@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="outstockAmount" column="outstock_amount" />
<result property="executeStatus" column="execute_status" />
<result property="erpStatus" column="erp_status" />
<result property="erpAmount" column="erp_amount" />
<result property="outstockPerson" column="outstock_person" />
<result property="outstockTime" column="outstock_time" />
<result property="outstockWay" column="outstock_way" />
@ -38,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWmsRawOutstockDetailVo">
select raw_outstock_detail_id, raw_outstock_id, location_code, material_barcode, material_id, instock_batch, material_production_Date, plan_amount, outstock_amount, execute_status, erp_status, outstock_person, outstock_time, outstock_way, machine_name, quality_status, create_by, create_date, update_by, update_date, stack_amount from wms_raw_outstock_detail wrod
select raw_outstock_detail_id, raw_outstock_id, location_code, material_barcode, material_id, instock_batch, material_production_Date, plan_amount, outstock_amount, execute_status, erp_status,erp_amount, outstock_person, outstock_time, outstock_way, machine_name, quality_status, create_by, create_date, update_by, update_date, stack_amount from wms_raw_outstock_detail wrod
</sql>
<select id="selectWmsRawOutstockDetailList" parameterType="WmsRawOutstockDetail" resultMap="WmsRawOutstockDetailResult">

@ -51,10 +51,18 @@
<el-table v-loading="loading" :data="materialinfoList" @selection-change="handleSelectionChange"
@row-click="handleRowClick"
highlight-current-row>
<el-table-column type="selection" width="55" align="center" v-if="false" />
<el-table v-loading="loading" :data="materialinfoList"
@selection-change="handleSelectionChange"
:current-row-key="selectedRowId"
ref="materialRef"
>
<el-table-column label="选择" width="50">
<template slot-scope="scope">
<el-radio v-model="selectedRowId" :label="scope.row.materialId" @change="handleSelect(scope.row)">
{{scope.row.i}}
</el-radio>
</template>
</el-table-column>
<el-table-column label="物料ID" align="center" prop="materialId" v-if="false"/>
<el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="center" prop="materialName"/>
@ -108,6 +116,7 @@ export default {
baseMaterialTypeOptions: [],
//
materialinfoList: [],
selectedRowId:null,
//
title: "",
//
@ -182,6 +191,16 @@ export default {
handleRowClick(row) {
this.selectedRow = row
},
handleSelect(row){
this.selectedRow = row;
this.selectedRowId = row.materialId;
//
this.$nextTick(() => {
this.$refs.materialRef.setCurrentRow(row);
});
},
}
};

@ -184,6 +184,12 @@
width="100"
>
</el-table-column>
<el-table-column
label="计划到货日期"
prop="planDeliveryDate"
width="100"
>
</el-table-column>
</el-table>
</div>
</div>

@ -150,6 +150,12 @@
width="100"
>
</el-table-column>
<el-table-column
label="计划到货日期"
prop="planDeliveryDate"
width="100"
>
</el-table-column>
</el-table>
</div>
</div>

@ -139,6 +139,12 @@
width="100"
>
</el-table-column>
<el-table-column
label="计划到货日期"
prop="planDeliveryDate"
width="100"
>
</el-table-column>
</el-table>
</div>
</div>
@ -238,14 +244,14 @@
>
领料
</el-button>
<el-button
@click="handleMaterialConfirmForm(scope)"
size="small"
type="text"
v-if="scope.row.planDetailStatus === PLAN_DETAIL_STATUS.STARTED"
>
扫描
</el-button>
<!-- <el-button-->
<!-- @click="handleMaterialConfirmForm(scope)"-->
<!-- size="small"-->
<!-- type="text"-->
<!-- v-if="scope.row.planDetailStatus === PLAN_DETAIL_STATUS.STARTED"-->
<!-- >-->
<!-- 扫描-->
<!-- </el-button>-->
<el-button
size="small"
type="text"

@ -113,6 +113,12 @@
width="100"
>
</el-table-column>
<el-table-column
label="计划到货日期"
prop="planDeliveryDate"
width="100"
>
</el-table-column>
</el-table>
</div>
</div>

@ -108,6 +108,12 @@
width="100"
>
</el-table-column>
<el-table-column
label="计划到货日期"
prop="planDeliveryDate"
width="100"
>
</el-table-column>
</el-table>
</div>
</div>

@ -25,16 +25,16 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="顶级标识" prop="topFlag">
<el-select v-model="queryParams.topFlag" placeholder="请选择顶级标识" clearable>
<el-option
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="顶级标识" prop="topFlag">-->
<!-- <el-select v-model="queryParams.topFlag" placeholder="请选择顶级标识" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.active_flag"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="校验类型" prop="checkType">-->
<!-- <el-select v-model="queryParams.checkType" placeholder="请选择校验类型" clearable>-->
<!-- <el-option-->

@ -115,6 +115,7 @@
</el-table-column>
<el-table-column label="物料编码" align="center" prop="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName" />
<el-table-column label="物料规格" align="center" prop="materialSpec" />
<el-table-column label="物料条码" align="center" prop="materialBarcode" />
<el-table-column label="批次条码" align="center" prop="materialBatchCode" />
<el-table-column label="托盘编码" align="center" prop="palletInfoCode" />

@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form ref="form" :model="form" label-width="100px">
<el-row>
<el-col :span="8" :offset="2">
<el-form-item label="任务编号" prop="taskCode">
@ -125,6 +125,12 @@
<el-table-column label="物料条码" prop="materialBarcode"/>
<el-table-column label="计划数量" prop="planAmount"/>
<el-table-column label="出库数量" prop="outstockAmount" v-if="detailFlag"/>
<el-table-column label="同步ERP状态" align="center" prop="erpStatus" >
<template slot-scope="scope">
<dict-tag :options="dict.type.wms_erp_status" :value="scope.row.erpStatus"/>
</template>
</el-table-column>
<el-table-column label="同步ERP数量" align="center" prop="erpAmount" />
</el-table>
</el-form>
<div slot="footer" class="dialog-footer">

Loading…
Cancel
Save