|
|
@ -41,6 +41,8 @@ import com.win.module.wms.dal.dataobject.balance.BalanceDO; |
|
|
|
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO; |
|
|
|
import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; |
|
|
|
import com.win.module.wms.dal.dataobject.interfaceinfo.InterfaceInfoDO; |
|
|
|
import com.win.module.wms.dal.dataobject.inventorymoveRecord.InventorymoveRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.inventorymoveRecord.InventorymoveRecordMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.itemarea.ItemareaDO; |
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
import com.win.module.wms.dal.dataobject.itempackage.ItempackageDO; |
|
|
@ -51,9 +53,11 @@ import com.win.module.wms.dal.dataobject.packageMassage.PackageDO; |
|
|
|
import com.win.module.wms.dal.dataobject.production.ProductionDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.production.ProductionMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productreceiptDetailb.ProductreceiptDetailbDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productreceiptJob.ProductreceiptJobMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productreceiptRecord.ProductreceiptRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productreceiptRecord.ProductreceiptRecordDetailbDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productreceiptRecord.ProductreceiptRecordMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productreceiptRequest.ProductreceiptRequestMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productredressJob.ProductredressJobDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productredressJob.ProductredressJobMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productredressRecord.ProductredressRecordDetailDO; |
|
|
@ -79,12 +83,16 @@ import com.win.module.wms.dal.mysql.productreceiptRecord.ProductreceiptRecordMai |
|
|
|
import com.win.module.wms.dal.mysql.productredressRecord.ProductredressRecordDetailMapper; |
|
|
|
import com.win.module.wms.dal.mysql.productredressRecord.ProductredressRecordMainMapper; |
|
|
|
import com.win.module.wms.dal.mysql.workstation.WorkstationMapper; |
|
|
|
import com.win.module.wms.enums.common.HoldReceiveTypeEnum; |
|
|
|
import com.win.module.wms.enums.common.InventoryStatusEnum; |
|
|
|
import com.win.module.wms.enums.job.JobStatusEnum; |
|
|
|
import com.win.module.wms.enums.plan.PlanStatusEnum; |
|
|
|
import com.win.module.wms.enums.request.RequestStatusEnum; |
|
|
|
import com.win.module.wms.service.accountcalendar.AccountcalendarService; |
|
|
|
import com.win.module.wms.service.balance.BalanceService; |
|
|
|
import com.win.module.wms.service.businesstype.BusinesstypeService; |
|
|
|
import com.win.module.wms.service.documentSwitch.SwitchService; |
|
|
|
import com.win.module.wms.service.expectin.ExpectinService; |
|
|
|
import com.win.module.wms.service.interfaceinfo.InterfaceInfoService; |
|
|
|
import com.win.module.wms.service.interfaceinfo.dto.ProductreceiptDTO; |
|
|
|
import com.win.module.wms.service.itembasic.ItembasicService; |
|
|
@ -208,6 +216,9 @@ public class ProductreceiptRecordMainServiceImpl implements ProductreceiptRecord |
|
|
|
private ItembasicMapper itembasicMapper; |
|
|
|
@Resource |
|
|
|
private WorkstationMapper workstationMapper; |
|
|
|
@Resource |
|
|
|
private ExpectinService expectinService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
@ -974,10 +985,12 @@ public class ProductreceiptRecordMainServiceImpl implements ProductreceiptRecord |
|
|
|
productreceiptRecordMainMapper.deleteById(id); |
|
|
|
} |
|
|
|
|
|
|
|
private void validateProductreceiptRecordMainExists(Long id) { |
|
|
|
if (productreceiptRecordMainMapper.selectById(id) == null) { |
|
|
|
private ProductreceiptRecordMainDO validateProductreceiptRecordMainExists(Long id) { |
|
|
|
ProductreceiptRecordMainDO productreceiptRecordMainDO = productreceiptRecordMainMapper.selectById(id); |
|
|
|
if (productreceiptRecordMainDO == null) { |
|
|
|
throw exception(PRODUCTRECEIPT_RECORD_MAIN_NOT_EXISTS); |
|
|
|
} |
|
|
|
return productreceiptRecordMainDO; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -2512,4 +2525,179 @@ public class ProductreceiptRecordMainServiceImpl implements ProductreceiptRecord |
|
|
|
backflushDetailbQadMapper.updateBatch(backflushDetailbQadDOListNumber); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 隔离报工接收 |
|
|
|
* @param id 主表ID |
|
|
|
* @return 是否成功 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public boolean receive(Long id) { |
|
|
|
ProductreceiptRecordMainDO productreceiptRecordMainDO = validateProductreceiptRecordMainExists(id); |
|
|
|
List<ProductreceiptRecordDetailDO> detailDOList = productreceiptRecordDetailMapper.selectListByMasterId(id); |
|
|
|
|
|
|
|
BusinesstypeDO businesstypeDO = businesstypeService.selectBusinesstypeExist("ProductReceiptScrap"); |
|
|
|
String inTransactionType = businesstypeDO.getInTransactionType(); |
|
|
|
String outTransactionType = businesstypeDO.getOutTransactionType(); |
|
|
|
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(inTransactionType); |
|
|
|
// 库存事务
|
|
|
|
List<TransactionCreateReqVO> transactionCreateReqVOList = new ArrayList<>(); |
|
|
|
for(ProductreceiptRecordDetailDO productreceiptRecordDetailDO: detailDOList){ |
|
|
|
// 判断物料器具处理
|
|
|
|
boolean isContainer = itemCodeIsContainer(productreceiptRecordDetailDO.getItemCode()); |
|
|
|
// 添加库存事务list
|
|
|
|
// 入动作
|
|
|
|
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO(); |
|
|
|
BeanUtils.copyProperties(productreceiptRecordDetailDO, transactionCreateReqVO); |
|
|
|
transactionCreateReqVO.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId())); |
|
|
|
transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction()); |
|
|
|
transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode()); |
|
|
|
transactionCreateReqVO.setBusinessType(productreceiptRecordMainDO.getBusinessType()); |
|
|
|
transactionCreateReqVO.setOwnerCode(productreceiptRecordDetailDO.getToOwnerCode()); |
|
|
|
transactionCreateReqVO.setRecordNumber(productreceiptRecordMainDO.getNumber()); |
|
|
|
transactionCreateReqVO.setId(null); |
|
|
|
transactionCreateReqVO.setPackingNumber(productreceiptRecordDetailDO.getPackingNumber()); |
|
|
|
transactionCreateReqVO.setBatch(productreceiptRecordDetailDO.getBatch()); |
|
|
|
transactionCreateReqVO.setContainerNumber(productreceiptRecordDetailDO.getContainerNumber()); |
|
|
|
transactionCreateReqVO.setAmount(BigDecimal.ZERO); |
|
|
|
transactionCreateReqVO.setWarehouseCode(productreceiptRecordMainDO.getToWarehouseCode()); |
|
|
|
// 判断物料是否为器具
|
|
|
|
if (isContainer) { |
|
|
|
BusinesstypeDO businesstypeDO1 = businesstypeService.selectBusinesstypeExist(productreceiptRecordMainDO.getBusinessType()); |
|
|
|
String inAreaTypes = businesstypeDO1.getInAreaTypes(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(inAreaTypes)) { |
|
|
|
String[] areaTypeArray = inAreaTypes.split(","); |
|
|
|
List<String> areaTypeList = Arrays.asList(areaTypeArray); |
|
|
|
QueryWrapper<AreabasicDO> areabasicDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
areabasicDOQueryWrapper.in("type", areaTypeList); |
|
|
|
List<AreabasicDO> areabasicDOS = areabasicMapper.selectList(areabasicDOQueryWrapper); |
|
|
|
if (areabasicDOS != null && areabasicDOS.size() > 0) { |
|
|
|
List<LocationDO> locationDOS = locationMapper.selectList("area_code", areabasicDOS.get(0)); |
|
|
|
if (locationDOS != null && locationDOS.size() > 0) { |
|
|
|
LocationDO locationDOTemp = locationDOS.get(0); |
|
|
|
transactionCreateReqVO.setLocationCode(locationDOTemp.getCode()); |
|
|
|
transactionCreateReqVO.setLocationGroupCode(locationDOTemp.getLocationGroupCode()); |
|
|
|
transactionCreateReqVO.setAreaCode(locationDOTemp.getAreaCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
transactionCreateReqVO.setLocationCode(productreceiptRecordDetailDO.getToLocationCode()); |
|
|
|
} |
|
|
|
LocationDO locationDOTransaction = locationService.queryByCode(productreceiptRecordDetailDO.getToLocationCode()); |
|
|
|
transactionCreateReqVO.setLocationGroupCode(locationDOTransaction.getLocationGroupCode()); |
|
|
|
transactionCreateReqVO.setAreaCode(locationDOTransaction.getAreaCode()); |
|
|
|
transactionCreateReqVO.setWarehouseCode(locationDOTransaction.getWarehouseCode()); |
|
|
|
transactionCreateReqVO.setArriveDate(LocalDateTime.now()); |
|
|
|
transactionCreateReqVO.setProduceDate(productreceiptRecordDetailDO.getProduceDate()); |
|
|
|
transactionCreateReqVO.setExpireDate(productreceiptRecordDetailDO.getExpireDate()); |
|
|
|
transactionCreateReqVO.setActiveTime(LocalDateTime.now()); |
|
|
|
// 根据 库位 获取 库区DO
|
|
|
|
AreabasicDO areabasicDO = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode()); |
|
|
|
transactionCreateReqVO.setAreaType(areabasicDO.getType()); |
|
|
|
transactionCreateReqVO.setAreaCode(areabasicDO.getCode()); |
|
|
|
// 按照实际扫描箱码 查询 包装信息 获取包装规格和标包数
|
|
|
|
PackageDO packageDO = packageService.getPackageByNumber(transactionCreateReqVO.getPackingNumber()); |
|
|
|
if (packageDO == null) { |
|
|
|
transactionCreateReqVO.setPackUnit(null); |
|
|
|
transactionCreateReqVO.setPackQty(BigDecimal.ZERO); |
|
|
|
} else { |
|
|
|
transactionCreateReqVO.setPackUnit(packageDO.getPackUnit()); |
|
|
|
transactionCreateReqVO.setPackQty(packageDO.getPackQty()); |
|
|
|
} |
|
|
|
|
|
|
|
transactionCreateReqVO.setSiteId(productreceiptRecordDetailDO.getSiteId()); |
|
|
|
transactionCreateReqVOList.add(transactionCreateReqVO); |
|
|
|
// 判断物料是否为器具
|
|
|
|
if (isContainer) { |
|
|
|
// 库存事务 出动作
|
|
|
|
TransactionCreateReqVO transactionCreateReqVOOut = new TransactionCreateReqVO(); |
|
|
|
BeanUtils.copyProperties(productreceiptRecordDetailDO, transactionCreateReqVOOut); |
|
|
|
TransactiontypeDO transactiontypeDOOut = jobUtils.selectDocumentFromTransactionType(outTransactionType); |
|
|
|
transactionCreateReqVOOut.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId())); |
|
|
|
transactionCreateReqVOOut.setInventoryAction(transactiontypeDOOut.getInventoryAction()); |
|
|
|
transactionCreateReqVOOut.setTransactionType(transactiontypeDOOut.getCode()); |
|
|
|
transactionCreateReqVOOut.setBusinessType(productreceiptRecordMainDO.getBusinessType()); |
|
|
|
transactionCreateReqVOOut.setOwnerCode(productreceiptRecordDetailDO.getToOwnerCode()); |
|
|
|
transactionCreateReqVOOut.setRecordNumber(productreceiptRecordDetailDO.getNumber()); |
|
|
|
transactionCreateReqVOOut.setId(null); |
|
|
|
transactionCreateReqVOOut.setPackingNumber(productreceiptRecordDetailDO.getPackingNumber()); |
|
|
|
transactionCreateReqVOOut.setBatch(productreceiptRecordDetailDO.getBatch()); |
|
|
|
transactionCreateReqVOOut.setContainerNumber(productreceiptRecordDetailDO.getContainerNumber()); |
|
|
|
transactionCreateReqVOOut.setAmount(BigDecimal.ZERO); |
|
|
|
transactionCreateReqVOOut.setWarehouseCode(productreceiptRecordMainDO.getToWarehouseCode()); |
|
|
|
BusinesstypeDO businesstypeDO1 = businesstypeService.selectBusinesstypeExist(productreceiptRecordMainDO.getBusinessType()); |
|
|
|
String inAreaTypes = businesstypeDO1.getInAreaTypes(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(inAreaTypes)) { |
|
|
|
String[] areaTypeArray = inAreaTypes.split(","); |
|
|
|
List<String> areaTypeList = Arrays.asList(areaTypeArray); |
|
|
|
QueryWrapper<AreabasicDO> areabasicDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
areabasicDOQueryWrapper.in("type", areaTypeList); |
|
|
|
List<AreabasicDO> areabasicDOS = areabasicMapper.selectList(areabasicDOQueryWrapper); |
|
|
|
if (areabasicDOS != null && areabasicDOS.size() > 0) { |
|
|
|
List<LocationDO> locationDOS = locationMapper.selectList("area_code", areabasicDOS.get(0)); |
|
|
|
if (locationDOS != null && locationDOS.size() > 0) { |
|
|
|
LocationDO locationDOTemp = locationDOS.get(0); |
|
|
|
transactionCreateReqVOOut.setLocationCode(locationDOTemp.getCode()); |
|
|
|
transactionCreateReqVOOut.setLocationGroupCode(locationDOTemp.getLocationGroupCode()); |
|
|
|
transactionCreateReqVOOut.setAreaCode(locationDOTemp.getAreaCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
transactionCreateReqVOOut.setArriveDate(LocalDateTime.now()); |
|
|
|
transactionCreateReqVOOut.setProduceDate(productreceiptRecordDetailDO.getProduceDate()); |
|
|
|
transactionCreateReqVOOut.setExpireDate(productreceiptRecordDetailDO.getExpireDate()); |
|
|
|
transactionCreateReqVOOut.setActiveTime(LocalDateTime.now()); |
|
|
|
// 根据 库位 获取 库区DO
|
|
|
|
AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVOOut.getLocationCode()); |
|
|
|
transactionCreateReqVOOut.setAreaType(areabasicDOOut.getType()); |
|
|
|
transactionCreateReqVOOut.setAreaCode(areabasicDOOut.getCode()); |
|
|
|
// 按照实际扫描箱码 查询 包装信息 获取包装规格和标包数
|
|
|
|
PackageDO packageDOOut = packageService.getPackageByNumber(transactionCreateReqVOOut.getPackingNumber()); |
|
|
|
if (packageDOOut == null) { |
|
|
|
transactionCreateReqVOOut.setPackUnit(null); |
|
|
|
transactionCreateReqVOOut.setPackQty(BigDecimal.ZERO); |
|
|
|
} else { |
|
|
|
transactionCreateReqVOOut.setPackUnit(packageDOOut.getPackUnit()); |
|
|
|
transactionCreateReqVOOut.setPackQty(packageDOOut.getPackQty()); |
|
|
|
} |
|
|
|
transactionCreateReqVOOut.setSiteId(productreceiptRecordDetailDO.getSiteId()); |
|
|
|
transactionCreateReqVOList.add(transactionCreateReqVOOut); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 增加库存事务
|
|
|
|
transactionService.createTransaction(transactionCreateReqVOList); |
|
|
|
// 移除预计入
|
|
|
|
expectinService.deleteExpectinByJobNumber(productreceiptRecordMainDO.getJobNumber()); |
|
|
|
// 变更记录
|
|
|
|
trendsApi.createTrends(productreceiptRecordMainDO.getId(), "job_productreceipt_main", "执行了制品收货任务", TrendsTypeEnum.JOB_EXECUTE, String.valueOf(getLoginUserId())); |
|
|
|
// 根据单据开关判断是否创建 回冲记录
|
|
|
|
SwitchDO switchDOBack = switchService.selectSwitchExist("CreateBackflushRecordAfterProductreceiptRecordCreated"); |
|
|
|
if (switchDOBack.getEffectiveSetValue().equals("TRUE")) { |
|
|
|
// 创建 回冲记录(record_productreceipt_detailb)
|
|
|
|
this.generateProductreceiptRecordByBom(productreceiptRecordMainDO, detailDOList); |
|
|
|
} |
|
|
|
// 根据单据开关判断是否创建 QAD接口数据
|
|
|
|
if (switchService.selectSwitchExist("PostQAD").getEffectiveSetValue().equals("TRUE")) { |
|
|
|
this.createInterfaceInfo(productreceiptRecordMainDO, detailDOList); |
|
|
|
} |
|
|
|
LambdaUpdateWrapper<ProductreceiptRecordDetailDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
lambdaUpdateWrapper.set(ProductreceiptRecordDetailDO::getReceiveStatus, HoldReceiveTypeEnum.RECEIVED.getCode()); |
|
|
|
lambdaUpdateWrapper.eq(ProductreceiptRecordDetailDO::getMasterId,productreceiptRecordMainDO.getId()); |
|
|
|
productreceiptRecordDetailMapper.update(new ProductreceiptRecordDetailDO(),lambdaUpdateWrapper); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public boolean refuse(Long id) { |
|
|
|
ProductreceiptRecordMainDO productreceiptRecordMainDO = validateProductreceiptRecordMainExists(id); |
|
|
|
LambdaUpdateWrapper<ProductreceiptRecordDetailDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
lambdaUpdateWrapper.set(ProductreceiptRecordDetailDO::getReceiveStatus, HoldReceiveTypeEnum.REJECTED.getCode()); |
|
|
|
lambdaUpdateWrapper.eq(ProductreceiptRecordDetailDO::getMasterId,productreceiptRecordMainDO.getId()); |
|
|
|
productreceiptRecordDetailMapper.update(new ProductreceiptRecordDetailDO(),lambdaUpdateWrapper); |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|