| | |
| | | package com.consum.base.controller; |
| | | |
| | | import com.consum.base.BaseController; |
| | | 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.pojo.LWhFormTransferGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormTransferParam; |
| | | import com.consum.base.pojo.LWhProcureModelParams; |
| | | import com.consum.base.pojo.ProcureModelInfoDto; |
| | | import com.consum.base.pojo.UseRecordDto; |
| | | import com.consum.base.pojo.UseRecordSkuDto; |
| | | import com.consum.base.pojo.query.TransferQry; |
| | | import com.consum.base.pojo.response.FormTransferVO; |
| | | import com.consum.base.pojo.response.FromTransferTemplateInfoVO; |
| | | import com.consum.base.pojo.response.LWHFromTransferExtendVO; |
| | | import com.consum.base.pojo.response.TransferInfoVO; |
| | | import com.consum.base.service.BaseGoodsModelsServiceImpl; |
| | | import com.consum.base.service.BaseWarehouseServiceImpl; |
| | | import com.consum.base.service.LWhFormTransferCoreService; |
| | | import com.consum.base.service.LWhFormTransferServiceImpl; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.base.service.LWhProcureModelUserRecordServiceImpl; |
| | | import com.consum.base.service.LWhProcureModelUserServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormTransfer; |
| | |
| | | import com.consum.model.po.LWhProcureModelUser; |
| | | import com.consum.model.po.LWhProcureModelUserRecord; |
| | | import com.consum.model.vo.LWhFormOutputVo; |
| | | import com.consum.model.vo.LWhFormTransferVo; |
| | | import com.consum.model.vo.LWhProcureModelVo; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.commons.compress.utils.Lists; |
| | |
| | | @Autowired |
| | | private LWhFormTransferServiceImpl lWhFormTransferService; |
| | | @Autowired |
| | | private BaseWarehouseServiceImpl baseWarehouseService; |
| | | @Autowired |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | @Autowired |
| | | private LWhFormTransferCoreService lWhFormTransferCoreService; |
| | |
| | | @ApiOperation(value = "单据新增", notes = "单据新增") |
| | | @ApiImplicitParam(name = "param", value = "单据新增", required = true, dataType = "LWhFormTransferParam") |
| | | @PostMapping("/add") |
| | | public ResponseValue add(@RequestBody LWhFormTransferParam param) { |
| | | public ResponseValue add(@RequestBody LWhFormTransferParam param) throws Exception { |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | List<LWhProcureModelParams> transferGoods = param.getModels(); |
| | | List<LWhFormTransferGoodsInfoParam> transferGoods = param.getTransferGoods(); |
| | | if (CollectionUtils.isEmpty(transferGoods)) { |
| | | return ResponseValue.error("调拨单不能为空"); |
| | | } |
| | | int result = this.lWhFormTransferService.add(param, currentUser, this.getSysInfo()); |
| | | int result = this.lWhFormTransferService.add(param, this.getSysInfo()); |
| | | if (result > 0) { |
| | | return ResponseValue.success(1); |
| | | } |
| | |
| | | * @Description 列表查询(调拨明细) |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | * <p> |
| | | * 1.查询调拨单 |
| | | * <p> |
| | | * 2.查询物品型号 |
| | | */ |
| | | // 1.查询调拨单 |
| | | // 2.查询物品型号 |
| | | @ApiOperation(value = "单据列表查询", notes = "单据列表查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "size", value = "每页条数", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "param", value = "条件参数", required = true, dataType = "TransferQry"), |
| | | }) |
| | | @GetMapping("/list") |
| | | public ResponseValue queryFormTransferList(TransferQry param) { |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | FinSysTenantUser sysInfo = getSysInfo(); |
| | | |
| | | //只能查询本级 及以下机构的调拨单 |
| | | //?????? |
| | | |
| | | GenericPager genericPager = lWhFormTransferService.queryFormTransferList(param); |
| | | List<LWhFormTransfer> datas = genericPager.getDatas(); |
| | | ArrayList<LWhFormTransferVo> newDatas = new ArrayList<>(); |
| | | ArrayList<FormTransferVO> result = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(datas)) { |
| | | datas.forEach(item -> { |
| | | FormTransferVO formTransferVO = new FormTransferVO(); |
| | | BeanUtils.copyProperties(item, formTransferVO); |
| | | |
| | | List<FromTransferTemplateInfoVO> templateInfoList = Lists.newArrayList(); |
| | | |
| | | // 查询型号数量 |
| | | String sql = "SELECT bgt.id,bgm.GOODS_TEMPLATES_ID,GOODS_NAME,sum( counts ) count FROM " |
| | | + "l_wh_procure_model pm LEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id " |
| | | + "LEFT JOIN base_goods_template bgt ON bgm.GOODS_TEMPLATES_ID = bgt.id " |
| | | + "WHERE pm.BUSINESS_ID =:id GROUP BY bgm.GOODS_TEMPLATES_ID"; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("id", item.getId()); |
| | | List<Map<String, Object>> procureModelList = lWhProcureModelService.select(sql, paramMap, new MapperUtil()); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | FromTransferTemplateInfoVO procureTemplateInfoVO = MapUtils.convertMapToObj(map, FromTransferTemplateInfoVO.class); |
| | | templateInfoList.add(procureTemplateInfoVO); |
| | | } |
| | | formTransferVO.setFromTransferTemplateInfoList(templateInfoList); |
| | | |
| | | result.add(formTransferVO); |
| | | |
| | | |
| | | /*// 查询型号数量 |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(); |
| | | Integer businessType = item.getBusinessType(); |
| | | // TODO 调拨=0 分发=1 退回=2 |
| | |
| | | break; |
| | | } |
| | | lWhProcureModel.setBusinessId(item.getId()); |
| | | |
| | | LWhFormTransferVo formTransferExtend = new LWhFormTransferVo(); |
| | | BeanUtils.copyProperties(item, formTransferExtend); |
| | | |
| | | List<LWhProcureModel> models = lWhProcureModelService.select(lWhProcureModel); |
| | | List<LWhProcureModelVo> lWhProcureModelVoList = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(models)) { |
| | |
| | | lWhProcureModelVoList.add(lWhProcureModelVo); |
| | | }); |
| | | } |
| | | |
| | | formTransferExtend.setModels(lWhProcureModelVoList); |
| | | newDatas.add(formTransferExtend); |
| | | newDatas.add(formTransferExtend);*/ |
| | | }); |
| | | } |
| | | try { |
| | | Field fieldDatas = GenericPager.class.getDeclaredField("datas"); |
| | | fieldDatas.setAccessible(true); |
| | | fieldDatas.set(genericPager, newDatas); |
| | | fieldDatas.set(genericPager, result); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | | @ApiOperation(value = "根据id查询详情", notes = "根据id查询详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | }) |
| | | @GetMapping("/detail") |
| | | public ResponseValue getById(Long id) { |
| | | if (id == null) { |
| | | return ResponseValue.error("调拨单id为空"); |
| | | } |
| | | LWhFormTransferVo vo = this.lWhFormTransferService.getById(id); |
| | | LWHFromTransferExtendVO vo = this.lWhFormTransferService.getById(id); |
| | | return ResponseValue.success(vo); |
| | | } |
| | | |
| | |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/31 |
| | | */ |
| | | @ApiOperation(value = "撤销", notes = "撤销") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | }) |
| | | @PostMapping("/updStatus") |
| | | public ResponseValue updateStatus(Long id) { |
| | | if (id == null) { |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/31 |
| | | */ |
| | | @ApiOperation(value = "调拨入库", notes = "调拨入库") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | }) |
| | | @PostMapping("/income") |
| | | public ResponseValue income(Long id) { |
| | | lWhFormTransferCoreService.doTransferInPut(id, getCurrentUser()); |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/31 |
| | | */ |
| | | @ApiOperation(value = "调拨出库", notes = "调拨出库") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | }) |
| | | @PostMapping("/output") |
| | | public ResponseValue output(Long id) { |
| | | lWhFormTransferCoreService.doTransferOutPut(id, getCurrentUser()); |
| | |
| | | }) |
| | | @GetMapping("/query/detail") |
| | | public ResponseValue queryDepartmentTransferOrder(Long agencyId) { |
| | | |
| | | |
| | | |
| | | |
| | | TransferInfoVO transferInfoVO = new TransferInfoVO(); |
| | | return ResponseValue.success(transferInfoVO); |