add - 质检插入

master
wangh 1 year ago
parent cf3148223f
commit 7251da7f05

@ -4,9 +4,13 @@ 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;
@ -35,14 +39,31 @@ public class PdaBindingController {
}
//条码绑定
@Autowired
private IReportQualityInspectionService qualityService;
// 质检提交
@PostMapping("/checkSubmit")
public AjaxResult checkSubmit(@RequestBody CheckInfoDto checkInfo/*,
@RequestParam("processCode") String processCode,
@RequestParam("userName") String userName*/) {
System.out.println(checkInfo.toString());
// System.out.println(processCode);
// System.out.println(userName);
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.setProcessResult(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();
}

@ -8,12 +8,28 @@ import java.util.List;
*/
public class CheckInfoDto {
private String code;//产品条码
private String defect;
private List<DefectBeen> list;//缺陷列表
private String measure;//处理措施TREATMENT_MEASURE
private String offline;
private String processCode;
private String userName;
public String getProcessCode() {
return processCode;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getCode() {
return code;
@ -23,13 +39,7 @@ public class CheckInfoDto {
this.code = code;
}
public String getDefect() {
return defect;
}
public void setDefect(String defect) {
this.defect = defect;
}
public List<DefectBeen> getList() {
return list;
@ -55,16 +65,12 @@ public class CheckInfoDto {
this.offline = offline;
}
@Override
public String toString() {
return "CheckInfoDto{" + "code='" + code + '\'' + ", defect='" + defect + '\'' + ", list=" + list + ", measure='" + measure + '\'' + ", offline='" + offline + '\'' + '}';
}
public static class DefectBeen {
private String qualityDefectCode;
private String qualityDefectName;
private String itemCode;
private String stationCode;
public DefectBeen() {
}
@ -85,17 +91,14 @@ public class CheckInfoDto {
this.qualityDefectName = qualityDefectName;
}
public String getItemCode() {
return itemCode;
public String getStationCode() {
return stationCode;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
public void setItemCode(String stationCode) {
this.stationCode = stationCode;
}
@Override
public String toString() {
return "DefectBeen{" + "qualityDefectCode='" + qualityDefectCode + '\'' + ", qualityDefectName='" + qualityDefectName + '\'' + ", itemCode='" + itemCode + '\'' + '}';
}
}
}

Loading…
Cancel
Save