| | |
| | | package org.jeecg.modules.tms.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.modules.tms.entity.dto.OutBoundAddDto; |
| | | import org.jeecg.modules.tms.entity.dto.OutBoundOrderFlowDto; |
| | | import org.jeecg.modules.tms.entity.dto.OutBoundRequestDto; |
| | | import org.jeecg.modules.tms.entity.dto.OutboundOrderAndDetailDto; |
| | | import org.jeecg.modules.tms.entity.vo.OutboundDetailVo; |
| | | import org.jeecg.modules.tms.entity.vo.SelectOutboundToolVo; |
| | | import org.jeecg.modules.tms.enums.OutBillStatus; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @Autowired |
| | | private IOutboundDetailService outboundDetailService; |
| | | |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | |
| | | @Autowired |
| | | private TranslateDictTextUtils translateDictTextUtils; |
| | | |
| | | |
| | | |
| | | /*---------------------------------主表处理-begin-------------------------------------*/ |
| | | |
| | |
| | | Page<OutboundOrder> page = new Page<OutboundOrder>(pageNo, pageSize); |
| | | IPage<OutboundOrder> pageList = outboundOrderService.queryPageList(page, parameterMap); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | @ApiOperation(value="出库申请-查询借用出库工具列表", notes="出库申请-查询借用出库工具列表") |
| | | @GetMapping(value = "/selectBorrowOutboundToolPageList") |
| | | public Result<IPage<SelectOutboundToolVo>> queryBorrowOutboundToolPageList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | Map<String, String[]> parameterMap = req.getParameterMap(); |
| | | Page<SelectOutboundToolVo> page = new Page<>(pageNo, pageSize); |
| | | IPage<SelectOutboundToolVo> pageList = outboundOrderService.queryBorrowOutboundToolPageList(page, parameterMap); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | @ApiOperation(value="出库申请-查询刃磨出库工具列表", notes="出库申请-查询刃磨出库工具列表") |
| | | @GetMapping(value = "/selectSharpenOutboundToolPageList") |
| | | public Result<IPage<SelectOutboundToolVo>> querySharpenOutboundToolPageList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | Map<String, String[]> parameterMap = req.getParameterMap(); |
| | | Page<SelectOutboundToolVo> page = new Page<>(pageNo, pageSize); |
| | | IPage<SelectOutboundToolVo> pageList = outboundOrderService.querySharpenOutboundToolPageList(page, parameterMap); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | @ApiOperation(value="tms_outbound_order-通过id查询", notes="tms_outbound_order-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam("id") String id) { |
| | | OutboundOrder outboundOrder = outboundOrderService.getById(id); |
| | | if (outboundOrder == null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | try { |
| | | String jsonStr = objectMapper.writeValueAsString(outboundOrder); |
| | | JSONObject item = JSONObject.parseObject(jsonStr, Feature.OrderedField); |
| | | translateDictTextUtils.translateField("outStorehouseType", outboundOrder.getOutStorehouseType(), item, "out_storehouse_type"); |
| | | translateDictTextUtils.translateField("handler", outboundOrder.getHandler(), item, "sys_user,realname,id"); |
| | | translateDictTextUtils.translateField("orderStatus", outboundOrder.getOrderStatus(), item, "out_bill_status"); |
| | | translateDictTextUtils.translateField("outStatus", outboundOrder.getOutStatus(), item, "out_storehouse_status"); |
| | | translateDictTextUtils.translateField("createBy", outboundOrder.getCreateBy(), item, "sys_user,realname,username"); |
| | | translateDictTextUtils.translateField("updateBy", outboundOrder.getUpdateBy(), item, "sys_user,realname,username"); |
| | | return Result.OK(item); |
| | | } catch (JsonProcessingException e) { |
| | | return Result.error("数据转译失败!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value="tms_outbound_order-提交出库申请单", notes="tms_outbound_order-提交出库申请单") |
| | | @GetMapping(value = "/submit") |
| | | public Result<String> submit(@RequestParam(name="id") String id) { |
| | | OutboundOrder order = new OutboundOrder(); |
| | | order.setId(id); |
| | | order.setOrderStatus(OutBillStatus.SUBMITTED.getValue()); |
| | | outboundOrderService.updateById(order); |
| | | //开启流程 |
| | | outboundOrderService.submit(id); |
| | | return Result.OK("提交成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "审批流程") |
| | | @ApiOperation(value = "出库申请单-审批流程", notes = "出库申请单-审批流程") |
| | | @PostMapping("/approval") |
| | | public Result<?> approval(@RequestBody OutBoundOrderFlowDto outBoundOrderFlowDto) { |
| | | outboundOrderService.approvalProcess(outBoundOrderFlowDto); |
| | | return Result.OK("操作成功"); |
| | | } |
| | | |
| | | @AutoLog(value = "申请单方式出库") |
| | | @ApiOperation(value = "申请单方式出库", notes = "申请单方式出库") |
| | | @PostMapping(value = "/outBoundByApply") |
| | | public Result<?> outBoundByApply(@RequestBody List<OutBoundRequestDto> outBoundRequestList) { |
| | | outboundOrderService.outBoundByApply(outBoundRequestList); |
| | | return Result.OK("出库成功"); |
| | | } |
| | | |
| | | @AutoLog(value = "新增方式出库") |
| | | @ApiOperation(value = "新增方式出库", notes = "新增方式出库") |
| | | @PostMapping(value = "/outBoundByAdd") |
| | | public Result<?> outBoundByAdd(@RequestBody List<OutBoundAddDto> boundAddList) { |
| | | outboundOrderService.outBoundByAdd(boundAddList); |
| | | return Result.OK("出库成功"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * @param id |