电子标签亮灯 灭灯逻辑
This commit is contained in:
@@ -14,6 +14,8 @@ public class WmsJobRequest {
|
||||
private String taskNo;
|
||||
//托盘编码
|
||||
private String trayCode;
|
||||
//拣选输送机
|
||||
private String pickSsj;
|
||||
//料架编码
|
||||
private String containerCode;
|
||||
//起点
|
||||
|
||||
@@ -10,11 +10,18 @@ import com.ruoyi.api.service.IToWmsService;
|
||||
import com.ruoyi.bas.cargoSpace.mapper.BasCargoSpaceMapper;
|
||||
import com.ruoyi.bas.container.domain.BasContainer;
|
||||
import com.ruoyi.bas.container.service.IBasContainerService;
|
||||
import com.ruoyi.bas.tag.domain.BasTag;
|
||||
import com.ruoyi.bas.tag.service.IBasTagService;
|
||||
import com.ruoyi.bas.taskNo.service.IBasTaskNoService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojob.mapper.MydoJobMapper;
|
||||
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
||||
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||
import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
import com.ruoyi.out.tagTask.service.ITagTaskService;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -33,8 +40,17 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
@Autowired
|
||||
private IMydoJobDetailService mydoJobDetailService;
|
||||
@Autowired
|
||||
private IBasContainerService basContainerService;
|
||||
|
||||
@Autowired
|
||||
private ITagTaskService tagTaskService;
|
||||
@Autowired
|
||||
private IBasTaskNoService basTaskNoService;
|
||||
@Autowired
|
||||
private IBasTagService iBasTagService;
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult inJob(MydoJob mydoJob) {
|
||||
@@ -50,6 +66,12 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
switch (wmsJobRequest.getWmsType()){
|
||||
case "1":
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getTrayCode())){
|
||||
return AjaxResult.error("托盘码不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getTaskNo())){
|
||||
return AjaxResult.error("作业号不能为空");
|
||||
}
|
||||
//入库
|
||||
mydoJobParam.setTaskNo(wmsJobRequest.getTaskNo());
|
||||
mydoJobParam.setTrayCode(wmsJobRequest.getTrayCode());
|
||||
@@ -61,6 +83,15 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
mydoJobService.manualCompleted(inMydoJob);
|
||||
break;
|
||||
case "2":
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getTrayCode())){
|
||||
return AjaxResult.error("托盘码不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getPickSsj())){
|
||||
return AjaxResult.error("拣选工位不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getTaskNo())){
|
||||
return AjaxResult.error("作业号不能为空");
|
||||
}
|
||||
//出库
|
||||
mydoJobParam.setTaskNo(wmsJobRequest.getTaskNo());
|
||||
mydoJobParam.setTrayCode(wmsJobRequest.getTrayCode());
|
||||
@@ -69,10 +100,42 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
return AjaxResult.error("没有该作业 taskNo: {}", wmsJobRequest.getTaskNo());
|
||||
}
|
||||
//mydoJobService.OuthandFinish(outMydoJobs.stream().map(MydoJob::getJobId).toArray(String[]::new));
|
||||
//todo 同步电子标签
|
||||
|
||||
//查询拣选工位绑定的电子标签
|
||||
BasTag tagParam = new BasTag();
|
||||
tagParam.setPickAdd(wmsJobRequest.getPickSsj());
|
||||
List<BasTag> tags = iBasTagService.selectBasTagList(tagParam);
|
||||
if (tags.isEmpty()){
|
||||
return AjaxResult.error("没有该拣选工位绑定的电子标签");
|
||||
}
|
||||
BasTag basTag = tags.get(0);
|
||||
basTag.setTrayCode(wmsJobRequest.getTrayCode());
|
||||
iBasTagService.updateBasTag(basTag);
|
||||
//同步电子标签
|
||||
MydoJobDetail param = new MydoJobDetail();
|
||||
param.setJobId(outMydoJobs.get(0).getJobId());
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(param);
|
||||
for (MydoJobDetail mydoJobDetail : mydoJobDetails) {
|
||||
TagTask tagTask = new TagTask();
|
||||
tagTask.setTagId(basTag.getId());
|
||||
tagTask.setJobDetailId(mydoJobDetail.getJobDetailId());
|
||||
tagTask.setProductId(mydoJobDetail.getProductId());
|
||||
tagTask.setNum(mydoJobDetail.getOutQuantity());
|
||||
tagTask.setStatus("0");
|
||||
tagTask.setColor("0");
|
||||
tagTask.setFloor("0");
|
||||
tagTaskService.insertTagTask(tagTask);
|
||||
}
|
||||
break;
|
||||
case "3":
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getContainerCode())){
|
||||
return AjaxResult.error("容器码不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getPositionCode1())){
|
||||
return AjaxResult.error("起始点位不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getPositionCode2())){
|
||||
return AjaxResult.error("目标点位不能为空");
|
||||
}
|
||||
//agv搬运作业
|
||||
//绑定料架和点位
|
||||
BasContainer basContainerParam = new BasContainer();
|
||||
@@ -90,6 +153,6 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
default:
|
||||
return AjaxResult.error("作业类型错误");
|
||||
}
|
||||
return null;
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.bas.tag.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.bas.tag.domain.BasTag;
|
||||
import com.ruoyi.bas.tag.service.IBasTagService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 电子标签Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bas/tag")
|
||||
public class BasTagController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBasTagService basTagService;
|
||||
|
||||
/**
|
||||
* 查询电子标签列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:tag:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BasTag basTag)
|
||||
{
|
||||
startPage();
|
||||
List<BasTag> list = basTagService.selectBasTagList(basTag);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出电子标签列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:tag:export')")
|
||||
@Log(title = "电子标签", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BasTag basTag)
|
||||
{
|
||||
List<BasTag> list = basTagService.selectBasTagList(basTag);
|
||||
ExcelUtil<BasTag> util = new ExcelUtil<BasTag>(BasTag.class);
|
||||
util.exportExcel(response, list, "电子标签数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电子标签详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:tag:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(basTagService.selectBasTagById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电子标签
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:tag:add')")
|
||||
@Log(title = "电子标签", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BasTag basTag)
|
||||
{
|
||||
return toAjax(basTagService.insertBasTag(basTag));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电子标签
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:tag:edit')")
|
||||
@Log(title = "电子标签", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BasTag basTag)
|
||||
{
|
||||
return toAjax(basTagService.updateBasTag(basTag));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电子标签
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:tag:remove')")
|
||||
@Log(title = "电子标签", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(basTagService.deleteBasTagByIds(ids));
|
||||
}
|
||||
}
|
||||
157
ruoyi-admin/src/main/java/com/ruoyi/bas/tag/domain/BasTag.java
Normal file
157
ruoyi-admin/src/main/java/com/ruoyi/bas/tag/domain/BasTag.java
Normal file
@@ -0,0 +1,157 @@
|
||||
package com.ruoyi.bas.tag.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 电子标签对象 bas_tag
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
public class BasTag extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** ip地址 */
|
||||
@Excel(name = "ip地址")
|
||||
private String ip;
|
||||
|
||||
/** 拣选工位 */
|
||||
@Excel(name = "拣选工位")
|
||||
private String pickAdd;
|
||||
|
||||
/** 托盘码 */
|
||||
@Excel(name = "托盘码")
|
||||
private String trayCode;
|
||||
|
||||
/** 当前显示数量 */
|
||||
@Excel(name = "当前显示数量")
|
||||
private String curNum;
|
||||
|
||||
/** 下发完成 */
|
||||
@Excel(name = "下发完成")
|
||||
private String sendCompleted;
|
||||
|
||||
/** 备用1 */
|
||||
@Excel(name = "备用1")
|
||||
private String spare1;
|
||||
|
||||
/** 备用2 */
|
||||
@Excel(name = "备用2")
|
||||
private String spare2;
|
||||
|
||||
/** 备用3 */
|
||||
@Excel(name = "备用3")
|
||||
private String spare3;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setIp(String ip)
|
||||
{
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getIp()
|
||||
{
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setPickAdd(String pickAdd)
|
||||
{
|
||||
this.pickAdd = pickAdd;
|
||||
}
|
||||
|
||||
public String getPickAdd()
|
||||
{
|
||||
return pickAdd;
|
||||
}
|
||||
|
||||
public void setTrayCode(String trayCode)
|
||||
{
|
||||
this.trayCode = trayCode;
|
||||
}
|
||||
|
||||
public String getTrayCode()
|
||||
{
|
||||
return trayCode;
|
||||
}
|
||||
|
||||
public void setCurNum(String curNum)
|
||||
{
|
||||
this.curNum = curNum;
|
||||
}
|
||||
|
||||
public String getCurNum()
|
||||
{
|
||||
return curNum;
|
||||
}
|
||||
|
||||
public void setSendCompleted(String sendCompleted)
|
||||
{
|
||||
this.sendCompleted = sendCompleted;
|
||||
}
|
||||
|
||||
public String getSendCompleted()
|
||||
{
|
||||
return sendCompleted;
|
||||
}
|
||||
|
||||
public void setSpare1(String spare1)
|
||||
{
|
||||
this.spare1 = spare1;
|
||||
}
|
||||
|
||||
public String getSpare1()
|
||||
{
|
||||
return spare1;
|
||||
}
|
||||
|
||||
public void setSpare2(String spare2)
|
||||
{
|
||||
this.spare2 = spare2;
|
||||
}
|
||||
|
||||
public String getSpare2()
|
||||
{
|
||||
return spare2;
|
||||
}
|
||||
|
||||
public void setSpare3(String spare3)
|
||||
{
|
||||
this.spare3 = spare3;
|
||||
}
|
||||
|
||||
public String getSpare3()
|
||||
{
|
||||
return spare3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("ip", getIp())
|
||||
.append("pickAdd", getPickAdd())
|
||||
.append("trayCode", getTrayCode())
|
||||
.append("curNum", getCurNum())
|
||||
.append("sendCompleted", getSendCompleted())
|
||||
.append("spare1", getSpare1())
|
||||
.append("spare2", getSpare2())
|
||||
.append("spare3", getSpare3())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.bas.tag.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.bas.tag.domain.BasTag;
|
||||
|
||||
/**
|
||||
* 电子标签Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
public interface BasTagMapper
|
||||
{
|
||||
/**
|
||||
* 查询电子标签
|
||||
*
|
||||
* @param id 电子标签主键
|
||||
* @return 电子标签
|
||||
*/
|
||||
public BasTag selectBasTagById(Long id);
|
||||
|
||||
/**
|
||||
* 查询电子标签列表
|
||||
*
|
||||
* @param basTag 电子标签
|
||||
* @return 电子标签集合
|
||||
*/
|
||||
public List<BasTag> selectBasTagList(BasTag basTag);
|
||||
|
||||
/**
|
||||
* 新增电子标签
|
||||
*
|
||||
* @param basTag 电子标签
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasTag(BasTag basTag);
|
||||
|
||||
/**
|
||||
* 修改电子标签
|
||||
*
|
||||
* @param basTag 电子标签
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasTag(BasTag basTag);
|
||||
|
||||
/**
|
||||
* 删除电子标签
|
||||
*
|
||||
* @param id 电子标签主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasTagById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除电子标签
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasTagByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.bas.tag.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.bas.tag.domain.BasTag;
|
||||
|
||||
/**
|
||||
* 电子标签Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
public interface IBasTagService
|
||||
{
|
||||
/**
|
||||
* 查询电子标签
|
||||
*
|
||||
* @param id 电子标签主键
|
||||
* @return 电子标签
|
||||
*/
|
||||
public BasTag selectBasTagById(Long id);
|
||||
|
||||
/**
|
||||
* 查询电子标签列表
|
||||
*
|
||||
* @param basTag 电子标签
|
||||
* @return 电子标签集合
|
||||
*/
|
||||
public List<BasTag> selectBasTagList(BasTag basTag);
|
||||
|
||||
/**
|
||||
* 新增电子标签
|
||||
*
|
||||
* @param basTag 电子标签
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasTag(BasTag basTag);
|
||||
|
||||
/**
|
||||
* 修改电子标签
|
||||
*
|
||||
* @param basTag 电子标签
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasTag(BasTag basTag);
|
||||
|
||||
/**
|
||||
* 批量删除电子标签
|
||||
*
|
||||
* @param ids 需要删除的电子标签主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasTagByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除电子标签信息
|
||||
*
|
||||
* @param id 电子标签主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasTagById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.ruoyi.bas.tag.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.bas.tag.mapper.BasTagMapper;
|
||||
import com.ruoyi.bas.tag.domain.BasTag;
|
||||
import com.ruoyi.bas.tag.service.IBasTagService;
|
||||
|
||||
/**
|
||||
* 电子标签Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
@Service
|
||||
public class BasTagServiceImpl implements IBasTagService
|
||||
{
|
||||
@Autowired
|
||||
private BasTagMapper basTagMapper;
|
||||
|
||||
/**
|
||||
* 查询电子标签
|
||||
*
|
||||
* @param id 电子标签主键
|
||||
* @return 电子标签
|
||||
*/
|
||||
@Override
|
||||
public BasTag selectBasTagById(Long id)
|
||||
{
|
||||
return basTagMapper.selectBasTagById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询电子标签列表
|
||||
*
|
||||
* @param basTag 电子标签
|
||||
* @return 电子标签
|
||||
*/
|
||||
@Override
|
||||
public List<BasTag> selectBasTagList(BasTag basTag)
|
||||
{
|
||||
return basTagMapper.selectBasTagList(basTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电子标签
|
||||
*
|
||||
* @param basTag 电子标签
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBasTag(BasTag basTag)
|
||||
{
|
||||
return basTagMapper.insertBasTag(basTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电子标签
|
||||
*
|
||||
* @param basTag 电子标签
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBasTag(BasTag basTag)
|
||||
{
|
||||
return basTagMapper.updateBasTag(basTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除电子标签
|
||||
*
|
||||
* @param ids 需要删除的电子标签主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasTagByIds(Long[] ids)
|
||||
{
|
||||
return basTagMapper.deleteBasTagByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电子标签信息
|
||||
*
|
||||
* @param id 电子标签主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasTagById(Long id)
|
||||
{
|
||||
return basTagMapper.deleteBasTagById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.ruoyi.out.tagTask.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
import com.ruoyi.out.tagTask.service.ITagTaskService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 电子标签任务Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/out/tagTask")
|
||||
public class TagTaskController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITagTaskService tagTaskService;
|
||||
|
||||
/**
|
||||
* 查询电子标签任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('out:tagTask:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TagTask tagTask)
|
||||
{
|
||||
startPage();
|
||||
List<TagTask> list = tagTaskService.selectTagTaskList(tagTask);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出电子标签任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('out:tagTask:export')")
|
||||
@Log(title = "电子标签任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TagTask tagTask)
|
||||
{
|
||||
List<TagTask> list = tagTaskService.selectTagTaskList(tagTask);
|
||||
ExcelUtil<TagTask> util = new ExcelUtil<TagTask>(TagTask.class);
|
||||
util.exportExcel(response, list, "电子标签任务数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电子标签任务详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('out:tagTask:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(tagTaskService.selectTagTaskById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电子标签任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('out:tagTask:add')")
|
||||
@Log(title = "电子标签任务", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TagTask tagTask)
|
||||
{
|
||||
return toAjax(tagTaskService.insertTagTask(tagTask));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电子标签任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('out:tagTask:edit')")
|
||||
@Log(title = "电子标签任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TagTask tagTask)
|
||||
{
|
||||
return toAjax(tagTaskService.updateTagTask(tagTask));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电子标签任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('out:tagTask:remove')")
|
||||
@Log(title = "电子标签任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(tagTaskService.deleteTagTaskByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 传入电子标签信息
|
||||
*/
|
||||
@Scheduled(fixedDelay = 2000)
|
||||
public void tagManager(){
|
||||
tagTaskService.tagManager();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package com.ruoyi.out.tagTask.domain;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.ruoyi.out.tagTask.service.impl.TagTaskServiceImpl.byteArrayToHexString;
|
||||
|
||||
|
||||
public class ExecuteSocket {
|
||||
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(ExecuteSocket.class);
|
||||
|
||||
/**
|
||||
* socket对象
|
||||
*/
|
||||
private Socket socket;
|
||||
|
||||
/**
|
||||
* 连接超时时间,默认是10s
|
||||
*/
|
||||
private int connectTimeout = 10_000;
|
||||
|
||||
/**
|
||||
* 接收数据超时时间,默认是10s
|
||||
*/
|
||||
private int receiveTimeout = 10_000;
|
||||
|
||||
/**
|
||||
* socket的地址
|
||||
*/
|
||||
private InetSocketAddress socketAddress;
|
||||
|
||||
/**
|
||||
* socket是否发生错误
|
||||
*/
|
||||
private AtomicBoolean socketError;
|
||||
|
||||
private String ip;
|
||||
|
||||
public ExecuteSocket(String ip, int port) {
|
||||
|
||||
this.socketError = new AtomicBoolean(false);//无并发,可用boolean代替
|
||||
this.socketAddress = new InetSocketAddress(ip, port);
|
||||
this.ip=ip;
|
||||
logger.info("------------链接开始!------------");
|
||||
}
|
||||
|
||||
// public ExecuteSocket() {
|
||||
// this("127.0.0.1",3003);
|
||||
// }
|
||||
|
||||
//连接校验
|
||||
private boolean checkConnected() {
|
||||
boolean b = !this.socketError.get() && this.socket != null && (socket.isConnected() && !socket.isClosed());
|
||||
return b;
|
||||
}
|
||||
//关闭连接
|
||||
public void close() {
|
||||
try {
|
||||
if (this.socket != null) {
|
||||
//System.out.println("stock"+socket);
|
||||
this.socket.close();
|
||||
this.socket = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
//throw new SocketRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
//获取连接,异常直接抛出
|
||||
public Socket getAvailableSocket() throws Exception {
|
||||
|
||||
|
||||
// 已连接的直接返回socket
|
||||
if (this.checkConnected()) {
|
||||
// System.out.println("长连接是否支持?"+this.socket.getKeepAlive());
|
||||
return this.socket;
|
||||
}
|
||||
// 未连接,表示已断开,需要手动关闭socket,创建新的socket
|
||||
this.close();
|
||||
|
||||
// 重新创建对象,并连接
|
||||
this.socket = new Socket();
|
||||
this.socket.setSoTimeout(1000);//6s
|
||||
this.socket.connect(this.socketAddress, this.connectTimeout);
|
||||
this.socketError.set(false);
|
||||
//this.doAfterConnected();
|
||||
logger.info("-------------ip:"+this.socketAddress+"重新连接--------------");
|
||||
return socket;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 心跳
|
||||
* */
|
||||
public boolean writeHeart(String heartStr){
|
||||
Socket socket = null;
|
||||
try {
|
||||
socket = this.getAvailableSocket();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(heartStr)){
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
OutputStream os = socket.getOutputStream();
|
||||
os.write(heartStr.getBytes());
|
||||
os.flush();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("-------IP"+ip+"发送心跳异常---,["+e.getMessage()+"]---");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 写入数据
|
||||
* */
|
||||
public boolean writeData(byte[] bytes){
|
||||
|
||||
Socket socket = null;
|
||||
try {
|
||||
socket = this.getAvailableSocket();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("-------写入数据异常,原因获取连接失败,【"+e.getMessage()+"】------");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
OutputStream os = socket.getOutputStream();
|
||||
os.write(bytes);
|
||||
os.flush();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("-------写入数据异常-,【"+e.getMessage()+"】-----");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 读取
|
||||
* */
|
||||
public String readData() throws IOException {
|
||||
|
||||
Socket socket;
|
||||
try {
|
||||
socket = this.getAvailableSocket();//连接超时,抛异常
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
logger.info("-------IP"+ip+"获取连接失败---,【"+e.getMessage()+"】---");
|
||||
return "";
|
||||
}
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = socket.getInputStream();
|
||||
int size = is.available();
|
||||
byte[] bytes = new byte[size];
|
||||
is.read(bytes);
|
||||
String content = byteArrayToHexString(bytes, size);
|
||||
return content;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
is.close();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package com.ruoyi.out.tagTask.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 电子标签任务对象 tag_task
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
public class TagTask extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 电子标签信息id */
|
||||
private Long id;
|
||||
|
||||
/** 电子标签id */
|
||||
@Excel(name = "电子标签id")
|
||||
private Long tagId;
|
||||
|
||||
/** 子任务编号 */
|
||||
@Excel(name = "子任务编号")
|
||||
private String jobDetailId;
|
||||
|
||||
/** 物料编码 */
|
||||
@Excel(name = "物料编码")
|
||||
private String productId;
|
||||
|
||||
/** 显示的数量 */
|
||||
@Excel(name = "显示的数量")
|
||||
private String num;
|
||||
|
||||
/** 状态 0-未显示 1-显示 2-完成*/
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
/** 颜色 */
|
||||
@Excel(name = "颜色")
|
||||
private String color;
|
||||
|
||||
/** 层数 */
|
||||
@Excel(name = "层数")
|
||||
private String floor;
|
||||
|
||||
/** 备用1 */
|
||||
@Excel(name = "备用1")
|
||||
private String spare1;
|
||||
|
||||
/** 备用2 */
|
||||
@Excel(name = "备用2")
|
||||
private String spare2;
|
||||
|
||||
/** 备用3 */
|
||||
@Excel(name = "备用3")
|
||||
private String spare3;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setTagId(Long tagId)
|
||||
{
|
||||
this.tagId = tagId;
|
||||
}
|
||||
|
||||
public Long getTagId()
|
||||
{
|
||||
return tagId;
|
||||
}
|
||||
|
||||
public void setJobDetailId(String jobDetailId)
|
||||
{
|
||||
this.jobDetailId = jobDetailId;
|
||||
}
|
||||
|
||||
public String getJobDetailId()
|
||||
{
|
||||
return jobDetailId;
|
||||
}
|
||||
|
||||
public void setProductId(String productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setNum(String num)
|
||||
{
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public String getNum()
|
||||
{
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setColor(String color)
|
||||
{
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setFloor(String floor)
|
||||
{
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
public String getFloor()
|
||||
{
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setSpare1(String spare1)
|
||||
{
|
||||
this.spare1 = spare1;
|
||||
}
|
||||
|
||||
public String getSpare1()
|
||||
{
|
||||
return spare1;
|
||||
}
|
||||
|
||||
public void setSpare2(String spare2)
|
||||
{
|
||||
this.spare2 = spare2;
|
||||
}
|
||||
|
||||
public String getSpare2()
|
||||
{
|
||||
return spare2;
|
||||
}
|
||||
|
||||
public void setSpare3(String spare3)
|
||||
{
|
||||
this.spare3 = spare3;
|
||||
}
|
||||
|
||||
public String getSpare3()
|
||||
{
|
||||
return spare3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("tagId", getTagId())
|
||||
.append("jobDetailId", getJobDetailId())
|
||||
.append("productId", getProductId())
|
||||
.append("num", getNum())
|
||||
.append("status", getStatus())
|
||||
.append("color", getColor())
|
||||
.append("floor", getFloor())
|
||||
.append("spare1", getSpare1())
|
||||
.append("spare2", getSpare2())
|
||||
.append("spare3", getSpare3())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.out.tagTask.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
|
||||
/**
|
||||
* 电子标签任务Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
public interface TagTaskMapper
|
||||
{
|
||||
/**
|
||||
* 查询电子标签任务
|
||||
*
|
||||
* @param id 电子标签任务主键
|
||||
* @return 电子标签任务
|
||||
*/
|
||||
public TagTask selectTagTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 查询电子标签任务列表
|
||||
*
|
||||
* @param tagTask 电子标签任务
|
||||
* @return 电子标签任务集合
|
||||
*/
|
||||
public List<TagTask> selectTagTaskList(TagTask tagTask);
|
||||
|
||||
/**
|
||||
* 新增电子标签任务
|
||||
*
|
||||
* @param tagTask 电子标签任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTagTask(TagTask tagTask);
|
||||
|
||||
/**
|
||||
* 修改电子标签任务
|
||||
*
|
||||
* @param tagTask 电子标签任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTagTask(TagTask tagTask);
|
||||
|
||||
/**
|
||||
* 删除电子标签任务
|
||||
*
|
||||
* @param id 电子标签任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTagTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除电子标签任务
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTagTaskByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.ruoyi.out.tagTask.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
|
||||
/**
|
||||
* 电子标签任务Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
public interface ITagTaskService
|
||||
{
|
||||
/**
|
||||
* 查询电子标签任务
|
||||
*
|
||||
* @param id 电子标签任务主键
|
||||
* @return 电子标签任务
|
||||
*/
|
||||
public TagTask selectTagTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 查询电子标签任务列表
|
||||
*
|
||||
* @param tagTask 电子标签任务
|
||||
* @return 电子标签任务集合
|
||||
*/
|
||||
public List<TagTask> selectTagTaskList(TagTask tagTask);
|
||||
|
||||
/**
|
||||
* 新增电子标签任务
|
||||
*
|
||||
* @param tagTask 电子标签任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTagTask(TagTask tagTask);
|
||||
|
||||
/**
|
||||
* 修改电子标签任务
|
||||
*
|
||||
* @param tagTask 电子标签任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTagTask(TagTask tagTask);
|
||||
|
||||
/**
|
||||
* 批量删除电子标签任务
|
||||
*
|
||||
* @param ids 需要删除的电子标签任务主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTagTaskByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除电子标签任务信息
|
||||
*
|
||||
* @param id 电子标签任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTagTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 电子标签管理
|
||||
*/
|
||||
void tagManager();
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
package com.ruoyi.out.tagTask.service.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.bas.tag.domain.BasTag;
|
||||
import com.ruoyi.bas.tag.service.IBasTagService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.out.tagTask.domain.ExecuteSocket;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.out.tagTask.mapper.TagTaskMapper;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
import com.ruoyi.out.tagTask.service.ITagTaskService;
|
||||
|
||||
import static io.netty.util.internal.StringUtil.byteToHexString;
|
||||
|
||||
/**
|
||||
* 电子标签任务Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TagTaskServiceImpl implements ITagTaskService {
|
||||
@Autowired
|
||||
private TagTaskMapper tagTaskMapper;
|
||||
@Autowired
|
||||
private IBasTagService basTagService;
|
||||
|
||||
private HashMap<String, ExecuteSocket> tagSockteMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 查询电子标签任务
|
||||
*
|
||||
* @param id 电子标签任务主键
|
||||
* @return 电子标签任务
|
||||
*/
|
||||
@Override
|
||||
public TagTask selectTagTaskById(Long id) {
|
||||
return tagTaskMapper.selectTagTaskById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询电子标签任务列表
|
||||
*
|
||||
* @param tagTask 电子标签任务
|
||||
* @return 电子标签任务
|
||||
*/
|
||||
@Override
|
||||
public List<TagTask> selectTagTaskList(TagTask tagTask) {
|
||||
return tagTaskMapper.selectTagTaskList(tagTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电子标签任务
|
||||
*
|
||||
* @param tagTask 电子标签任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTagTask(TagTask tagTask) {
|
||||
return tagTaskMapper.insertTagTask(tagTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电子标签任务
|
||||
*
|
||||
* @param tagTask 电子标签任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTagTask(TagTask tagTask) {
|
||||
return tagTaskMapper.updateTagTask(tagTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除电子标签任务
|
||||
*
|
||||
* @param ids 需要删除的电子标签任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTagTaskByIds(Long[] ids) {
|
||||
return tagTaskMapper.deleteTagTaskByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电子标签任务信息
|
||||
*
|
||||
* @param id 电子标签任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTagTaskById(Long id) {
|
||||
return tagTaskMapper.deleteTagTaskById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tagManager() {
|
||||
//查询所有的电子标签任务
|
||||
TagTask tagTaskParam = new TagTask();
|
||||
//tagTaskParam.setStatus("0");
|
||||
List<TagTask> allTagTasks = tagTaskMapper.selectTagTaskList(tagTaskParam);
|
||||
if (CollUtil.isNotEmpty(allTagTasks)) {
|
||||
//按标签分组
|
||||
Map<Long, List<TagTask>> tagGroup = allTagTasks.stream().collect(Collectors.groupingBy(TagTask::getTagId));
|
||||
for (Long tagId : tagGroup.keySet()) {
|
||||
BasTag basTag = basTagService.selectBasTagById(tagId);
|
||||
List<TagTask> tagTaskList = tagGroup.get(tagId);
|
||||
if (CollUtil.isNotEmpty(tagTaskList)) {
|
||||
|
||||
if (tagTaskList.stream().allMatch(x -> "2".equals(x.getStatus()))) {
|
||||
//全部拣选完成 灭灯逻辑
|
||||
//灭灯
|
||||
boolean b = sendDzbqOff(basTag);
|
||||
log.info("灭灯:{}", b);
|
||||
if (b) {
|
||||
//删除标签绑定信息
|
||||
basTag.setSendCompleted("0");
|
||||
basTag.setTrayCode("");
|
||||
basTagService.updateBasTag(basTag);
|
||||
//删除tagList
|
||||
tagTaskMapper.deleteTagTaskByIds(tagTaskList.stream().map(TagTask::getId).toArray(Long[]::new));
|
||||
}
|
||||
} else {
|
||||
Optional<TagTask> first = tagTaskList.stream().filter(x -> "1".equals(x.getStatus())).findFirst();
|
||||
if (first.isPresent()) {
|
||||
TagTask tagTask = first.get();
|
||||
log.info("正在处理任务:{},id:{}", tagTask.getProductId(), tagTask.getId());
|
||||
} else {
|
||||
TagTask tagTask = tagTaskList.get(0);
|
||||
try {
|
||||
boolean b = sendMsgDzbq(basTag,tagTask);
|
||||
log.info("下发电子标签:ip:{},id:{}数量:{}", basTag.getIp(), basTag.getId(), basTag.getCurNum());
|
||||
if (b) {
|
||||
basTag.setSendCompleted("1");
|
||||
basTagService.updateBasTag(basTag);
|
||||
tagTask.setStatus("1");
|
||||
tagTaskMapper.updateTagTask(tagTask);
|
||||
log.info("下发电子标签:ip:" + basTag.getIp() + ",id:" + basTag.getId() + "数量:" + basTag.getCurNum());
|
||||
} else {
|
||||
sendMsgDzbq(basTag,tagTask);
|
||||
//sendMsgDzbq( Integer.parseInt("1"), 0x02, 0x80, Integer.parseInt(tagTask.getFloor()), Integer.parseInt(tagTask.getNum()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//查询所有下发的任务
|
||||
tagTaskParam = new TagTask();
|
||||
tagTaskParam.setStatus("1");
|
||||
allTagTasks = tagTaskMapper.selectTagTaskList(tagTaskParam);
|
||||
if (CollUtil.isNotEmpty(allTagTasks)) {
|
||||
Map<Long, List<TagTask>> tagGroup = allTagTasks.stream().collect(Collectors.groupingBy(TagTask::getTagId));
|
||||
for (Long tagId : tagGroup.keySet()) {
|
||||
BasTag basTag = basTagService.selectBasTagById(tagId);
|
||||
Socket socket = getSocket(basTag);
|
||||
try {
|
||||
/** 接收电子标签指令 */
|
||||
String content = readData(socket);//读取值
|
||||
if (!content.isEmpty()) {
|
||||
log.info("读取电子标签值:" + content);
|
||||
}
|
||||
for (TagTask tagTask : tagGroup.get(tagId)) {
|
||||
//将拍灯指令整理成数组
|
||||
String[] split = content.split("5a");
|
||||
for (String s : split) {
|
||||
if (s.length() == 10) {
|
||||
String type = s.substring(4, 6);//指令类型 01是下发成功反馈 12是拍灭绿灯指令
|
||||
if ("12".equals(type)) {
|
||||
//12为 绿色拍灯指令
|
||||
int address = new BigInteger(s.substring(2, 4), 16).intValue();
|
||||
if (address == basTag.getId()) {
|
||||
//更新当前子任务状态
|
||||
tagTask.setStatus("2");
|
||||
tagTaskMapper.updateTagTask(tagTask);
|
||||
log.info("更新任务状态:" + tagTask.getProductId() + ",id:" + tagTask.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取socket
|
||||
*
|
||||
* @param basTag
|
||||
* @return
|
||||
*/
|
||||
private Socket getSocket(BasTag basTag) {
|
||||
try {
|
||||
if (tagSockteMap.containsKey(basTag.getPickAdd())) {
|
||||
ExecuteSocket executeSocket = tagSockteMap.get(basTag.getPickAdd());
|
||||
|
||||
return executeSocket.getAvailableSocket();
|
||||
|
||||
} else {
|
||||
ExecuteSocket executeSocket = new ExecuteSocket(basTag.getIp(), 0);
|
||||
tagSockteMap.put(basTag.getPickAdd(), executeSocket);
|
||||
return executeSocket.getAvailableSocket();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new RuntimeException("获取socket异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 灭灯
|
||||
*
|
||||
* @param basTag
|
||||
*/
|
||||
public boolean sendDzbqOff(BasTag basTag) {
|
||||
int address = Convert.toInt(basTag.getId());
|
||||
Socket socket = getSocket(basTag);
|
||||
int x7 = (address + 0x10 + 0x03 + 0xe8 + 0x03 + 0xe8) % 256;//累加 校验
|
||||
return sendMsgSocket( socket,"FA " + String.format("%02x", address) + " 10 00 03 e8 03 e8 " + String.format("%02x", x7) + " AF");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下发电子标签
|
||||
* @param basTag
|
||||
* @param tagTask
|
||||
* @return
|
||||
*/
|
||||
public boolean sendMsgDzbq( BasTag basTag ,TagTask tagTask) {
|
||||
String green = String.format("%04x", Convert.toInt(tagTask.getNum()));
|
||||
String red = String.format("%04x", 0);
|
||||
String greenFirst2 = green.substring(0, 2);
|
||||
String greenLast2 = green.substring(2);
|
||||
String redFirst2 = red.substring(0, 2);
|
||||
String redLast2 = red.substring(2);
|
||||
Integer sid = Convert.toInt(basTag.getId());
|
||||
int x3 = Integer.parseInt(greenFirst2, 16);//绿色数值
|
||||
int x4 = Integer.parseInt(greenLast2, 16);//绿色数值
|
||||
int x5 = Integer.parseInt(redFirst2, 16);//红色数值
|
||||
int x6 = Integer.parseInt(redLast2, 16);//红色数值
|
||||
int x7 = (sid + 0x02+0x80 + x3 + x4 + x5 + x6) % 256;//累加 校验
|
||||
String value = "FA" + String.format("%02x", sid) + String.format("%02x", 0x02) + String.format("%02x", 0x80) + greenFirst2 +
|
||||
greenLast2 + redFirst2 + redLast2 + String.format("%02x", x7) + "AF";
|
||||
System.out.println(value);
|
||||
return sendMsgSocket(getSocket(basTag),value);
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
public boolean sendMsgSocket(Socket socket,String msg) {
|
||||
byte[] bytes = hexStringToByteArray(msg);
|
||||
try(OutputStream os = socket.getOutputStream()) {
|
||||
os.write(bytes);
|
||||
os.flush();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 16进制表示的字符串转换为字节数组
|
||||
*
|
||||
* @param hexString 16进制表示的字符串
|
||||
* @return byte[] 字节数组
|
||||
*/
|
||||
public static byte[] hexStringToByteArray(String hexString) {
|
||||
hexString = hexString.replaceAll(" ", "");
|
||||
int len = hexString.length();
|
||||
byte[] bytes = new byte[len / 2];
|
||||
for (int i = 0; i < len; i += 2) {
|
||||
// 两位一组,表示一个字节,把这样表示的16进制字符串,还原成一个字节
|
||||
bytes[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4) + Character
|
||||
.digit(hexString.charAt(i + 1), 16));
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static String byteArrayToHexString(byte b[], int len) {
|
||||
StringBuilder resultSb = new StringBuilder();
|
||||
for (int i = 0; i < len; i++) {
|
||||
resultSb.append(byteToHexString(b[i]));
|
||||
}
|
||||
return resultSb.toString();
|
||||
}
|
||||
|
||||
/*
|
||||
* 读取
|
||||
* */
|
||||
public String readData(Socket socket){
|
||||
try (InputStream is = socket.getInputStream()){
|
||||
int size = is.available();
|
||||
byte[] bytes = new byte[size];
|
||||
is.read(bytes);
|
||||
return byteArrayToHexString(bytes, size);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -28,6 +28,8 @@ import com.ruoyi.out.outStockoutDetail.domain.OutStockoutDetail;
|
||||
import com.ruoyi.out.outStockoutDetail.service.IOutStockoutDetailService;
|
||||
import com.ruoyi.out.submit.domain.OutPickSubmit;
|
||||
import com.ruoyi.out.submit.service.IOutPickSubmitService;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
import com.ruoyi.out.tagTask.service.ITagTaskService;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import com.ruoyi.pda.domain.TrayCodeMsg;
|
||||
import com.ruoyi.pda.mapper.PdaMapper;
|
||||
@@ -80,6 +82,8 @@ public class PdaServiceImp implements PdaService {
|
||||
private IBasStockService basStockService;
|
||||
@Autowired
|
||||
private IOutPickSubmitService outPickSubmitService;
|
||||
@Autowired
|
||||
private ITagTaskService tagTaskService;
|
||||
|
||||
/**
|
||||
* 空托盘入库
|
||||
@@ -267,6 +271,22 @@ public class PdaServiceImp implements PdaService {
|
||||
BigDecimal newPickQuantity = Convert.toBigDecimal(mydoJobDetail.getPickQuantity());
|
||||
mydoJobDetailOld.setPickQuantity(oldPickQuantity.add(newPickQuantity).toString());
|
||||
mydoJobDetailService.updateMydoJobDetail(mydoJobDetailOld);
|
||||
//修改电子标签
|
||||
TagTask param = new TagTask();
|
||||
param.setJobDetailId(mydoJobDetail.getJobDetailId());
|
||||
List<TagTask> tagTasks = tagTaskService.selectTagTaskList(param);
|
||||
if (CollUtil.isNotEmpty(tagTasks)) {
|
||||
TagTask tagTask = tagTasks.get(0);
|
||||
BigDecimal num = Convert.toBigDecimal(tagTask.getNum());
|
||||
if (num.compareTo(newPickQuantity) == 0){
|
||||
tagTask.setStatus("2");
|
||||
tagTaskService.updateTagTask(tagTask);
|
||||
}else {
|
||||
tagTask.setNum(num.subtract(newPickQuantity).toString());
|
||||
tagTaskService.updateTagTask(tagTask);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//判断拣选数量是否等于出库数量
|
||||
MydoJobDetail mydoJobDetailParam = new MydoJobDetail();
|
||||
@@ -327,13 +347,20 @@ public class PdaServiceImp implements PdaService {
|
||||
oldOutPickSubmit.setQuantit(Convert.toBigDecimal(oldOutPickSubmit.getQuantit()).add(Convert.toBigDecimal(mydoJobDetail.getPickQuantity())).toString());
|
||||
outPickSubmitService.updateOutPickSubmit(oldOutPickSubmit);
|
||||
}
|
||||
//bindContainer(trayCodeMakeSure, mydoJobDetail, mydoJobDetailOld);
|
||||
|
||||
//修改单据实际数量
|
||||
String inOrOutDId = mydoJobDetailOld.getInOrOutDId();
|
||||
OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByStockoutDetailId(inOrOutDId);
|
||||
outStockoutDetail.setAssignNum(outStockoutDetail.getAssignNum().add(Convert.toBigDecimal(mydoJobDetail.getPickQuantity())));
|
||||
outStockoutDetailService.updateOutStockoutDetail(outStockoutDetail);
|
||||
//修改电子标签
|
||||
TagTask param = new TagTask();
|
||||
param.setJobDetailId(mydoJobDetail.getJobDetailId());
|
||||
List<TagTask> tagTasks = tagTaskService.selectTagTaskList(param);
|
||||
if (CollUtil.isNotEmpty(tagTasks)) {
|
||||
TagTask tagTask = tagTasks.get(0);
|
||||
tagTask.setStatus("2");
|
||||
tagTaskService.updateTagTask(tagTask);
|
||||
}
|
||||
}
|
||||
|
||||
//判断拣选数量是否等于出库数量
|
||||
@@ -369,6 +396,7 @@ public class PdaServiceImp implements PdaService {
|
||||
return AjaxResult.warn("新增库存,存在为0的数量");
|
||||
}
|
||||
for (MydoJobDetail mydoJobDetail : mydoJobDetailList) {
|
||||
//插入盘点提交表
|
||||
CheckCommitRecord checkCommitRecord = new CheckCommitRecord();
|
||||
checkCommitRecord.setQuantity(mydoJobDetail.getInQuantity());
|
||||
checkCommitRecord.setTrayCode(trayCodeMakeSure.getTrayCode());
|
||||
@@ -376,6 +404,15 @@ public class PdaServiceImp implements PdaService {
|
||||
checkCommitRecord.setSpare1(mydoJobDetail.getInOrOutDId());
|
||||
checkCommitRecord.setSpare2(mydoJobDetail.getProductId());
|
||||
checkCommitRecordService.insertCheckCommitRecord(checkCommitRecord);
|
||||
//修改电子标签任务
|
||||
TagTask param = new TagTask();
|
||||
param.setJobDetailId(mydoJobDetail.getJobDetailId());
|
||||
List<TagTask> tagTasks = tagTaskService.selectTagTaskList(param);
|
||||
if (CollUtil.isNotEmpty(tagTasks)) {
|
||||
TagTask tagTask = tagTasks.get(0);
|
||||
tagTask.setStatus("2");
|
||||
tagTaskService.updateTagTask(tagTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
|
||||
91
ruoyi-admin/src/main/resources/mapper/bas/BasTagMapper.xml
Normal file
91
ruoyi-admin/src/main/resources/mapper/bas/BasTagMapper.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.bas.tag.mapper.BasTagMapper">
|
||||
|
||||
<resultMap type="BasTag" id="BasTagResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ip" column="ip" />
|
||||
<result property="pickAdd" column="pick_add" />
|
||||
<result property="trayCode" column="tray_code" />
|
||||
<result property="curNum" column="cur_num" />
|
||||
<result property="sendCompleted" column="send_completed" />
|
||||
<result property="spare1" column="spare1" />
|
||||
<result property="spare2" column="spare2" />
|
||||
<result property="spare3" column="spare3" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBasTagVo">
|
||||
select id, ip, pick_add, tray_code, cur_num, send_completed, spare1, spare2, spare3 from bas_tag
|
||||
</sql>
|
||||
|
||||
<select id="selectBasTagList" parameterType="BasTag" resultMap="BasTagResult">
|
||||
<include refid="selectBasTagVo"/>
|
||||
<where>
|
||||
<if test="ip != null and ip != ''"> and ip = #{ip}</if>
|
||||
<if test="pickAdd != null and pickAdd != ''"> and pick_add = #{pickAdd}</if>
|
||||
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
|
||||
<if test="curNum != null and curNum != ''"> and cur_num = #{curNum}</if>
|
||||
<if test="sendCompleted != null and sendCompleted != ''"> and send_completed = #{sendCompleted}</if>
|
||||
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
|
||||
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
|
||||
<if test="spare3 != null and spare3 != ''"> and spare3 = #{spare3}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasTagById" parameterType="Long" resultMap="BasTagResult">
|
||||
<include refid="selectBasTagVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBasTag" parameterType="BasTag" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into bas_tag
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ip != null">ip,</if>
|
||||
<if test="pickAdd != null">pick_add,</if>
|
||||
<if test="trayCode != null">tray_code,</if>
|
||||
<if test="curNum != null">cur_num,</if>
|
||||
<if test="sendCompleted != null">send_completed,</if>
|
||||
<if test="spare1 != null">spare1,</if>
|
||||
<if test="spare2 != null">spare2,</if>
|
||||
<if test="spare3 != null">spare3,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ip != null">#{ip},</if>
|
||||
<if test="pickAdd != null">#{pickAdd},</if>
|
||||
<if test="trayCode != null">#{trayCode},</if>
|
||||
<if test="curNum != null">#{curNum},</if>
|
||||
<if test="sendCompleted != null">#{sendCompleted},</if>
|
||||
<if test="spare1 != null">#{spare1},</if>
|
||||
<if test="spare2 != null">#{spare2},</if>
|
||||
<if test="spare3 != null">#{spare3},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBasTag" parameterType="BasTag">
|
||||
update bas_tag
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ip != null">ip = #{ip},</if>
|
||||
<if test="pickAdd != null">pick_add = #{pickAdd},</if>
|
||||
<if test="trayCode != null">tray_code = #{trayCode},</if>
|
||||
<if test="curNum != null">cur_num = #{curNum},</if>
|
||||
<if test="sendCompleted != null">send_completed = #{sendCompleted},</if>
|
||||
<if test="spare1 != null">spare1 = #{spare1},</if>
|
||||
<if test="spare2 != null">spare2 = #{spare2},</if>
|
||||
<if test="spare3 != null">spare3 = #{spare3},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasTagById" parameterType="Long">
|
||||
delete from bas_tag where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBasTagByIds" parameterType="String">
|
||||
delete from bas_tag where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
101
ruoyi-admin/src/main/resources/mapper/out/TagTaskMapper.xml
Normal file
101
ruoyi-admin/src/main/resources/mapper/out/TagTaskMapper.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.out.tagTask.mapper.TagTaskMapper">
|
||||
|
||||
<resultMap type="TagTask" id="TagTaskResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="tagId" column="tag_id" />
|
||||
<result property="jobDetailId" column="job_detail_id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="num" column="num" />
|
||||
<result property="status" column="status" />
|
||||
<result property="color" column="color" />
|
||||
<result property="floor" column="floor" />
|
||||
<result property="spare1" column="spare1" />
|
||||
<result property="spare2" column="spare2" />
|
||||
<result property="spare3" column="spare3" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTagTaskVo">
|
||||
select id, tag_id, job_detail_id, product_id, num, status, color, floor, spare1, spare2, spare3 from tag_task
|
||||
</sql>
|
||||
|
||||
<select id="selectTagTaskList" parameterType="TagTask" resultMap="TagTaskResult">
|
||||
<include refid="selectTagTaskVo"/>
|
||||
<where>
|
||||
<if test="tagId != null "> and tag_id = #{tagId}</if>
|
||||
<if test="jobDetailId != null and jobDetailId != ''"> and job_detail_id = #{jobDetailId}</if>
|
||||
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
|
||||
<if test="num != null and num != ''"> and num = #{num}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="color != null and color != ''"> and color = #{color}</if>
|
||||
<if test="floor != null and floor != ''"> and floor = #{floor}</if>
|
||||
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
|
||||
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
|
||||
<if test="spare3 != null and spare3 != ''"> and spare3 = #{spare3}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTagTaskById" parameterType="Long" resultMap="TagTaskResult">
|
||||
<include refid="selectTagTaskVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTagTask" parameterType="TagTask" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tag_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="tagId != null">tag_id,</if>
|
||||
<if test="jobDetailId != null">job_detail_id,</if>
|
||||
<if test="productId != null">product_id,</if>
|
||||
<if test="num != null">num,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="color != null">color,</if>
|
||||
<if test="floor != null">floor,</if>
|
||||
<if test="spare1 != null">spare1,</if>
|
||||
<if test="spare2 != null">spare2,</if>
|
||||
<if test="spare3 != null">spare3,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="tagId != null">#{tagId},</if>
|
||||
<if test="jobDetailId != null">#{jobDetailId},</if>
|
||||
<if test="productId != null">#{productId},</if>
|
||||
<if test="num != null">#{num},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="color != null">#{color},</if>
|
||||
<if test="floor != null">#{floor},</if>
|
||||
<if test="spare1 != null">#{spare1},</if>
|
||||
<if test="spare2 != null">#{spare2},</if>
|
||||
<if test="spare3 != null">#{spare3},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTagTask" parameterType="TagTask">
|
||||
update tag_task
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="tagId != null">tag_id = #{tagId},</if>
|
||||
<if test="jobDetailId != null">job_detail_id = #{jobDetailId},</if>
|
||||
<if test="productId != null">product_id = #{productId},</if>
|
||||
<if test="num != null">num = #{num},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="color != null">color = #{color},</if>
|
||||
<if test="floor != null">floor = #{floor},</if>
|
||||
<if test="spare1 != null">spare1 = #{spare1},</if>
|
||||
<if test="spare2 != null">spare2 = #{spare2},</if>
|
||||
<if test="spare3 != null">spare3 = #{spare3},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTagTaskById" parameterType="Long">
|
||||
delete from tag_task where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTagTaskByIds" parameterType="String">
|
||||
delete from tag_task where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user