123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- package com.jsh.erp.controller.pda;
- import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
- import com.jsh.erp.base.AjaxResult;
- import com.jsh.erp.base.BaseController;
- import com.jsh.erp.base.TableDataInfo;
- import com.jsh.erp.datasource.entities.DepotHead;
- import com.jsh.erp.datasource.entities.MaterialVo4Unit;
- import com.jsh.erp.datasource.entities.Supplier;
- import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
- import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
- import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
- import com.jsh.erp.query.LambdaQueryWrapperX;
- import com.jsh.erp.service.*;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiModelProperty;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.web.bind.annotation.*;
- import javax.annotation.Resource;
- import java.util.List;
- @RestController
- @RequestMapping(value = "/pda")
- @Api(tags = {"PDA接口"})
- public class PdaController extends BaseController {
- @Resource
- private DepotHeadService depotHeadService;
- @Resource
- private DepotItemService depotItemService;
- @Resource
- private SupplierService supplierService;
- @Resource
- private MaterialService materialService;
- /**
- * 采购入库
- * @return
- */
- @PostMapping ("/purchaseInventory")
- @ApiOperation(value = "采购入库")
- public TableDataInfo purchaseInventory(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
- pdaDepotHeadDTO.setSubType("采购订单");
- startPage();
- List<PDADepotHeadVO> pdaDepotHeadVOList = depotHeadService.pdaList(pdaDepotHeadDTO);
- return getDataTable(pdaDepotHeadVOList);
- }
- @PostMapping("/saleOrder")
- @ApiOperation(value = "检货任务")
- public TableDataInfo saleOrder(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
- pdaDepotHeadDTO.setSubType("销售订单");
- startPage();
- List<PDADepotHeadVO> pdaDepotHeadVOList = depotHeadService.pdaList(pdaDepotHeadDTO);
- return getDataTable(pdaDepotHeadVOList);
- }
- @ApiModelProperty(value = "订单详情")
- @GetMapping("/orderInfo/{id}")
- public AjaxResult orderInfo(@PathVariable("id") Long id){
- DepotHead depotHead = depotHeadService.getOne(new LambdaQueryWrapperX<DepotHead>().eq(DepotHead::getId, id));
- depotHead.setSupplierName(supplierService.getOne(new LambdaQueryWrapperX<Supplier>().eq(Supplier::getId, depotHead.getOrganId())).getSupplier());
- return AjaxResult.success(depotHead);
- }
- @GetMapping("/orderDetail/{id}")
- @ApiOperation("订单明细")
- public TableDataInfo orderDetail(@PathVariable("id") Long id) {
- startPage();
- List<PDADepotItemVO> list = depotItemService.pdaList(id);
- return getDataTable(list);
- }
- @ApiOperation("订单开始处理")
- @GetMapping("/orderStartHandle/{id}")
- public AjaxResult orderStartHandle(@PathVariable("id") Long id) {
- depotHeadService.update(new UpdateWrapper<DepotHead>().set("status", "4").eq("id", id));
- return AjaxResult.success();
- }
- @ApiOperation("商品详情")
- @GetMapping("/materialDetail/{id}")
- public AjaxResult materialDetail(@PathVariable("id") Long id) {
- return AjaxResult.success(depotItemService.pdaDetail(id));
- }
- @ApiOperation("商品库存详情")
- @GetMapping("/materialDepotDetail/{type}/{materialId}")
- public TableDataInfo materialDepotDetail(@PathVariable("type") String type, @PathVariable("materialId") Long materialId) {
- startPage();
- if ("out".equals(type)) {
- type = "入库";
- } else {
- type = "出库";
- }
- List<PDADepotItemVO> list = depotItemService.materialDepotDetail(type , materialId);
- return getDataTable(list);
- }
- @ApiOperation("用于返回字段说明")
- @GetMapping("test")
- public AjaxResult test(PDADepotItemVO pdaDepotItemVO) {
- return AjaxResult.success();
- }
- @PostMapping ("/orderSubmit")
- @ApiOperation(value = "订单提交")
- public AjaxResult orderSubmit(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
- try {
- depotHeadService.pdaOrderSubmit(pdaDepotHeadDTO);
- } catch (Exception e) {
- e.printStackTrace();
- return AjaxResult.error();
- }
- return AjaxResult.success();
- }
- @ApiOperation("商品存货查询")
- @GetMapping("/inventoryInquiry/{type}/{keyword}")
- public TableDataInfo inventoryInquiry(@PathVariable("type") String type,@PathVariable("keyword") String keyword){
- startPage();
- List<PDADepotItemVO> list = materialService.inventoryInquiry(type , keyword);
- return getDataTable(list);
- }
- }
|