yinq 10 months ago
commit 99da946f62

@ -1,6 +1,7 @@
package com.aucma.api.controller;
import com.aucma.api.domain.dto.CheckInfoDto;
import com.aucma.api.domain.dto.RepairSubmitInfoDto;
import com.aucma.api.service.IPdaBindingService;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.utils.StringUtils;
@ -21,7 +22,7 @@ import static com.aucma.common.core.domain.AjaxResult.success;
* @date 2023/11/14 9:28
*/
@RestController
@RequestMapping(("/api"))
@RequestMapping("/api")
public class PdaApiController {
@Autowired
@ -41,31 +42,52 @@ public class PdaApiController {
//条码绑定
@PostMapping("/barCodeBanding")
public AjaxResult barCodeBanding(String boxCode, String innerCode, String loginName) {
// 查询质检缺陷有没有修复 还没做
// 查询质检缺陷有没有修复
int countQa = service.countQualityRecordByCode(boxCode);
if (countQa > 0) {
return error("返修中" + countQa + "条未处理,不允许绑定");
}
// 查询插入
// Long objid=service.select
return success();
return toAjax(service.updateCodeBinding(boxCode, innerCode));
}
@PostMapping("/selectGoodsName")
public AjaxResult selectGoodsName(String code) {
String boxName = service.selectBoxNameByCode(code);
if (boxName == null) {
return error("查询失败,条码不正确");
}
return success("操作成功", boxName);
}
@Autowired
private IReportQualityInspectionService qualityService;
// 质检查询名称、前工位返修数据
@PostMapping("/check/select")
public AjaxResult checkSelect(String code) {
String boxName = service.selectBoxNameByCode(code);
if (boxName == null) {
boxName = "固定数据";
// return error("箱壳条码扫描错误");
}
List<ReportQualityInspection> list = service.checkSelectRepairInfo(code);
return success(boxName, list);
}
// 质检提交
@PostMapping("/checkSubmit")
public AjaxResult checkSubmit(@RequestBody CheckInfoDto checkInfo) {
List<CheckInfoDto.DefectBeen> list = checkInfo.getList();
String boxName = service.selectBoxNameByCode(checkInfo.getCode());
if (boxName==null) {
return error("箱壳条码扫描错误");
}
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.setMaterialName(boxName);
// inspection.setMaterialName(boxName);
inspection.setTreatmentMeasure(checkInfo.getMeasure());
inspection.setProcessResult(checkInfo.getMeasureName());
inspection.setIsLowerLine(checkInfo.getOffline());
inspection.setInspectorCode(checkInfo.getUserName());
inspection.setInspectorTime(new Date());
assert list != null;
@ -83,11 +105,22 @@ public class PdaApiController {
//返修查询质检信息
@PostMapping("/findCheckInfoByCode")
public AjaxResult findCheckInfoByCode(String code) {
List<ReportQualityInspection> list= qualityService.findCheckInfoByCode(code);
if (list==null || list.isEmpty()){
List<ReportQualityInspection> list = service.findCheckInfoByCode(code);
if (list == null || list.isEmpty()) {
return error("扫描条码不正确");
}
return success(list);
}
//返修提交质检信息
@PostMapping("/submitRepair")
public AjaxResult submitRepair(@RequestBody RepairSubmitInfoDto info) {
return toAjax(service.submitRepair(info));
}
private AjaxResult toAjax(int rows) {
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
}

@ -0,0 +1,48 @@
package com.aucma.api.domain.dto;
import java.util.List;
/**
* @author wanghao
* @date 2023/12/4 15:05
*/
public class RepairSubmitInfoDto {
private List<Integer> list;
private String loginName;
private String repairName;
private int isFlag;
public List<Integer> getList() {
return list;
}
public void setList(List<Integer> list) {
this.list = list;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getRepairName() {
return repairName;
}
public void setRepairName(String repairName) {
this.repairName = repairName;
}
public int getIsFlag() {
return isFlag;
}
public void setIsFlag(int isFlag) {
this.isFlag = isFlag;
}
}

@ -1,8 +1,12 @@
package com.aucma.api.mapper;
import com.aucma.api.domain.dto.RepairSubmitInfoDto;
import com.aucma.report.domain.ReportQualityInspection;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author wanghao
* @date 2023/11/14 10:16
@ -14,4 +18,14 @@ public interface PdaBindingMapper {
int insertBindingInfo(@Param("boxCode") String boxCode,
@Param("boxName") String boxName,
@Param("innerCode")String innerCode);
int countQualityRecordByCode(String code);
int updateCodeBinding(@Param("boxCode") String boxCode, @Param("innerCode")String innerCode);
int submitRepair(@Param("info")RepairSubmitInfoDto info);
List<ReportQualityInspection> findCheckInfoByCode(String code);
List<ReportQualityInspection> checkSelectRepairInfo(String code);
}

@ -1,5 +1,10 @@
package com.aucma.api.service;
import com.aucma.api.domain.dto.RepairSubmitInfoDto;
import com.aucma.report.domain.ReportQualityInspection;
import java.util.List;
/**
* @author wanghao
* @date 2023/11/14 9:56
@ -8,4 +13,14 @@ public interface IPdaBindingService {
String selectBoxNameByCode(String boxCode);
int insertBindingInfo(String boxCode, String boxName, String innerCode);
int countQualityRecordByCode(String code);
int updateCodeBinding(String boxCode, String innerCode);
int submitRepair(RepairSubmitInfoDto info);
List<ReportQualityInspection> findCheckInfoByCode(String code);
List<ReportQualityInspection> checkSelectRepairInfo(String code);
}

@ -1,10 +1,14 @@
package com.aucma.api.service.impl;
import com.aucma.api.domain.dto.RepairSubmitInfoDto;
import com.aucma.api.mapper.PdaBindingMapper;
import com.aucma.api.service.IPdaBindingService;
import com.aucma.report.domain.ReportQualityInspection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author wanghao
* @date 2023/11/14 9:56
@ -25,5 +29,28 @@ public class PdaServiceImpl implements IPdaBindingService {
return mapper.insertBindingInfo(boxCode,boxName,innerCode);
}
@Override
public int countQualityRecordByCode(String code) {
return mapper.countQualityRecordByCode(code);
}
@Override
public int updateCodeBinding(String boxCode, String innerCode) {
return mapper.updateCodeBinding(boxCode,innerCode);
}
@Override
public int submitRepair(RepairSubmitInfoDto info) {
return mapper.submitRepair(info);
}
@Override
public List<ReportQualityInspection> findCheckInfoByCode(String code) {
return mapper.findCheckInfoByCode(code);
}
@Override
public List<ReportQualityInspection> checkSelectRepairInfo(String code) {
return mapper.checkSelectRepairInfo(code);
}
}

@ -10,9 +10,52 @@
</select>
<insert id="insertBindingInfo">
INSERT INTO AUCMA_SCADA.CODE_BINDING
(OBJ_ID, BOX_CODE, BOX_NAME, LINER_CODE, BINDING_RESULT, RECORD_TIME1)
INSERT INTO AUCMA_SCADA.CODE_BINDING(OBJ_ID, BOX_CODE, BOX_NAME, LINER_CODE, BINDING_RESULT, RECORD_TIME1)
VALUES (AUCMA_SCADA.SEQ_CODE_BINDING.nextval, #{boxCode}, #{boxName}, #{innerCode}, '成功', SYSDATE)
</insert>
<update id="updateCodeBinding">
UPDATE AUCMA_SCADA.CODE_BINDING
SET PRODUCT_CODE = #{innerCode}, BINDING_RESULT = '成功',RECORD_TIME2 = SYSDATE,IS_PASS= 1
where BOX_CODE = #{boxCode}
</update>
<select id="countQualityRecordByCode" resultType="int">
select count(OBJ_ID)
from AUCMA_MES.REPORT_QUALITY_INSPECTION
where BAR_CODE = #{code} and IS_FLAG !=1
</select>
<update id="submitRepair" parameterType="com.aucma.api.domain.dto.RepairSubmitInfoDto">
UPDATE AUCMA_MES.REPORT_QUALITY_INSPECTION
SET PROCESS_RESULT = #{info.repairName},
REWORK_NUMBER = 1,
FINISH_TIME = sysdate,
IS_FLAG = #{info.isFlag},
UPDATED_BY = #{info.loginName},
UPDATED_TIME = sysdate
WHERE OBJ_ID in
<foreach item="objId" collection="info.list" open="(" separator="," close=")">
#{objId}
</foreach>
</update>
<select id="findCheckInfoByCode" resultMap="com.aucma.report.mapper.ReportQualityInspectionMapper.ReportQualityInspectionResult">
select OBJ_ID,
MATERIAL_NAME,
QUALITY_DEFECT_CODE,
QUALITY_DEFECT_NAME
from AUCMA_MES.REPORT_QUALITY_INSPECTION
where BAR_CODE = #{code}
and IS_FLAG is null
</select>
<select id="checkSelectRepairInfo" resultMap="com.aucma.report.mapper.ReportQualityInspectionMapper.ReportQualityInspectionResult">
select OBJ_ID,
MATERIAL_NAME,
QUALITY_DEFECT_CODE,
QUALITY_DEFECT_NAME
from AUCMA_MES.REPORT_QUALITY_INSPECTION
where BAR_CODE = #{code}
and IS_FLAG = 1
</select>
</mapper>

@ -119,6 +119,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers(HttpMethod.POST, "/sap/port/**").permitAll()
// 开放看板接口
.antMatchers(HttpMethod.POST, "/boardReport/**").permitAll()
.antMatchers(HttpMethod.POST, "/**/**/**").permitAll()
.antMatchers(HttpMethod.GET, "/**/**/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
.and()

@ -59,5 +59,5 @@ public interface ReportQualityInspectionMapper
*/
public int deleteReportQualityInspectionByObjIds(Long[] objIds);
List<ReportQualityInspection> findCheckInfoByCode(String code);
}

@ -59,5 +59,5 @@ public interface IReportQualityInspectionService
*/
public int deleteReportQualityInspectionByObjId(Long objId);
List<ReportQualityInspection> findCheckInfoByCode(String code);
}

@ -91,10 +91,6 @@ public class ReportQualityInspectionServiceImpl implements IReportQualityInspect
return reportQualityInspectionMapper.deleteReportQualityInspectionByObjId(objId);
}
@Override
public List<ReportQualityInspection> findCheckInfoByCode(String code) {
return reportQualityInspectionMapper.findCheckInfoByCode(code);
}
}

@ -168,12 +168,6 @@
</foreach>
</delete>
<select id="findCheckInfoByCode" resultMap="ReportQualityInspectionResult">
select OBJ_ID,
QUALITY_DEFECT_CODE,
QUALITY_DEFECT_NAME
from AUCMA_MES.REPORT_QUALITY_INSPECTION
where BAR_CODE = #{code}
and PROCESS_RESULT is null
</select>
</mapper>
Loading…
Cancel
Save