修改 巡检接口

master
wanghao 3 months ago
parent e512f702d3
commit 26e38e002f

@ -173,7 +173,6 @@ public class ApiController {
private IRecordInvalidatedService recordInvalidatedService; private IRecordInvalidatedService recordInvalidatedService;
@PostMapping("/xj/selectLite") @PostMapping("/xj/selectLite")
public String xjSelectLite(String user) { public String xjSelectLite(String user) {
List<StockDto> list = apiService.xjSelect(user); List<StockDto> list = apiService.xjSelect(user);
@ -186,13 +185,21 @@ public class ApiController {
@Autowired @Autowired
private IRecordInspectionService inspectionService; private IRecordInspectionService inspectionService;
@PostMapping("/inspection/skipTask")
public AjaxResult inspectionSubmit(long tableId, String remark) {
apiService.updataInspectionTaskByObjid(tableId,remark,"跳过");
return success();
}
@PostMapping("/xj/submit") @PostMapping("/xj/submit")
public AjaxResult inspectionSubmit(long tableId, String json, long inspectionId, String user,List<MultipartFile> files) { public AjaxResult inspectionSubmit(long tableId, String json, long inspectionId, String user, List<MultipartFile> files) {
//插入 info 表 //插入 info 表
List<StockDto> list = JSONObject.parseArray(json, StockDto.class); List<StockDto> list = JSONObject.parseArray(json, StockDto.class);
String locationCode = list.get(0).getLocationCode();
apiService.deleteInspectionInfo(locationCode, inspectionId);
apiService.insertInspectionInfo(list, inspectionId); apiService.insertInspectionInfo(list, inspectionId);
//修改task状态 //修改task状态
apiService.updataInspectionTaskByObjid(tableId); apiService.updataInspectionTaskByObjid(tableId,null,"已完成");
//存储图片,插库 //存储图片,插库
String filePath = RuoYiConfig.getUploadPath() + "/inspection"; String filePath = RuoYiConfig.getUploadPath() + "/inspection";
@ -205,7 +212,8 @@ public class ApiController {
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("上传图片路径:" + pathName); System.out.println("上传图片路径:" + pathName);
apiService.insertInspetionPictrue(inspectionId, tableId,user, pathName);
apiService.insertInspetionPictrue(inspectionId, tableId, user, pathName, locationCode);
} }
} }
@ -213,20 +221,6 @@ public class ApiController {
} }
/**
*
*
* @param user
* @return
*/
@PostMapping("/inspection/selectTask")
public AjaxResult inspectionSelectTask(String user) {
List<CheckTaskInfo> list = apiService.inspectionSelectTask(user);
if (list == null || list.isEmpty()) {
return error("需要创建");
}
return success(list);
}
/** /**
* *
@ -263,17 +257,37 @@ public class ApiController {
} }
/**
*
*
* @return
*/
@PostMapping("/inspection/selectTask")
public AjaxResult inspectionSelectTask(@RequestParam(value = "state", defaultValue = "") String state) {
try {
int inspectionid = apiService.selectCodeFromRecode();
System.out.println(inspectionid + "-" + state);
List<CheckTaskInfo> list = apiService.inspectionSelectTask(state, inspectionid);
// if (list == null || list.isEmpty()) {
// return error("需要领用轮挡到机位");
// }
return success(list);
} catch (Exception e) {
e.printStackTrace();
return error("需要创建");
}
}
/** /**
* *
*
* @param epc * @param epc
* @param user * @param user
* @param remark * @param remark
* @return * @return
*/ */
@PostMapping("/bf/submit") @PostMapping("/bf/submit")
public AjaxResult bfSubmit(String epc, String reason,String user, String remark,List<MultipartFile> files) { public AjaxResult bfSubmit(String epc, String reason, String user, String remark, List<MultipartFile> files) {
//插入记录 //插入记录
RecordInvalidated recordInvalidated = new RecordInvalidated(); RecordInvalidated recordInvalidated = new RecordInvalidated();
recordInvalidated.setEpc(epc); recordInvalidated.setEpc(epc);
@ -296,7 +310,7 @@ public class ApiController {
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("上传图片路径:" + pathName); System.out.println("上传图片路径:" + pathName);
apiService.insertBfImg(recordInvalidated.getObjid(),epc,user, pathName); apiService.insertBfImg(recordInvalidated.getObjid(), epc, user, pathName);
} }
} }

@ -59,16 +59,22 @@ public interface ApiMapper {
void insertCheckTask(@Param("id") int id,@Param("list") List<CheckTaskInfo> list); void insertCheckTask(@Param("id") int id,@Param("list") List<CheckTaskInfo> list);
List<CheckTaskInfo> inspectionSelectTask(String user); List<CheckTaskInfo> inspectionSelectTask(@Param("state") String state,
@Param("id")int id);
List<StockDto> inspectionSelectLocation(String code); List<StockDto> inspectionSelectLocation(String code);
void updataInspectionTaskByObjid(long tableId); void updataInspectionTaskByObjid( @Param("tableId")long tableId,
@Param("remark") String remark,
@Param("state") String state
);
void insertInspetionPictrue(@Param("inspetionId") long inspectionId, void insertInspetionPictrue(@Param("inspetionId") long inspectionId,
@Param("tableId") long tableId, @Param("tableId") long tableId,
@Param("user") String user, @Param("user") String user,
@Param("pathName") String pathName); @Param("pathName") String pathName,
@Param("locationCode") String locationCode
);
void insertBfImg(@Param("objid") Long objid, void insertBfImg(@Param("objid") Long objid,
@Param("epc") String epc, @Param("epc") String epc,
@ -76,4 +82,8 @@ public interface ApiMapper {
@Param("pathName") String pathName); @Param("pathName") String pathName);
List<CheckTaskInfo> selectLocationFromLedger(); List<CheckTaskInfo> selectLocationFromLedger();
int selectCodeFromRecode();
void deleteInspectionInfo(@Param("inspectionId") long inspectionId,@Param("locationCode") String locationCode);
} }

@ -109,20 +109,20 @@ public class ApiService {
mapper.insertCheckTask(id, list); mapper.insertCheckTask(id, list);
} }
public List<CheckTaskInfo> inspectionSelectTask(String user) { public List<CheckTaskInfo> inspectionSelectTask(String state,int id) {
return mapper.inspectionSelectTask(user); return mapper.inspectionSelectTask(state,id);
} }
public List<StockDto> inspectionSelectLocation(String code) { public List<StockDto> inspectionSelectLocation(String code) {
return mapper.inspectionSelectLocation(code); return mapper.inspectionSelectLocation(code);
} }
public void updataInspectionTaskByObjid(long tableId) { public void updataInspectionTaskByObjid(long tableId, String remark,String state) {
mapper.updataInspectionTaskByObjid(tableId); mapper.updataInspectionTaskByObjid(tableId,remark,state);
} }
public void insertInspetionPictrue(long inspectionId, long tableId, String user, String pathName) { public void insertInspetionPictrue(long inspectionId, long tableId, String user, String pathName,String locationCode) {
mapper.insertInspetionPictrue(inspectionId, tableId,user, pathName); mapper.insertInspetionPictrue(inspectionId, tableId,user, pathName,locationCode);
} }
public void insertBfImg(Long objid, String epc, String user, String pathName) { public void insertBfImg(Long objid, String epc, String user, String pathName) {
@ -132,4 +132,12 @@ public class ApiService {
public List<CheckTaskInfo> selectLocationFromLedger() { public List<CheckTaskInfo> selectLocationFromLedger() {
return mapper.selectLocationFromLedger(); return mapper.selectLocationFromLedger();
} }
public int selectCodeFromRecode() {
return mapper.selectCodeFromRecode();
}
public void deleteInspectionInfo(String locationCode, long inspectionId) {
mapper.deleteInspectionInfo(inspectionId,locationCode);
}
} }

@ -192,6 +192,7 @@
<result column="task_state" property="taskState"/> <result column="task_state" property="taskState"/>
<result column="objid" property="id"/> <result column="objid" property="id"/>
<result column="area_id" property="areaId"/> <result column="area_id" property="areaId"/>
<result column="store_id" property="areaId"/>
<result column="inspection_id" property="inspectionId"/> <result column="inspection_id" property="inspectionId"/>
</resultMap> </resultMap>
@ -221,8 +222,14 @@
task_state, task_state,
rit.inspection_id rit.inspection_id
from record_inspection_task rit from record_inspection_task rit
right join record_inspection ri on rit.inspection_id = ri.inspection_id
where inspection_user = #{user} <where>
inspection_id=#{id}
<if test="state != null and state != '全部'">
AND task_state = #{state}
</if>
</where>
</select> </select>
<select id="inspectionSelectLocation" resultType="com.ruoyi.api.domain.StockDto"> <select id="inspectionSelectLocation" resultType="com.ruoyi.api.domain.StockDto">
@ -237,12 +244,12 @@
</select> </select>
<!--完成任务--> <!--完成任务-->
<update id="updataInspectionTaskByObjid"> <update id="updataInspectionTaskByObjid">
UPDATE record_inspection_task SET task_state = '完成' WHERE objid = #{tableId}; UPDATE record_inspection_task SET task_state = #{state},remark = #{remark} WHERE objid = #{tableId};
</update> </update>
<insert id="insertInspetionPictrue"> <insert id="insertInspetionPictrue">
INSERT INTO record_inspection_img (inspection_id, task_id, img_path, create_by) INSERT INTO record_inspection_img (inspection_id, task_id, img_path, create_by,location_code)
VALUES (#{inspetionId},#{tableId}, #{pathName}, #{user}); VALUES (#{inspetionId},#{tableId}, #{pathName}, #{user},#{locationCode});
</insert> </insert>
<insert id="insertBfImg"> <insert id="insertBfImg">
@ -262,4 +269,15 @@
group by bl.location_code group by bl.location_code
order by bl.location_code order by bl.location_code
</select> </select>
<select id="selectCodeFromRecode" resultType="int">
select inspection_id
from record_inspection
-- where date(inspection_time) = date(now())
order by inspection_time desc
limit 1
</select>
<delete id="deleteInspectionInfo">
delete from bg_wheel_chocks.record_inspection_info where inspection_id = #{inspectionId} and location_code =#{locationCode}
</delete>
</mapper> </mapper>
Loading…
Cancel
Save