|
@ -1,15 +1,56 @@ |
|
|
package com.win.module.wms.service.issueJob; |
|
|
package com.win.module.wms.service.issueJob; |
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
import com.win.framework.common.exception.ServiceException; |
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
import com.win.module.wms.controller.issueJob.vo.IssueJobMainCreateReqVO; |
|
|
import com.win.module.infra.api.trends.TrendsApi; |
|
|
import com.win.module.wms.controller.issueJob.vo.IssueJobMainExportReqVO; |
|
|
import com.win.module.infra.enums.TrendsTypeEnum; |
|
|
import com.win.module.wms.controller.issueJob.vo.IssueJobMainPageReqVO; |
|
|
import com.win.module.system.api.serialnumber.SerialNumberApi; |
|
|
import com.win.module.wms.controller.issueJob.vo.IssueJobMainUpdateReqVO; |
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
|
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
|
|
import com.win.module.system.enums.serialNumber.RuleCodeEnum; |
|
|
|
|
|
import com.win.module.wms.controller.expectin.vo.ExpectinCreateReqVO; |
|
|
|
|
|
import com.win.module.wms.controller.issueJob.vo.*; |
|
|
|
|
|
import com.win.module.wms.controller.purchasereceiptJob.vo.PurchasereceiptJobDetailUpdateReqVO; |
|
|
|
|
|
import com.win.module.wms.controller.transaction.vo.TransactionCreateReqVO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.issueJob.IssueJobDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.issueRecord.IssueRecordDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.issueRecord.IssueRecordMainDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.jobsetting.JobsettingDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.onlinesettlementRecord.OnlinesettlementRecordDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.onlinesettlementRecord.OnlinesettlementRecordMainDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.productionreceiptJob.ProductionreceiptJobDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.productionreceiptJob.ProductionreceiptJobMainDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptJob.PurchasereceiptJobDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptJob.PurchasereceiptJobMainDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRecord.PurchasereceiptRecordDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRecord.PurchasereceiptRecordMainDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRecord.PurchaseshortageDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.transactiontype.TransactiontypeDO; |
|
|
|
|
|
import com.win.module.wms.dal.mysql.issueRecord.IssueRecordDetailMapper; |
|
|
|
|
|
import com.win.module.wms.dal.mysql.issueRecord.IssueRecordMainMapper; |
|
|
|
|
|
import com.win.module.wms.dal.mysql.onlinesettlementRecord.OnlinesettlementRecordDetailMapper; |
|
|
|
|
|
import com.win.module.wms.dal.mysql.onlinesettlementRecord.OnlinesettlementRecordMainMapper; |
|
|
|
|
|
import com.win.module.wms.dal.mysql.productionreceiptJob.ProductionreceiptJobDetailMapper; |
|
|
|
|
|
import com.win.module.wms.dal.mysql.productionreceiptJob.ProductionreceiptJobMainMapper; |
|
|
|
|
|
import com.win.module.wms.enums.job.JobStatusEnum; |
|
|
|
|
|
import com.win.module.wms.enums.job.JobStatusState; |
|
|
|
|
|
import com.win.module.wms.service.documentSwitch.SwitchService; |
|
|
|
|
|
import com.win.module.wms.service.expectin.ExpectinService; |
|
|
|
|
|
import com.win.module.wms.service.expectout.ExpectoutService; |
|
|
|
|
|
import com.win.module.wms.service.jobsetting.JobsettingService; |
|
|
|
|
|
import com.win.module.wms.service.transaction.TransactionService; |
|
|
|
|
|
import com.win.module.wms.util.JobUtils; |
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
import com.win.module.wms.dal.dataobject.issueJob.IssueJobMainDO; |
|
|
import com.win.module.wms.dal.dataobject.issueJob.IssueJobMainDO; |
|
@ -19,6 +60,7 @@ import com.win.module.wms.convert.issueJob.IssueJobMainConvert; |
|
|
import com.win.module.wms.dal.mysql.issueJob.IssueJobMainMapper; |
|
|
import com.win.module.wms.dal.mysql.issueJob.IssueJobMainMapper; |
|
|
|
|
|
|
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
|
|
|
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
|
|
import static com.win.module.wms.enums.ErrorCodeConstants.*; |
|
|
import static com.win.module.wms.enums.ErrorCodeConstants.*; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -30,39 +72,47 @@ import static com.win.module.wms.enums.ErrorCodeConstants.*; |
|
|
@Validated |
|
|
@Validated |
|
|
public class IssueJobMainServiceImpl implements IssueJobMainService { |
|
|
public class IssueJobMainServiceImpl implements IssueJobMainService { |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private OnlinesettlementRecordDetailMapper onlinesettlementRecordDetailMapper; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private OnlinesettlementRecordMainMapper onlinesettlementRecordMainMapper; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private ProductionreceiptJobDetailMapper productionreceiptJobDetailMapper; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private JobsettingService jobsettingService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private ProductionreceiptJobMainMapper productionreceiptJobMainMapper; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private SwitchService switchService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private ExpectinService expectinService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private ExpectoutService expectoutService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private TransactionService transactionService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private JobUtils jobUtils; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private IssueRecordDetailMapper issueRecordDetailMapper; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private IssueRecordMainMapper issueRecordMainMapper; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private SerialNumberApi serialNumberApi; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private IssueJobDetailService issueJobDetailService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private TrendsApi trendsApi; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private AdminUserApi userApi; |
|
|
@Resource |
|
|
@Resource |
|
|
private IssueJobMainMapper issueJobMainMapper; |
|
|
private IssueJobMainMapper issueJobMainMapper; |
|
|
|
|
|
|
|
|
@Override |
|
|
private IssueJobMainDO validateIssueJobMainExists(Long id) { |
|
|
public Long createIssueJobMain(IssueJobMainCreateReqVO createReqVO) { |
|
|
IssueJobMainDO issueJobMainDO = issueJobMainMapper.selectById(id); |
|
|
// 插入
|
|
|
if (issueJobMainDO == null) { |
|
|
IssueJobMainDO issueJobMain = IssueJobMainConvert.INSTANCE.convert(createReqVO); |
|
|
|
|
|
issueJobMainMapper.insert(issueJobMain); |
|
|
|
|
|
// 返回
|
|
|
|
|
|
return issueJobMain.getId(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void updateIssueJobMain(IssueJobMainUpdateReqVO updateReqVO) { |
|
|
|
|
|
// 校验存在
|
|
|
|
|
|
validateIssueJobMainExists(updateReqVO.getId()); |
|
|
|
|
|
// 更新
|
|
|
|
|
|
IssueJobMainDO updateObj = IssueJobMainConvert.INSTANCE.convert(updateReqVO); |
|
|
|
|
|
issueJobMainMapper.updateById(updateObj); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void deleteIssueJobMain(Long id) { |
|
|
|
|
|
// 校验存在
|
|
|
|
|
|
validateIssueJobMainExists(id); |
|
|
|
|
|
// 删除
|
|
|
|
|
|
issueJobMainMapper.deleteById(id); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void validateIssueJobMainExists(Long id) { |
|
|
|
|
|
if (issueJobMainMapper.selectById(id) == null) { |
|
|
|
|
|
throw exception(ISSUE_JOB_MAIN_NOT_EXISTS); |
|
|
throw exception(ISSUE_JOB_MAIN_NOT_EXISTS); |
|
|
} |
|
|
} |
|
|
|
|
|
return issueJobMainDO; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -75,6 +125,11 @@ public class IssueJobMainServiceImpl implements IssueJobMainService { |
|
|
return issueJobMainMapper.selectBatchIds(ids); |
|
|
return issueJobMainMapper.selectBatchIds(ids); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public List<IssueJobMainDO> getIssueJobMainList(CustomConditions conditions) { |
|
|
|
|
|
return issueJobMainMapper.selectSeniorList(conditions); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageResult<IssueJobMainDO> getIssueJobMainPage(IssueJobMainPageReqVO pageReqVO) { |
|
|
public PageResult<IssueJobMainDO> getIssueJobMainPage(IssueJobMainPageReqVO pageReqVO) { |
|
|
return issueJobMainMapper.selectPage(pageReqVO); |
|
|
return issueJobMainMapper.selectPage(pageReqVO); |
|
@ -109,4 +164,286 @@ public class IssueJobMainServiceImpl implements IssueJobMainService { |
|
|
map.put("count", l.intValue()); |
|
|
map.put("count", l.intValue()); |
|
|
return map; |
|
|
return map; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public Integer acceptIssueJobMain(Long id) { |
|
|
|
|
|
IssueJobMainDO issueJobMainDO = this.validateIssueJobMainExists(id); |
|
|
|
|
|
JobStatusState jobStatusState = new JobStatusState(issueJobMainDO.getStatus()); |
|
|
|
|
|
if(!jobStatusState.accept()) { |
|
|
|
|
|
throw exception(ISSUE_JOB_MAIN_STATUS_ERROR); |
|
|
|
|
|
} |
|
|
|
|
|
Long userId = getLoginUserId(); |
|
|
|
|
|
AdminUserRespDTO userRespDTO = userApi.getUser(userId); |
|
|
|
|
|
issueJobMainDO.setStatus(jobStatusState.getState().getCode()); |
|
|
|
|
|
issueJobMainDO.setAcceptUserId(String.valueOf(userId)); |
|
|
|
|
|
issueJobMainDO.setAcceptUserName(userRespDTO.getNickname()); |
|
|
|
|
|
issueJobMainDO.setAcceptTime(LocalDateTime.now()); |
|
|
|
|
|
trendsApi.createTrends(id, "issueJob", "承接了发料任务", TrendsTypeEnum.UPDATE); |
|
|
|
|
|
return issueJobMainMapper.updateById(issueJobMainDO); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public Integer abandonIssueJobMain(Long id) { |
|
|
|
|
|
IssueJobMainDO issueJobMainDO = this.validateIssueJobMainExists(id); |
|
|
|
|
|
JobStatusState jobStatusState = new JobStatusState(issueJobMainDO.getStatus()); |
|
|
|
|
|
if(!jobStatusState.cancelAccept()) { |
|
|
|
|
|
throw exception(ISSUE_JOB_MAIN_STATUS_ERROR); |
|
|
|
|
|
} |
|
|
|
|
|
issueJobMainDO.setStatus(jobStatusState.getState().getCode()); |
|
|
|
|
|
issueJobMainDO.setAcceptUserId(null); |
|
|
|
|
|
issueJobMainDO.setAcceptUserName(null); |
|
|
|
|
|
issueJobMainDO.setAcceptTime(null); |
|
|
|
|
|
trendsApi.createTrends(id, "issueJob", "取消了发料任务", TrendsTypeEnum.UPDATE); |
|
|
|
|
|
return issueJobMainMapper.updateById(issueJobMainDO); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public Integer closeIssueJobMain(Long id) { |
|
|
|
|
|
IssueJobMainDO issueJobMainDO = this.validateIssueJobMainExists(id); |
|
|
|
|
|
JobStatusState jobStatusState = new JobStatusState(issueJobMainDO.getStatus()); |
|
|
|
|
|
if(!jobStatusState.close()) { |
|
|
|
|
|
throw exception(ISSUE_JOB_MAIN_STATUS_ERROR); |
|
|
|
|
|
} |
|
|
|
|
|
issueJobMainDO.setStatus(jobStatusState.getState().getCode()); |
|
|
|
|
|
trendsApi.createTrends(id, "issueJob", "关闭了发料任务", TrendsTypeEnum.UPDATE); |
|
|
|
|
|
return issueJobMainMapper.updateById(issueJobMainDO); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public Integer executeIssueJobMain(IssueJobMainUpdateReqVO issueJobMainUpdateReqVO) { |
|
|
|
|
|
//查询数据
|
|
|
|
|
|
IssueJobMainDO issueJobMainDO = this.validateIssueJobMainExists(issueJobMainUpdateReqVO.getId()); |
|
|
|
|
|
List<IssueJobDetailDO> subList = issueJobDetailService.selectList(issueJobMainDO.getId()); |
|
|
|
|
|
JobStatusState jobStatusState = new JobStatusState(issueJobMainDO.getStatus()); |
|
|
|
|
|
boolean flag = jobStatusState.execute(); |
|
|
|
|
|
if(!flag) { |
|
|
|
|
|
throw new ServiceException(ISSUE_JOB_MAIN_STATUS_ERROR); |
|
|
|
|
|
} |
|
|
|
|
|
//更新完成信息
|
|
|
|
|
|
Long userId = getLoginUserId(); |
|
|
|
|
|
AdminUserRespDTO userRespDTO = userApi.getUser(userId); |
|
|
|
|
|
issueJobMainDO.setStatus(jobStatusState.getState().getCode()); |
|
|
|
|
|
issueJobMainDO.setCompleteTime(LocalDateTime.now()); |
|
|
|
|
|
issueJobMainDO.setCompleteUserId(String.valueOf(userRespDTO.getId())); |
|
|
|
|
|
issueJobMainDO.setCompleteUserName(userRespDTO.getNickname()); |
|
|
|
|
|
//更新任务表状态
|
|
|
|
|
|
int result = issueJobMainMapper.updateById(issueJobMainDO); |
|
|
|
|
|
//创建 发料记录 主表
|
|
|
|
|
|
IssueRecordMainDO issueRecordMainDO = new IssueRecordMainDO(); |
|
|
|
|
|
BeanUtils.copyProperties(issueJobMainDO, issueRecordMainDO); |
|
|
|
|
|
String number = serialNumberApi.generateCode(RuleCodeEnum.INSPECT_RECORD.getCode()); |
|
|
|
|
|
issueRecordMainDO.setNumber(number); |
|
|
|
|
|
issueRecordMainDO.setJobNumber(issueJobMainDO.getNumber()); |
|
|
|
|
|
issueRecordMainDO.setId(null); |
|
|
|
|
|
issueRecordMainDO.setWorkshopCode(issueJobMainDO.getWorkShopCode()); |
|
|
|
|
|
issueRecordMainDO.setCreator(null); |
|
|
|
|
|
issueRecordMainDO.setCreateTime(null); |
|
|
|
|
|
issueRecordMainDO.setUpdater(null); |
|
|
|
|
|
issueRecordMainDO.setUpdateTime(null); |
|
|
|
|
|
//增加业务类型
|
|
|
|
|
|
BusinesstypeDO businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("IssueJob"); |
|
|
|
|
|
issueRecordMainDO.setBusinessType(businesstypeDO.getCode()); |
|
|
|
|
|
issueRecordMainMapper.insert(issueRecordMainDO); |
|
|
|
|
|
// 获取参数中的sublist
|
|
|
|
|
|
List<IssueJobDetailUpdateReqVO> issueJobDetailUpdateReqVOList = issueJobMainUpdateReqVO.getSubList(); |
|
|
|
|
|
//发料记录子
|
|
|
|
|
|
List<IssueRecordDetailDO> issueRecordDetailDOList = new ArrayList<>(); |
|
|
|
|
|
//库存事务
|
|
|
|
|
|
List<TransactionCreateReqVO> transactionCreateReqVOList = new ArrayList<>(); |
|
|
|
|
|
subList.forEach(subListItem -> { |
|
|
|
|
|
// 获取参数中recordLst
|
|
|
|
|
|
issueJobDetailUpdateReqVOList.forEach(DetailUpdateItem -> { |
|
|
|
|
|
// 匹配任务子表与参数中子表
|
|
|
|
|
|
if (DetailUpdateItem.getId().equals(subListItem.getId())) { |
|
|
|
|
|
List<Map<String,Object>> recordLst = DetailUpdateItem.getRecordLst(); |
|
|
|
|
|
recordLst.forEach(recordLstItem -> { |
|
|
|
|
|
IssueRecordDetailDO issueRecordDetailDO = new IssueRecordDetailDO(); |
|
|
|
|
|
BeanUtils.copyProperties(subListItem, issueRecordDetailDO); |
|
|
|
|
|
issueRecordDetailDO.setId(null); |
|
|
|
|
|
issueRecordDetailDO.setNumber(number); |
|
|
|
|
|
issueRecordDetailDO.setMasterId(issueRecordMainDO.getId()); |
|
|
|
|
|
issueRecordDetailDO.setCreator(null); |
|
|
|
|
|
issueRecordDetailDO.setCreateTime(null); |
|
|
|
|
|
issueRecordDetailDO.setUpdater(null); |
|
|
|
|
|
issueRecordDetailDO.setUpdateTime(null); |
|
|
|
|
|
// 如果使用在途库 赋值 业务类型对应的在途库库位
|
|
|
|
|
|
issueRecordDetailDO.setOnTheWayLocationCode(issueRecordMainDO.getUseOnTheWayLocation().equals("TRUE")?businesstypeDO.getOnTheWayArea():""); |
|
|
|
|
|
// 根据recordLst 进行赋值子表部分数据
|
|
|
|
|
|
issueRecordDetailDO.setQty(new BigDecimal(recordLstItem.get("handleQty").toString())); |
|
|
|
|
|
issueRecordDetailDO.setToPackingNumber(recordLstItem.get("toPackingNumber").toString()); |
|
|
|
|
|
issueRecordDetailDO.setToContainerNumber(recordLstItem.get("toContainerNumber").toString()); |
|
|
|
|
|
issueRecordDetailDO.setToBatch(recordLstItem.get("toBatch").toString()); |
|
|
|
|
|
issueRecordDetailDO.setToLocationCode(recordLstItem.get("toLocationCode").toString()); |
|
|
|
|
|
issueRecordDetailDO.setInventoryStatus(recordLstItem.get("toInventoryStatus").toString()); |
|
|
|
|
|
issueRecordDetailDO.setSupplierCode(recordLstItem.get("supplierCode").toString()); |
|
|
|
|
|
issueRecordDetailDOList.add(issueRecordDetailDO); |
|
|
|
|
|
//添加库存事务list
|
|
|
|
|
|
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO(); |
|
|
|
|
|
BeanUtils.copyProperties(issueRecordDetailDO, transactionCreateReqVO); |
|
|
|
|
|
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(businesstypeDO.getInTransactionType()); |
|
|
|
|
|
transactionCreateReqVO.setWorker(issueRecordDetailDO.getCreator()); |
|
|
|
|
|
transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction()); |
|
|
|
|
|
transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode()); |
|
|
|
|
|
transactionCreateReqVO.setBusinessType(issueRecordMainDO.getBusinessType()); |
|
|
|
|
|
transactionCreateReqVO.setOwnerCode(issueRecordDetailDO.getFromOwnerCode()); |
|
|
|
|
|
transactionCreateReqVO.setRecordNumber(number); |
|
|
|
|
|
transactionCreateReqVO.setId(null); |
|
|
|
|
|
transactionCreateReqVO.setPackingNumber(issueRecordDetailDO.getToPackingNumber()); |
|
|
|
|
|
transactionCreateReqVO.setBatch(issueRecordDetailDO.getToBatch()); |
|
|
|
|
|
transactionCreateReqVO.setContainerNumber(issueRecordDetailDO.getToContainerNumber()); |
|
|
|
|
|
transactionCreateReqVO.setAmount(BigDecimal.ZERO); |
|
|
|
|
|
// 如果使用在途库 库存事务 库位赋值为 在途库
|
|
|
|
|
|
transactionCreateReqVO.setLocationCode(issueRecordMainDO.getUseOnTheWayLocation().equals("TRUE")?issueRecordDetailDO.getOnTheWayLocationCode():recordLstItem.get("toLocationCode").toString()); |
|
|
|
|
|
transactionCreateReqVOList.add(transactionCreateReqVO); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
if(!issueRecordDetailDOList.isEmpty()) { |
|
|
|
|
|
issueRecordDetailMapper.insertBatch(issueRecordDetailDOList); |
|
|
|
|
|
} |
|
|
|
|
|
// 1-创建发料记录后 是否创建 生产收料任务 2-同时满足 使用在途库
|
|
|
|
|
|
if (issueRecordMainDO.getUseOnTheWayLocation().equals("TRUE") && (switchService.selectSwitchExist("CreateProductionReceiptJobAfterIssueRecordCreated").getEffectiveSetValue().equals("TRUE")) ) { |
|
|
|
|
|
// 创建 生产收料任务
|
|
|
|
|
|
createProductionreceiptJob(issueRecordMainDO,issueRecordDetailDOList); |
|
|
|
|
|
} |
|
|
|
|
|
// 不使用在途库 创建 上线结算记录
|
|
|
|
|
|
if (issueRecordMainDO.getUseOnTheWayLocation().equals("FALSE")) { |
|
|
|
|
|
// 创建 上线结算记录
|
|
|
|
|
|
createOnlinesettlementRecord(issueRecordMainDO,issueRecordDetailDOList); |
|
|
|
|
|
} |
|
|
|
|
|
//增加库存事务
|
|
|
|
|
|
transactionService.createTransaction(transactionCreateReqVOList); |
|
|
|
|
|
//移除预计入
|
|
|
|
|
|
expectinService.deleteExpectinByJobNumber(issueJobMainDO.getNumber()); |
|
|
|
|
|
//移除预计出
|
|
|
|
|
|
expectoutService.deleteExpectoutByJobNumber(issueJobMainDO.getNumber()); |
|
|
|
|
|
//变更记录
|
|
|
|
|
|
trendsApi.createTrends(issueJobMainDO.getId(), "issueJob", "执行了发料任务", TrendsTypeEnum.UPDATE); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 创建 生产收料任务 |
|
|
|
|
|
* @param issueRecordMainDO |
|
|
|
|
|
* @param issueRecordDetailDOList |
|
|
|
|
|
*/ |
|
|
|
|
|
private void createProductionreceiptJob (IssueRecordMainDO issueRecordMainDO, List<IssueRecordDetailDO> issueRecordDetailDOList) { |
|
|
|
|
|
//生产收料任务主
|
|
|
|
|
|
ProductionreceiptJobMainDO productionreceiptJobMainDO = new ProductionreceiptJobMainDO(); |
|
|
|
|
|
BeanUtils.copyProperties(issueRecordMainDO, productionreceiptJobMainDO); |
|
|
|
|
|
String number = serialNumberApi.generateCode(RuleCodeEnum.PRODUCTION_RECEIPT_JOB.getCode()); |
|
|
|
|
|
productionreceiptJobMainDO.setId(null); |
|
|
|
|
|
productionreceiptJobMainDO.setNumber(number); |
|
|
|
|
|
productionreceiptJobMainDO.setIssueJobNumber(issueRecordMainDO.getJobNumber()); |
|
|
|
|
|
productionreceiptJobMainDO.setIssueRecordNumber(issueRecordMainDO.getNumber()); |
|
|
|
|
|
productionreceiptJobMainDO.setStatus(JobStatusEnum.PENDING.getCode()); |
|
|
|
|
|
productionreceiptJobMainDO.setRequestDueTime(issueRecordMainDO.getDueTime()); |
|
|
|
|
|
productionreceiptJobMainDO.setCreator(null); |
|
|
|
|
|
productionreceiptJobMainDO.setCreateTime(null); |
|
|
|
|
|
productionreceiptJobMainDO.setUpdater(null); |
|
|
|
|
|
productionreceiptJobMainDO.setUpdateTime(null); |
|
|
|
|
|
// TODO: 字段数据无来源: 过期时间 expired_time 优先级 priority 优先级增量 priority_increment
|
|
|
|
|
|
// 增加任务单据设置
|
|
|
|
|
|
JobsettingDO jobsettingDO = jobsettingService.selectJobsettingExist("IssueReceiptJob"); |
|
|
|
|
|
productionreceiptJobMainDO.setAutoComplete(jobsettingDO.getAutoComplete()); |
|
|
|
|
|
productionreceiptJobMainDO.setAllowModifyLocation(jobsettingDO.getAllowModifyLocation()); |
|
|
|
|
|
productionreceiptJobMainDO.setAllowModifyQty(jobsettingDO.getAllowModifyQty()); |
|
|
|
|
|
productionreceiptJobMainDO.setAllowBiggerQty(jobsettingDO.getAllowBiggerQty()); |
|
|
|
|
|
productionreceiptJobMainDO.setAllowSmallerQty(jobsettingDO.getAllowSmallerQty()); |
|
|
|
|
|
productionreceiptJobMainDO.setAllowModifyInventoryStatus(jobsettingDO.getAllowModifyInventoryStatus()); |
|
|
|
|
|
productionreceiptJobMainDO.setAllowContinuousScanning(jobsettingDO.getAllowContinuousScanning()); |
|
|
|
|
|
productionreceiptJobMainDO.setAllowPartialComplete(jobsettingDO.getAllowPartialComplete()); |
|
|
|
|
|
productionreceiptJobMainDO.setAllowModifyPackingNumber(jobsettingDO.getAllowModifyPackingNumber()); |
|
|
|
|
|
productionreceiptJobMainDO.setAllowModifyBatch(jobsettingDO.getAllowModifyBach()); |
|
|
|
|
|
//增加业务类型
|
|
|
|
|
|
BusinesstypeDO businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("ProductionReceiptJob"); |
|
|
|
|
|
productionreceiptJobMainDO.setBusinessType(businesstypeDO.getCode()); |
|
|
|
|
|
productionreceiptJobMainMapper.insert(productionreceiptJobMainDO); |
|
|
|
|
|
//生产收料任务子 集合
|
|
|
|
|
|
List<ProductionreceiptJobDetailDO> productionreceiptJobDetailDOList = new ArrayList<>(); |
|
|
|
|
|
// 预计入 集合
|
|
|
|
|
|
List<ExpectinCreateReqVO> expectinCreateReqVOList = new ArrayList<>(); |
|
|
|
|
|
// 构造任务子数据
|
|
|
|
|
|
issueRecordDetailDOList.forEach(item -> { |
|
|
|
|
|
ProductionreceiptJobDetailDO productionreceiptJobDetailDO = new ProductionreceiptJobDetailDO(); |
|
|
|
|
|
BeanUtils.copyProperties(item, productionreceiptJobDetailDO); |
|
|
|
|
|
productionreceiptJobDetailDO.setPackingNumber(item.getToPackingNumber()); |
|
|
|
|
|
productionreceiptJobDetailDO.setContainerNumber(item.getToContainerNumber()); |
|
|
|
|
|
productionreceiptJobDetailDO.setBatch(item.getToBatch()); |
|
|
|
|
|
productionreceiptJobDetailDO.setMasterId(productionreceiptJobMainDO.getId()); |
|
|
|
|
|
productionreceiptJobDetailDO.setNumber(productionreceiptJobMainDO.getNumber()); |
|
|
|
|
|
productionreceiptJobDetailDO.setCreator(null); |
|
|
|
|
|
productionreceiptJobDetailDO.setCreateTime(null); |
|
|
|
|
|
productionreceiptJobDetailDO.setUpdater(null); |
|
|
|
|
|
productionreceiptJobDetailDO.setUpdateTime(null); |
|
|
|
|
|
productionreceiptJobDetailDOList.add(productionreceiptJobDetailDO); |
|
|
|
|
|
//生成 预计入
|
|
|
|
|
|
ExpectinCreateReqVO expectinCreateReqVO = new ExpectinCreateReqVO(); |
|
|
|
|
|
BeanUtils.copyProperties(productionreceiptJobDetailDO, expectinCreateReqVO); |
|
|
|
|
|
expectinCreateReqVO.setJobNumber(number); |
|
|
|
|
|
expectinCreateReqVO.setBusinessType(productionreceiptJobMainDO.getBusinessType()); |
|
|
|
|
|
expectinCreateReqVO.setLocationCode(productionreceiptJobDetailDO.getToLocationCode()); |
|
|
|
|
|
expectinCreateReqVO.setOwnerCode(productionreceiptJobDetailDO.getToOwnerCode()); |
|
|
|
|
|
expectinCreateReqVOList.add(expectinCreateReqVO); |
|
|
|
|
|
}); |
|
|
|
|
|
if(!productionreceiptJobDetailDOList.isEmpty()) { |
|
|
|
|
|
productionreceiptJobDetailMapper.insertBatch(productionreceiptJobDetailDOList); |
|
|
|
|
|
} |
|
|
|
|
|
//增加预计入
|
|
|
|
|
|
expectinService.createExpectin(expectinCreateReqVOList); |
|
|
|
|
|
//变更记录
|
|
|
|
|
|
trendsApi.createTrends(productionreceiptJobMainDO.getId(), "productionReceiptJob", "创建了生产收料任务", TrendsTypeEnum.CREATE); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 创建 上线结算记录 |
|
|
|
|
|
* @param issueRecordMainDO |
|
|
|
|
|
* @param issueRecordDetailDOList |
|
|
|
|
|
*/ |
|
|
|
|
|
private void createOnlinesettlementRecord (IssueRecordMainDO issueRecordMainDO, List<IssueRecordDetailDO> issueRecordDetailDOList) { |
|
|
|
|
|
OnlinesettlementRecordMainDO onlinesettlementRecordMainDO = new OnlinesettlementRecordMainDO(); |
|
|
|
|
|
BeanUtils.copyProperties(issueRecordMainDO, onlinesettlementRecordMainDO); |
|
|
|
|
|
onlinesettlementRecordMainDO.setIssueRecordNumber(issueRecordMainDO.getNumber()); |
|
|
|
|
|
onlinesettlementRecordMainDO.setWarehouseCode(issueRecordMainDO.getToWarehouseCode()); |
|
|
|
|
|
String number = serialNumberApi.generateCode(RuleCodeEnum.ONLINE_SETTLEMENT_RECORD.getCode()); |
|
|
|
|
|
onlinesettlementRecordMainDO.setId(null); |
|
|
|
|
|
onlinesettlementRecordMainDO.setNumber(number); |
|
|
|
|
|
onlinesettlementRecordMainDO.setBusinessType(""); |
|
|
|
|
|
onlinesettlementRecordMainDO.setInTransactionType(""); |
|
|
|
|
|
onlinesettlementRecordMainDO.setOutTransactionType(""); |
|
|
|
|
|
onlinesettlementRecordMainDO.setRequestNumber(""); |
|
|
|
|
|
onlinesettlementRecordMainDO.setCreator(null); |
|
|
|
|
|
onlinesettlementRecordMainDO.setCreateTime(null); |
|
|
|
|
|
onlinesettlementRecordMainDO.setUpdater(null); |
|
|
|
|
|
onlinesettlementRecordMainDO.setUpdateTime(null); |
|
|
|
|
|
onlinesettlementRecordMainMapper.insert(onlinesettlementRecordMainDO); |
|
|
|
|
|
//上线结算记录子 集合
|
|
|
|
|
|
List<OnlinesettlementRecordDetailDO> onlinesettlementRecordDetailDOList = new ArrayList<>(); |
|
|
|
|
|
issueRecordDetailDOList.forEach(item -> { |
|
|
|
|
|
OnlinesettlementRecordDetailDO onlinesettlementRecordDetailDO = new OnlinesettlementRecordDetailDO(); |
|
|
|
|
|
BeanUtils.copyProperties(item, onlinesettlementRecordDetailDO); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setPackingNumber(item.getToPackingNumber()); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setContainerNumber(item.getToContainerNumber()); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setBatch(item.getToBatch()); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setLocationCode(item.getToLocationCode()); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setLocationGroupCode(item.getToLocationGroupCode()); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setAreaCode(item.getToAreaCode()); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setMasterId(onlinesettlementRecordMainDO.getId()); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setNumber(number); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setId(null); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setCreator(null); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setCreateTime(null); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setUpdater(null); |
|
|
|
|
|
onlinesettlementRecordDetailDO.setUpdateTime(null); |
|
|
|
|
|
onlinesettlementRecordDetailDOList.add(onlinesettlementRecordDetailDO); |
|
|
|
|
|
}); |
|
|
|
|
|
if(!onlinesettlementRecordDetailDOList.isEmpty()) { |
|
|
|
|
|
onlinesettlementRecordDetailMapper.insertBatch(onlinesettlementRecordDetailDOList); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|