MaterialBatchController.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package com.jsh.erp.controller.materialBatch;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.jsh.erp.base.AjaxResult;
  5. import com.jsh.erp.base.BaseController;
  6. import com.jsh.erp.base.TableDataInfo;
  7. import com.jsh.erp.datasource.entities.MaterialBatch;
  8. import com.jsh.erp.datasource.entities.MaterialVo4Unit;
  9. import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
  10. import com.jsh.erp.query.LambdaQueryWrapperX;
  11. import com.jsh.erp.query.QueryWrapperX;
  12. import com.jsh.erp.service.MaterialBatchService;
  13. import com.jsh.erp.utils.BaseResponseInfo;
  14. import com.jsh.erp.utils.DateUtils;
  15. import com.jsh.erp.utils.StringUtil;
  16. import io.swagger.annotations.Api;
  17. import io.swagger.annotations.ApiOperation;
  18. import org.springframework.web.bind.annotation.GetMapping;
  19. import org.springframework.web.bind.annotation.RequestMapping;
  20. import org.springframework.web.bind.annotation.RequestParam;
  21. import org.springframework.web.bind.annotation.RestController;
  22. import javax.annotation.Resource;
  23. import javax.servlet.http.HttpServletRequest;
  24. import java.util.ArrayList;
  25. import java.util.List;
  26. @RestController
  27. @RequestMapping(value = "/materialBatch")
  28. @Api(tags = {"商品批次信息管理"})
  29. public class MaterialBatchController extends BaseController {
  30. @Resource
  31. private MaterialBatchService materialBatchService;
  32. @GetMapping(value = "/getDetailList")
  33. @ApiOperation(value = "根据商品id获取批次信息")
  34. public TableDataInfo getDetailList(@RequestParam("materialId") Long materialId){
  35. startPage();
  36. List<MaterialBatch> list = materialBatchService.list(new LambdaQueryWrapperX<MaterialBatch>().eq(MaterialBatch::getMaterialId,materialId));
  37. return getDataTable(list);
  38. }
  39. @GetMapping(value = "/findBatchNumbersByBarCode")
  40. @ApiOperation(value = "根据条码查询批次号")
  41. public AjaxResult findBatchNumbersByBarCode(@RequestParam(value = "barCodes",required = false) String barCodes){
  42. List<MaterialBatch> dataList = materialBatchService.findBySelectWithBarCode(barCodes);
  43. StringBuffer str = new StringBuffer();
  44. if (null != dataList) {
  45. for (MaterialBatch material : dataList) {
  46. str.append("," + material.getBatchNumber());
  47. }
  48. }
  49. return AjaxResult.success(str.length() > 1 ? str.deleteCharAt(0) : str);
  50. }
  51. }