可以添加多张测量图片

This commit is contained in:
liuchengqian 2022-03-08 17:05:53 +08:00
parent c698abfa11
commit 49130281bb

View File

@ -13,7 +13,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.Locale; import java.util.Locale;
import java.util.Optional;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -26,26 +25,16 @@ public class PictureServiceImpl implements PictureService {
@Override @Override
public String insertPicture(PictureQo pictureQo, MultipartFile pictureFile) throws IOException { public String insertPicture(PictureQo pictureQo, MultipartFile pictureFile) throws IOException {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
String lotNo = pictureQo.getLotNo();
String machineNo = pictureQo.getMachineNo();
String materialNo = pictureQo.getMaterialNo();
String modelNo = pictureQo.getModelNo();
String machineTypeNo = pictureQo.getMachineTypeNo();
String craftItemName = pictureQo.getCraftItemName();
Optional<PictureEntity> pictureEntity2 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
if (pictureEntity2.isPresent()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale);
}
String file = ExcelUploadUtil.memoryFile(pictureFile, 2); String file = ExcelUploadUtil.memoryFile(pictureFile, 2);
PictureEntity pictureEntity1 = new PictureEntity(); PictureEntity pictureEntity = new PictureEntity();
pictureEntity1.setLotNo(lotNo); pictureEntity.setLotNo(pictureQo.getLotNo());
pictureEntity1.setMachineNo(machineNo); pictureEntity.setMachineNo(pictureQo.getMachineNo());
pictureEntity1.setMaterialNo(materialNo); pictureEntity.setMaterialNo(pictureQo.getMaterialNo());
pictureEntity1.setModelNo(modelNo); pictureEntity.setModelNo(pictureQo.getModelNo());
pictureEntity1.setMachineTypeNo(machineTypeNo); pictureEntity.setMachineTypeNo(pictureQo.getMachineTypeNo());
pictureEntity1.setCraftItemName(craftItemName); pictureEntity.setCraftItemName(pictureQo.getCraftItemName());
pictureEntity1.setPicturePath(file); pictureEntity.setPicturePath(file);
pictureDao.save(pictureEntity1); pictureDao.save(pictureEntity);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
} }
} }