| | |
| | | package com.consum.base.service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.param.BaseWarehouseParam1; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.model.po.*; |
| | | import com.iplatform.model.po.S_user_core; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | **/ |
| | | @Slf4j |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
| | | public class LWhFormOutputCoreService { |
| | | |
| | | private BaseGoodsTemplateServiceImpl baseGoodsTemplateService; |
| | |
| | | private CodeGeneratorService codeGeneratorService; |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | private LWhFormOutputService lWhFormOutputService; |
| | | private LWhWarningCoreServiceImpl lWhWarningCoreService; |
| | | private LWarehouseFlowService lWarehouseFlowService; |
| | | private LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService; |
| | | private LWhGoodsRecordService lWhGoodsRecordService; |
| | |
| | | LWhFormOutputService lWhFormOutputService, |
| | | LWarehouseFlowService lWarehouseFlowService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordService) { |
| | | LWhGoodsRecordService lWhGoodsRecordService, |
| | | LWhWarningCoreServiceImpl lWhWarningCoreService) { |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | | this.lWhGoodsService = lWhGoodsService; |
| | | this.codeGeneratorService = codeGeneratorService; |
| | |
| | | this.lWarehouseFlowService = lWarehouseFlowService; |
| | | this.lWhGoodsRecordDetailsService = lWhGoodsRecordDetailsService; |
| | | this.lWhGoodsRecordService = lWhGoodsRecordService; |
| | | this.lWhWarningCoreService = lWhWarningCoreService; |
| | | } |
| | | |
| | | |
| | |
| | | * @return 出库单Id |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createOutFormByTransId(Long whFormTransferId, S_user_core currentUser, Long dealTime) { |
| | | public Long createOutFormByTransId(Long whFormTransferId, WhBusinessEnum businessEnum, S_user_core currentUser, Long dealTime) { |
| | | if (whFormTransferId == null) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | //申请调拨的物品 |
| | | List<LWhProcureModel> goodsModelNumList = lWhProcureModelService.getModelByForm(WhBusinessEnum.DIAOBO, whFormTransferId); |
| | | List<LWhProcureModel> goodsModelNumList = lWhProcureModelService.getModelByForm(businessEnum, whFormTransferId); |
| | | if (CollectionUtils.isEmpty(goodsModelNumList)) { |
| | | log.error("没有要入库的物品"); |
| | | return null; |
| | | throw new RuntimeException("没有要入库的物品"); |
| | | // return null; |
| | | } |
| | | Long outWarehouseId = lWhFormTransfer.getOutWarehouseId(); |
| | | String outWarehouseName = lWhFormTransfer.getOutWarehouseName(); |
| | |
| | | whFormOutput.setOutputName("调拨出库"); |
| | | whFormOutput.setWarehouseId(outWarehouseId); |
| | | whFormOutput.setWarehouseName(outWarehouseName); |
| | | // 这样就查询不到该条记录 |
| | | whFormOutput.setAgencyId(null); |
| | | whFormOutput.setAgencyName(null); |
| | | whFormOutput.setOperatorId(currentUser.getId()); |
| | |
| | | * @return 流水记录总表ID |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long outFormByTransId(Long outWarehouseFormId,WhBusinessEnum businessType, S_user_core currentUser, Long dealTime) { |
| | | public Long outFormByTransId(Long outWarehouseFormId, WhBusinessEnum businessType, S_user_core currentUser, Long dealTime) { |
| | | if (outWarehouseFormId == null) { |
| | | return null; |
| | | } |
| | |
| | | long lWarehouseFlowBusinessId = outWarehouseFormId; |
| | | |
| | | // 物品状态(0=在途调拨;1=入库未分发;2=已下发;3=报废) |
| | | short queryModelStatusT = 1; |
| | | Integer queryModelStatusT = 1; |
| | | //采购方式(1:集采;2=自采) |
| | | Short buyTypeT = null; |
| | | Integer buyTypeT = null; |
| | | Integer modGoodsTransferingStatusT = null; |
| | | String outputCode = lWhFormOutput.getOutputCode(); |
| | | if ((BaseWarehouseParam1.In_OutPutTypeEnum.Transfer_Output.getValue() + "").equals(outputCode)) { |
| | | short businessTypeValue = businessType.getValue(); |
| | | if (BaseWarehouseParam1.In_OutPutTypeEnum.Transfer_Output.getValue() == businessTypeValue) { |
| | | //调拨出库 |
| | | queryModelStatusT = 1; |
| | | buyTypeT = 1; |
| | | lWarehouseFlowBusinessId = lWhFormOutput.getTransBusinessId(); |
| | | modGoodsTransferingStatusT = 0; |
| | | } else if ((BaseWarehouseParam1.In_OutPutTypeEnum.Dept_Lending_Out.getValue() + "").equals(outputCode)) { |
| | | } else if (BaseWarehouseParam1.In_OutPutTypeEnum.Dept_Lending_Out.getValue() == businessTypeValue) { |
| | | // 部门仓库 分发出库 |
| | | // queryModelStatusT = 2; |
| | | } else if ((BaseWarehouseParam1.In_OutPutTypeEnum.Fragmentary_Output.getValue() + "").equals(outputCode)) { |
| | | lWarehouseFlowBusinessId = lWhFormOutput.getTransBusinessId(); |
| | | } else if (BaseWarehouseParam1.In_OutPutTypeEnum.Fragmentary_Output.getValue() == businessTypeValue) { |
| | | // 零星出库 |
| | | queryModelStatusT = 1; |
| | | buyTypeT = null; |
| | | modGoodsTransferingStatusT = 4; |
| | | } else if (BaseWarehouseParam1.In_OutPutTypeEnum.Inventory_Output.getValue() == businessTypeValue) { |
| | | // 盘点出库 |
| | | queryModelStatusT = 1; |
| | | buyTypeT = null; |
| | | modGoodsTransferingStatusT = 4; |
| | | } |
| | | short queryModelStatus = queryModelStatusT; |
| | | Short buyType = buyTypeT; |
| | | Integer queryModelStatus = queryModelStatusT; |
| | | Integer buyType = buyTypeT; |
| | | Integer modGoodsTransferingStatus = modGoodsTransferingStatusT; |
| | | |
| | | ArrayList<Long> allChangModelList = new ArrayList<>(); |
| | | goodsModelNumList.forEach(itemModelInfo -> { |
| | | // 需要调拨的物品的某个型号 |
| | | Long baseGoodsModelsId = itemModelInfo.getBaseGoodsModelsId(); |
| | | allChangModelList.add(baseGoodsModelsId); |
| | | // 需要调拨的物品某个型号的数量 |
| | | Integer counts = itemModelInfo.getCounts(); |
| | | |
| | |
| | | lWhFormOutput.setWarehouseFlowId(lWarehouseFlowId); |
| | | lWhFormOutputService.update(lWhFormOutput); |
| | | |
| | | //当库存变动时调用该方法 |
| | | if (outWarehouseType == 0){ |
| | | lWhWarningCoreService.updateKuCun(Convert.toShort(outWarehouseType, (short) 0), outWarehouseId, allChangModelList, null, dealTime); |
| | | } |
| | | return lWarehouseFlowId; |
| | | } |
| | | |