| | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.param.BaseWarehouseParam1; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.model.po.*; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhFormOutput; |
| | | import com.consum.model.po.LWhFormTransfer; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName WhFormOutputCoreService |
| | |
| | | |
| | | @Autowired |
| | | public LWhFormOutputCoreService(BaseGoodsTemplateServiceImpl baseGoodsTemplateService, |
| | | LWhGoodsService lWhGoodsService, |
| | | CodeGeneratorService codeGeneratorService, |
| | | LWhProcureModelService lWhProcureModelService, |
| | | LWhFormOutputService lWhFormOutputService, |
| | | LWarehouseFlowService lWarehouseFlowService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordService) { |
| | | LWhGoodsService lWhGoodsService, |
| | | CodeGeneratorService codeGeneratorService, |
| | | LWhProcureModelService lWhProcureModelService, |
| | | LWhFormOutputService lWhFormOutputService, |
| | | LWarehouseFlowService lWarehouseFlowService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordService) { |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | | this.lWhGoodsService = lWhGoodsService; |
| | | this.codeGeneratorService = codeGeneratorService; |
| | |
| | | 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, 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)) { |
| | |
| | | buyTypeT = null; |
| | | modGoodsTransferingStatusT = 4; |
| | | } |
| | | short queryModelStatus = queryModelStatusT; |
| | | Short buyType = buyTypeT; |
| | | Integer queryModelStatus = queryModelStatusT; |
| | | Integer buyType = buyTypeT; |
| | | Integer modGoodsTransferingStatus = modGoodsTransferingStatusT; |
| | | |
| | | goodsModelNumList.forEach(itemModelInfo -> { |
| | |
| | | |
| | | //出库时候,按 先入库的先出库,同时入库的,按价格高的先出库 |
| | | outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseType, outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType, |
| | | counts); |
| | | counts); |
| | | lWhGoodsService.modGoodsTransfering(outGoodsId, inWarehouseType, inWarehouseId, inWarehouseName, modGoodsTransferingStatus); |
| | | // 批量插入 进出库流水明细[L_WH_GOODS_RECORD_DETAILS] |
| | | lWhGoodsRecordDetailsService.sameGoodsInsertMore(outGoodsId, whGoodsRecordId, (short) 0); |
| | | lWhGoodsRecordService.insert(whGoodsRecord); |
| | | } |
| | | long totalAmount = lWhGoodsService.queryGoodsPriceById(outGoodsId); |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(itemModelInfo.getId()); |
| | | whGoodsRecord.setTotalPrice(totalAmount); |
| | | lWhGoodsRecordService.insert(whGoodsRecord); |
| | | lWhProcureModel.setTotalAmount(totalAmount); |
| | | lWhProcureModelService.update(lWhProcureModel); |
| | | }); |
| | |
| | | warehouseFlow.setWarehouseId(outWarehouseId); |
| | | warehouseFlow.setWarehouseName(warehouseName); |
| | | warehouseFlow.setThisType(2); |
| | | warehouseFlow.setBusinessType(WhBusinessEnum.DIAOBO.getValue() + 0); |
| | | warehouseFlow.setBusinessType(businessType.getValue() + 0); |
| | | |
| | | warehouseFlow.setBusinessFormId(lWarehouseFlowBusinessId); |
| | | warehouseFlow.setOperatorId(userId); |