修改 巡检

master
wanghao
parent 6703d73c7c
commit d423b752f7

@ -1,22 +1,27 @@
package com.ruoyi.api.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.api.domain.CheckTaskInfo;
import com.ruoyi.api.domain.InStoreDto;
import com.ruoyi.api.domain.OutStoreDto;
import com.ruoyi.api.domain.StockDto;
import com.ruoyi.api.service.impl.ApiService;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.domain.AjaxResult;
import static com.ruoyi.common.core.domain.AjaxResult.*;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.manage.domain.*;
import com.ruoyi.manage.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.unit.DataUnit;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.*;
@ -55,7 +60,7 @@ public class ApiController {
public AjaxResult instoreSubmit(@RequestBody InStoreDto inStore) {
List<String> epcList = inStore.getEpcList();
int size = epcList.size();
System.out.println("数据条数:"+size);
System.out.println("数据条数:" + size);
Iterator<String> iterator = epcList.iterator();
while (iterator.hasNext()) {
String epc = iterator.next();
@ -66,13 +71,13 @@ public class ApiController {
}
int size1 = epcList.size();
int i = size - size1;
if (size1>0){
if (size1 > 0) {
apiService.submintInsertRecordIn(inStore);
apiService.submintInsertLedger(inStore);
}
return success("本次入库成功:" + size1 +"条,屏蔽重复入库:"+ i +"条");
return success("本次入库成功:" + size1 + "条,屏蔽重复入库:" + i + "条");
}
@ -88,13 +93,13 @@ public class ApiController {
@PostMapping("/outStore/submit")
public AjaxResult outStoreSubmit(@RequestBody OutStoreDto outStoreDto) {
try {
List<String> epcList = outStoreDto.getEpcList();
//int i=0;
for (String epc:epcList ) {
List<String> epcList = outStoreDto.getEpcList();
//int i=0;
for (String epc : epcList) {
String tag = apiService.selectLedgerbyEpcForOutStore(epc);
if (tag!=null){
apiService.submitInsertRecordOut(outStoreDto,epc);
apiService.updataLedgerFoyOut(outStoreDto,epc);
if (tag != null) {
apiService.submitInsertRecordOut(outStoreDto, epc);
apiService.updataLedgerFoyOut(outStoreDto, epc);
//i++;
}
@ -118,7 +123,7 @@ public class ApiController {
}*/
return success();
}catch (Exception e){
} catch (Exception e) {
return error();
}
@ -180,16 +185,9 @@ public class ApiController {
return success();
}
@PostMapping("/xj/select")
public AjaxResult xjSelect(String user) {
List<StockDto> list = apiService.xjSelect(user);
if (list == null) {
return error("没有维护巡检区域");
}
return success(list);
}
@PostMapping("/xj/selectLite")
public String xjSelectLite(String user) {
@PostMapping("/xj/selectLite")
public String xjSelectLite(String user) {
List<StockDto> list = apiService.xjSelect(user);
if (list == null) {
return "null";
@ -201,15 +199,81 @@ public class ApiController {
private IRecordInspectionService inspectionService;
@PostMapping("/xj/submit")
public AjaxResult inspectionSubmit(String json, String user) {
public AjaxResult inspectionSubmit(long tableId, String json, long inspectionId, List<MultipartFile> files) {
//插入 info 表
List<StockDto> list = JSONObject.parseArray(json, StockDto.class);
apiService.insertInspectionInfo(list, inspectionId);
//修改task状态
apiService.updataInspectionTaskByObjid(tableId);
//存储图片,插库
String filePath = RuoYiConfig.getUploadPath() + "/inspection";
Date date = new Date();
if (files != null && files.size() > 0) {
for (MultipartFile multipartFile : files) {
String pathName = null;
try {
pathName = FileUploadUtils.upload(filePath, multipartFile);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("上传图片路径:" + pathName);
//apiService.confirmSubment(inspectionId, tableId, pathName);
}
}
return success();
}
/**
*
*
* @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);
}
/**
*
*
* @param
* @return
*/
@PostMapping("/inspection/select")
public AjaxResult inspectionSelect(String code) {
List<StockDto> list = apiService.inspectionSelectLocation(code);
if (list == null) {
return error("没有领用轮挡");
}
return success(list);
}
/**
*
*
* @param user
* @return
*/
@PostMapping("/xj/createTask")
public AjaxResult inspectionCreateTask(String user) {
List<CheckTaskInfo> list = apiService.selectLocationByAreaUser(user);
if (list == null || list.isEmpty()) {
return error("没有维护巡检区域");
}
RecordInspection recordInspection = new RecordInspection();
recordInspection.setInspectionUser(user);
int insertNumber = inspectionService.insertRecordInspection(recordInspection);
if (insertNumber == 1) {
List<StockDto> list = JSONObject.parseArray(json, StockDto.class);
apiService.insertInspectionInfo(list,recordInspection.getInspectionId());
}
return success();
apiService.insertCheckTask(Math.toIntExact(recordInspection.getInspectionId()), list);
return success("创建成功", insertNumber);
}
@ -233,6 +297,7 @@ public class ApiController {
apiService.updataLedgerIn(epc, subCode);
return success();
}
@PostMapping("/fpout/select")
public AjaxResult fpOutSelect() {
List<StockDto> list = apiService.fpOutSelect();
@ -246,10 +311,10 @@ public class ApiController {
public AjaxResult fpoutSubmit(String json, String user) {
try {
List<StockDto> list = JSONObject.parseArray(json, StockDto.class);
apiService.insertWasreOutRecord(list,user);
apiService.updataLedgerForWasreOut(list,user);
apiService.insertWasreOutRecord(list, user);
apiService.updataLedgerForWasreOut(list, user);
return success();
}catch (Exception e){
} catch (Exception e) {
return error();
}

@ -0,0 +1,71 @@
package com.ruoyi.api.domain;
import com.ruoyi.common.annotation.Log;
public class CheckTaskInfo {
private int index;
private Long id;
private Long areaId;
private String locationCode;
private String areaName;
private String taskState;
private Long inspectionId;
public Long getInspectionId() {
return inspectionId;
}
public void setInspectionId(Long inspectionId) {
this.inspectionId = inspectionId;
}
public Long getAreaId() {
return areaId;
}
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public String getTaskState() {
return taskState;
}
public void setTaskState(String taskState) {
this.taskState = taskState;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLocationCode() {
return locationCode;
}
public void setLocationCode(String locationCode) {
this.locationCode = locationCode;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
}

@ -1,5 +1,6 @@
package com.ruoyi.api.mapper;
import com.ruoyi.api.domain.CheckTaskInfo;
import com.ruoyi.api.domain.InStoreDto;
import com.ruoyi.api.domain.OutStoreDto;
import com.ruoyi.api.domain.StockDto;
@ -53,4 +54,14 @@ public interface ApiMapper {
String selectLedgerbyEpcForOutStore(String epc);
int updataLedgerFoyOut(@Param("outStoreDto") OutStoreDto outStoreDto, @Param("epc") String epc);
List<CheckTaskInfo> selectLocationByAreaUser(String user);
void insertCheckTask(@Param("id") int id,@Param("list") List<CheckTaskInfo> list);
List<CheckTaskInfo> inspectionSelectTask(String user);
List<StockDto> inspectionSelectLocation(String code);
void updataInspectionTaskByObjid(long tableId);
}

@ -1,5 +1,6 @@
package com.ruoyi.api.service.impl;
import com.ruoyi.api.domain.CheckTaskInfo;
import com.ruoyi.api.domain.InStoreDto;
import com.ruoyi.api.domain.OutStoreDto;
import com.ruoyi.api.domain.StockDto;
@ -19,17 +20,19 @@ import java.util.List;
public class ApiService {
@Autowired
private ApiMapper mapper;
@Transactional
@Transactional
public int submintInsertRecordIn(InStoreDto inStore) {
return mapper.submintInsertRecordIn(inStore);
}
@Transactional
public int submintInsertLedger(InStoreDto inStore) {
return mapper.submintInsertLedger(inStore);
}
public int submitInsertRecordOut(OutStoreDto outStoreDto,String epc) {
return mapper.submitInsertRecordOut(outStoreDto,epc);
public int submitInsertRecordOut(OutStoreDto outStoreDto, String epc) {
return mapper.submitInsertRecordOut(outStoreDto, epc);
}
public int updataLedger(OutStoreDto outStoreDto) {
@ -41,7 +44,7 @@ public class ApiService {
}
public void insertCheckInfo(List<StockDto> list, Long checkId) {
mapper.insertCheckInfo(list,checkId);
mapper.insertCheckInfo(list, checkId);
}
public List<StockDto> xjSelect(String user) {
@ -53,7 +56,7 @@ public class ApiService {
}
public void updataLedgerForBf(String epc, String state) {
mapper.updataLedgerForBf(epc,state);
mapper.updataLedgerForBf(epc, state);
}
public LedgerRfid fpInSelect(String epc) {
@ -61,38 +64,60 @@ public class ApiService {
}
public int fpInSubmit(String epc, String localtionCode, String user, String bf, String subCode) {
return mapper.fpInSubmit(epc,localtionCode,user,bf,subCode);
return mapper.fpInSubmit(epc, localtionCode, user, bf, subCode);
}
public void updataLedgerIn(String epc, String locationCode) {
mapper.updataLedgerIn(epc,locationCode);
mapper.updataLedgerIn(epc, locationCode);
}
public void insertInspectionInfo(List<StockDto> list, Long inspectionId) {
mapper.insertInspectionInfo(list,inspectionId);
mapper.insertInspectionInfo(list, inspectionId);
}
public List<StockDto> fpOutSelect() {
return mapper.fpOutSelect();
}
@Transactional
@Transactional
public void insertWasreOutRecord(List<StockDto> list, String user) {
mapper.insertWasreOutRecord(list,user);
mapper.insertWasreOutRecord(list, user);
}
@Transactional
public void updataLedgerForWasreOut(List<StockDto> list, String user) {
mapper.updataLedgerForWasreOut(list);
}
public String selectLedgerbyEpcForInStore(String epc) {
return mapper.selectLedgerbyEpcForInStore(epc);
return mapper.selectLedgerbyEpcForInStore(epc);
}
public String selectLedgerbyEpcForOutStore(String epc) {
return mapper.selectLedgerbyEpcForOutStore(epc);
return mapper.selectLedgerbyEpcForOutStore(epc);
}
public int updataLedgerFoyOut(OutStoreDto outStoreDto, String epc) {
return mapper.updataLedgerFoyOut(outStoreDto, epc);
}
public List<CheckTaskInfo> selectLocationByAreaUser(String user) {
return mapper.selectLocationByAreaUser(user);
}
public void insertCheckTask(int id, List<CheckTaskInfo> list) {
mapper.insertCheckTask(id, list);
}
public List<CheckTaskInfo> inspectionSelectTask(String user) {
return mapper.inspectionSelectTask(user);
}
public List<StockDto> inspectionSelectLocation(String code) {
return mapper.inspectionSelectLocation(code);
}
public int updataLedgerFoyOut(OutStoreDto outStoreDto,String epc) {
return mapper.updataLedgerFoyOut(outStoreDto,epc);
public void updataInspectionTaskByObjid(long tableId) {
mapper.updataInspectionTaskByObjid(tableId);
}
}

@ -3,7 +3,6 @@
<mapper namespace="com.ruoyi.api.mapper.ApiMapper">
<select id="selectLedgerbyEpcForOutStore" resultType="string">
select rifd_code from ledger_rfid where rifd_code = #{epc}
and is_scrap = 1
@ -24,7 +23,6 @@
</insert>
<insert id="submintInsertLedger">
INSERT ignore into ledger_rfid (manufacturer_id, rifd_code, batch_code, location_code)
VALUES
@ -39,9 +37,9 @@
INSERT INTO record_out (epc_code, location_code, use_user, create_by)
VALUES
<foreach collection="outStoreDto.epcList" item="epc" separator=",">
(
#{epc}, #{outStoreDto.areaCode}, #{outStoreDto.useUser}, #{outStoreDto.submitUser}
)
(
#{epc}, #{outStoreDto.areaCode}, #{outStoreDto.useUser}, #{outStoreDto.submitUser}
)
</foreach>
</insert>
@ -166,16 +164,16 @@
<insert id="insertWasreOutRecord">
INSERT INTO record_waste_out (epc_code, location_code, create_by) VALUES
<foreach collection="list" item="item" separator=",">
( #{item.epcCode},#{item.locationCode},#{user})
( #{item.epcCode},#{item.locationCode},#{user})
</foreach>
</insert>
<update id="updataLedgerForWasreOut" >
<update id="updataLedgerForWasreOut">
UPDATE ledger_rfid
SET location_type = null,
location_code = null,
is_scrap = '3',
update_time = now()
location_code = null,
is_scrap = '3',
update_time = now()
<where>
rifd_code in
<foreach item="item" collection="list" open="(" separator="," close=")">
@ -184,4 +182,62 @@
</where>
</update>
<resultMap id="checkTaskResultMap" type="com.ruoyi.api.domain.CheckTaskInfo">
<result column="index" property="index"/>
<result column="location_code" property="locationCode"/>
<result column="plane_position" property="locationCode"/>
<result column="store_name" property="areaName"/>
<result column="area_name" property="areaName"/>
<result column="task_state" property="taskState"/>
<result column="objid" property="id"/>
<result column="area_id" property="areaId"/>
<result column="inspection_id" property="inspectionId"/>
</resultMap>
<select id="selectLocationByAreaUser" resultMap="checkTaskResultMap">
select bs.store_id as objid ,
bs.store_name,
location_code
from base_location bl
left join base_store bs on bl.store_id = bs.store_id
right join base_area_user bau on bau.area_id = bl.store_id
where bl.stote_tag = 2 and bau.user_id=#{user}
</select>
<insert id="insertCheckTask">
INSERT INTO record_inspection_task (inspection_id, area_id,area_name, plane_position) VALUES
<foreach collection="list" item="data" separator=",">
(#{id}, #{data.id}, #{data.areaName}, #{data.locationCode})
</foreach>
</insert>
<select id="inspectionSelectTask" resultMap="checkTaskResultMap">
select rit.objid,
area_id,
area_name,
plane_position,
row_number() over (order by rit.objid) as 'index',
task_state,
rit.inspection_id
from record_inspection_task rit
right join record_inspection ri on rit.inspection_id = ri.inspection_id
where task_state = '待完成'
and inspection_user = #{user}
</select>
<select id="inspectionSelectLocation" resultType="com.ruoyi.api.domain.StockDto">
select row_number() over (order by location_code) as 'index',
rifd_code as epcCode,
location_code as locationCode,
create_time as createTime,
'未检' as state
from ledger_rfid
where is_scrap = 1
and location_code = #{code}
</select>
<!--完成任务-->
<update id="updataInspectionTaskByObjid" >
UPDATE record_inspection_task SET task_state = '完成' WHERE objid = #{tableId};
</update>
</mapper>

@ -1,6 +1,7 @@
package com.ruoyi.manage.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -21,14 +22,13 @@ import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
*
* @author wangh
* @date 2024-01-25
*/
@Controller
@RequestMapping("/manage/base_area_user")
public class BaseAreaUserController extends BaseController
{
public class BaseAreaUserController extends BaseController {
private String prefix = "manage/base_area_user";
@Autowired
@ -36,8 +36,7 @@ public class BaseAreaUserController extends BaseController
@RequiresPermissions("manage:base_area_user:view")
@GetMapping()
public String base_area_user()
{
public String base_area_user() {
return prefix + "/base_area_user";
}
@ -47,8 +46,7 @@ public class BaseAreaUserController extends BaseController
@RequiresPermissions("manage:base_area_user:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(BaseAreaUser baseAreaUser)
{
public TableDataInfo list(BaseAreaUser baseAreaUser) {
startPage();
List<BaseAreaUser> list = baseAreaUserService.selectBaseAreaUserList(baseAreaUser);
return getDataTable(list);
@ -61,8 +59,7 @@ public class BaseAreaUserController extends BaseController
@Log(title = "机场区域用户绑定", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(BaseAreaUser baseAreaUser)
{
public AjaxResult export(BaseAreaUser baseAreaUser) {
List<BaseAreaUser> list = baseAreaUserService.selectBaseAreaUserList(baseAreaUser);
ExcelUtil<BaseAreaUser> util = new ExcelUtil<BaseAreaUser>(BaseAreaUser.class);
return util.exportExcel(list, "机场区域用户绑定数据");
@ -72,8 +69,7 @@ public class BaseAreaUserController extends BaseController
*
*/
@GetMapping("/add")
public String add()
{
public String add() {
return prefix + "/add";
}
@ -84,9 +80,12 @@ public class BaseAreaUserController extends BaseController
@Log(title = "机场区域用户绑定", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(BaseAreaUser baseAreaUser)
{
return toAjax(baseAreaUserService.insertBaseAreaUser(baseAreaUser));
public AjaxResult addSave(BaseAreaUser baseAreaUser) {
List<BaseAreaUser> list = baseAreaUserService.selectBaseAreaUserList(baseAreaUser);
if (list == null || list.isEmpty()) {
return toAjax(baseAreaUserService.insertBaseAreaUser(baseAreaUser));
}
return error("数据已经维护");
}
/**
@ -94,8 +93,7 @@ public class BaseAreaUserController extends BaseController
*/
@RequiresPermissions("manage:base_area_user:edit")
@GetMapping("/edit/{objid}")
public String edit(@PathVariable("objid") Long objid, ModelMap mmap)
{
public String edit(@PathVariable("objid") Long objid, ModelMap mmap) {
BaseAreaUser baseAreaUser = baseAreaUserService.selectBaseAreaUserByObjid(objid);
mmap.put("baseAreaUser", baseAreaUser);
return prefix + "/edit";
@ -108,10 +106,12 @@ public class BaseAreaUserController extends BaseController
@Log(title = "机场区域用户绑定", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(BaseAreaUser baseAreaUser)
{
return toAjax(baseAreaUserService.updateBaseAreaUser(baseAreaUser));
public AjaxResult editSave(BaseAreaUser baseAreaUser) {
List<BaseAreaUser> list = baseAreaUserService.selectBaseAreaUserList(baseAreaUser);
if (list == null || list.isEmpty()) {
return toAjax(baseAreaUserService.updateBaseAreaUser(baseAreaUser));
}
return error("数据已经维护");
}
/**
@ -119,10 +119,9 @@ public class BaseAreaUserController extends BaseController
*/
@RequiresPermissions("manage:base_area_user:remove")
@Log(title = "机场区域用户绑定", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
public AjaxResult remove(String ids) {
return toAjax(baseAreaUserService.deleteBaseAreaUserByObjids(ids));
}
}

Loading…
Cancel
Save