| | |
| | | package com.consum.base.controller; |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.pojo.*; |
| | | import com.consum.base.service.BaseCategoryServiceImpl; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.pojo.LWhFormOutputExtend; |
| | | import com.consum.base.pojo.LWhFormOutputInsertParam; |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.service.LWhFormOutputServiceImpl; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.*; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormOutput; |
| | | 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.web.ResponseValue; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Description 出库单 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/27 |
| | | */ |
| | | @Api(value = "出库单", tags = "出库单") |
| | | @RestController |
| | | @RequestMapping("/pc/l/wh/form/output") |
| | | public class LWhFormOutputController extends BaseController { |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/27 |
| | | */ |
| | | @ApiOperation(value = "新增出库单", notes = "新增出库单") |
| | | // @ApiImplicitParam(name = "param", value = "出库单实体", required = true, dataType = "LWhFormOutputInsertParam") |
| | | @PostMapping("/add") |
| | | public ResponseValue add(@RequestBody LWhFormOutputInsertParam param) { |
| | | public ResponseValue add() { |
| | | LWhFormOutputInsertParam param = CommonUtil.getObjFromReqBody(LWhFormOutputInsertParam.class); |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | int result = this.lWhFormOutputService.add(param, currentUser,this.getSysInfo()); |
| | | if (result > 0) return ResponseValue.success(1); |
| | | int result = this.lWhFormOutputService.add(param, currentUser, this.getSysInfo()); |
| | | if (result > 0) { |
| | | return ResponseValue.success(1); |
| | | } |
| | | return ResponseValue.error("新增失败!"); |
| | | } |
| | | |
| | | /** |
| | | * @Description 列表查询 |
| | | */ |
| | | @ApiOperation(value = "列表查询", notes = "列表查询") |
| | | @ApiImplicitParam(name = "param", value = "出库单实体", required = true, dataType = "LWhFormOutputParam") |
| | | @GetMapping("/list") |
| | | public ResponseValue queryFormOutputList(LWhFormOutputParam param) { |
| | | public ResponseValue queryFormOutputList() { |
| | | LWhFormOutputParam param = CommonUtil.getObjFromReq(LWhFormOutputParam.class); |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description 根据仓库id和型号id 查询库存 |
| | | * @Description 根据仓库id和型号id 查询库存 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/11/2 |
| | | */ |
| | | @GetMapping("/select/number") |
| | | public ResponseValue selectNumber(Long warehouseId,Long baseGoodsModelsId) { |
| | | public ResponseValue selectNumber(Long warehouseId, Long baseGoodsModelsId) { |
| | | if (warehouseId == null || baseGoodsModelsId == null) { |
| | | return ResponseValue.error("参数错误"); |
| | | } |
| | | int num = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, (short) 1,null); |
| | | int num = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, (short) 1, null); |
| | | return ResponseValue.success(num); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | * @Description 列表查询 |
| | | */ |
| | | @ApiOperation(value = "采购单列表查询", notes = "采购单列表查询") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "采购查询条件", required = true, dataType = "FormProcureQryDto", paramType = "query")}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param", value = "采购查询条件", required = true, dataType = "FormProcureQryDto", paramType = "query") |
| | | }) |
| | | @GetMapping("/list") |
| | | public ResponseValue queryFormProcureList(FormProcureQryDto param) { |
| | | S_user_core currentUser = this.getCurrentUser(); |
New file |
| | |
| | | package com.consum.base.pojo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: 出库物品型号 |
| | | * @date 2023/11/13 11:29 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "出库物品型号") |
| | | public class LWFormsOutputGoodsModelParam { |
| | | |
| | | //规格型号编号 |
| | | @ApiModelProperty(value = "规格型号编号") |
| | | private Long baseGoodsModelsId; |
| | | // 计量单位 |
| | | @ApiModelProperty(value = "计量单位") |
| | | private String baseUnit; |
| | | //库存数量 |
| | | @ApiModelProperty(value = "库存数量") |
| | | private Long warehouseNum; |
| | | //数量 |
| | | @ApiModelProperty(value = "操作数量") |
| | | private Integer counts; |
| | | |
| | | @ApiModelProperty(value = "采购类型") |
| | | private Integer procureModelBusinessType; |
| | | |
| | | } |
New file |
| | |
| | | package com.consum.base.pojo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/11/2 |
| | | */ |
| | | @ApiModel(value = "记录物品信息和规格型号") |
| | | @Data |
| | | public class LWFormsOutputGoodsParam { |
| | | |
| | | |
| | | /** |
| | | * 物品id |
| | | */ |
| | | @ApiModelProperty(value = "物品id") |
| | | private Long baseGoodsTemplateId; |
| | | /** |
| | | * 物品模版名称 |
| | | */ |
| | | @ApiModelProperty(value = "物品模版名称") |
| | | private String goodsTemplateName; |
| | | |
| | | /** |
| | | * 分类id |
| | | */ |
| | | @ApiModelProperty(value = "分类id") |
| | | private Long baseCategoryId; |
| | | |
| | | /** |
| | | * 记录物品信息和规格型号 |
| | | */ |
| | | private List<LWFormsOutputGoodsModelParam> models; |
| | | |
| | | } |
| | |
| | | package com.consum.base.pojo; |
| | | |
| | | import com.walker.web.param.ParamRequest; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Description 新增出库单参数 |
| | | * @Description 新增出库单参数 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/27 |
| | | */ |
| | | @ApiModel(value = "LWhFormOutputInsertParam") |
| | | @Data |
| | | public class LWhFormOutputInsertParam extends ParamRequest { |
| | | |
| | | /** |
| | | * 仓库id |
| | | */ |
| | | @ApiModelProperty(value = "仓库id") |
| | | private Long warehouseId; |
| | | /** |
| | | * 出库时间 |
| | | */ |
| | | @ApiModelProperty(value = "出库时间") |
| | | private Long dealTime; |
| | | /** |
| | | * 出库手续 |
| | | */ |
| | | @ApiModelProperty(value = "出库手续") |
| | | private String procureDoc; |
| | | /** |
| | | * 记录物品信息和规格型号 |
| | | */ |
| | | private List<LWhFormOutputGoodsParams> goods; |
| | | @ApiModelProperty(value = "记录物品信息和规格型号") |
| | | private List<LWFormsOutputGoodsParam> goods; |
| | | |
| | | |
| | | |
| | | public Long getWarehouseId() { |
| | | return warehouseId; |
| | | } |
| | | |
| | | public void setWarehouseId(Long warehouseId) { |
| | | this.warehouseId = warehouseId; |
| | | } |
| | | |
| | | public Long getDealTime() { |
| | | return dealTime; |
| | | } |
| | | |
| | | public void setDealTime(Long dealTime) { |
| | | this.dealTime = dealTime; |
| | | } |
| | | |
| | | public List<LWhFormOutputGoodsParams> getGoods() { |
| | | return goods; |
| | | } |
| | | |
| | | public void setGoods(List<LWhFormOutputGoodsParams> goods) { |
| | | this.goods = goods; |
| | | } |
| | | } |
| | |
| | | import com.consum.model.po.LWhProcureModelUser; |
| | | import com.consum.model.po.LWhProcureModelUserRecord; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName LGoodsUserRecordCoreService |
| | |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class LGoodsUserRecordCoreService { |
| | | |
| | | @Resource |
| | | private GoodsBaseServiceImpl goodsBaseService; |
| | | @Resource |
| | |
| | | Long inWarehouseId = whFormTransfer.getInWarehouseId(); |
| | | // 将所有物品设置为未分发 |
| | | List<Long> srappedGoodsIds = lWhGoodsService.queryScrappedGoodsIds(inWarehouseType, inWarehouseId, transBusinessId, null, null, null, null); |
| | | lWhGoodsService.modGoodsTransfering(srappedGoodsIds, null, null, null, (short) 3); |
| | | lWhGoodsService.modGoodsTransfering(srappedGoodsIds, null, null, null, 3); |
| | | // 设置旧的LAST_RECORD= 0 |
| | | lGoodsUserRecordService.updSetNotLast(srappedGoodsIds); |
| | | //插入新的 |
| | |
| | | //通过LockManage获得锁 |
| | | Object warehouseModelLockObj = LockManage.acquireLock(inWarehouseType, inWarehouseId, baseGoodsModelsId); |
| | | synchronized (warehouseModelLockObj) { |
| | | List<Long> toUserGoodsIds = lWhGoodsService.queryScrappedGoodsIds(inWarehouseType, inWarehouseId, transBusinessId, null, baseGoodsModelsId, (short) 1, goodsNum); |
| | | List<Long> toUserGoodsIds = lWhGoodsService.queryScrappedGoodsIds(inWarehouseType, inWarehouseId, transBusinessId, null, baseGoodsModelsId, |
| | | (short) 1, goodsNum); |
| | | if (CollectionUtils.isEmpty(toUserGoodsIds)) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | throw new RuntimeException("操作失败!型号数量不足"); |
| | |
| | | tmp.setLastRecord(1); |
| | | goodsUserRecords.add(tmp); |
| | | } |
| | | lWhGoodsService.modGoodsTransfering(toUserGoodsIds, null, null, null, (short) 2); |
| | | lWhGoodsService.modGoodsTransfering(toUserGoodsIds, null, null, null, 2); |
| | | lGoodsUserRecordService.insertBatch(goodsUserRecords); |
| | | } |
| | | } |
| | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.param.BaseWarehouseParam1; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.model.po.*; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhFormOutput; |
| | | import com.consum.model.po.LWhFormTransfer; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName WhFormOutputCoreService |
| | |
| | | |
| | | @Autowired |
| | | public LWhFormOutputCoreService(BaseGoodsTemplateServiceImpl baseGoodsTemplateService, |
| | | LWhGoodsService lWhGoodsService, |
| | | CodeGeneratorService codeGeneratorService, |
| | | LWhProcureModelService lWhProcureModelService, |
| | | LWhFormOutputService lWhFormOutputService, |
| | | LWarehouseFlowService lWarehouseFlowService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordService) { |
| | | LWhGoodsService lWhGoodsService, |
| | | CodeGeneratorService codeGeneratorService, |
| | | LWhProcureModelService lWhProcureModelService, |
| | | LWhFormOutputService lWhFormOutputService, |
| | | LWarehouseFlowService lWarehouseFlowService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordService) { |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | | this.lWhGoodsService = lWhGoodsService; |
| | | this.codeGeneratorService = codeGeneratorService; |
| | |
| | | short queryModelStatusT = 1; |
| | | //采购方式(1:集采;2=自采) |
| | | Short buyTypeT = null; |
| | | Short modGoodsTransferingStatusT = null; |
| | | Integer modGoodsTransferingStatusT = null; |
| | | String outputCode = lWhFormOutput.getOutputCode(); |
| | | if ((BaseWarehouseParam1.In_OutPutTypeEnum.Transfer_Output.getValue() + "").equals(outputCode)) { |
| | | //调拨出库 |
| | |
| | | } |
| | | short queryModelStatus = queryModelStatusT; |
| | | Short buyType = buyTypeT; |
| | | Short modGoodsTransferingStatus = modGoodsTransferingStatusT; |
| | | Integer modGoodsTransferingStatus = modGoodsTransferingStatusT; |
| | | |
| | | goodsModelNumList.forEach(itemModelInfo -> { |
| | | // 需要调拨的物品的某个型号 |
| | |
| | | whGoodsRecord.setEndCount(goodsModelNum - counts); |
| | | |
| | | //出库时候,按 先入库的先出库,同时入库的,按价格高的先出库 |
| | | List<Long> outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseType, outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType, goodsModelNum); |
| | | List<Long> outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseType, outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType, |
| | | goodsModelNum); |
| | | lWhGoodsService.modGoodsTransfering(outGoodsId, inWarehouseType, inWarehouseId, inWarehouseName, modGoodsTransferingStatus); |
| | | // 批量插入 进出库流水明细[L_WH_GOODS_RECORD_DETAILS] |
| | | lWhGoodsRecordDetailsService.sameGoodsInsertMore(outGoodsId, whGoodsRecordId, (short) 0); |
| | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.param.BaseWarehouseParam1; |
| | | import com.consum.base.pojo.*; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.model.po.*; |
| | | import com.consum.base.pojo.LWFormsOutputGoodsModelParam; |
| | | import com.consum.base.pojo.LWFormsOutputGoodsParam; |
| | | import com.consum.base.pojo.LWhFormOutputInsertParam; |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | 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.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description 出库单 |
| | |
| | | private BaseGoodsModelsServiceImpl baseGoodsModelsService; |
| | | |
| | | private static String QUERY_FORM_OUTPUT_LIST = "SELECT * FROM l_wh_form_output WHERE 1 = 1"; |
| | | |
| | | |
| | | // /** |
| | | // * @Description 新增出库单 |
| | |
| | | return 0; |
| | | } |
| | | //2.新增物品型号记录 |
| | | List<LWhFormOutputGoodsParams> goodsList = param.getGoods(); |
| | | List<LWFormsOutputGoodsParam> goodsList = param.getGoods(); |
| | | List<LWhProcureModel> modelList = new ArrayList<>(); |
| | | for (LWhFormOutputGoodsParams goods : goodsList) { |
| | | List<LWhProcureModelParams> models = goods.getModels(); |
| | | for (LWhProcureModelParams model : models) { |
| | | for (LWFormsOutputGoodsParam goods : goodsList) { |
| | | List<LWFormsOutputGoodsModelParam> models = goods.getModels(); |
| | | for (LWFormsOutputGoodsModelParam model : models) { |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(); |
| | | lWhProcureModel.setId(IdUtil.generateId()); |
| | | lWhProcureModel.setBusinessType(3); |
| | |
| | | } |
| | | lWhProcureModel.setCounts(model.getCounts()); |
| | | //根据物品型号查询物品库存 |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0,warehouseId, model.getBaseGoodsModelsId(), (short) 1, null); |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, model.getBaseGoodsModelsId(), (short) 1, null); |
| | | lWhProcureModel.setWorehouseCount(goodsNum); |
| | | modelList.add(lWhProcureModel); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description 列表查询 |
| | | * @Description 列表查询 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | |
| | | } |
| | | //物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append(" AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=1 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)"); |
| | | sql.append( |
| | | " AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=1 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)"); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //机构 |
| | | if (param.getAgencyId() != null){ |
| | | if (param.getAgencyId() != null) { |
| | | sql.append(" and AGENCY_ID like :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //创建人 |
| | | if (!StringUtils.isEmpty(param.getOperatorName())) { |
| | |
| | | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.model.po.*; |
| | | 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 com.walker.infrastructure.utils.NumberGenerator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @ClassName LWhFormScrappedCoreService |
| | |
| | | @Service |
| | | @Slf4j |
| | | public class LWhFormScrappedCoreService { |
| | | |
| | | private GoodsBaseServiceImpl goodsBaseService; |
| | | private LWhFormScrappedGoodsService lWhFormScrappedGoodsService; |
| | | private BaseGoodsTemplateServiceImpl baseGoodsTemplateService; |
| | |
| | | |
| | | @Autowired |
| | | public LWhFormScrappedCoreService(GoodsBaseServiceImpl goodsBaseService, |
| | | LWhFormScrappedGoodsService lWhFormScrappedGoodsService, |
| | | BaseGoodsTemplateServiceImpl baseGoodsTemplateService, |
| | | LWhGoodsService lWhGoodsService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordService, |
| | | LWarehouseFlowService lWarehouseFlowService) { |
| | | LWhFormScrappedGoodsService lWhFormScrappedGoodsService, |
| | | BaseGoodsTemplateServiceImpl baseGoodsTemplateService, |
| | | LWhGoodsService lWhGoodsService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordService, |
| | | LWarehouseFlowService lWarehouseFlowService) { |
| | | // this.lWhFormScrappedService = lWhFormScrappedService; |
| | | this.lWhFormScrappedGoodsService = lWhFormScrappedGoodsService; |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | |
| | | } |
| | | |
| | | // 按型号分组 |
| | | Map<Long, List<LWhFormScrappedGoods>> modelGroup = formScrappedGoods.stream().collect(Collectors.groupingBy(LWhFormScrappedGoods::getBaseGoodsModelsId)); |
| | | Map<Long, List<LWhFormScrappedGoods>> modelGroup = formScrappedGoods.stream() |
| | | .collect(Collectors.groupingBy(LWhFormScrappedGoods::getBaseGoodsModelsId)); |
| | | for (Map.Entry<Long, List<LWhFormScrappedGoods>> entry : modelGroup.entrySet()) { |
| | | //规格型号编号 |
| | | Long baseGoodsModelsId = entry.getKey(); |
| | |
| | | //使用人员名称 |
| | | String userName = formScrappedGood.getUserName(); |
| | | // 根据分发单、规格型号编号、使用人员名称,进行报废 |
| | | srappedGoodsIds = lWhGoodsService.queryScrappedGoodsIds(warehouseType, warehouseId, transBusinessId, userName, baseGoodsModelsId, (short) 2, counts); |
| | | srappedGoodsIds = lWhGoodsService.queryScrappedGoodsIds(warehouseType, warehouseId, transBusinessId, userName, baseGoodsModelsId, |
| | | (short) 2, counts); |
| | | } |
| | | if (CollectionUtils.isEmpty(srappedGoodsIds) || srappedGoodsIds.size() < counts) { |
| | | log.error("要报废的物品数量不足!"); |
| | |
| | | whGoodsRecord.setEndCount(goodsModelNum - counts); |
| | | |
| | | // 设置物品为报废状态 |
| | | lWhGoodsService.modGoodsTransfering(srappedGoodsIds, null, null, null, (short) 3); |
| | | lWhGoodsService.modGoodsTransfering(srappedGoodsIds, null, null, null, 3); |
| | | // 批量插入 进出库流水明细[L_WH_GOODS_RECORD_DETAILS] |
| | | lWhGoodsRecordDetailsService.sameGoodsInsertMore(srappedGoodsIds, whGoodsRecordId, (short) 2); |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.model.po.*; |
| | | import com.consum.model.po.LGoodsUserRecord; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhFormTransfer; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.consum.model.po.LWhGoodsRecordDetails; |
| | | import com.consum.model.po.LWhProcureModelUser; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | /** |
| | | * @ClassName LWhFormTransferCoreService |
| | |
| | | @Slf4j |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class LWhFormTransferCoreService { |
| | | |
| | | @Resource |
| | | private LWhFormTransferServiceImpl lWhFormTransferService; |
| | | @Resource |
| | |
| | | //单据类型。0仓库调拨;1部门分发;2部门物品回退 |
| | | Integer businessType = lWhFormTransfer.getBusinessType(); |
| | | //状态(0=在途调拨;1=入库未分发;2=已下发;3=报废 4 零星出库) |
| | | short goodsStatus = 1; |
| | | Integer goodsStatus = 1; |
| | | //类型0分发使用1 反库 |
| | | Integer recordType = null; |
| | | if (businessType == 1) { |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.model.po.LWhGoods; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @ClassName LWhGoodsService |
| | |
| | | * @param goodsModelNum 取出的数量 |
| | | * @return |
| | | */ |
| | | private static String QUERY_OUT_GOODS_ID = "SELECT*FROM L_WH_GOODS WHERE 1=1"; |
| | | private static String QUERY_OUT_GOODS_ID = "SELECT * FROM L_WH_GOODS WHERE 1=1"; |
| | | |
| | | public List<Map<String, Object>> queryOutGoods(Integer warehouseType, Long warehouseId, Long baseGoodsModelsId, Short states, Short buyType, Integer goodsModelNum) { |
| | | public List<Map<String, Object>> queryOutGoods(Integer warehouseType, Long warehouseId, Long baseGoodsModelsId, Short states, Short buyType, |
| | | Integer goodsModelNum) { |
| | | StringBuilder sql = new StringBuilder(QUERY_OUT_GOODS_ID); |
| | | Map<String, Object> paramts = new HashMap<>(); |
| | | if (warehouseType != null) { |
| | |
| | | paramts.put("warehouseId", warehouseId); |
| | | } |
| | | if (baseGoodsModelsId != null) { |
| | | sql.append(" and BASE_GOODS_TEMPLATE_ID=:baseGoodsModelsId"); |
| | | sql.append(" and BASE_GOODS_MODELS_ID=:baseGoodsModelsId"); |
| | | paramts.put("baseGoodsModelsId", baseGoodsModelsId); |
| | | } |
| | | if (states != null) { |
| | |
| | | sql.append(" and BUY_TYPE=:buyType"); |
| | | paramts.put("buyType", buyType); |
| | | } |
| | | return select(sql.append(" limit").append(goodsModelNum).toString(), paramts); |
| | | return select(sql.append(" limit ").append(goodsModelNum).toString(), paramts); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 查询报废物品 |
| | | * 默认优先报废最高价的物品 |
| | | * 查询报废物品 默认优先报废最高价的物品 |
| | | * |
| | | * @param warehouseType |
| | | * @param warehouseId |
| | |
| | | private static String QUERY_SCRAPPED_GOODS_END = " ORDER BY goods.PRICE DESC,goods.PROCURE_DATE ASC,goods.id"; |
| | | |
| | | public List<Map<String, Object>> queryScrappedGoods(Integer warehouseType, |
| | | Long warehouseId, |
| | | Long transBusinessId, |
| | | String nowUserName, |
| | | Long baseGoodsModelsId, |
| | | Short states, |
| | | Integer goodsModelNum) { |
| | | Long warehouseId, |
| | | Long transBusinessId, |
| | | String nowUserName, |
| | | Long baseGoodsModelsId, |
| | | Short states, |
| | | Integer goodsModelNum) { |
| | | if (warehouseType == null) { |
| | | warehouseType = 0; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询报废物品 |
| | | * 默认优先报废最高价的物品 |
| | | * 查询报废物品 默认优先报废最高价的物品 |
| | | * |
| | | * @param warehouseType |
| | | * @param warehouseId |
| | |
| | | * @return |
| | | */ |
| | | public List<Long> queryScrappedGoodsIds(Integer warehouseType, |
| | | Long warehouseId, |
| | | Long transBusinessId, |
| | | String nowUserName, |
| | | Long baseGoodsModelsId, |
| | | Short states, |
| | | Integer goodsModelNum) { |
| | | List<Map<String, Object>> outGoods = queryScrappedGoods(warehouseType, warehouseId, transBusinessId, nowUserName, baseGoodsModelsId, states, goodsModelNum); |
| | | Long warehouseId, |
| | | Long transBusinessId, |
| | | String nowUserName, |
| | | Long baseGoodsModelsId, |
| | | Short states, |
| | | Integer goodsModelNum) { |
| | | List<Map<String, Object>> outGoods = queryScrappedGoods(warehouseType, warehouseId, transBusinessId, nowUserName, baseGoodsModelsId, states, |
| | | goodsModelNum); |
| | | if (CollectionUtils.isEmpty(outGoods)) { |
| | | return null; |
| | | } |
| | |
| | | * @param toWarehouseName |
| | | * @return |
| | | */ |
| | | private static String MOD_GOODS_TRANSFERING_PREFIX = "update L_WH_GOODS set"; |
| | | private static String MOD_GOODS_TRANSFERING_PREFIX = "update L_WH_GOODS set "; |
| | | |
| | | public int modGoodsTransfering(List<Long> whGoods, Integer warehouseType, Long toWarehouseId, String toWarehouseName, Short states) { |
| | | StringBuilder sql = new StringBuilder(MOD_GOODS_TRANSFERING_PREFIX); |
| | | ArrayList<Object> params = new ArrayList<>(); |
| | | if (toWarehouseId != null) { |
| | | sql.append(", WAREHOUSE_TYPE=?"); |
| | | params.add(warehouseType); |
| | | } |
| | | if (toWarehouseId != null) { |
| | | sql.append(", WAREHOUSE_ID=?"); |
| | | params.add(toWarehouseId); |
| | | } |
| | | if (toWarehouseName != null) { |
| | | sql.append(", WAREHOUSE_NAME=?"); |
| | | params.add(toWarehouseName); |
| | | } |
| | | if (states != null) { |
| | | sql.append(", STATES=?"); |
| | | params.add(states); |
| | | } |
| | | sql.deleteCharAt(22); |
| | | sql.append(" where id in(?)"); |
| | | params.add(whGoods); |
| | | return update(sql.toString(), params.toArray()); |
| | | public int modGoodsTransfering(List<Long> whGoods, Integer warehouseType, Long toWarehouseId, String toWarehouseName, Integer states) { |
| | | |
| | | List<LWhGoods> params = new ArrayList<>(); |
| | | whGoods.stream().forEach(id -> { |
| | | LWhGoods lWhGoods = new LWhGoods(); |
| | | lWhGoods.setId(id); |
| | | if (toWarehouseId != null) { |
| | | lWhGoods.setWarehouseType(warehouseType); |
| | | } |
| | | if (toWarehouseId != null) { |
| | | lWhGoods.setWarehouseId(toWarehouseId); |
| | | } |
| | | if (toWarehouseName != null) { |
| | | lWhGoods.setWarehouseName(toWarehouseName); |
| | | } |
| | | if (states != null) { |
| | | lWhGoods.setStates(states); |
| | | } |
| | | params.add(lWhGoods); |
| | | }); |
| | | return updateBatch(params); |
| | | } |
| | | |
| | | } |