| | |
| | | import {getUploadUrl} from '@/utils/base'; |
| | | import {mapGetters} from 'vuex'; |
| | | import * as DateFormatter from '@/utils/DateFormatter'; |
| | | import {warehouseAllSelectNumber,warehouseSelectNumber} from "@/api/baseSetting/finsystenant"; |
| | | import {warehouseAllSelectNumber} from "@/api/baseSetting/finsystenant"; |
| | | |
| | | export default { |
| | | components: {MyButton, winMd, upload}, |
| | |
| | | let num = await warehouseSelectNumber({ |
| | | warehouseId: this.formData.warehouseId, |
| | | baseGoodsModelsId: item, |
| | | warehouseType: 0, |
| | | states: 1, |
| | | buyType: null, |
| | | }); |
| | |
| | | let num = await warehouseSelectNumber({ |
| | | warehouseId: this.formData.warehouseId, |
| | | baseGoodsModelsId: item, |
| | | warehouseType: 0, |
| | | states: 1, |
| | | buyType: null, |
| | | }); |
| | |
| | | </template> |
| | | <script> |
| | | import {getParentTenant, queryWarehouseGoods, transferAdd} from '@/api/stock/transfer'; |
| | | import {getCategorySelectTree, goodsModel, warehouseAllSelectNumber, warehouseSelectNumber} from '@/api/baseSetting/finsystenant'; |
| | | import {getCategorySelectTree, goodsModel, warehouseAllSelectNumber} from '@/api/baseSetting/finsystenant'; |
| | | import MyButton from '@/components/myButton/myButton'; |
| | | import winMd from '@/components/win/win-md'; |
| | | import upload from '@/components/upload/index'; |
| | |
| | | } |
| | | Long baseGoodsModelsId = warehouseQry.getBaseGoodsModelsId(); |
| | | Integer warehouseType = warehouseQry.getWarehouseType(); |
| | | Integer states = warehouseQry.getStates(); |
| | | Integer buyType = warehouseQry.getBuyType(); |
| | | |
| | | // TODO 其他类型的库存查询是否要查部门类型的库存 |
| | | // 其他类型的库存查询是否也要查部门类型的库存 |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int num = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 1, buyType); |
| | | return ResponseValue.success(num); |
| | |
| | | } |
| | | try { |
| | | Field fieldDatas = GenericPager.class.getDeclaredField("datas"); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(genericPager, result); |
| | | ReflectUtil.setFieldValue(genericPager, fieldDatas, result); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import com.consum.base.service.LWhProcureModelUserRecordService; |
| | | import com.consum.base.service.LWhProcureModelUserService; |
| | | import com.consum.base.service.impl.LWhFormTransferCoreService; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormTransfer; |
| | | import com.consum.model.po.LWhProcureModel; |
| | |
| | | @Autowired |
| | | private LWhProcureModelUserRecordService lWhProcureModelUserRecordService; |
| | | @Autowired |
| | | private BaseWarehouseService baseWarehouseService; |
| | | @Autowired |
| | | private LGoodsUserRecordCoreService lGoodsUserRecordCoreService; |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | @Autowired |
| | | private BaseWarehouseService baseWarehouseService; |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | modelByForm.stream().map(LWhProcureModel::getBaseGoodsModelsId).collect(Collectors.toSet()); |
| | | |
| | | // TODO 不同库处理 |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String agencyId = sysTenantUser.getTenantId(); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), null, (short)1); |
| | | Set<Long> wareHouseIds = baseWarehouseList.stream().map(BaseWarehouse::getId).collect(Collectors.toSet()); |
| | | // 通过调拨单中的型号id查询出该型号物品所在的仓库位置 |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds); |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds, wareHouseIds); |
| | | GoodsInfoDTO goodsInfoDTO = goodsInfoDTOS.stream().findFirst().orElse(null); |
| | | |
| | | if (ObjectUtils.isEmpty(goodsInfoDTO)) { |
| | | return ResponseValue.error("该型号没有库存可使用"); |
| | | } |
| | | // FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | // String agencyId = sysTenantUser.getTenantId(); |
| | | // List<BaseWarehouse> baseWarehouseList = |
| | |
| | | Set<Long> baseModelIds = |
| | | modelByForm.stream().map(LWhProcureModel::getBaseGoodsModelsId).collect(Collectors.toSet()); |
| | | |
| | | // TODO 不同库处理 |
| | | // TODO 不同库处理且为本机构的仓库物品 |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String agencyId = sysTenantUser.getTenantId(); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), null, (short)1); |
| | | Set<Long> wareHouseIds = baseWarehouseList.stream().map(BaseWarehouse::getId).collect(Collectors.toSet()); |
| | | |
| | | // 通过调拨单中的型号id查询出该型号物品所在的仓库位置 |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds); |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds, wareHouseIds); |
| | | GoodsInfoDTO goodsInfoDTO = goodsInfoDTOS.stream().findFirst().orElse(null); |
| | | // 出库前 设置出库仓库 |
| | | // FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | |
| | | // if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | // return ResponseValue.error("机构无默认仓库!"); |
| | | // } |
| | | |
| | | if (ObjectUtils.isEmpty(goodsInfoDTO)) { |
| | | return ResponseValue.error("该型号没有库存可使用"); |
| | | } |
| | | Long wareHouseId = goodsInfoDTO.getWarehouseId(); |
| | | String warehouseName = goodsInfoDTO.getWarehouseName(); |
| | | LWhFormTransfer lWhFormTransfer = new LWhFormTransfer(id); |
| | |
| | | |
| | | goodsUseRecordVO.setRecordSkuDtoList(useRecordSkuList); |
| | | return goodsUseRecordVO; |
| | | |
| | | }).sorted(Comparator.comparing(GoodsUseRecordVO::getUpdateTime, Comparator.nullsFirst(Long::compareTo)) |
| | | .reversed()) |
| | | .collect(Collectors.toList()); |
| | |
| | | /** |
| | | * 1 采购 |
| | | */ |
| | | CAIGOU((short) 1), |
| | | CAIGOU(1), |
| | | /** |
| | | * 2 调拨 |
| | | */ |
| | | DIAOBO((short) 2), |
| | | DIAOBO(2), |
| | | /** |
| | | * 3出库 |
| | | */ |
| | | CHUKU((short) 3), |
| | | CHUKU(3), |
| | | /** |
| | | * 4部门分发 |
| | | */ |
| | | BUMENFENFA((short) 4), |
| | | BUMENFENFA(4), |
| | | /** |
| | | * 报废 |
| | | */ |
| | | BAOFEI((short) 5), |
| | | BAOFEI(5), |
| | | /** |
| | | * 部门物品回退仓库 |
| | | */ |
| | | BUMENTUIHUI((short) 6), |
| | | BUMENTUIHUI(6), |
| | | /** |
| | | * 物品盘点 |
| | | */ |
| | | PANDIAN((short) 7), |
| | | ; |
| | | PANDIAN(7),; |
| | | |
| | | private short value; |
| | | private Integer value; |
| | | |
| | | WhBusinessEnum(short value) { |
| | | WhBusinessEnum(Integer value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public short getValue() { |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * flowType转为 进出库流水总表[L_WAREHOUSE_FLOW] 的 THIS_TYPE:本次调整类型 和 BUSINESS_TYPE:单据类型 |
| | | * flowType转为 进出库流水总表[L_WAREHOUSE_FLOW] 的 THIS_TYPE:本次调整类型 和 BUSINESS_TYPE:单据类型 |
| | | * |
| | | * @param flowType 同码表,1采购入库 2退还入库 3调拨入库 4盘盈入库 5申领出库 6调拨出库 7盘亏出库 8报废出库 9其他出库 |
| | | * @return flowThisType:本次调整类型(1=调增;2=调减) |
| | | * flowBusinessType:单据类型 1 采购2 调拨 3出库4部门分发5报废6部门物品回退仓库7物品盘点 |
| | | * @return flowThisType:本次调整类型(1=调增;2=调减) flowBusinessType:单据类型 1 采购2 调拨 3出库4部门分发5报废6部门物品回退仓库7物品盘点 |
| | | */ |
| | | public static Map<String, Short> getTypeByFlowType(Short flowType) { |
| | | //单据类型 1 采购2 调拨 3出库4部门分发5报废6部门物品回退仓库7物品盘点 |
| | | // 单据类型 1 采购2 调拨 3出库4部门分发5报废6部门物品回退仓库7物品盘点 |
| | | Short flowBusinessType = null; |
| | | //1=调增;2=调减 |
| | | // 1=调增;2=调减 |
| | | Short flowThisType = null; |
| | | //单据类型。0仓库调拨;1部门分发;2部门物品回退 |
| | | // 单据类型。0仓库调拨;1部门分发;2部门物品回退 |
| | | Short transferBusinessType = null; |
| | | switch (flowType) { |
| | | //1采购入库 |
| | | // 1采购入库 |
| | | case 1: |
| | | flowThisType = 1; |
| | | flowBusinessType = 1; |
| | | break; |
| | | //2退还入库 |
| | | // 2退还入库 |
| | | case 2: |
| | | flowThisType = 1; |
| | | flowBusinessType = 2; |
| | | break; |
| | | //3调拨入库 |
| | | // 3调拨入库 |
| | | case 3: |
| | | flowThisType = 1; |
| | | flowBusinessType = 3; |
| | |
| | | flowThisType = 1; |
| | | flowBusinessType = 7; |
| | | break; |
| | | //5申领出库 |
| | | // 5申领出库 |
| | | case 5: |
| | | flowThisType = 2; |
| | | flowBusinessType = 4; |
| | | // transferBusinessType = 1; |
| | | // transferBusinessType = 1; |
| | | break; |
| | | // 6调拨出库 |
| | | case 6: |
| | | flowThisType = 2; |
| | | flowBusinessType = 2; |
| | | // transferBusinessType = 1; |
| | | // transferBusinessType = 1; |
| | | break; |
| | | //7盘亏出库 |
| | | // 7盘亏出库 |
| | | case 7: |
| | | flowThisType = 2; |
| | | flowBusinessType = 7; |
| | |
| | | } |
| | | |
| | | /** |
| | | * flowType转为 进出库流水总表[L_WAREHOUSE_FLOW] 的 THIS_TYPE:本次调整类型 和 BUSINESS_TYPE:单据类型 |
| | | * flowType转为 进出库流水总表[L_WAREHOUSE_FLOW] 的 THIS_TYPE:本次调整类型 和 BUSINESS_TYPE:单据类型 |
| | | * |
| | | * @param deptFlowType // 同码表,1 物品申领 2 物品分发 3 物品退还 4 物品报废 |
| | | * @return flowThisType:本次调整类型(1=调增;2=调减) |
| | | * flowBusinessType:单据类型 1 采购2 调拨 3出库4部门分发5报废6部门物品回退仓库7物品盘点 |
| | | * @return flowThisType:本次调整类型(1=调增;2=调减) flowBusinessType:单据类型 1 采购2 调拨 3出库4部门分发5报废6部门物品回退仓库7物品盘点 |
| | | */ |
| | | public static Map<String, Short> getTypeByDeptFlowType(Short deptFlowType) { |
| | | //单据类型 1 采购 2 调拨 3出库4部门分发5报废6部门物品回退仓库7物品盘点 |
| | | // 单据类型 1 采购 2 调拨 3出库4部门分发5报废6部门物品回退仓库7物品盘点 |
| | | Short flowBusinessType = null; |
| | | //1=调增;2=调减 |
| | | // 1=调增;2=调减 |
| | | Short flowThisType = null; |
| | | //单据类型。0仓库调拨;1部门分发;2部门物品回退 |
| | | // 单据类型。0仓库调拨;1部门分发;2部门物品回退 |
| | | Short transferBusinessType = null; |
| | | switch (deptFlowType) { |
| | | //物品申领 |
| | | // 物品申领 |
| | | case 1: |
| | | // flowThisType = 2; |
| | | // flowBusinessType = 2; |
| | | // flowThisType = 2; |
| | | // flowBusinessType = 2; |
| | | break; |
| | | //2 物品分发 |
| | | // 2 物品分发 |
| | | case 2: |
| | | flowThisType = 1; |
| | | flowBusinessType = 4; |
| | | // transferBusinessType = 1; |
| | | // transferBusinessType = 1; |
| | | break; |
| | | //3 物品退还 |
| | | // 3 物品退还 |
| | | case 3: |
| | | flowThisType = 2; |
| | | flowBusinessType = 6; |
| | | // transferBusinessType = 2; |
| | | // transferBusinessType = 2; |
| | | break; |
| | | // 4 物品报废 |
| | | case 4: |
| | |
| | | Map<String, Short> rtnMap = new HashMap<>(); |
| | | rtnMap.put("flowBusinessType", flowBusinessType); |
| | | rtnMap.put("flowThisType", flowThisType); |
| | | // rtnMap.put("transferBusinessType", transferBusinessType); |
| | | // rtnMap.put("transferBusinessType", transferBusinessType); |
| | | return rtnMap; |
| | | } |
| | | } |
| | |
| | | package com.consum.base.core.service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.service.BaseGoodsModelsService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.WhWarning; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | |
| | | /** |
| | | * @ClassName LWhWarningCoreServiceImpl |
| | |
| | | * @param warehouseId |
| | | * @param baseModelIdList |
| | | */ |
| | | public void updateKuCun(Short warehouseType, Long warehouseId, List<Long> baseModelIdList, FinSysTenantUser sysInfo, Long dealTime) { |
| | | public void updateKuCun(Short warehouseType, Long warehouseId, List<Long> baseModelIdList, FinSysTenantUser sysInfo, |
| | | Long dealTime) { |
| | | if (baseModelIdList == null) { |
| | | baseModelIdList = new ArrayList<>(); |
| | | } |
| | | sysInfo = sysInfo == null ? new FinSysTenantUser() : sysInfo; |
| | | // 获取到达到阈值的物品 |
| | | List<Map<String, Object>> kuCunNotifyList = lWhWarningService.checkKuCun(warehouseType, warehouseId, baseModelIdList); |
| | | // |
| | | // log.info("没有达到阈值的物品"); |
| | | List<Map<String, Object>> kuCunNotifyList = |
| | | lWhWarningService.checkKuCun(warehouseType, warehouseId, baseModelIdList); |
| | | // log.info("没有达到阈值的物品"); |
| | | if (CollectionUtils.isEmpty(kuCunNotifyList)) { |
| | | kuCunNormalModel(warehouseType, warehouseId, baseModelIdList); |
| | | return; |
| | | } |
| | | List<Long> allChangModelList = baseModelIdList.stream() |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | List<Long> allChangModelList = baseModelIdList.stream().distinct().collect(Collectors.toList()); |
| | | baseModelIdList = allChangModelList; |
| | | |
| | | // 将数据插入库存预警【WH_WARNING】 |
| | |
| | | whWarning.setBaseGoodsTemplateId(Convert.toLong(modelInfo.get("goodsId"))); |
| | | whWarning.setBaseGoodsTemplateName(Convert.toStr(modelInfo.get("goodsName"))); |
| | | whWarning.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | whWarning.setBaseGoodsModelsName((String) modelInfo.get("modelName")); |
| | | whWarning.setBaseGoodsModelsName((String)modelInfo.get("modelName")); |
| | | whWarning.setGoodsType(2); |
| | | whWarning.setWarningType(warningType); |
| | | whWarning.setUpperLimit(upperLimit); |
| | |
| | | warningList.add(whWarning); |
| | | } |
| | | |
| | | //修改以前的预警状态 |
| | | // 修改以前的预警状态 |
| | | baseModelIdList.removeAll(kuCunNotifyModelIdList); |
| | | kuCunNormalModel(warehouseType, warehouseId, baseModelIdList); |
| | | |
| | | //批量插入预警 |
| | | // 批量插入预警 |
| | | lWhWarningService.insertBatch(warningList); |
| | | |
| | | } |
| | | |
| | | private String KU_CUN_NORMAL_MODEL = "update WH_WARNING set STATES=2 where WAREHOUSE_TYPE=? and BASE_WAREHOUSE_ID=?"; |
| | | private String KU_CUN_NORMAL_MODEL = |
| | | "update WH_WARNING set STATES=2 where WAREHOUSE_TYPE=? and BASE_WAREHOUSE_ID=?"; |
| | | |
| | | /** |
| | | * @param warehouseType |
| | |
| | | |
| | | StringBuilder sql = new StringBuilder(KU_CUN_NORMAL_MODEL); |
| | | if (!org.springframework.util.CollectionUtils.isEmpty(normalBaseModelIdList)) { |
| | | sql.append(" and BASE_GOODS_MODELS_ID in(").append(org.apache.commons.lang3.StringUtils.join(normalBaseModelIdList, ",")).append(")"); |
| | | sql.append(" and BASE_GOODS_MODELS_ID in(") |
| | | .append(org.apache.commons.lang3.StringUtils.join(normalBaseModelIdList, ",")).append(")"); |
| | | } |
| | | return lWhWarningService.update(sql.toString(), params.toArray()); |
| | | } |
| | |
| | | */ |
| | | GoodsModelCountDTO queryGoodsAmount(Long baseGoodsModelsId, Integer type); |
| | | |
| | | List<GoodsInfoDTO> queryGoodsInfo(Set<Long> baseModelIds); |
| | | List<GoodsInfoDTO> queryGoodsInfo(Set<Long> baseModelIds, Set<Long> wareHouseIds); |
| | | } |
| | |
| | | return null; |
| | | } |
| | | // 查询该调拨单是否已经生成了出库单 |
| | | Long outWarehouseFormIdT = lWhFormOutputService.queyrIdByTransferId(whFormTransferId); |
| | | if (outWarehouseFormIdT != null) { |
| | | return outWarehouseFormIdT; |
| | | Long outWarehouseFormId = lWhFormOutputService.queyrIdByTransferId(whFormTransferId); |
| | | if (outWarehouseFormId != null) { |
| | | return outWarehouseFormId; |
| | | } |
| | | // 出库单ID |
| | | outWarehouseFormId = NumberGenerator.getLongSequenceNumberNano(); |
| | | |
| | | // 申请调拨的物品 |
| | | List<LWhProcureModel> goodsModelNumList = lWhProcureModelService.getModelByForm(businessEnum, whFormTransferId); |
| | | if (CollectionUtils.isEmpty(goodsModelNumList)) { |
| | | log.error("没有要入库的物品"); |
| | | throw new RuntimeException("没有要入库的物品"); |
| | | // return null; |
| | | } |
| | | Long outWarehouseId = lWhFormTransfer.getOutWarehouseId(); |
| | | String outWarehouseName = lWhFormTransfer.getOutWarehouseName(); |
| | | |
| | | // 出库单ID |
| | | outWarehouseFormIdT = NumberGenerator.getLongSequenceNumberNano(); |
| | | Long outWarehouseFormId = outWarehouseFormIdT; |
| | | |
| | | // 调拨单物品 已经按型号分好了 |
| | | goodsModelNumList.forEach(itemModelInfo -> { |
| | | for (LWhProcureModel itemModelInfo : goodsModelNumList) { |
| | | // 复用对象 |
| | | itemModelInfo.setId(IdUtil.generateId()); |
| | | itemModelInfo.setFromProcureGoodsId(null); |
| | |
| | | itemModelInfo.setBusinessId(outWarehouseFormId); |
| | | itemModelInfo.setPrice(null); |
| | | itemModelInfo.setSupplier(null); |
| | | }); |
| | | } |
| | | lWhProcureModelService.insertBatch(goodsModelNumList); |
| | | |
| | | // //创建出库单 |
| | | LWhFormOutput whFormOutput = new LWhFormOutput(); |
| | | |
| | | whFormOutput.setId(outWarehouseFormId); |
| | | // 此时并没有出库 |
| | | whFormOutput.setWarehouseFlowId(null); |
| | |
| | | whFormOutput.setOperatorName(currentUser.getNick_name()); |
| | | |
| | | whFormOutput.setDealTime(dealTime); |
| | | whFormOutput.setStates(1); |
| | | whFormOutput.setStates(OutPutStatesType.OUT_PENDING.getValue()); |
| | | int insert = lWhFormOutputService.insert(whFormOutput); |
| | | if (insert == 0) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | |
| | | // 流水记录总表ID |
| | | long lWarehouseFlowId = NumberGenerator.getLongSequenceNumberNano(); |
| | | // 流水记录总表中 业务ID 。调拨单时 保存调拨单id 出库单时 保存出库单id |
| | | long lWarehouseFlowBusinessId = outWarehouseFormId; |
| | | Integer queryModelStatus = 1; |
| | | Integer buyType = null; |
| | | Integer modGoodsTransferStatus = null; |
| | | |
| | | // 物品状态(0=在途调拨;1=入库未分发;2=已下发;3=报废) |
| | | Integer queryModelStatusT = 1; |
| | | // 采购方式(1:集采;2=自采) |
| | | Integer buyTypeT = null; |
| | | Integer modGoodsTransferingStatusT = null; |
| | | short businessTypeValue = businessType.getValue(); |
| | | if (InAndOutPutType.Transfer_Output.getValue() == businessTypeValue) { |
| | | Integer businessTypeValue = businessType.getValue(); |
| | | if (businessTypeValue == InAndOutPutType.Transfer_Output.getValue()) { |
| | | // 调拨出库 |
| | | queryModelStatusT = 1; |
| | | buyTypeT = 1; |
| | | queryModelStatus = 0; |
| | | buyType = 1; |
| | | lWarehouseFlowBusinessId = lWhFormOutput.getTransBusinessId(); |
| | | modGoodsTransferingStatusT = 0; |
| | | } else if (InAndOutPutType.Dept_Lending_Out.getValue() == businessTypeValue) { |
| | | modGoodsTransferStatus = 0; |
| | | } else if (businessTypeValue == InAndOutPutType.Dept_Lending_Out.getValue()) { |
| | | // 部门仓库 分发出库 |
| | | // queryModelStatusT = 2; |
| | | lWarehouseFlowBusinessId = lWhFormOutput.getTransBusinessId(); |
| | | } else if (InAndOutPutType.Fragmentary_Output.getValue() == businessTypeValue) { |
| | | // 零星出库 |
| | | queryModelStatusT = 1; |
| | | buyTypeT = null; |
| | | modGoodsTransferingStatusT = 4; |
| | | } else if (InAndOutPutType.Inventory_Output.getValue() == businessTypeValue) { |
| | | // 盘点出库 |
| | | queryModelStatusT = 1; |
| | | buyTypeT = null; |
| | | modGoodsTransferingStatusT = 4; |
| | | } else if (businessTypeValue == InAndOutPutType.Fragmentary_Output.getValue() |
| | | || businessTypeValue == InAndOutPutType.Inventory_Output.getValue()) { |
| | | // 零星出库 或 盘点出库 |
| | | queryModelStatus = 1; |
| | | modGoodsTransferStatus = 4; |
| | | } |
| | | Integer queryModelStatus = queryModelStatusT; |
| | | Integer buyType = buyTypeT; |
| | | Integer modGoodsTransferingStatus = modGoodsTransferingStatusT; |
| | | |
| | | ArrayList<Long> allChangModelList = new ArrayList<>(); |
| | | goodsModelNumList.forEach(itemModelInfo -> { |
| | | for (LWhProcureModel itemModelInfo : goodsModelNumList) { |
| | | // 需要调拨的物品的某个型号 |
| | | Long baseGoodsModelsId = itemModelInfo.getBaseGoodsModelsId(); |
| | | |
| | |
| | | |
| | | // 查询型号信息 |
| | | Map<String, Object> tempGoodsInfo = baseGoodsTemplateService.queryGoodsInfoByModelId(baseGoodsModelsId); |
| | | // 价值类型 |
| | | String classificationObj = (String)tempGoodsInfo.get("classification"); |
| | | Short classificationT = 3; |
| | | if (classificationObj != null) { |
| | | classificationT = (short)((classificationObj).charAt(0) - 64); |
| | | } |
| | | short classification = classificationT; |
| | | |
| | | Long tempGoodsId = (Long)tempGoodsInfo.get("goodsid"); |
| | | String goodsName = (String)tempGoodsInfo.get("goodsname"); |
| | | String modelName = (String)tempGoodsInfo.get("modelname"); |
| | | String goodsUnit = (String)tempGoodsInfo.get("unit"); |
| | | |
| | | // 插入 各规格物品的进出库记录 L_WH_GOODS_RECORD |
| | | long whGoodsRecordId = NumberGenerator.getLongSequenceNumberNano(); |
| | |
| | | outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseType, outWarehouseId, baseGoodsModelsId, |
| | | queryModelStatus, buyType, counts); |
| | | lWhGoodsService.modGoodsTransfering(outGoodsId, inWarehouseType, inWarehouseId, inWarehouseName, |
| | | modGoodsTransferingStatus); |
| | | modGoodsTransferStatus); |
| | | // 批量插入 进出库流水明细[L_WH_GOODS_RECORD_DETAILS] |
| | | lWhGoodsRecordDetailsService.sameGoodsInsertMore(outGoodsId, whGoodsRecordId, (short)0); |
| | | } |
| | |
| | | lWhGoodsRecordServiceImpl.insert(whGoodsRecord); |
| | | lWhProcureModel.setTotalAmount(totalAmount); |
| | | lWhProcureModelService.update(lWhProcureModel); |
| | | }); |
| | | } |
| | | LWarehouseFlow warehouseFlow = new LWarehouseFlow(); |
| | | warehouseFlow.setId(lWarehouseFlowId); |
| | | warehouseFlow.setWarehouseId(outWarehouseId); |
| | | warehouseFlow.setWarehouseName(warehouseName); |
| | | warehouseFlow.setThisType(2); |
| | | warehouseFlow.setBusinessType(businessType.getValue() + 0); |
| | | warehouseFlow.setBusinessType(businessType.getValue()); |
| | | |
| | | warehouseFlow.setBusinessFormId(whFormTransferId == null ? lWarehouseFlowBusinessId : whFormTransferId); |
| | | warehouseFlow.setOperatorId(userId); |
| | |
| | | import com.consum.base.core.type.GoodsModelType; |
| | | import com.consum.base.core.type.InAndOutPutType; |
| | | import com.consum.base.core.type.OutPutStatesType; |
| | | import com.consum.base.core.type.WareHouseType; |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | |
| | | lWhProcureModel.setCounts(model.getCounts()); |
| | | // 根据物品型号查询物品库存 |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(WareHouseType.TENANT.getValue(), warehouseIds, |
| | | model.getBaseGoodsModelsId(), 1, null); |
| | | // 查询库存时不区分机构和部门 |
| | | int goodsNum = |
| | | this.lWhGoodsService.queryGoodsModelNum(null, warehouseIds, model.getBaseGoodsModelsId(), 1, null); |
| | | lWhProcureModel.setWorehouseCount(goodsNum); |
| | | modelList.add(lWhProcureModel); |
| | | } |
| | |
| | | warehouseFlow.setWarehouseId(warehouseId); |
| | | warehouseFlow.setWarehouseName(lWhFormProcure.getWarehouseName()); |
| | | warehouseFlow.setThisType(1); |
| | | warehouseFlow.setBusinessType(WhBusinessEnum.CAIGOU.getValue() + 0); |
| | | warehouseFlow.setBusinessType(WhBusinessEnum.CAIGOU.getValue()); |
| | | warehouseFlow.setBusinessFormId(whFormProcureId); |
| | | warehouseFlow.setOperatorId(userId); |
| | | warehouseFlow.setOperatorName(nickName); |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.utils.*; |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormProcureGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormProcureParam; |
| | | import com.consum.base.pojo.LWhProcureModelParam; |
| | | import com.consum.base.pojo.excel.ProcureExcelTemplate; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.*; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.LOrgSupplierServiceImpl; |
| | | import com.consum.base.service.LWhFormProcureGoodsService; |
| | | import com.consum.base.service.LWhFormProcureService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LOrgSupplier; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhFormProcureGoods; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @ClassName lWhFormProcureService |
| | |
| | | + "LEFT JOIN l_wh_form_procure_goods fpg ON fp.id = fpg.WH_FORM_PROCURE_ID " |
| | | + "LEFT JOIN l_wh_procure_model pm ON pm.FROM_PROCURE_GOODS_ID = fpg.id WHERE pm.BUSINESS_TYPE = 1 "); |
| | | // 只查询本机构的采购单 |
| | | if (param.getAgencyId() != null){ |
| | | if (param.getAgencyId() != null) { |
| | | sql.append("and fp.AGENCY_ID like :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId()); |
| | | } |
| | |
| | | String modelName = (String)tempGoodsInfo.get("modelname"); |
| | | // 查询型号库存 |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseIds, baseGoodsModelsId, 1, null); |
| | | // 库存查询所有类型的包括机构和部门的类型 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(null, warehouseIds, baseGoodsModelsId, 1, null); |
| | | LWhProcureModel model = new LWhProcureModel(); |
| | | model.setId(IdUtil.generateId()); |
| | | model.setFromProcureGoodsId(fromProcureGoodsId); |
| | | model.setBusinessType(WhBusinessEnum.CAIGOU.getValue() + 0); |
| | | model.setBusinessType(WhBusinessEnum.CAIGOU.getValue()); |
| | | model.setBusinessId(whFormProcureId); |
| | | model.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | model.setBaseGoodsModelsName(modelName); |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhFormScrapped; |
| | | import com.consum.model.po.LWhFormScrappedGoods; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | 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; |
| | | import java.util.stream.Collectors; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.GoodsBaseServiceImpl; |
| | | import com.consum.base.service.LWarehouseFlowService; |
| | | import com.consum.base.service.LWhFormScrappedGoodsService; |
| | | import com.consum.base.service.LWhGoodsRecordService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhFormScrapped; |
| | | import com.consum.model.po.LWhFormScrappedGoods; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @ClassName LWhFormScrappedCoreService |
| | |
| | | List<Long> srappedGoodsIds = null; |
| | | if (warehouseType == null || warehouseType == 0) { |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 1, null); |
| | | goodsModelNum = |
| | | lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 1, null); |
| | | srappedGoodsIds = lWhGoodsService.queryScrappedGoodsIds(warehouseType, warehouseId, null, null, |
| | | baseGoodsModelsId, (short)1, counts); |
| | | } else { |
| | |
| | | srappedGoodsIds = lWhGoodsService.queryScrappedGoodsIds(warehouseType, warehouseId, |
| | | transBusinessId, userName, baseGoodsModelsId, (short)2, counts); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 2, null); |
| | | goodsModelNum = |
| | | lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 2, null); |
| | | } |
| | | |
| | | if (goodsModelNum < counts) { |
| | |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.type.WareHouseType; |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | |
| | | long lWhFormScrappedId = IdUtil.generateId(); |
| | | lWhFormScrapped.setId(lWhFormScrappedId); |
| | | lWhFormScrapped.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.Scrapped)); |
| | | lWhFormScrapped.setWarehouseType(0); |
| | | lWhFormScrapped.setWarehouseType(WareHouseType.TENANT.getValue()); |
| | | |
| | | // 公用 |
| | | Long warehouseId = null; |
| | |
| | | scrappedGoods.setId(IdUtil.generateId()); |
| | | // 根据物品型号查询物品库存 |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int goodsNum = |
| | | lWhGoodsService.queryGoodsModelNum(0, warehouseIds, scrappedGoods.getBaseGoodsModelsId(), 1, null); |
| | | int goodsNum = lWhGoodsService.queryGoodsModelNum(WareHouseType.TENANT.getValue(), warehouseIds, |
| | | scrappedGoods.getBaseGoodsModelsId(), 1, null); |
| | | if (params.getCounts() > goodsNum) { |
| | | log.error("报废数量大于库存数量"); |
| | | return 0; |
| | |
| | | long dealTime = DateUtils.getDateTimeNumber(System.currentTimeMillis()); |
| | | // 单据类型。0仓库调拨;1部门分发;2部门物品回退 |
| | | Integer businessType = lWhFormTransfer.getBusinessType(); |
| | | businessType = businessType == null ? 0 : businessType; |
| | | WhBusinessEnum businessEnum = WhBusinessEnum.DIAOBO; |
| | | if (businessType == 0) { |
| | | businessEnum = WhBusinessEnum.DIAOBO; |
| | | } else if (businessType == 1) { |
| | | WhBusinessEnum businessEnum; |
| | | if (businessType == 1) { |
| | | businessEnum = WhBusinessEnum.BUMENFENFA; |
| | | } else if (businessType == 2) { |
| | | businessEnum = WhBusinessEnum.BUMENTUIHUI; |
| | | } else { |
| | | businessEnum = WhBusinessEnum.DIAOBO; |
| | | } |
| | | |
| | | // 出库单ID |
| | |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.type.CategoryType; |
| | | import com.consum.base.core.type.TransferBusinessType; |
| | | import com.consum.base.core.type.WareHouseType; |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | |
| | | |
| | | // 调拨类型单据 |
| | | if (businessType == TransferBusinessType.STOCK_TRANSFER.getValue()) { |
| | | // 入库仓库为当前用户的默认仓库 |
| | | // 入库仓库为当前用户的默认仓库中的第一个 |
| | | String tenantId = sysInfo.getTenantId(); |
| | | String tenantName = sysInfo.getTenantName(); |
| | | BaseWarehouse warehouse = baseWarehouseService.getDefaultWarehouseByAgencyId(Long.valueOf(tenantId)); |
| | |
| | | baseWarehouse.setId(baseWarehouseId); |
| | | BaseWarehouse warehouse = baseWarehouseService.get(baseWarehouse); |
| | | |
| | | lWhFormTransfer.setInWarehouseType(1); |
| | | lWhFormTransfer.setInWarehouseType(WareHouseType.DEPARTMENT.getValue()); |
| | | lWhFormTransfer.setInWarehouseId(param.getDepartmentId()); |
| | | lWhFormTransfer.setInWarehouseName(param.getDepartmentName()); |
| | | lWhFormTransfer.setInOperatorName(param.getOperatorName()); |
| | | lWhFormTransfer.setInTime(param.getCreateTime()); |
| | | |
| | | lWhFormTransfer.setOutWarehouseType(0); |
| | | lWhFormTransfer.setOutWarehouseType(WareHouseType.TENANT.getValue()); |
| | | lWhFormTransfer.setOutWarehouseId(warehouse.getId()); |
| | | lWhFormTransfer.setOutWarehouseName(warehouse.getWarehouseName()); |
| | | |
| | |
| | | baseWarehouseService.getBaseWareHouseList(outAgencyId, null, (short)1); |
| | | List<Long> warehouseIdList = |
| | | baseWareHouseList.stream().map(BaseWarehouse::getId).collect(Collectors.toList()); |
| | | int goodsNum = lWhGoodsService.queryGoodsModelNum(0, warehouseIdList, baseGoodsModelsId, 1, null); |
| | | int goodsNum = lWhGoodsService.queryGoodsModelNum(WareHouseType.TENANT.getValue(), warehouseIdList, |
| | | baseGoodsModelsId, 1, null); |
| | | lWhProcureModel.setWorehouseCount(goodsNum); |
| | | } |
| | | if (businessType == TransferBusinessType.DEPARTMENT_PROCURE.getValue()) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<GoodsInfoDTO> queryGoodsInfo(Set<Long> baseModelIds) { |
| | | public List<GoodsInfoDTO> queryGoodsInfo(Set<Long> baseModelIds, Set<Long> wareHouseIds) { |
| | | |
| | | List<GoodsInfoDTO> goodsInfoDTOS = Lists.newArrayList(); |
| | | StringBuilder sql = new StringBuilder( |
| | | "SELECT distinct WAREHOUSE_ID,WAREHOUSE_NAME from L_WH_GOODS where base_goods_models_id in (:baseGoodsModelsIds) " |
| | | + "and WAREHOUSE_TYPE =0 and BUY_TYPE =1 and states =1"); |
| | | + "and WAREHOUSE_TYPE =0 and BUY_TYPE =1 and states =1 and WAREHOUSE_ID in (:wareHouseIds)"); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("baseGoodsModelsIds", baseModelIds); |
| | | param.put("wareHouseIds", wareHouseIds); |
| | | List<Map<String, Object>> result = this.select(sql.toString(), param, new MapperUtil()); |
| | | result.forEach(item -> { |
| | | GoodsInfoDTO goodsInfoDTO = MapUtils.convertMapToObj(item, GoodsInfoDTO.class); |