MaterialBatchController.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 = "商品批次信息管理")
  34. public TableDataInfo getDetailList(@RequestParam("materialId") Long materialId,
  35. HttpServletRequest request)throws Exception {
  36. startPage();
  37. List<MaterialBatch> list = materialBatchService.list(new LambdaQueryWrapperX<MaterialBatch>().eq(MaterialBatch::getMaterialId,materialId).eq(MaterialBatch::getDeleteFlag,"0"));
  38. return getDataTable(list);
  39. }
  40. @GetMapping(value = "/findBatchNumbersByBarCode")
  41. @ApiOperation(value = "根据条码查询批次号")
  42. public AjaxResult findBatchNumbersByBarCode(@RequestParam(value = "barCodes",required = false) String barCodes){
  43. List<MaterialBatch> dataList = materialBatchService.findBySelectWithBarCode(barCodes);
  44. StringBuffer str = new StringBuffer();
  45. //存放数据json数组
  46. if (null != dataList) {
  47. for (MaterialBatch material : dataList) {
  48. str.append("," + material.getBatchNumber());
  49. }
  50. }
  51. return AjaxResult.success(str.length() > 1 ? str.deleteCharAt(0) : str);
  52. }
  53. }