| | |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.domain.PageResult; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.MatnrToGroupParams; |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import com.vincent.rsf.server.manager.entity.excel.MatnrsTemplate; |
| | | import com.vincent.rsf.server.manager.service.MatnrService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | return R.ok().add(matnrService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:list')") |
| | | @GetMapping("/matnr/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(matnrService.getById(id)); |
| | | return R.ok(matnrService.selectMatnrById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:save')") |
| | |
| | | return R.error("Update Fail"); |
| | | } |
| | | if (!FieldsUtils.getFieldsSta().isEmpty()) { |
| | | Matnr matnr1 = matnrService.getById(matnr.getId()); |
| | | params.put("fieldsIndex", matnr1.getFieldsIndex()); |
| | | FieldsUtils.updateFieldsValue(params); |
| | | } |
| | | |
| | |
| | | return R.ok(new PageResult().setRecords(matnrPage.getRecords()).setTotal(matnrPage.getTotal())); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:list')") |
| | | @ApiOperation("绑定物料分组") |
| | | @PostMapping("/matnr/group/bind") |
| | | public R bindMatnrToGroup(@RequestBody MatnrToGroupParams params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | if (matnrService.bindMatnrs(params)) { |
| | | return R.ok(); |
| | | } else { |
| | | return R.error("操作失败!!"); |
| | | } |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:update')") |
| | | @ApiOperation("批量修改") |
| | | @PostMapping("/matnr/batch/update") |
| | | public R batchUpdate(@RequestBody MatnrToGroupParams params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getMatnr())) { |
| | | return R.error("物料属性不能为空!!"); |
| | | } |
| | | if (matnrService.batchUpdate(params)) { |
| | | return R.ok(); |
| | | }else { |
| | | return R.error("操作失败!!"); |
| | | } |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:list')") |
| | | @ApiOperation("导出物料信息") |
| | | @PostMapping("/matnr/export") |