物料管理接口添加说明

This commit is contained in:
hy2250089 2019-12-13 23:37:02 +08:00
parent 866479b582
commit 496b55dfa6
5 changed files with 81 additions and 14 deletions

View File

@ -76,6 +76,17 @@
ORDER BY mapb.process_step ORDER BY mapb.process_step
</select> </select>
<select id="findListByProductNameIdOld" resultMap="ProcessBomDto">
SELECT
mapb.id,mapb.product_process_id,mapb.process_name,mapb.process_apartment,mapb.process_step,mapb.process_content,mapab.code,mapab.specification,mapab.dosage,mapab.materials_id,mami.materials_name
FROM mt_alone_product_process_bom mappb
LEFT JOIN mt_alone_process_bom mapb ON mappb.id = mapb.product_process_id
LEFT JOIN mt_alone_process_materials_bom mapab ON mapb.id = mapab.process_bom_id
LEFT JOIN mt_alone_materials_info mami ON mapab.materials_id = mami.id
WHERE mappb.product_id = #{productId}
ORDER BY mapb.process_step
</select>
<select id="findListByProductNameId" resultMap="ProcessBomDto"> <select id="findListByProductNameId" resultMap="ProcessBomDto">
SELECT SELECT
mapb.id,mapb.product_process_id,mapb.process_name,mapb.process_apartment,mapb.process_step,mapb.process_content,mapab.code,mapab.specification,mapab.dosage,mapab.materials_id,mami.materials_name mapb.id,mapb.product_process_id,mapb.process_name,mapb.process_apartment,mapb.process_step,mapb.process_content,mapab.code,mapab.specification,mapab.dosage,mapab.materials_id,mami.materials_name

View File

@ -48,11 +48,20 @@ public class MaterialsInfoController {
@Autowired @Autowired
private MaterialsOutgoingLogService materialsOutgoingLogService; private MaterialsOutgoingLogService materialsOutgoingLogService;
/**
* hy
* 新增物料信息
* @param materialsInfo
* @param currentUser
* @return
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "materialsInfo", value = "物料", paramType = "body", dataType = "MaterialsInfo", required = true)
})
@OperateLog(description = "添加物料信息", type = "增加") @OperateLog(description = "添加物料信息", type = "增加")
@ApiOperation(value = "添加物料信息", notes = "添加物料信息") @ApiOperation(value = "添加物料信息", notes = "添加物料信息")
@PostMapping("/add") @PostMapping("/add")
public Result add(@RequestBody MaterialsInfo materialsInfo, @ApiIgnore @User CurrentUser currentUser) { public Result add(@RequestBody MaterialsInfo materialsInfo, @ApiIgnore @User CurrentUser currentUser) {
//增加物料信息
if(currentUser==null){ if(currentUser==null){
return ResultGenerator.genFailResult( CommonCode.SERVICE_ERROR,"未登录错误",null ); return ResultGenerator.genFailResult( CommonCode.SERVICE_ERROR,"未登录错误",null );
} }
@ -91,22 +100,43 @@ public class MaterialsInfoController {
return ResultGenerator.genSuccessResult(); return ResultGenerator.genSuccessResult();
} }
/**
* hy
* 获取某种物料详细信息
* @param params
* @param currentUser
* @return
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "companyId", value = "公司id", paramType = "query", dataType = "int", required = false),
@ApiImplicitParam(name = "materialsId", value = "物料id", paramType = "query", dataType = "int", required = true)
})
@OperateLog(description = "获取某种物料详细信息", type = "查询") @OperateLog(description = "获取某种物料详细信息", type = "查询")
@ApiOperation(value = "获取某种物料详细信息", notes = "获取某种物料详细信息") @ApiOperation(value = "获取某种物料详细信息", notes = "获取某种物料详细信息")
@GetMapping("/detail") @GetMapping("/detail")
public Result detail(MaterialsInfoParams params, @ApiIgnore @User CurrentUser currentUser) { public Result detail(MaterialsInfoParams params, @ApiIgnore @User CurrentUser currentUser) {
if(currentUser==null){ //if(currentUser==null){
return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); // return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
} //}
StringUtil.trimObjectStringProperties(params); StringUtil.trimObjectStringProperties(params);
params.setCompanyId(currentUser.getCompanyId()); params.setCompanyId(1);
MaterialsInfoDto materialsInfoDto = materialsInfoService.findDetailById(params); MaterialsInfoDto materialsInfoDto = materialsInfoService.findDetailById(params);
return ResultGenerator.genSuccessResult(materialsInfoDto); return ResultGenerator.genSuccessResult(materialsInfoDto);
} }
/**
* hy
* 物料信息分页列表查询
* @param params
* @param currentUser
* @return
*/
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "materialsId", value = "物料id", paramType = "query", dataType = "int", required = true) @ApiImplicitParam(name = "companyId", value = "公司id", paramType = "query", dataType = "int", required = false),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String", required = false),
@ApiImplicitParam(name = "begDate", value = "起始日期", paramType = "query", dataType = "Date", required = false),
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", dataType = "Date", required = false)
}) })
@OperateLog(description = "物料信息分页查询", type = "查询") @OperateLog(description = "物料信息分页查询", type = "查询")
@ApiOperation(value = "物料信息列表分页", notes = "物料信息列表分页") @ApiOperation(value = "物料信息列表分页", notes = "物料信息列表分页")
@ -176,7 +206,7 @@ public class MaterialsInfoController {
}catch (Exception e){ }catch (Exception e){
ResultGenerator.genFailResult(CommonCode.SERVER_INERNAL_ERROR,"操作数据库异常","null"); ResultGenerator.genFailResult(CommonCode.SERVER_INERNAL_ERROR,"操作数据库异常","null");
} }
PageInfo pageInfo = new PageInfo(list);; PageInfo pageInfo = new PageInfo(list);
return ResultGenerator.genSuccessResult(pageInfo); return ResultGenerator.genSuccessResult(pageInfo);
} }

View File

@ -13,6 +13,8 @@ import com.deer.wms.project.seed.core.result.ResultGenerator;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -38,6 +40,16 @@ public class MaterialsOutgoingLogController {
//@Autowired //@Autowired
//private MaterialsOutgoingLogDTOService materialsOutgoingLogDTOService; //private MaterialsOutgoingLogDTOService materialsOutgoingLogDTOService;
/**
* hy
* 添加一条出入库记录同时更新对应的库存信息
* @param materialsOutgoingLogDto
* @param currentUser
* @return
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "materialsOutgoingLogDto", value = "物料出入库", paramType = "body", dataType = "MaterialsOutgoingLogDto", required = true)
})
@OperateLog(description = "添加一条出入库记录", type = "增加") @OperateLog(description = "添加一条出入库记录", type = "增加")
@ApiOperation(value = "添加一条出入库记录", notes = "添加一条出入库记录") @ApiOperation(value = "添加一条出入库记录", notes = "添加一条出入库记录")
@PostMapping("/add") @PostMapping("/add")
@ -73,7 +85,18 @@ public class MaterialsOutgoingLogController {
return ResultGenerator.genSuccessResult(materialsOutgoingLog); return ResultGenerator.genSuccessResult(materialsOutgoingLog);
} }
/**
* hy
* 获取某种物料的所有出入库记录
* @param params
* @param currentUser
* @return
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "companyId", value = "公司id", paramType = "query", dataType = "int", required = false),
@ApiImplicitParam(name = "type", value = "出入库类型0入库1出库", paramType = "query", dataType = "int", required = true),
@ApiImplicitParam(name = "materialsId", value = "物料id", paramType = "query", dataType = "int", required = true)
})
@OperateLog(description = "获取某种物料的所有出入库记录", type = "查询") @OperateLog(description = "获取某种物料的所有出入库记录", type = "查询")
@ApiOperation(value = "获取某种物料的所有出入库记录", notes = "获取某种物料的所有出入库记录") @ApiOperation(value = "获取某种物料的所有出入库记录", notes = "获取某种物料的所有出入库记录")
@GetMapping("/listByOneMaterial") @GetMapping("/listByOneMaterial")

View File

@ -125,10 +125,16 @@ public class ProcessBomController {
PageInfo pageInfo = new PageInfo(list); PageInfo pageInfo = new PageInfo(list);
return ResultGenerator.genSuccessResult(pageInfo); return ResultGenerator.genSuccessResult(pageInfo);
} }
/** /**
* hy
*
* 根据选择的产品名称来展示产品其他数据和工序数据 * 根据选择的产品名称来展示产品其他数据和工序数据
* @param params
* @param currentUser
* @return
*/ */
@ApiOperation(value = "工序来获取物料信息", notes = "工序来获取物料信息") @ApiOperation(value = "根据产品名称获取工序", notes = "根据产品名称获取工序")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "access-token", value = "token", paramType = "header", dataType = "String", required = true) @ApiImplicitParam(name = "access-token", value = "token", paramType = "header", dataType = "String", required = true)
}) })
@ -138,11 +144,7 @@ public class ProcessBomController {
return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
} }
if (currentUser.getCompanyType() != SystemManageConstant.COMPANY_TYPE_MT){ params.setCompanyId(1);
params.setCompanyId(currentUser.getCompanyId());
}else{
params.setCompanyId(null);
}
PageHelper.startPage(params.getPageNum(), params.getPageSize()); PageHelper.startPage(params.getPageNum(), params.getPageSize());
List<ProcessBomDto> list = processBomService.findListByProductNameId(params); List<ProcessBomDto> list = processBomService.findListByProductNameId(params);
PageInfo pageInfo = new PageInfo(list); PageInfo pageInfo = new PageInfo(list);

View File

@ -1,5 +1,6 @@
package com.deer.wms.produce.manage.web; package com.deer.wms.produce.manage.web;
import com.deer.wms.intercept.annotation.Authority;
import com.deer.wms.intercept.annotation.User; import com.deer.wms.intercept.annotation.User;
import com.deer.wms.intercept.common.data.CurrentUser; import com.deer.wms.intercept.common.data.CurrentUser;
import com.deer.wms.produce.manage.model.ProductProcess; import com.deer.wms.produce.manage.model.ProductProcess;