添加根据物料条码查询物料数据

This commit is contained in:
李宇奇 2025-03-12 21:53:27 +08:00
parent 48212ff484
commit 1ad9da1833
6 changed files with 27 additions and 9 deletions

View File

@ -7,19 +7,13 @@ import com.ruoyi.app.domain.AppGoods;
import com.ruoyi.app.domain.AppLocation;
import com.ruoyi.app.domain.AppStock;
import com.ruoyi.app.service.IAppGoodsService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.web.controller.section.EnhanceDataList;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -152,4 +146,14 @@ public class AppGoodsController extends BaseController {
List<AppGoods> appGoodsList = appGoodsService.queryListByGoodsId(appGoods.getGoodsId());
return success("查询成功",appGoodsList);
}
@Anonymous
@GetMapping("/getGoodsInfoByCode")
public AjaxResult getGoodsInfoByCode(@RequestParam("goodsCode") String goodsCode) {
if(StringUtils.isBlank(goodsCode)){
return error("查询物料条码不能为空");
}
AppGoods appGoods = appGoodsService.getGoodsInfoByCode(goodsCode);
return success("查询成功", appGoods);
}
}

View File

@ -114,7 +114,7 @@ public class SecurityConfig
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
// 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn", "/app/pmsOrderOut/**", "/app/task/sendLocation", "/app/task/taskResult","/app/task/createOutRequest", "/system/storage/**", "/app/location/count", "/app/vehicle/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn", "/app/pmsOrderOut/**", "/app/task/sendLocation", "/app/task/taskResult","/app/task/createOutRequest", "/system/storage/**", "/app/location/count/**", "/app/vehicle/**", "/app/goods/getGoodsInfoByCode/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();
})

View File

@ -78,4 +78,6 @@ public interface AppGoodsMapper
List<AppGoods> selectAppGoodsListByIds(String[] goodsIds);
List<AppGoods> queryListByGoodsId(String goodsId);
public AppGoods selectAppGoodsByCode(String goodsCode);
}

View File

@ -83,4 +83,6 @@ public interface IAppGoodsService
String importGoods(List<AppGoods> appGoodsList, boolean updateSupport);
List<AppGoods> queryListByGoodsId(String goodsId);
public AppGoods getGoodsInfoByCode(String goodsCode);
}

View File

@ -165,4 +165,9 @@ public class AppGoodsServiceImpl implements IAppGoodsService {
public List<AppGoods> queryListByGoodsId(String goodsId) {
return appGoodsMapper.queryListByGoodsId(goodsId);
}
@Override
public AppGoods getGoodsInfoByCode(String goodsCode) {
return appGoodsMapper.selectAppGoodsByCode(goodsCode);
}
}

View File

@ -129,4 +129,9 @@
#{id}
</foreach>
</select>
<select id="selectAppGoodsByCode" parameterType="String" resultMap="AppGoodsResult">
<include refid="selectAppGoodsVo"/>
where goods_code = #{goodsCode}
</select>
</mapper>