| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.Material; |
| | | import com.whyc.service.MaterialService; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "物料管理") |
| | |
| | | public Response getAttachByMaterialId(@RequestParam int materialId){ |
| | | return service.getAttachByMaterialId(materialId); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "根据物料型号('-','_'之前的部分)查询物料的历史版本",notes = "9.3修改后使用") |
| | | @GetMapping("getMaterialVersion") |
| | | public Response getMaterialVersion(@RequestParam String subModel){ |
| | | return service.getMaterialVersion(subModel); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据物料id查询物料信息",notes = "9.3修改后使用") |
| | | @GetMapping("getMaterialById") |
| | | public Response getMaterialById(@RequestParam int materialId){ |
| | | return service.getMaterialById(materialId); |
| | | } |
| | | |
| | | /**物料id-物料编码-物料型号*/ |
| | | @ApiOperation(value = "追加附件",notes = "materialStr为json字符串,包含id,subCode,subModel") |
| | | @PostMapping("attachment") |
| | | public Response addAttachment(@RequestParam String materialStr, @RequestParam MultipartFile... file) throws IOException { |
| | | Material material = ActionUtil.getGson().fromJson(materialStr, Material.class); |
| | | List<MultipartFile> multipartFileList = Arrays.asList(file); |
| | | return service.addAttachment(multipartFileList,material); |
| | | } |
| | | |
| | | @ApiOperation("物料图纸对比") |
| | | @GetMapping("dwgCompare") |
| | | public Response dwgCompare(@RequestParam int materialId,@RequestParam int materialId2) throws IOException { |
| | | return service.dwgCompare(materialId,materialId2); |
| | | } |
| | | |
| | | /**物料id-物料编码-物料型号*/ |
| | | @ApiOperation(value = "更新图片或者图纸",notes = "materialStr为json字符串,包含id,subCode,subModel") |
| | | @PutMapping("picOrDwg") |
| | | public Response updatePicOrDwg(@RequestParam String materialStr, @RequestPart MultipartFile file) throws IOException { |
| | | Material material = ActionUtil.getGson().fromJson(materialStr, Material.class); |
| | | return service.updatePicOrDwg(file,material); |
| | | } |
| | | |
| | | /** |
| | | * 1.bom解析时就追加特定的(什么时候追加? 解析过后,从系统查询,型号相同类别不同,则型号变更) |
| | | * 示例: |
| | | * 存在 类A 型A, |
| | | * 追加 类A 型A,则型号不变,也不会重复添加 |
| | | * 追加 类B 型A,则型号改变,检查也不会被去重,允许添加 |
| | | * 追加 类B 型A, |
| | | * 2.物料新增 |
| | | * 必须新增类别 |
| | | * 3.修复原来数据中可以变更的部分,下面示例中1386无法修复,不处理,因为一种物料对应了两种类别,填充任意一种会导致误解 |
| | | * material_id category |
| | | * 1384 组装类 |
| | | * 1385 组装类 |
| | | * 1386 组装类 |
| | | * 1386 出货配件类 |
| | | * 1387 组装类 |
| | | * @param sign 输入简易签名 |
| | | * @return |
| | | */ |
| | | @GetMapping("fillCategory") |
| | | public Response updateFillCategory(@RequestParam String sign){ |
| | | service.updateFillCategory(sign); |
| | | return new Response().set(1,"完成物料类别自动填充"); |
| | | } |
| | | } |