You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.9 KiB
Java
85 lines
2.9 KiB
Java
package com.aucma.api.controller;
|
|
|
|
import com.aucma.api.domain.dto.CheckInfoDto;
|
|
import com.aucma.api.service.IPdaBindingService;
|
|
import com.aucma.common.core.domain.AjaxResult;
|
|
import com.aucma.common.utils.StringUtils;
|
|
import com.aucma.report.domain.ReportQualityInspection;
|
|
import com.aucma.report.service.IReportQualityInspectionService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.Optional;
|
|
|
|
import static com.aucma.common.core.domain.AjaxResult.error;
|
|
import static com.aucma.common.core.domain.AjaxResult.success;
|
|
|
|
/**
|
|
* @author wanghao
|
|
* @date 2023/11/14 9:28
|
|
*/
|
|
@RestController
|
|
@RequestMapping(("/api"))
|
|
public class PdaApiController {
|
|
|
|
@Autowired
|
|
private IPdaBindingService service;
|
|
|
|
//壳胆绑定-提交
|
|
@PostMapping("/boxBanding")
|
|
public AjaxResult binding(String boxCode, String innerCode, String loginName) {
|
|
String boxName = service.selectBoxNameByCode(boxCode);
|
|
if (StringUtils.isNotNull(boxName)) {
|
|
service.insertBindingInfo(boxCode, boxName, innerCode);
|
|
return success();
|
|
}
|
|
return error("箱壳条码扫描错误");
|
|
}
|
|
|
|
//条码绑定
|
|
@PostMapping("/barCodeBanding")
|
|
public AjaxResult barCodeBanding(String boxCode, String innerCode, String loginName) {
|
|
return success();
|
|
}
|
|
|
|
@Autowired
|
|
private IReportQualityInspectionService qualityService;
|
|
|
|
// 质检提交
|
|
@PostMapping("/checkSubmit")
|
|
public AjaxResult checkSubmit(@RequestBody CheckInfoDto checkInfo) {
|
|
List<CheckInfoDto.DefectBeen> list = checkInfo.getList();
|
|
int size = (list == null || list.isEmpty()) ? 1 : list.size();
|
|
for (int i = 0; i < size; i++) {
|
|
ReportQualityInspection inspection = new ReportQualityInspection();
|
|
inspection.setBarCode(checkInfo.getCode());
|
|
inspection.setTreatmentMeasure(checkInfo.getMeasure());
|
|
inspection.setIsLowerLine(checkInfo.getOffline());
|
|
inspection.setInspectorCode(checkInfo.getUserName());
|
|
inspection.setInspectorTime(new Date());
|
|
assert list != null;
|
|
if (!list.isEmpty()) {
|
|
inspection.setTestItemCode(list.get(i).getStationCode());
|
|
inspection.setQualityDefectCode(list.get(i).getQualityDefectCode());
|
|
inspection.setQualityDefectName(list.get(i).getQualityDefectName());
|
|
}
|
|
qualityService.insertReportQualityInspection(inspection);
|
|
}
|
|
|
|
return success();
|
|
}
|
|
|
|
//返修查询质检信息
|
|
@PostMapping("/findCheckInfoByCode")
|
|
public AjaxResult findCheckInfoByCode(String code) {
|
|
List<ReportQualityInspection> list= qualityService.findCheckInfoByCode(code);
|
|
if (list==null || list.isEmpty()){
|
|
return error("扫描条码不正确");
|
|
}
|
|
return success(list);
|
|
}
|
|
|
|
}
|