1.出库手续回显
2.调拨申请时库存查询更换接口
3.调拨出库时从已有物品所在的仓库中选择
| | |
| | | import {getUploadUrl} from '@/utils/base'; |
| | | import {mapGetters} from 'vuex'; |
| | | import * as DateFormatter from '@/utils/DateFormatter'; |
| | | import {warehouseSelectNumber} from "@/api/baseSetting/finsystenant"; |
| | | import {warehouseAllSelectNumber,warehouseSelectNumber} from "@/api/baseSetting/finsystenant"; |
| | | |
| | | export default { |
| | | components: {MyButton, winMd, upload}, |
| | |
| | | let str = JSON.stringify(arr); |
| | | for (const item of e) { |
| | | if (str.indexOf(item) === -1) { |
| | | let num = await warehouseSelectNumber({ |
| | | let num = await warehouseAllSelectNumber({ |
| | | baseGoodsModelsId: item, |
| | | warehouseType: 0, |
| | | states: 1, |
| | | agencyId: this.userInfo.tenantId, |
| | | }); |
| | |
| | | package com.consum.base.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | Integer states = warehouseQry.getStates(); |
| | | Integer buyType = warehouseQry.getBuyType(); |
| | | |
| | | int num = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 1, buyType); |
| | | // TODO 其他类型的库存查询是否要查部门类型的库存 |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int num = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 1, buyType); |
| | | return ResponseValue.success(num); |
| | | } |
| | | |
| | |
| | | Integer states = warehouseQry.getStates(); |
| | | Integer buyType = warehouseQry.getBuyType(); |
| | | |
| | | // 调拨时只查机构类型的集采仓库库存 |
| | | // 部门分发时不分机构和部门,因为调拨进来的物品也算在库存里只是类型为部门,同样检视所有仓库该型号的数量 |
| | | int num = lWhGoodsService.queryGoodsModelInWareHouseNum(warehouseType, warehouseIdList, baseGoodsModelsId, |
| | | states, buyType); |
| | | return ResponseValue.success(num); |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.pojo.GoodsUseRecordVO; |
| | | import com.consum.base.pojo.LWhFormTransferGoodsInfoParam; |
| | | import com.consum.base.pojo.RecordUserInfoVO; |
| | | import com.consum.base.pojo.UseRecordSkuVO; |
| | | import com.consum.base.pojo.dto.GoodsInfoDTO; |
| | | import com.consum.base.pojo.dto.UseRecordDTO; |
| | | import com.consum.base.pojo.excel.TransferExcelTemplate; |
| | | import com.consum.base.pojo.query.TransferQry; |
| | |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.LGoodsUserRecordCoreService; |
| | | import com.consum.base.service.LWhFormTransferService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | 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; |
| | | import com.consum.model.po.LWhProcureModelUser; |
| | | import com.consum.model.po.LWhProcureModelUserRecord; |
| | | import com.iplatform.model.po.S_user_core; |
| | |
| | | private BaseWarehouseService baseWarehouseService; |
| | | @Autowired |
| | | private LGoodsUserRecordCoreService lGoodsUserRecordCoreService; |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | if (transferBusinessType == 1) { |
| | | // 先出库,再入库 |
| | | // 出库前 设置出库仓库 |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String agencyId = sysTenantUser.getTenantId(); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), (short)1, (short)1); |
| | | if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | return ResponseValue.error("机构无默认仓库!"); |
| | | } |
| | | BaseWarehouse baseWarehouse = baseWarehouseList.get(0); |
| | | Long wareHouseId = baseWarehouse.getId(); |
| | | String warehouseName = baseWarehouse.getWarehouseName(); |
| | | List<LWhProcureModel> modelByForm = lWhProcureModelService.getModelByForm(WhBusinessEnum.DIAOBO, id); |
| | | Set<Long> baseModelIds = |
| | | modelByForm.stream().map(LWhProcureModel::getBaseGoodsModelsId).collect(Collectors.toSet()); |
| | | |
| | | // TODO 不同库处理 |
| | | // 通过调拨单中的型号id查询出该型号物品所在的仓库位置 |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds); |
| | | GoodsInfoDTO goodsInfoDTO = goodsInfoDTOS.stream().findFirst().orElse(null); |
| | | |
| | | // FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | // String agencyId = sysTenantUser.getTenantId(); |
| | | // List<BaseWarehouse> baseWarehouseList = |
| | | // baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), (short)1, (short)1); |
| | | // if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | // return ResponseValue.error("机构无默认仓库!"); |
| | | // } |
| | | // BaseWarehouse baseWarehouse = baseWarehouseList.get(0); |
| | | |
| | | Long wareHouseId = goodsInfoDTO.getWarehouseId(); |
| | | String warehouseName = goodsInfoDTO.getWarehouseName(); |
| | | LWhFormTransfer lWhFormTransfer = new LWhFormTransfer(id); |
| | | lWhFormTransfer.setOutWarehouseId(wareHouseId); |
| | | lWhFormTransfer.setOutWarehouseName(warehouseName); |
| | |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @PostMapping("/output") |
| | | public ResponseValue output(Long id) { |
| | | |
| | | List<LWhProcureModel> modelByForm = lWhProcureModelService.getModelByForm(WhBusinessEnum.DIAOBO, id); |
| | | Set<Long> baseModelIds = |
| | | modelByForm.stream().map(LWhProcureModel::getBaseGoodsModelsId).collect(Collectors.toSet()); |
| | | |
| | | // TODO 不同库处理 |
| | | // 通过调拨单中的型号id查询出该型号物品所在的仓库位置 |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds); |
| | | GoodsInfoDTO goodsInfoDTO = goodsInfoDTOS.stream().findFirst().orElse(null); |
| | | // 出库前 设置出库仓库 |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String agencyId = sysTenantUser.getTenantId(); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), (short)1, (short)1); |
| | | if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | return ResponseValue.error("机构无默认仓库!"); |
| | | } |
| | | BaseWarehouse baseWarehouse = baseWarehouseList.get(0); |
| | | Long wareHouseId = baseWarehouse.getId(); |
| | | String warehouseName = baseWarehouse.getWarehouseName(); |
| | | // FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | // String agencyId = sysTenantUser.getTenantId(); |
| | | // List<BaseWarehouse> baseWarehouseList = |
| | | // baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), (short)1, (short)1); |
| | | // if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | // return ResponseValue.error("机构无默认仓库!"); |
| | | // } |
| | | |
| | | Long wareHouseId = goodsInfoDTO.getWarehouseId(); |
| | | String warehouseName = goodsInfoDTO.getWarehouseName(); |
| | | LWhFormTransfer lWhFormTransfer = new LWhFormTransfer(id); |
| | | lWhFormTransfer.setOutWarehouseId(wareHouseId); |
| | | lWhFormTransfer.setOutWarehouseName(warehouseName); |
| | |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import java.util.Arrays; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | |
| | | Object warehouseModelLockObj = LockManage.acquireLock(warehouseType, warehouseId, baseGoodsModelsId); |
| | | int goodsModelNum = 0; |
| | | synchronized (warehouseModelLockObj) { |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 2, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 2, null); |
| | | for (Map<String, Object> depFormScrappedModel : eachFfModelList) { |
| | | // 调拨单信息 |
| | | Long transBusinessId = (Long) depFormScrappedModel.get("TRANS_BUSINESS_ID"); |
| | |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import java.util.Arrays; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | |
| | | Object warehouseModelLockObj = LockManage.acquireLock(warehouseType, warehouseId, baseGoodsModelsId); |
| | | int goodsModelNum = 0; |
| | | synchronized (warehouseModelLockObj) { |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 2, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 2, null); |
| | | for (Map<String, Object> depFormScrappedModel : eachFfModelList) { |
| | | // 调拨单信息 |
| | | Long transBusinessId = (Long) depFormScrappedModel.get("TRANS_BUSINESS_ID"); |
| | |
| | | List<Map<String, Object>> scrappedAllGoodsList = new ArrayList<>(); |
| | | synchronized (warehouseModelLockObj) { |
| | | //查询期初数量 |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, inWarehouseId, baseGoodsModelsId, 1, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(inWarehouseId)); |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseIds, baseGoodsModelsId, 1, null); |
| | | for (Map<String, Object> depFormScrappedModel : eachFfModelList) { |
| | | scrappedAllGoodsList.addAll((List<Map<String, Object>>) depFormScrappedModel.get("scrappedGoodsList")); |
| | | } |
New file |
| | |
| | | package com.consum.base.core.type; |
| | | |
| | | public enum InAndOutPutType { |
| | | |
| | | /** |
| | | * 正常入库:0 |
| | | */ |
| | | Common(0), |
| | | /** |
| | | * 采购入库:1 |
| | | */ |
| | | Procure_Input(1), |
| | | |
| | | /** |
| | | * 零星入库 2 |
| | | */ |
| | | Fragmentary_Input(2), |
| | | |
| | | /** |
| | | * 零星出库 3 |
| | | */ |
| | | Fragmentary_Output(3), |
| | | |
| | | /** |
| | | * 调拨入库 4 |
| | | */ |
| | | Transfer_Input(4), |
| | | /** |
| | | * 调拨出库 5 |
| | | */ |
| | | Transfer_Output(5), |
| | | |
| | | /** |
| | | * 盘点入库 6 |
| | | */ |
| | | Inventory_Input(6), |
| | | |
| | | /** |
| | | * 盘点出库 7 |
| | | */ |
| | | Inventory_Output(7), |
| | | |
| | | /** |
| | | * 仓库物品报废 |
| | | */ |
| | | Scrapped_Warehouse(8), |
| | | |
| | | /** |
| | | * 在用物品报废 |
| | | */ |
| | | Scrapped_Using(9), |
| | | /** |
| | | * 机构仓库 分发出库 |
| | | */ |
| | | Lending_Out(10), |
| | | /** |
| | | * 机构仓库 分发返库 |
| | | */ |
| | | Lending_Back(11), |
| | | /** |
| | | * 部门仓库 分发出库 |
| | | */ |
| | | Dept_Lending_Out(12), |
| | | /** |
| | | * 部门仓库 分发返库 |
| | | */ |
| | | Dept_Lending_Back(13); |
| | | |
| | | private int value; |
| | | |
| | | InAndOutPutType(int value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public int getValue() { |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * 根据编码获取对应枚举 |
| | | * |
| | | * @param key 编码 |
| | | * @return |
| | | */ |
| | | public static InAndOutPutType getValueByKey(String key) { |
| | | for (InAndOutPutType myEnum : InAndOutPutType.values()) { |
| | | if (myEnum.name().equals(key)) { |
| | | return myEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.consum.base.core.type; |
| | | |
| | | /** |
| | | * 仓库类型 |
| | | * |
| | | * @author asus |
| | | * @version 2023/12/15 14:20 |
| | | **/ |
| | | public enum WareHouseType { |
| | | |
| | | /** |
| | | * 机构 |
| | | */ |
| | | TENANT(0, "机构"), |
| | | /** |
| | | * 部门 |
| | | */ |
| | | DEPARTMENT(1, "部门"); |
| | | |
| | | private Integer value; |
| | | |
| | | private String desc; |
| | | |
| | | WareHouseType(Integer value, String desc) { |
| | | this.value = value; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(Integer value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | } |
New file |
| | |
| | | package com.consum.base.pojo.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: 型号所在仓库信息 |
| | | * @date 2023/12/15 17:06 |
| | | */ |
| | | @Data |
| | | public class GoodsInfoDTO { |
| | | |
| | | private Long warehouseId; |
| | | private String warehouseName; |
| | | |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | this.simpleJdbcCall = new SimpleJdbcCall(jdbcTemplate).withCatalogName(dataBaseName).withProcedureName("InsertL_WH_GOODS"); |
| | | this.simpleJdbcCall = |
| | | new SimpleJdbcCall(jdbcTemplate).withCatalogName(dataBaseName).withProcedureName("InsertL_WH_GOODS"); |
| | | } |
| | | |
| | | @Autowired |
| | | public LWarehouseFlowCoreService(JdbcTemplate jdbcTemplate, LWarehouseFlowService lWarehouseFlowService, LWhGoodsService lWhGoodsService, |
| | | BaseGoodsTemplateService baseGoodsTemplateService, LWhGoodsRecordService lWhGoodsRecordServiceImpl) { |
| | | public LWarehouseFlowCoreService(JdbcTemplate jdbcTemplate, LWarehouseFlowService lWarehouseFlowService, |
| | | LWhGoodsService lWhGoodsService, BaseGoodsTemplateService baseGoodsTemplateService, |
| | | LWhGoodsRecordService lWhGoodsRecordServiceImpl) { |
| | | this.jdbcTemplate = jdbcTemplate; |
| | | this.lWarehouseFlowService = lWarehouseFlowService; |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | |
| | | * @param warehouseFlow |
| | | * @return |
| | | */ |
| | | public int buyInsertWareFlow(List<LWhProcureModel> goodsModelNumList, LWhFormProcure lWhFormProcure, LWarehouseFlow warehouseFlow) { |
| | | public int buyInsertWareFlow(List<LWhProcureModel> goodsModelNumList, LWhFormProcure lWhFormProcure, |
| | | LWarehouseFlow warehouseFlow) { |
| | | if (CollectionUtils.isEmpty(goodsModelNumList)) { |
| | | log.error("没有要入库的物品"); |
| | | return 0; |
| | |
| | | Long dealTime = warehouseFlow.getDealTime(); |
| | | BaseWarehouse baseWarehouses = lWarehouseFlowService.get(new BaseWarehouse(warehouseId)); |
| | | String warehouseName = baseWarehouses.getWarehouseName(); |
| | | //采购方式(1:集采;2=自采) |
| | | // 采购方式(1:集采;2=自采) |
| | | short buyType = lWhFormProcure.getBuyType().shortValue(); |
| | | //采购时间 |
| | | // 采购时间 |
| | | Long procureTime2 = lWhFormProcure.getProcureTime(); |
| | | Long procureTime = procureTime2 == null ? dealTime : procureTime2; |
| | | // 插入流水总表 |
| | |
| | | return 0; |
| | | } |
| | | |
| | | //统计各型号数量 |
| | | Map<Long, Integer> countsSumByBaseGoodsModelsId = goodsModelNumList.stream() |
| | | .collect(Collectors.groupingBy(LWhProcureModel::getBaseGoodsModelsId, |
| | | Collectors.summingInt(LWhProcureModel::getCounts))); |
| | | // 统计各型号数量 |
| | | Map<Long, Integer> countsSumByBaseGoodsModelsId = goodsModelNumList.stream().collect(Collectors |
| | | .groupingBy(LWhProcureModel::getBaseGoodsModelsId, Collectors.summingInt(LWhProcureModel::getCounts))); |
| | | Map<Long, List<LWhProcureModel>> sameModelList = goodsModelNumList.stream() |
| | | // 按型号分 |
| | | .collect(Collectors.groupingBy(LWhProcureModel::getBaseGoodsModelsId)); |
| | | // 按型号分 |
| | | .collect(Collectors.groupingBy(LWhProcureModel::getBaseGoodsModelsId)); |
| | | countsSumByBaseGoodsModelsId.forEach((baseGoodsModelsId, modelCount) -> { |
| | | //查询型号信息 |
| | | // 查询型号信息 |
| | | Map<String, Object> tempGoodsInfo = baseGoodsTemplateService.queryGoodsInfoByModelId(baseGoodsModelsId); |
| | | //价值类型 |
| | | String classificationObj = (String) tempGoodsInfo.get("classification"); |
| | | // 价值类型 |
| | | String classificationObj = (String)tempGoodsInfo.get("classification"); |
| | | Short classificationT = 3; |
| | | if (classificationObj != null) { |
| | | classificationT = (short) ((classificationObj).charAt(0) - 64); |
| | | 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"); |
| | | 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 = IdUtil.generateId(); |
| | |
| | | whGoodsRecord.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | whGoodsRecord.setBaseGoodsModelsName(modelName); |
| | | whGoodsRecord.setDealTime(dealTime); |
| | | //本次调整类型 1=调增;2=调减 |
| | | // 本次调整类型 1=调增;2=调减 |
| | | whGoodsRecord.setThisType(1); |
| | | |
| | | //通过LockManage获得锁 |
| | | // 通过LockManage获得锁 |
| | | Object warehouseModelLockObj = LockManage.acquireLock(warehouseType, warehouseId, baseGoodsModelsId); |
| | | synchronized (warehouseModelLockObj) { |
| | | // 获得锁后查询该型号的期初数量 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 1, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int goodsModelNum = |
| | | lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 1, null); |
| | | whGoodsRecord.setInitialCount(goodsModelNum); |
| | | whGoodsRecord.setThisCount(modelCount); |
| | | whGoodsRecord.setEndCount(goodsModelNum + modelCount); |
| | | |
| | | long totalPrice = 0; |
| | | //将同型号的物品插入 库存物品详情 |
| | | // 将同型号的物品插入 库存物品详情 |
| | | List<LWhProcureModel> lWhProcureModels = sameModelList.get(baseGoodsModelsId); |
| | | for (LWhProcureModel item : lWhProcureModels) { |
| | | //供应商 |
| | | // 供应商 |
| | | String supplier = item.getSupplier(); |
| | | //价格 |
| | | // 价格 |
| | | Long price = item.getPrice(); |
| | | //物品个数 |
| | | // 物品个数 |
| | | Integer counts = item.getCounts(); |
| | | totalPrice = totalPrice + counts * price; |
| | | sameGoodsInsertMore(warehouseFlowId, warehouseType, warehouseId, whGoodsRecordId, (short) 1, warehouseName, |
| | | classification, tempGoodsId, goodsName, baseGoodsModelsId, modelName, |
| | | supplier, buyType, goodsUnit, price, procureTime, 1, dealTime, counts); |
| | | } |
| | | ; |
| | | sameGoodsInsertMore(warehouseFlowId, warehouseType, warehouseId, whGoodsRecordId, (short)1, |
| | | warehouseName, classification, tempGoodsId, goodsName, baseGoodsModelsId, modelName, supplier, |
| | | buyType, goodsUnit, price, procureTime, 1, dealTime, counts); |
| | | } ; |
| | | whGoodsRecord.setTotalPrice(totalPrice); |
| | | } |
| | | lWhGoodsRecordServiceImpl.insert(whGoodsRecord); |
| | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 同样规格的物品 插入多次, 同时将主键记录在 进出库流水明细【L_WH_GOODS_RECORD_DETAILS】, 更新 物品仓库保管记录【L_GOODS_WH_RECORD】 |
| | | * |
| | | * @param pWarehouseId 仓库id |
| | | * @param pWarehouseName 仓库名称 |
| | | * @param pCostType 物品价值类型 |
| | | * @param pWarehouseId 仓库id |
| | | * @param pWarehouseName 仓库名称 |
| | | * @param pCostType 物品价值类型 |
| | | * @param pBaseGoodsTemplateId 物品模板ID |
| | | * @param pGoodsTemplateName 物品模板名称 |
| | | * @param pBaseGoodsModelsId 物品型号ID |
| | | * @param pGoodsTemplateName 物品模板名称 |
| | | * @param pBaseGoodsModelsId 物品型号ID |
| | | * @param pBaseGoodsModelsName 物品型号名称 |
| | | * @param pUnit 物品单位 |
| | | * @param pSupplier 物品供应商 |
| | | * @param pBuyType 物品购买类型 |
| | | * @param pPrice 物品价格 |
| | | * @param pProcureDate 采购日期 |
| | | * @param pStates 状态 |
| | | * @param pTimes 插入条数 |
| | | * @param pUnit 物品单位 |
| | | * @param pSupplier 物品供应商 |
| | | * @param pBuyType 物品购买类型 |
| | | * @param pPrice 物品价格 |
| | | * @param pProcureDate 采购日期 |
| | | * @param pStates 状态 |
| | | * @param pTimes 插入条数 |
| | | */ |
| | | public void sameGoodsInsertMore(long pWarehouseFlowId, Integer warehouseType, long pWarehouseId, long pWhGoodsRecordId, short pRecordType, |
| | | String pWarehouseName, short pCostType, |
| | | long pBaseGoodsTemplateId, String pGoodsTemplateName, long pBaseGoodsModelsId, |
| | | String pBaseGoodsModelsName, String pSupplier, short pBuyType, |
| | | String pUnit, long pPrice, long pProcureDate, |
| | | int pStates, long pDealTime, int pTimes) { |
| | | SqlParameterSource in = new MapSqlParameterSource() |
| | | .addValue("p_WAREHOUSE_FLOW_ID", pWarehouseFlowId) |
| | | .addValue("p_WAREHOUSE_TYPE", warehouseType) |
| | | .addValue("p_WAREHOUSE_ID", pWarehouseId) |
| | | .addValue("p_WH_GOODS_RECORD_ID", pWhGoodsRecordId) |
| | | .addValue("p_RECORD_TYPE", pRecordType) |
| | | .addValue("p_WAREHOUSE_NAME", pWarehouseName) |
| | | .addValue("p_COST_TYPE", pCostType) |
| | | .addValue("p_BASE_GOODS_TEMPLATE_ID", pBaseGoodsTemplateId) |
| | | .addValue("p_GOODS_TEMPLATE_NAME", pGoodsTemplateName) |
| | | .addValue("p_BASE_GOODS_MODELS_ID", pBaseGoodsModelsId) |
| | | .addValue("p_BASE_GOODS_MODELS_NAME", pBaseGoodsModelsName) |
| | | .addValue("p_SUPPLIER", pSupplier) |
| | | .addValue("p_BUY_TYPE", pBuyType) |
| | | .addValue("p_UNIT", pUnit) |
| | | .addValue("p_PRICE", pPrice) |
| | | .addValue("p_PROCURE_DATE", pProcureDate) |
| | | .addValue("p_STATES", pStates) |
| | | .addValue("p_DEAL_TIME", pDealTime) |
| | | .addValue("p_times", pTimes); |
| | | public void sameGoodsInsertMore(long pWarehouseFlowId, Integer warehouseType, long pWarehouseId, |
| | | long pWhGoodsRecordId, short pRecordType, String pWarehouseName, short pCostType, long pBaseGoodsTemplateId, |
| | | String pGoodsTemplateName, long pBaseGoodsModelsId, String pBaseGoodsModelsName, String pSupplier, |
| | | short pBuyType, String pUnit, long pPrice, long pProcureDate, int pStates, long pDealTime, int pTimes) { |
| | | SqlParameterSource in = new MapSqlParameterSource().addValue("p_WAREHOUSE_FLOW_ID", pWarehouseFlowId) |
| | | .addValue("p_WAREHOUSE_TYPE", warehouseType).addValue("p_WAREHOUSE_ID", pWarehouseId) |
| | | .addValue("p_WH_GOODS_RECORD_ID", pWhGoodsRecordId).addValue("p_RECORD_TYPE", pRecordType) |
| | | .addValue("p_WAREHOUSE_NAME", pWarehouseName).addValue("p_COST_TYPE", pCostType) |
| | | .addValue("p_BASE_GOODS_TEMPLATE_ID", pBaseGoodsTemplateId) |
| | | .addValue("p_GOODS_TEMPLATE_NAME", pGoodsTemplateName) |
| | | .addValue("p_BASE_GOODS_MODELS_ID", pBaseGoodsModelsId) |
| | | .addValue("p_BASE_GOODS_MODELS_NAME", pBaseGoodsModelsName).addValue("p_SUPPLIER", pSupplier) |
| | | .addValue("p_BUY_TYPE", pBuyType).addValue("p_UNIT", pUnit).addValue("p_PRICE", pPrice) |
| | | .addValue("p_PROCURE_DATE", pProcureDate).addValue("p_STATES", pStates).addValue("p_DEAL_TIME", pDealTime) |
| | | .addValue("p_times", pTimes); |
| | | Map<String, Object> out = simpleJdbcCall.execute(in); |
| | | System.out.println("Procedure result: " + out); |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.pojo.dto.GoodsInfoDTO; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.consum.base.pojo.dto.GoodsModelCountDTO; |
| | | import com.walker.jdbc.service.BaseService; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * LWhGoodsService |
| | |
| | | * @version 2023/12/05 13:52 |
| | | **/ |
| | | public interface LWhGoodsService extends BaseService { |
| | | int queryGoodsModelNum(Integer warehouseType, Long warehouseId, Long baseGoodsModelsId, Integer states, |
| | | |
| | | int queryGoodsModelNum(Integer warehouseType, List<Long> warehouseId, Long baseGoodsModelsId, Integer states, |
| | | Integer buyType); |
| | | |
| | | int queryGoodsModelInWareHouseNum(Integer warehouseType, List<Long> warehouseId, Long baseGoodsModelsId, Integer states, |
| | | Integer buyType); |
| | | int queryGoodsModelInWareHouseNum(Integer warehouseType, List<Long> warehouseId, Long baseGoodsModelsId, |
| | | Integer states, Integer buyType); |
| | | |
| | | List<Map<String, Object>> queryOutGoods(Integer warehouseType, Long warehouseId, Long baseGoodsModelsId, |
| | | Integer states, Integer buyType, Integer goodsModelNum); |
| | |
| | | * @return |
| | | */ |
| | | GoodsModelCountDTO queryGoodsAmount(Long baseGoodsModelsId, Integer type); |
| | | |
| | | List<GoodsInfoDTO> queryGoodsInfo(Set<Long> baseModelIds); |
| | | } |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | continue; |
| | | } |
| | | // 查询型号库存 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseIds, baseGoodsModelsId, 1, null); |
| | | LWhProcureModel model = new LWhProcureModel(); |
| | | model.setId(IdUtil.generateId()); |
| | | model.setFromProcureGoodsId(fromProcureGoodsId); |
| | |
| | | continue; |
| | | } |
| | | //根据物品型号查询物品库存 |
| | | int goodsNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int goodsNum = lWhGoodsService.queryGoodsModelNum(0, warehouseIds, baseGoodsModelsId, 1, null); |
| | | //新增L_WH_PROCURE_MODEL记录 |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(); |
| | | lWhProcureModel.setId(IdUtil.generateId()); |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | List<FormInventoryGoodsVO> goodsVOList = Lists.newArrayList(); |
| | | result.forEach(item -> { |
| | | FormInventoryGoodsVO baseGoodsModels = MapUtils.convertMapToObj(item, FormInventoryGoodsVO.class); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int inventoryCount = |
| | | this.lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModels.getId(), 1, null); |
| | | this.lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModels.getId(), 1, null); |
| | | baseGoodsModels.setInventoryCount(inventoryCount); |
| | | goodsVOList.add(baseGoodsModels); |
| | | }); |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | 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.type.InAndOutPutType; |
| | | import com.consum.base.core.type.OutPutStatesType; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | |
| | | private LWhGoodsRecordService lWhGoodsRecordServiceImpl; |
| | | |
| | | @Autowired |
| | | public LWhFormOutputCoreService(BaseGoodsTemplateService baseGoodsTemplateService, |
| | | LWhGoodsService lWhGoodsService, |
| | | CodeGeneratorService codeGeneratorService, |
| | | LWhProcureModelService lWhProcureModelService, |
| | | LWhFormOutputService lWhFormOutputService, |
| | | LWarehouseFlowService lWarehouseFlowService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordServiceImpl, |
| | | LWhWarningCoreServiceImpl lWhWarningCoreService) { |
| | | public LWhFormOutputCoreService(BaseGoodsTemplateService baseGoodsTemplateService, LWhGoodsService lWhGoodsService, |
| | | CodeGeneratorService codeGeneratorService, LWhProcureModelService lWhProcureModelService, |
| | | LWhFormOutputService lWhFormOutputService, LWarehouseFlowService lWarehouseFlowService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, LWhGoodsRecordService lWhGoodsRecordServiceImpl, |
| | | LWhWarningCoreServiceImpl lWhWarningCoreService) { |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | | this.lWhGoodsService = lWhGoodsService; |
| | | this.codeGeneratorService = codeGeneratorService; |
| | |
| | | this.lWhWarningCoreService = lWhWarningCoreService; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据 调拨单 生成 出库单 |
| | | * |
| | |
| | | * @return 出库单Id |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createOutFormByTransId(Long whFormTransferId, WhBusinessEnum businessEnum, S_user_core currentUser, Long dealTime) { |
| | | public Long createOutFormByTransId(Long whFormTransferId, WhBusinessEnum businessEnum, S_user_core currentUser, |
| | | Long dealTime) { |
| | | if (whFormTransferId == null) { |
| | | return null; |
| | | } |
| | |
| | | return outWarehouseFormIdT; |
| | | } |
| | | |
| | | //申请调拨的物品 |
| | | // 申请调拨的物品 |
| | | List<LWhProcureModel> goodsModelNumList = lWhProcureModelService.getModelByForm(businessEnum, whFormTransferId); |
| | | if (CollectionUtils.isEmpty(goodsModelNumList)) { |
| | | log.error("没有要入库的物品"); |
| | | throw new RuntimeException("没有要入库的物品"); |
| | | // return null; |
| | | // return null; |
| | | } |
| | | Long outWarehouseId = lWhFormTransfer.getOutWarehouseId(); |
| | | String outWarehouseName = lWhFormTransfer.getOutWarehouseName(); |
| | |
| | | whFormOutput.setId(outWarehouseFormId); |
| | | // 此时并没有出库 |
| | | whFormOutput.setWarehouseFlowId(null); |
| | | whFormOutput.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.OutPut_Warehouse)); |
| | | //进出库流水总表 入库单ID |
| | | whFormOutput |
| | | .setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.OutPut_Warehouse)); |
| | | // 进出库流水总表 入库单ID |
| | | whFormOutput.setInWarehouseFlowId(null); |
| | | // 调拨单ID(调拨时需要) |
| | | // 调拨单ID(调拨时需要) |
| | | whFormOutput.setTransBusinessId(whFormTransferId); |
| | | whFormOutput.setOutputCode(BaseWarehouseParam1.In_OutPutTypeEnum.Transfer_Output.getValue() + ""); |
| | | whFormOutput.setOutputCode(InAndOutPutType.Transfer_Output.getValue() + ""); |
| | | whFormOutput.setOutputName("调拨出库"); |
| | | whFormOutput.setWarehouseId(outWarehouseId); |
| | | whFormOutput.setWarehouseName(outWarehouseName); |
| | |
| | | return outWarehouseFormId; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据 出库单 出库 |
| | | * |
| | |
| | | * @return 流水记录总表ID |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long outFormByTransId(Long outWarehouseFormId, WhBusinessEnum businessType, S_user_core currentUser, Long dealTime, Long whFormTransferId) { |
| | | public Long outFormByTransId(Long outWarehouseFormId, WhBusinessEnum businessType, S_user_core currentUser, |
| | | Long dealTime, Long whFormTransferId) { |
| | | if (outWarehouseFormId == null) { |
| | | return null; |
| | | } |
| | |
| | | log.error("出库失败!请检查出库单状态"); |
| | | return null; |
| | | } |
| | | //申请调拨的物品 |
| | | List<LWhProcureModel> goodsModelNumList = lWhProcureModelService.getModelByForm(WhBusinessEnum.CHUKU, outWarehouseFormId); |
| | | // 申请调拨的物品 |
| | | List<LWhProcureModel> goodsModelNumList = |
| | | lWhProcureModelService.getModelByForm(WhBusinessEnum.CHUKU, outWarehouseFormId); |
| | | if (CollectionUtils.isEmpty(goodsModelNumList)) { |
| | | log.error("没有要出库的物品"); |
| | | return null; |
| | |
| | | |
| | | // 流水记录总表ID |
| | | long lWarehouseFlowId = NumberGenerator.getLongSequenceNumberNano(); |
| | | // 流水记录总表中 业务ID 。调拨单时 保存调拨单id 出库单时 保存出库单id |
| | | // 流水记录总表中 业务ID 。调拨单时 保存调拨单id 出库单时 保存出库单id |
| | | long lWarehouseFlowBusinessId = outWarehouseFormId; |
| | | |
| | | // 物品状态(0=在途调拨;1=入库未分发;2=已下发;3=报废) |
| | | Integer queryModelStatusT = 1; |
| | | //采购方式(1:集采;2=自采) |
| | | // 采购方式(1:集采;2=自采) |
| | | Integer buyTypeT = null; |
| | | Integer modGoodsTransferingStatusT = null; |
| | | short businessTypeValue = businessType.getValue(); |
| | | if (BaseWarehouseParam1.In_OutPutTypeEnum.Transfer_Output.getValue() == businessTypeValue) { |
| | | //调拨出库 |
| | | if (InAndOutPutType.Transfer_Output.getValue() == businessTypeValue) { |
| | | // 调拨出库 |
| | | queryModelStatusT = 1; |
| | | buyTypeT = 1; |
| | | lWarehouseFlowBusinessId = lWhFormOutput.getTransBusinessId(); |
| | | modGoodsTransferingStatusT = 0; |
| | | } else if (BaseWarehouseParam1.In_OutPutTypeEnum.Dept_Lending_Out.getValue() == businessTypeValue) { |
| | | // 部门仓库 分发出库 |
| | | // queryModelStatusT = 2; |
| | | } else if (InAndOutPutType.Dept_Lending_Out.getValue() == businessTypeValue) { |
| | | // 部门仓库 分发出库 |
| | | // queryModelStatusT = 2; |
| | | lWarehouseFlowBusinessId = lWhFormOutput.getTransBusinessId(); |
| | | } else if (BaseWarehouseParam1.In_OutPutTypeEnum.Fragmentary_Output.getValue() == businessTypeValue) { |
| | | // 零星出库 |
| | | } else if (InAndOutPutType.Fragmentary_Output.getValue() == businessTypeValue) { |
| | | // 零星出库 |
| | | queryModelStatusT = 1; |
| | | buyTypeT = null; |
| | | modGoodsTransferingStatusT = 4; |
| | | } else if (BaseWarehouseParam1.In_OutPutTypeEnum.Inventory_Output.getValue() == businessTypeValue) { |
| | | // 盘点出库 |
| | | } else if (InAndOutPutType.Inventory_Output.getValue() == businessTypeValue) { |
| | | // 盘点出库 |
| | | queryModelStatusT = 1; |
| | | buyTypeT = null; |
| | | modGoodsTransferingStatusT = 4; |
| | |
| | | // 需要调拨的物品的某个型号 |
| | | Long baseGoodsModelsId = itemModelInfo.getBaseGoodsModelsId(); |
| | | |
| | | //TODO 为空时不加入更新列表 |
| | | // TODO 为空时不加入更新列表 |
| | | if (baseGoodsModelsId != null) { |
| | | allChangModelList.add(baseGoodsModelsId); |
| | | } |
| | | // 需要调拨的物品某个型号的数量 |
| | | Integer counts = itemModelInfo.getCounts(); |
| | | |
| | | //查询型号信息 |
| | | // 查询型号信息 |
| | | Map<String, Object> tempGoodsInfo = baseGoodsTemplateService.queryGoodsInfoByModelId(baseGoodsModelsId); |
| | | //价值类型 |
| | | String classificationObj = (String) tempGoodsInfo.get("classification"); |
| | | // 价值类型 |
| | | String classificationObj = (String)tempGoodsInfo.get("classification"); |
| | | Short classificationT = 3; |
| | | if (classificationObj != null) { |
| | | classificationT = (short) ((classificationObj).charAt(0) - 64); |
| | | 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"); |
| | | 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(); |
| | |
| | | whGoodsRecord.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | whGoodsRecord.setBaseGoodsModelsName(modelName); |
| | | whGoodsRecord.setDealTime(dealTime); |
| | | //本次调整类型 1=调增;2=调减 |
| | | // 本次调整类型 1=调增;2=调减 |
| | | whGoodsRecord.setThisType(2); |
| | | whGoodsRecord.setThisCount(counts); |
| | | |
| | | //通过LockManage获得锁 |
| | | // 通过LockManage获得锁 |
| | | Object warehouseModelLockObj = LockManage.acquireLock(outWarehouseType, outWarehouseId, baseGoodsModelsId); |
| | | List<Long> outGoodsId = null; |
| | | synchronized (warehouseModelLockObj) { |
| | | // 获得锁后查询该型号的期初数量 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(outWarehouseType, outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(outWarehouseId)); |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(outWarehouseType, warehouseIds, |
| | | baseGoodsModelsId, queryModelStatus, buyType); |
| | | if (goodsModelNum < counts) { |
| | | log.error("出库失败!型号{} 的数量不足,需要调拨{}个,仓库中现存{}个", baseGoodsModelsId, counts, goodsModelNum); |
| | | // 手动回滚 |
| | |
| | | whGoodsRecord.setInitialCount(goodsModelNum); |
| | | whGoodsRecord.setEndCount(goodsModelNum - counts); |
| | | |
| | | //出库时候,按 先入库的先出库,同时入库的,按价格高的先出库 |
| | | outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseType, outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType, |
| | | counts); |
| | | lWhGoodsService.modGoodsTransfering(outGoodsId, inWarehouseType, inWarehouseId, inWarehouseName, modGoodsTransferingStatus); |
| | | // 出库时候,按 先入库的先出库,同时入库的,按价格高的先出库 |
| | | outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseType, outWarehouseId, baseGoodsModelsId, |
| | | queryModelStatus, buyType, counts); |
| | | lWhGoodsService.modGoodsTransfering(outGoodsId, inWarehouseType, inWarehouseId, inWarehouseName, |
| | | modGoodsTransferingStatus); |
| | | // 批量插入 进出库流水明细[L_WH_GOODS_RECORD_DETAILS] |
| | | lWhGoodsRecordDetailsService.sameGoodsInsertMore(outGoodsId, whGoodsRecordId, (short) 0); |
| | | lWhGoodsRecordDetailsService.sameGoodsInsertMore(outGoodsId, whGoodsRecordId, (short)0); |
| | | } |
| | | long totalAmount = lWhGoodsService.queryGoodsPriceById(outGoodsId); |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(itemModelInfo.getId()); |
| | |
| | | } |
| | | // 向出库单 插入 进出库流水总表ID |
| | | lWhFormOutput = new LWhFormOutput(outWarehouseFormId); |
| | | lWhFormOutput.setStates(2); |
| | | lWhFormOutput.setStates(OutPutStatesType.OUT_SUCCESS.getValue()); |
| | | lWhFormOutput.setWarehouseFlowId(lWarehouseFlowId); |
| | | lWhFormOutputService.update(lWhFormOutput); |
| | | |
| | | //当库存变动时调用该方法 |
| | | // 当库存变动时调用该方法 |
| | | if (outWarehouseType == 0) { |
| | | lWhWarningCoreService.updateKuCun(Convert.toShort(outWarehouseType, (short) 0), outWarehouseId, allChangModelList, null, dealTime); |
| | | lWhWarningCoreService.updateKuCun(Convert.toShort(outWarehouseType, (short)0), outWarehouseId, |
| | | allChangModelList, null, dealTime); |
| | | } |
| | | return lWarehouseFlowId; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | 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 org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | 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.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; |
| | |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.pojo.excel.OutputExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormOutputQry; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.*; |
| | | import com.consum.base.service.BaseGoodsModelsService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.LWhFormOutputService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormOutput; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.consum.model.po.WhFormOutput; |
| | | 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 lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @Description 出库单 |
| | |
| | | private LWhFormOutputCoreService lWhFormOutputCoreService; |
| | | @Autowired |
| | | private BaseGoodsModelsService baseGoodsModelsService; |
| | | @Resource |
| | | private LWhWarningCoreServiceImpl lWhWarningCoreService; |
| | | |
| | | private static String QUERY_FORM_OUTPUT_LIST = "SELECT * FROM l_wh_form_output WHERE 1 = 1"; |
| | | |
| | | /** |
| | |
| | | return 0; |
| | | } |
| | | lWhFormOutput.setWarehouseName(warehouse.getWarehouseName()); |
| | | lWhFormOutput.setOutputCode(BaseWarehouseParam1.In_OutPutTypeEnum.Fragmentary_Output.getValue() + ""); |
| | | lWhFormOutput.setOutputCode(InAndOutPutType.Fragmentary_Output.getValue() + ""); |
| | | lWhFormOutput.setOutputName("零星出库"); |
| | | lWhFormOutput.setAgencyId(Long.valueOf(sysInfo.getTenantId())); |
| | | lWhFormOutput.setAgencyName(sysInfo.getTenantName()); |
| | |
| | | lWhFormOutput.setDealTime(param.getDealTime()); |
| | | lWhFormOutput.setStates(OutPutStatesType.OUT_PENDING.getValue()); |
| | | lWhFormOutput.setOutputDoc(param.getDoc()); |
| | | int flag1 = this.insert(lWhFormOutput); |
| | | if (flag1 == 0) { |
| | | log.error("新增出库单记录"); |
| | | int outputInsertNum = this.insert(lWhFormOutput); |
| | | if (outputInsertNum == 0) { |
| | | log.error("新增出库单记录失败"); |
| | | return 0; |
| | | } |
| | | // 2.新增物品型号记录 |
| | |
| | | } |
| | | lWhProcureModel.setCounts(model.getCounts()); |
| | | // 根据物品型号查询物品库存 |
| | | int goodsNum = |
| | | this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, model.getBaseGoodsModelsId(), 1, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(WareHouseType.TENANT.getValue(), warehouseIds, |
| | | model.getBaseGoodsModelsId(), 1, null); |
| | | lWhProcureModel.setWorehouseCount(goodsNum); |
| | | modelList.add(lWhProcureModel); |
| | | } |
| | | } |
| | | int flag2 = this.lWhProcureModelService.insert(modelList); |
| | | if (flag2 != modelList.size()) { |
| | | int modelInsertNum = this.lWhProcureModelService.insert(modelList); |
| | | if (modelInsertNum != modelList.size()) { |
| | | log.error("新增物品型号失败"); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return 0; |
| | |
| | | return 0; |
| | | } |
| | | // 4 预警 |
| | | //当库存变动时调用该方法 |
| | | // lWhWarningCoreService.updateKuCun((short) 0, warehouseId, new ArrayList<>(allChangModelList), null, DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | |
| | | // 当库存变动时调用该方法 |
| | | // lWhWarningCoreService.updateKuCun((short) 0, warehouseId, new ArrayList<>(allChangModelList), null, |
| | | // DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | String modelName = (String)tempGoodsInfo.get("modelname"); |
| | | // 查询型号库存 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseIds, baseGoodsModelsId, 1, null); |
| | | LWhProcureModel model = new LWhProcureModel(); |
| | | model.setId(IdUtil.generateId()); |
| | | model.setFromProcureGoodsId(fromProcureGoodsId); |
| | |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import java.util.Arrays; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | int goodsModelNum = 0; |
| | | List<Long> srappedGoodsIds = null; |
| | | if (warehouseType == null || warehouseType == 0) { |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 1, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | 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); |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 2, null); |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | goodsModelNum = lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseIds, baseGoodsModelsId, 2, null); |
| | | } |
| | | |
| | | if (goodsModelNum < counts) { |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.utils.*; |
| | | import com.consum.base.pojo.LWhFormScrappedGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormScrappedGoodsModelParams; |
| | | import com.consum.base.pojo.LWhFormScrappedParam; |
| | | import com.consum.base.pojo.dto.GoodModelInfoDTO; |
| | | import com.consum.base.pojo.excel.ScrappedInfoExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormScrappedQry; |
| | | import com.consum.base.pojo.response.*; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.*; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | 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.LWhFormScrappedGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormScrappedGoodsModelParams; |
| | | import com.consum.base.pojo.LWhFormScrappedParam; |
| | | import com.consum.base.pojo.dto.GoodModelInfoDTO; |
| | | import com.consum.base.pojo.excel.ScrappedInfoExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormScrappedQry; |
| | | import com.consum.base.pojo.response.FormScrappedGoodsDetailVO; |
| | | import com.consum.base.pojo.response.GoodsModelVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateInfoVO; |
| | | import com.consum.base.pojo.response.LWhFormScrappedExtendVO; |
| | | import com.consum.base.service.BaseGoodsModelsService; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.FinSysTenantDepartmentService; |
| | | import com.consum.base.service.LWhFormScrappedGoodsService; |
| | | import com.consum.base.service.LWhFormScrappedService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.SDictDataServiceImpl; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantDepartment; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormScrapped; |
| | | import com.consum.model.po.LWhFormScrappedGoods; |
| | | import com.consum.model.po.SDictData; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | |
| | | /** |
| | | * @Description 报废单 |
| | |
| | | LWhFormScrappedGoods scrappedGoods = new LWhFormScrappedGoods(); |
| | | scrappedGoods.setId(IdUtil.generateId()); |
| | | // 根据物品型号查询物品库存 |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId)); |
| | | int goodsNum = |
| | | lWhGoodsService.queryGoodsModelNum(0, warehouseId, scrappedGoods.getBaseGoodsModelsId(), 1, null); |
| | | lWhGoodsService.queryGoodsModelNum(0, warehouseIds, scrappedGoods.getBaseGoodsModelsId(), 1, null); |
| | | if (params.getCounts() > goodsNum) { |
| | | log.error("报废数量大于库存数量"); |
| | | return 0; |
| | |
| | | } |
| | | } |
| | | // 3.根据报废单报废物品 |
| | | Long lWarehouseFlowId = this.lWhFormScrappedCoreService.outFormByTransId(lWhFormScrappedId, currentUser, param.getDealTime()); |
| | | Long lWarehouseFlowId = |
| | | this.lWhFormScrappedCoreService.outFormByTransId(lWhFormScrappedId, currentUser, param.getDealTime()); |
| | | if (lWarehouseFlowId == null) { |
| | | log.error("根据出库单出库 失败"); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | List<Long> outGoodsId = null; |
| | | synchronized (warehouseModelLockObj) { |
| | | // 获得锁后查询该型号的期初数量 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(outWarehouseType, outWarehouseId, |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(outWarehouseId)); |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(outWarehouseType, warehouseIds, |
| | | baseGoodsModelsId, queryModelStatus, buyType); |
| | | if (goodsModelNum < counts) { |
| | | log.error("出库失败!型号{} 的数量不足,需要调拨{}个,仓库中现存{}个", baseGoodsModelsId, counts, goodsModelNum); |
| | |
| | | throw new RuntimeException("入库单失败,未查询到物品!"); |
| | | } |
| | | // 获得锁后查询该型号的期初数量 |
| | | List<Long> warehouseIds = new ArrayList<>(Arrays.asList(inWarehouseId)); |
| | | int goodsModelNum = |
| | | lWhGoodsService.queryGoodsModelNum(inWarehouseType, inWarehouseId, baseGoodsModelsId, 1, null); |
| | | lWhGoodsService.queryGoodsModelNum(inWarehouseType, warehouseIds, baseGoodsModelsId, 1, null); |
| | | |
| | | // 库存物品详情(L_WH_GOODS)中 状态设置为1 |
| | | lWhGoodsService.modGoodsTransfering(outGoodsIds, inWarehouseType, inWarehouseId, inWarehouseName, |
| | |
| | | |
| | | lWhFormTransfer.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(codeGeneratorEnum)); |
| | | |
| | | Long warehouseId = param.getInWarehouseId(); |
| | | // 调拨类型单据 |
| | | if (businessType == TransferBusinessType.STOCK_TRANSFER.getValue()) { |
| | | // 入库仓库为当前用户的默认仓库 |
| | |
| | | if (finSysTenant == null) { |
| | | log.error("调拨机构不存在"); |
| | | } |
| | | lWhFormTransfer.setOutAgencyId(finSysTenant.getId()); |
| | | Long outAgencyId = finSysTenant.getId(); |
| | | lWhFormTransfer.setOutAgencyId(outAgencyId); |
| | | lWhFormTransfer.setOutAgencyName(finSysTenant.getName()); |
| | | lWhFormTransfer.setOperatorId(sysInfo.getId()); |
| | | lWhFormTransfer.setOperatorName(sysInfo.getUserName()); |
| | |
| | | if (businessType == TransferBusinessType.STOCK_TRANSFER.getValue()) { |
| | | lWhProcureModel.setBusinessType(2); |
| | | // 根据物品型号查询物品库存 |
| | | int goodsNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | // 调拨申请时没有仓库id 查询上级机构的所有仓库 |
| | | List<BaseWarehouse> baseWareHouseList = |
| | | 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); |
| | | lWhProcureModel.setWorehouseCount(goodsNum); |
| | | } |
| | | if (businessType == TransferBusinessType.DEPARTMENT_PROCURE.getValue()) { |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | |
| | | |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.pojo.dto.GoodsInfoDTO; |
| | | import com.consum.base.pojo.dto.GoodsModelCountDTO; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | |
| | | private static String query_Goods_Model_Num = "SELECT COUNT(1) from L_WH_GOODS where 1=1"; |
| | | |
| | | @Override |
| | | public int queryGoodsModelNum(Integer warehouseType, Long warehouseId, Long baseGoodsModelsId, Integer states, |
| | | public int queryGoodsModelNum(Integer warehouseType, List<Long> warehouseId, Long baseGoodsModelsId, Integer states, |
| | | Integer buyType) { |
| | | StringBuilder sql = new StringBuilder(query_Goods_Model_Num); |
| | | Map<String, Object> paramts = new HashMap<>(); |
| | |
| | | paramts.put("warehouseType", warehouseType); |
| | | } |
| | | if (warehouseId != null) { |
| | | sql.append(" and WAREHOUSE_ID=:warehouseId"); |
| | | sql.append(" and WAREHOUSE_ID in (:warehouseId)"); |
| | | paramts.put("warehouseId", warehouseId); |
| | | } |
| | | if (baseGoodsModelsId != null) { |
| | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<GoodsInfoDTO> queryGoodsInfo(Set<Long> baseModelIds) { |
| | | |
| | | 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"); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("baseGoodsModelsIds", baseModelIds); |
| | | List<Map<String, Object>> result = this.select(sql.toString(), param, new MapperUtil()); |
| | | result.forEach(item -> { |
| | | GoodsInfoDTO goodsInfoDTO = MapUtils.convertMapToObj(item, GoodsInfoDTO.class); |
| | | goodsInfoDTOS.add(goodsInfoDTO); |
| | | }); |
| | | return goodsInfoDTOS; |
| | | } |
| | | } |
| | |
| | | public List<LWhProcureModel> getModelByForm(WhBusinessEnum businessType, Long businessId) { |
| | | StringBuilder sql = new StringBuilder(GET_MODEL_BY_FORM); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | // 项目阶段id |
| | | if (businessType != null) { |
| | | sql.append(" and BUSINESS_TYPE=:businessType "); |
| | | paramts.put("businessType", businessType.getValue()); |
| | |
| | | public List<Map<String, Object>> getFfOrderByGoodsIdAndDept(Long goodsTemplateId, Long departmentId) { |
| | | StringBuilder sql = new StringBuilder(GET_FF_ORDER_BY_GOODS_ID_AND_DEPT); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | // 项目阶段id |
| | | if (goodsTemplateId != null) { |
| | | sql.append(" AND baseTemp.ID=:goodsTemplateId "); |
| | | paramts.put("goodsTemplateId", goodsTemplateId); |