package com.jsh.erp.controller.materialBatch; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.jsh.erp.base.AjaxResult; import com.jsh.erp.base.BaseController; import com.jsh.erp.base.TableDataInfo; import com.jsh.erp.datasource.entities.MaterialBatch; import com.jsh.erp.datasource.entities.MaterialVo4Unit; import com.jsh.erp.datasource.vo.MaterialExtendVo4List; import com.jsh.erp.query.LambdaQueryWrapperX; import com.jsh.erp.query.QueryWrapperX; import com.jsh.erp.service.MaterialBatchService; import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.DateUtils; import com.jsh.erp.utils.StringUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.List; @RestController @RequestMapping(value = "/materialBatch") @Api(tags = {"商品批次信息管理"}) public class MaterialBatchController extends BaseController { @Resource private MaterialBatchService materialBatchService; @GetMapping(value = "/getDetailList") @ApiOperation(value = "根据商品id获取批次信息") public TableDataInfo getDetailList(@RequestParam("materialId") Long materialId){ startPage(); List list = materialBatchService.list(new LambdaQueryWrapperX().eq(MaterialBatch::getMaterialId,materialId)); return getDataTable(list); } @GetMapping(value = "/findBatchNumbersByBarCode") @ApiOperation(value = "根据条码查询批次号") public AjaxResult findBatchNumbersByBarCode(@RequestParam(value = "barCodes",required = false) String barCodes){ List dataList = materialBatchService.findBySelectWithBarCode(barCodes); StringBuffer str = new StringBuffer(); if (null != dataList) { for (MaterialBatch material : dataList) { str.append("," + material.getBatchNumber()); } } return AjaxResult.success(str.length() > 1 ? str.deleteCharAt(0) : str); } }