出库单据
This commit is contained in:
@@ -39,11 +39,9 @@ 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.outStockout.service.IOutStockoutService;
|
||||
import com.ruoyi.out.outStockoutDetail.service.IOutStockoutDetailService;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
import com.ruoyi.out.tagTask.service.ITagTaskService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -66,8 +64,7 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
@Autowired
|
||||
private IBasContainerService basContainerService;
|
||||
|
||||
@Autowired
|
||||
private ITagTaskService tagTaskService;
|
||||
|
||||
@Autowired
|
||||
private IBasTaskNoService basTaskNoService;
|
||||
@Autowired
|
||||
@@ -303,17 +300,7 @@ public class ToWmsServiceImpl implements IToWmsService {
|
||||
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);
|
||||
}
|
||||
|
||||
//开启线程
|
||||
//new Thread(new TagOutReadThread(basTag.getIp())).start();
|
||||
}
|
||||
|
||||
@@ -134,6 +134,15 @@ public class MydoJob extends BaseEntity
|
||||
private String createLeftTime;
|
||||
private String createRightTime;
|
||||
|
||||
private String productId;
|
||||
|
||||
public String getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(String productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getCreateLeftTime() {
|
||||
return createLeftTime;
|
||||
|
||||
@@ -148,6 +148,7 @@ public class MydoJobDetail extends BaseEntity
|
||||
private String spec;
|
||||
@Excel(name = "机型")
|
||||
private String unit;
|
||||
private String trayCode;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.job.mydojobdetail.mapper;
|
||||
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||
|
||||
import java.util.List;
|
||||
@@ -65,4 +66,6 @@ public interface MydoJobDetailMapper
|
||||
void deleteMydoJobDetailByJobId(String jobId);
|
||||
|
||||
List<MydoJobDetail> selectMydoJobDetailListByJobId(String jobId);
|
||||
|
||||
List<MydoJobDetail> selectMydoJobDetailListByExit(MydoJob mydoJob);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.job.mydojobdetail.service;
|
||||
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -65,4 +67,6 @@ public interface IMydoJobDetailService
|
||||
void deleteMydoJobDetailByJobId(String jobId);
|
||||
|
||||
List<MydoJobDetail> selectMydoJobDetailListByJobId(String jobId);
|
||||
|
||||
List<MydoJobDetail> selectMydoJobDetailListByExit(MydoJob mydoJob);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.ruoyi.job.mydojobdetail.service.impl;
|
||||
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||
import com.ruoyi.job.mydojobdetail.mapper.MydoJobDetailMapper;
|
||||
import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -112,4 +114,9 @@ public class MydoJobDetailServiceImpl implements IMydoJobDetailService
|
||||
public List<MydoJobDetail> selectMydoJobDetailListByJobId(String jobId) {
|
||||
return mydoJobDetailMapper.selectMydoJobDetailListByJobId(jobId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MydoJobDetail> selectMydoJobDetailListByExit(MydoJob mydoJob) {
|
||||
return mydoJobDetailMapper.selectMydoJobDetailListByExit(mydoJob);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
package com.ruoyi.out.tagTask.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
import com.ruoyi.out.tagTask.service.ITagTaskService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子标签任务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)
|
||||
//@PostConstruct
|
||||
public void tagOutManager() throws IOException {
|
||||
tagTaskService.tagOutManager();
|
||||
}
|
||||
|
||||
|
||||
//@Scheduled(fixedDelay = 2000)
|
||||
//@PostConstruct
|
||||
public void tagInManager(){
|
||||
tagTaskService.tagInManager();
|
||||
}
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
package com.ruoyi.out.tagTask.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 电子标签任务对象 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();
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.ruoyi.out.tagTask.mapper;
|
||||
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子标签任务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);
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.ruoyi.out.tagTask.service;
|
||||
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子标签任务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 tagOutManager() throws IOException;
|
||||
|
||||
void tagInManager();
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
package com.ruoyi.out.tagTask.service.impl;
|
||||
|
||||
import com.ruoyi.bas.tag.domain.BasTag;
|
||||
import com.ruoyi.bas.tag.service.IBasTagService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
import com.ruoyi.out.tagTask.mapper.TagTaskMapper;
|
||||
import com.ruoyi.out.tagTask.service.ITagTaskService;
|
||||
import com.ruoyi.out.tagTask.thread.TagInReadThread;
|
||||
import com.ruoyi.out.tagTask.thread.TagOutReadThread;
|
||||
import com.ruoyi.out.tagTask.util.ElectronicTagClient;
|
||||
import com.ruoyi.pda.service.PdaService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 电子标签任务Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-11
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TagTaskServiceImpl implements ITagTaskService {
|
||||
@Autowired
|
||||
private TagTaskMapper tagTaskMapper;
|
||||
@Autowired
|
||||
private IBasTagService basTagService;
|
||||
@Autowired
|
||||
private PdaService pdaService;
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
|
||||
private HashMap<String, Socket> 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 tagOutManager() throws IOException {
|
||||
BasTag param = new BasTag();
|
||||
param.setSpare3("1");
|
||||
List<BasTag> basTags = basTagService.selectBasTagList(param);
|
||||
Map<String, List<BasTag>> collect = basTags.stream().collect(Collectors.groupingBy(BasTag::getIp));
|
||||
for (String ip : collect.keySet()) {
|
||||
new Thread(new TagOutReadThread(ip)).start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tagInManager() {
|
||||
BasTag param = new BasTag();
|
||||
param.setSpare3("2");
|
||||
List<BasTag> basTags = basTagService.selectBasTagList(param);
|
||||
Map<String, List<BasTag>> collect = basTags.stream().collect(Collectors.groupingBy(BasTag::getIp));
|
||||
for (String ip : collect.keySet()) {
|
||||
new Thread(new TagInReadThread(ip)).start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 灭灯
|
||||
*
|
||||
* @param basTag
|
||||
*/
|
||||
/*public boolean sendDzbqOff(BasTag basTag) throws IOException {
|
||||
int address = Convert.toInt(basTag.getId());
|
||||
Socket socket = ElectronicTagClient.getSocket(basTag.getIp());
|
||||
int x7 = (address + 0x10 + 0x03 + 0xe8 + 0x03 + 0xe8) % 256;//累加 校验
|
||||
return ElectronicTagClient.sendHexData( socket,"FA " + String.format("%02x", address) + " 10 00 03 e8 03 e8 " + String.format("%02x", x7) + " AF");
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* todo 待调试 下发电子标签
|
||||
* @param basTag
|
||||
* @param tagTask
|
||||
* @return
|
||||
*/
|
||||
public boolean sendMsgDzbq( BasTag basTag ,TagTask tagTask) throws IOException {
|
||||
try (Socket socket = ElectronicTagClient.getSocket(basTag.getIp())
|
||||
){
|
||||
//socket.setSoTimeout(5000);
|
||||
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";
|
||||
return ElectronicTagClient.sendHexData( socket,value);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
package com.ruoyi.out.tagTask.thread;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.api.service.impl.ToWcsServiceImpl;
|
||||
import com.ruoyi.bas.tag.domain.BasTag;
|
||||
import com.ruoyi.bas.tag.service.IBasTagService;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
||||
import com.ruoyi.out.tagTask.mapper.TagTaskMapper;
|
||||
import com.ruoyi.out.tagTask.service.ITagTaskService;
|
||||
import com.ruoyi.out.tagTask.util.ElectronicTagClient;
|
||||
import com.ruoyi.pda.domain.TrayCodeMsg;
|
||||
import com.ruoyi.pda.service.PdaService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.Socket;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.out.tagTask.util.ElectronicTagClient.getSocket;
|
||||
|
||||
@Slf4j
|
||||
public class TagInReadThread implements Runnable {
|
||||
|
||||
private TagTaskMapper tagTaskMapper;
|
||||
private IMydoJobService mydoJobService;
|
||||
private ITagTaskService tagTaskService;
|
||||
private IBasTagService basTagService;
|
||||
private PdaService pdaService;
|
||||
private ToWcsServiceImpl toWcsService;
|
||||
private String ip;
|
||||
|
||||
public TagInReadThread(String ip) {
|
||||
this.tagTaskMapper = SpringUtils.getBean(TagTaskMapper.class);
|
||||
this.mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||
this.tagTaskService = SpringUtils.getBean(ITagTaskService.class);
|
||||
this.basTagService = SpringUtils.getBean(IBasTagService.class);
|
||||
this.pdaService = SpringUtils.getBean(PdaService.class);
|
||||
this.toWcsService = SpringUtils.getBean(ToWcsServiceImpl.class);
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (true) {
|
||||
try (Socket socket = getSocket(ip)) {
|
||||
if (socket==null){
|
||||
log.info("电子标签服务器连接失败,请检查ip:{}", ip);
|
||||
Thread.sleep(5000);
|
||||
continue;
|
||||
}
|
||||
BasTag param = new BasTag();
|
||||
param.setIp(ip);
|
||||
param.setSpare3("2");
|
||||
List<BasTag> tagList = basTagService.selectBasTagList(param);
|
||||
Map<String, List<BasTag>> collect = tagList.stream().collect(Collectors.groupingBy(BasTag::getSpare2));
|
||||
if (collect.containsKey("2")) {
|
||||
List<BasTag> basTags = collect.get("2");
|
||||
for (BasTag basTag : basTags) {
|
||||
//亮灯 下发ctu入库任务
|
||||
boolean b = ElectronicTagClient.sendMsgDzbq(socket, Convert.toInt(basTag.getId()), 1, 0);
|
||||
if (b) {
|
||||
basTag.setSpare2("0");
|
||||
basTagService.updateBasTag(basTag);
|
||||
log.info("亮灯提示空料箱任务已完成,下发电子标签:ip:{},id:{}", basTag.getIp(), basTag.getId());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tagList = basTagService.selectBasTagList(param);
|
||||
collect = tagList.stream().collect(Collectors.groupingBy(BasTag::getSpare2));
|
||||
if (collect.containsKey("0")) {
|
||||
List<BasTag> basTags = collect.get("0");
|
||||
String content = ElectronicTagClient.receiveHexData(socket);
|
||||
if (StrUtil.isNotEmpty(content)) {
|
||||
//将拍灯指令整理成数组
|
||||
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)) {
|
||||
int address = new BigInteger(s.substring(2, 4), 16).intValue();
|
||||
log.info("90收到指令:{}", address);
|
||||
Optional<BasTag> first = basTags.stream().filter(x -> x.getId().intValue() == address).findFirst();
|
||||
if (first.isPresent()){
|
||||
BasTag basTag = first.get();
|
||||
if (address == basTag.getId()) {
|
||||
//12为 绿色拍灯指令
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setInOrOut("1");
|
||||
mydoJobParam.setExitId("fluent");
|
||||
mydoJobParam.setStatus("1");
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobListApi(mydoJobParam);
|
||||
if (CollUtil.isEmpty(mydoJobs)) {
|
||||
//生成agv空料箱入库作业
|
||||
TrayCodeMsg trayCodeMsg = new TrayCodeMsg();
|
||||
trayCodeMsg.setTrayCode(IdUtil.fastSimpleUUID());
|
||||
trayCodeMsg.setWarehouseId("02");
|
||||
trayCodeMsg.setEntranceId(basTag.getPickAdd());
|
||||
pdaService.emptyBoxIn(trayCodeMsg);
|
||||
toWcsService.pushInMydoJob();
|
||||
} else {
|
||||
MydoJob mydoJob = mydoJobs.get(0);
|
||||
mydoJob.setEntranceId(basTag.getPickAdd());
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
toWcsService.pushInMydoJob();
|
||||
}
|
||||
//ctu 取货完成,灭灯
|
||||
boolean b1 = ElectronicTagClient.sendDzbqOff(socket, Convert.toInt(basTag.getId()));
|
||||
if (b1) {
|
||||
basTag.setSpare2("1");
|
||||
basTagService.updateBasTag(basTag);
|
||||
log.info("灭灯提示空料箱任务已下发");
|
||||
}
|
||||
}
|
||||
}
|
||||
//BasTag currentBasTag = basTags.stream().filter(x -> x.getId().intValue() == address).findFirst().get();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
package com.ruoyi.out.tagTask.thread;
|
||||
|
||||
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.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.out.tagTask.domain.TagTask;
|
||||
import com.ruoyi.out.tagTask.mapper.TagTaskMapper;
|
||||
import com.ruoyi.out.tagTask.util.ElectronicTagClient;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import com.ruoyi.pda.service.PdaService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.Socket;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.out.tagTask.util.ElectronicTagClient.*;
|
||||
|
||||
@Slf4j
|
||||
public class TagOutReadThread implements Runnable {
|
||||
|
||||
private TagTaskMapper tagTaskMapper;
|
||||
private IBasTagService basTagService;
|
||||
private PdaService pdaService;
|
||||
private String ip;
|
||||
|
||||
public TagOutReadThread(String ip) {
|
||||
this.tagTaskMapper = SpringUtils.getBean(TagTaskMapper.class);
|
||||
this.basTagService = SpringUtils.getBean(IBasTagService.class);
|
||||
this.pdaService = SpringUtils.getBean(PdaService.class);
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
while (true) {
|
||||
//查询所有下发的任务
|
||||
TagTask tagTaskParam = new TagTask();
|
||||
List<TagTask> tagTasks = tagTaskMapper.selectTagTaskList(tagTaskParam);
|
||||
if (CollUtil.isEmpty(tagTasks)){
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Map<Long, List<TagTask>> collect = tagTasks.stream().collect(Collectors.groupingBy(TagTask::getTagId));
|
||||
|
||||
try (Socket socket = getSocket(ip)) {
|
||||
//下发标签
|
||||
if (socket==null){
|
||||
log.info("电子标签服务器连接失败,请检查ip:{}", ip);
|
||||
Thread.sleep(5000);
|
||||
continue;
|
||||
}
|
||||
for (Long tagId : collect.keySet()) {
|
||||
List<TagTask> allTagTasks = collect.get(tagId);
|
||||
Optional<TagTask> first = allTagTasks.stream().filter(x -> "0".equals(x.getStatus())).findFirst();
|
||||
if (first.isPresent()) {
|
||||
TagTask tagTask = first.get();
|
||||
BasTag basTag = basTagService.selectBasTagById(tagId);
|
||||
boolean b = sendMsgDzbq(socket, Convert.toInt(basTag.getId()), Convert.toInt(tagTask.getNum()), Convert.toInt(tagTask.getNum()));
|
||||
if (b) {
|
||||
basTag.setSendCompleted("1");
|
||||
basTag.setCurNum(tagTask.getNum());
|
||||
basTagService.updateBasTag(basTag);
|
||||
tagTask.setStatus("1");
|
||||
tagTaskMapper.updateTagTask(tagTask);
|
||||
log.info("下发电子标签:ip:{},id:{}数量:{}", basTag.getIp(), basTag.getId(), tagTask.getNum());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tagTasks = tagTaskMapper.selectTagTaskList(tagTaskParam);
|
||||
collect = tagTasks.stream().collect(Collectors.groupingBy(TagTask::getTagId));
|
||||
for (Long tagId : collect.keySet()) {
|
||||
List<TagTask> allTagTasks = collect.get(tagId);
|
||||
if (allTagTasks.stream().allMatch(x -> "2".equals(x.getStatus()))) {
|
||||
//全部拣选完成 灭灯逻辑
|
||||
//灭灯
|
||||
BasTag basTag = basTagService.selectBasTagById(tagId);
|
||||
boolean b = sendDzbqOff(socket, Convert.toInt(basTag.getId()));
|
||||
if (b) {
|
||||
//出库确认
|
||||
TrayCodeMakeSure trayCodeMakeSure = new TrayCodeMakeSure();
|
||||
trayCodeMakeSure.setTrayCode(basTag.getTrayCode());
|
||||
AjaxResult ajaxResult = pdaService.outMakeSure(trayCodeMakeSure);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//删除标签绑定信息
|
||||
basTag.setSendCompleted("0");
|
||||
basTag.setTrayCode("");
|
||||
basTagService.updateBasTag(basTag);
|
||||
//删除tagList
|
||||
tagTaskMapper.deleteTagTaskByIds(allTagTasks.stream().map(TagTask::getId).toArray(Long[]::new));
|
||||
log.info("下发电子标签灭灯:ip:{},id:{}", basTag.getIp(), basTag.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tagTaskParam.setStatus("1");
|
||||
tagTasks = tagTaskMapper.selectTagTaskList(tagTaskParam);
|
||||
if (CollUtil.isNotEmpty(tagTasks)) {
|
||||
/* 接收电子标签指令 */
|
||||
String content = ElectronicTagClient.receiveHexData(socket);//读取值
|
||||
//将拍灯指令整理成数组
|
||||
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();
|
||||
log.info("119收到指令:{}", address);
|
||||
Optional<TagTask> first = tagTasks.stream().filter(x -> address == x.getTagId()).findFirst();
|
||||
if(first.isPresent()){
|
||||
TagTask tagTask = first.get();
|
||||
BasTag basTag = basTagService.selectBasTagById(tagTask.getTagId());
|
||||
if (address == basTag.getId()) {
|
||||
//更新当前子任务状态
|
||||
tagTask.setStatus("2");
|
||||
tagTaskMapper.updateTagTask(tagTask);
|
||||
log.info("更新任务状态:{},id:{}", tagTask.getProductId(), tagTask.getId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
package com.ruoyi.out.tagTask.util;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import jakarta.xml.bind.DatatypeConverter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Slf4j
|
||||
public class ElectronicTagClient {
|
||||
|
||||
/*public static void main(String[] args) {
|
||||
final String SERVER_IP = "192.168.0.7";
|
||||
final int SERVER_PORT = 20108;
|
||||
final String hexData = "FA0111000001000114AF";
|
||||
|
||||
try (Socket socket = new Socket(SERVER_IP, SERVER_PORT)) {
|
||||
System.out.println("成功连接到电子标签服务器: " + SERVER_IP + ":" + SERVER_PORT);
|
||||
|
||||
// 发送数据
|
||||
sendHexData(socket, hexData);
|
||||
|
||||
// 接收响应(30秒超时)
|
||||
String response = receiveHexData(socket, 30000);
|
||||
System.out.println("收到响应: " + response);
|
||||
|
||||
} catch (SocketTimeoutException e) {
|
||||
System.err.println("接收响应超时: " + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
System.err.println("通信错误: " + e.getMessage());
|
||||
} finally {
|
||||
System.out.println("连接已关闭");
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 发送16进制数据
|
||||
*
|
||||
* @param socket 已建立的Socket连接
|
||||
* @param hexData 要发送的16进制字符串
|
||||
* @throws IOException 如果发生I/O错误
|
||||
*/
|
||||
public static boolean sendHexData(Socket socket, String hexData) throws IOException {
|
||||
hexData = hexData.replace(" ", "");
|
||||
// 验证并处理奇数长度
|
||||
if (hexData.length() % 2 != 0) {
|
||||
System.out.println("警告:16进制字符串长度为奇数(" + hexData.length() + "),将在前面补0");
|
||||
hexData = "0" + hexData;
|
||||
}
|
||||
|
||||
byte[] sendBytes = hexStringToByteArray(hexData);
|
||||
System.out.println("发送字节: " + Arrays.toString(sendBytes));
|
||||
OutputStream output = socket.getOutputStream();
|
||||
output.write(sendBytes);
|
||||
output.flush();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收16进制响应数据
|
||||
*
|
||||
* @param socket 已建立的Socket连接
|
||||
* @param timeoutMillis 超时时间(毫秒)
|
||||
* @return 接收到的16进制字符串
|
||||
* @throws IOException 如果发生I/O错误或超时
|
||||
*/
|
||||
public static String receiveHexData(Socket socket){
|
||||
try {
|
||||
InputStream input = socket.getInputStream();
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
byte[] temp = new byte[1024];
|
||||
int bytesRead;
|
||||
|
||||
while ((bytesRead = input.read(temp)) != -1) {
|
||||
buffer.write(temp, 0, bytesRead);
|
||||
if (input.available() == 0) {
|
||||
break; // 没有更多数据可读
|
||||
}
|
||||
}
|
||||
|
||||
byte[] responseBytes = buffer.toByteArray();
|
||||
if (responseBytes.length == 0) {
|
||||
return "无响应数据";
|
||||
}
|
||||
return byteArrayToHexString(responseBytes);
|
||||
}catch (IOException e){
|
||||
log.error("e: {}", e.getMessage());
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
// 16进制字符串转字节数组
|
||||
public static byte[] hexStringToByteArray(String hexString) {
|
||||
return DatatypeConverter.parseHexBinary(hexString);
|
||||
}
|
||||
|
||||
// 字节数组转16进制字符串
|
||||
private static String byteArrayToHexString(byte[] bytes) {
|
||||
return DatatypeConverter.printHexBinary(bytes).toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发电子标签
|
||||
*
|
||||
* @param socket 连接
|
||||
* @param sid 标签id 数字
|
||||
* @param greenNum 绿色数字
|
||||
* @param redNum 红色数字
|
||||
*/
|
||||
public static boolean sendMsgDzbq(Socket socket, int sid, int greenNum, int redNum) {
|
||||
try {
|
||||
String green = String.format("%04x", greenNum);
|
||||
String red = String.format("%04x", redNum);
|
||||
String greenFirst2 = green.substring(0, 2);
|
||||
String greenLast2 = green.substring(2);
|
||||
String redFirst2 = red.substring(0, 2);
|
||||
String redLast2 = red.substring(2);
|
||||
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";
|
||||
return ElectronicTagClient.sendHexData(socket, value);
|
||||
} catch (Exception e) {
|
||||
log.error("e: ", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 灭灯
|
||||
*/
|
||||
public static boolean sendDzbqOff(Socket socket, int id) throws IOException {
|
||||
int x7 = (id + 0x10 + 0x03 + 0xe8 + 0x03 + 0xe8) % 256;//累加 校验
|
||||
return ElectronicTagClient.sendHexData(socket, "FA " + String.format("%02x", id) + " 10 00 03 e8 03 e8 " + String.format("%02x", x7) + " AF");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取socket
|
||||
*/
|
||||
public static Socket getSocket(String ip) {
|
||||
try {
|
||||
String[] split = ip.split(":");
|
||||
Socket socket = new Socket(split[0], Convert.toInt(split[1]));
|
||||
socket.setSoTimeout(3000);
|
||||
log.info("成功连接到电子标签服务器: " + split[0] + ":" + split[1]);
|
||||
return socket;
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.pda.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.api.domain.RequestEnter;
|
||||
import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargoSpace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.bas.container.domain.BasContainer;
|
||||
@@ -47,218 +48,21 @@ public class PdaController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PdaService pdaService;
|
||||
@Autowired
|
||||
private IInStockinDetailService inStockinDetailService;
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
@Autowired
|
||||
private IBasWarehouseService basWarehouseService;
|
||||
@Autowired
|
||||
private ITrayMsgService trayMsgService;
|
||||
@Autowired
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
@Autowired
|
||||
private IMydoJobDetailService mydoJobDetailService;
|
||||
@Autowired
|
||||
private IInStockinService inStockinService;
|
||||
@Autowired
|
||||
private IOutStockoutService outStockoutService;
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
/**
|
||||
* 空托盘入库
|
||||
*
|
||||
* @param trayCodeMsg
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/emptyTrayIn")
|
||||
@ResponseBody
|
||||
public AjaxResult emptyTrayIn(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
BasWarehouse basWarehouse = basWarehouseService.selectBasWarehouseByWarehouseId(trayCodeMsg.getWarehouseId());
|
||||
if (basWarehouse == null) {
|
||||
log.error("仓库不存在");
|
||||
return AjaxResult.error(MessageUtils.message("error.message18"));
|
||||
}
|
||||
if ("1".equals(basWarehouse.getWarehouseType()) && StrUtil.isEmpty(trayCodeMsg.getCargoSpaceId())) {
|
||||
log.error("请选择高架库货位");
|
||||
return AjaxResult.error(MessageUtils.message("error.message19"));
|
||||
}
|
||||
if ("2".equals(basWarehouse.getWarehouseType())) {
|
||||
BasCargoSpace basCargoSpace = new BasCargoSpace();
|
||||
basCargoSpace.setWarehouseId(trayCodeMsg.getWarehouseId());
|
||||
basCargoSpace.setStatus("1");
|
||||
List<BasCargoSpace> basCargoSpaces = basCargoSpaceService.selectBasCargoSpaceList(basCargoSpace);
|
||||
if (basCargoSpaces.isEmpty()) {
|
||||
log.error("此仓库没有空余货位");
|
||||
return AjaxResult.error(MessageUtils.message("error.message20"));
|
||||
} else {
|
||||
trayCodeMsg.setCargoSpaceId(basCargoSpaces.get(0).getCargoSpaceId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return pdaService.emptyTrayIn(trayCodeMsg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 空托盘库存查询
|
||||
*
|
||||
* @param warehouseId
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pda:selectKTPStcok:list')")
|
||||
@RequestMapping("/selectKTPStcok")
|
||||
@ResponseBody
|
||||
public AjaxResult selectKTPStcok(String warehouseId) {
|
||||
BasStock basStock = new BasStock();
|
||||
basStock.setWarehouseId(warehouseId);
|
||||
List<BasStock> basStockList = basStockService.selectKtpStock(basStock);
|
||||
|
||||
if (!basStockList.isEmpty()) {
|
||||
return AjaxResult.success(basStockList);
|
||||
} else {
|
||||
log.error("此区域没有空托盘库存");
|
||||
return AjaxResult.error(MessageUtils.message("error.message25"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 空托盘出库
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/emptyTrayOut")
|
||||
@ResponseBody
|
||||
@Log(title = "空托盘出库", businessType = BusinessType.INSERT)
|
||||
public AjaxResult emptyTrayOut(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
BasWarehouse basWarehouse = basWarehouseService.selectBasWarehouseByWarehouseId(trayCodeMsg.getWarehouseId());
|
||||
if (basWarehouse == null) {
|
||||
log.error("仓库不存在");
|
||||
return AjaxResult.error(MessageUtils.message("error.message18"));
|
||||
}
|
||||
if ("1".equals(basWarehouse.getWarehouseType()) && StrUtil.isEmpty(trayCodeMsg.getCargoSpaceId())) {
|
||||
log.error("请选择高架库货位");
|
||||
return AjaxResult.error(MessageUtils.message("error.message19"));
|
||||
}
|
||||
if ("2".equals(basWarehouse.getWarehouseType()) && StrUtil.isEmpty(trayCodeMsg.getExitId())) {
|
||||
log.error("请选择出口");
|
||||
return AjaxResult.error(MessageUtils.message("error.message22"));
|
||||
}
|
||||
if("2".equals(basWarehouse.getWarehouseType())){
|
||||
BasStock basStock = new BasStock();
|
||||
basStock.setWarehouseId(trayCodeMsg.getWarehouseId());
|
||||
List<BasStock> basStockList = basStockService.selectKtpStock(basStock);
|
||||
if(basStockList.isEmpty()){
|
||||
log.warn("此区域没有空托盘库存或此用户没有该区域权限");
|
||||
return AjaxResult.error(MessageUtils.message("error.message26"));
|
||||
}else{
|
||||
trayCodeMsg.setCargoSpaceId(basStockList.get(0).getCargoSpaceId());
|
||||
}
|
||||
}
|
||||
|
||||
return pdaService.emptyTrayOut(trayCodeMsg);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 空料箱出库
|
||||
// *
|
||||
// * @param trayCodeMsg
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping("/emptyBoxOut")
|
||||
// @ResponseBody
|
||||
// public AjaxResult emptyBoxOut(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
// return pdaService.emptyBoxOut(trayCodeMsg);
|
||||
// }
|
||||
/**
|
||||
* 查询平库入库单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pda:inoderList:list')")
|
||||
@RequestMapping("/inorder/list")
|
||||
@ResponseBody
|
||||
public List<InStockin> inoderList(@RequestBody InStockin inStockin) {
|
||||
inStockin.setTypeData(Arrays.asList("3"));
|
||||
List<InStockin> inStockins = inStockinService.selectInStockinList(inStockin);
|
||||
return inStockins;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑盘查询入库单详情
|
||||
*
|
||||
* @param stockinDetailId
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pda:inoderList:list')")
|
||||
@RequestMapping("/inorder/detail")
|
||||
@ResponseBody
|
||||
public InStockinDetail inoderList(String stockinDetailId) {
|
||||
InStockinDetail inStockinDetail1 = new InStockinDetail();
|
||||
inStockinDetail1.setStockinDetailId(stockinDetailId);
|
||||
InStockinDetail inStockinDetail = inStockinDetailService.selectStockinByDetailById(inStockinDetail1);
|
||||
return inStockinDetail;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定托盘物料
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pda:bindTrayMsg:submit')")
|
||||
@RequestMapping("/bindTrayMsg")
|
||||
@Log(title = "手持机绑定物料", businessType = BusinessType.INSERT)
|
||||
@ResponseBody
|
||||
public AjaxResult bindTrayMsg(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
return pdaService.bindTrayMsg(trayCodeMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询托盘已绑定物料
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pda:bindMsg:list')")
|
||||
@RequestMapping("/bindMsg")
|
||||
@ResponseBody
|
||||
public AjaxResult bindMsg(String trayCode) {
|
||||
TrayMsg trayMsg = new TrayMsg();
|
||||
trayMsg.setTrayCode(trayCode);
|
||||
List<TrayMsg> trayMsgs = trayMsgService.selectTrayMsgList(trayMsg);
|
||||
return AjaxResult.success(trayMsgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认入库
|
||||
*/
|
||||
/**
|
||||
* 入库扫码生成作业
|
||||
*/
|
||||
@RequestMapping("/addInJob")
|
||||
@Log(title = "手持机确认入库", businessType = BusinessType.INSERT)
|
||||
@ResponseBody
|
||||
public AjaxResult addInJob(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
BasWarehouse basWarehouse = basWarehouseService.selectBasWarehouseByWarehouseId(trayCodeMsg.getWarehouseId());
|
||||
if (basWarehouse == null) {
|
||||
log.error("仓库不存在");
|
||||
return AjaxResult.error(MessageUtils.message("error.message18"));
|
||||
}
|
||||
if ("1".equals(basWarehouse.getWarehouseType()) && StrUtil.isEmpty(trayCodeMsg.getCargoSpaceId())) {
|
||||
log.error("请选择高架库货位");
|
||||
return AjaxResult.error(MessageUtils.message("error.message19"));
|
||||
}
|
||||
if ("2".equals(basWarehouse.getWarehouseType())) {
|
||||
BasCargoSpace basCargoSpace = new BasCargoSpace();
|
||||
basCargoSpace.setWarehouseId(trayCodeMsg.getWarehouseId());
|
||||
basCargoSpace.setStatus("1");
|
||||
List<BasCargoSpace> basCargoSpaces = basCargoSpaceService.selectBasCargoSpaceList(basCargoSpace);
|
||||
if (basCargoSpaces.isEmpty()) {
|
||||
log.error("此仓库没有空余货位");
|
||||
return AjaxResult.error(MessageUtils.message("error.message20"));
|
||||
} else {
|
||||
trayCodeMsg.setCargoSpaceId(basCargoSpaces.get(0).getCargoSpaceId());
|
||||
}
|
||||
}
|
||||
public AjaxResult addInJob(@RequestBody RequestEnter requestEnter) {
|
||||
return pdaService.addInJob(requestEnter);
|
||||
}
|
||||
|
||||
return pdaService.addInJob(trayCodeMsg);
|
||||
@RequestMapping("/selectDetailByTray")
|
||||
@ResponseBody
|
||||
public AjaxResult selectDetailByTray(@RequestBody TrayCodeMakeSure trayCodeMakeSure) {
|
||||
return pdaService.selectDetailByTray(trayCodeMakeSure);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,17 +79,6 @@ public class PdaController extends BaseController {
|
||||
return pdaService.outMakeSure(trayCodeMakeSure);
|
||||
}
|
||||
|
||||
/**
|
||||
* 出货异常流程
|
||||
* @param trayCodeMakeSure
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pda:out:exception')")
|
||||
@PostMapping("/outException")
|
||||
@ResponseBody
|
||||
public AjaxResult outException(@RequestBody TrayCodeMakeSure trayCodeMakeSure) {
|
||||
return pdaService.outException(trayCodeMakeSure);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -301,165 +94,6 @@ public class PdaController extends BaseController {
|
||||
return pdaService.checkMakeSure(trayCodeMakeSure);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有待处理任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pda:taskList:list')")
|
||||
@RequestMapping("/taskList")
|
||||
@ResponseBody
|
||||
public AjaxResult taskList(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
List<BasWarehouse> basWarehouses = basWarehouseService.selectBasWarehouseList(new BasWarehouse());
|
||||
List<MydoJob> mydoJobArrayList = new ArrayList<>();
|
||||
if(!basWarehouses.isEmpty()){
|
||||
|
||||
for(BasWarehouse basWarehouse : basWarehouses){
|
||||
//高架库
|
||||
if("1".equals(basWarehouse.getWarehouseType())){
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setWarehouseId(basWarehouse.getWarehouseId());
|
||||
mydoJob.setTrayCode(trayCodeMsg.getTrayCode());
|
||||
mydoJob.setInOut(trayCodeMsg.getInOut());
|
||||
// if("1".equals(trayCodeMsg.getInOut())){
|
||||
mydoJob.setStatus("1");
|
||||
// }
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(mydoJob);
|
||||
//将mydoJob添加进mydoJobArrayList
|
||||
mydoJobArrayList.addAll(mydoJobs);
|
||||
}
|
||||
//ctu库
|
||||
if("2".equals(basWarehouse.getWarehouseType()) && !"1".equals(trayCodeMsg.getInOut())){
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
if("4".equals(trayCodeMsg.getInOut())){
|
||||
mydoJob.setInOut("4");
|
||||
}else if("2".equals(trayCodeMsg.getInOut())){
|
||||
mydoJob.setInOut("2");
|
||||
}else{
|
||||
List<String> list = new ArrayList<>(Arrays.asList("21", "22", "23","24","25","26"));
|
||||
mydoJob.setInOutIds(list);
|
||||
}
|
||||
mydoJob.setWarehouseId(basWarehouse.getWarehouseId());
|
||||
mydoJob.setTrayCode(trayCodeMsg.getTrayCode());
|
||||
mydoJob.setStatus("3");
|
||||
List<MydoJob> mydoJobs2 = mydoJobService.selectMydoJobList(mydoJob);
|
||||
mydoJobArrayList.addAll(mydoJobs2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(mydoJobArrayList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用托盘条码查询子作业数据
|
||||
*/
|
||||
@RequestMapping("/selectDetailByTray")
|
||||
@ResponseBody
|
||||
public AjaxResult selectDetailByTray(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setTrayCode(trayCodeMsg.getTrayCode());
|
||||
mydoJob.setStatus(trayCodeMsg.getStatus());
|
||||
mydoJob.setInOut(trayCodeMsg.getInOut());
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(mydoJob);
|
||||
if(mydoJobs.isEmpty()){
|
||||
log.error("此托盘没有作业");
|
||||
return AjaxResult.error();
|
||||
}
|
||||
MydoJobDetail mydoJobDetail = new MydoJobDetail();
|
||||
mydoJobDetail.setJobId(mydoJobs.get(0).getJobId());
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetail);
|
||||
|
||||
return AjaxResult.success(mydoJobDetails);
|
||||
}
|
||||
/**
|
||||
* 平库入库
|
||||
*/
|
||||
@RequestMapping("/pkIn")
|
||||
@ResponseBody
|
||||
public AjaxResult pkIn(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
return pdaService.pkIn(trayCodeMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询平库出库单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pda:outoderList:list')")
|
||||
@RequestMapping("/outorder/list")
|
||||
@ResponseBody
|
||||
public List<OutStockout> outoderList(@RequestBody OutStockout outStockout) {
|
||||
outStockout.setTypeData(Arrays.asList("3"));
|
||||
List<OutStockout> outStockouts = outStockoutService.selectOutStockoutList(outStockout);
|
||||
return outStockouts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平库出库
|
||||
*/
|
||||
@RequestMapping("/pkout")
|
||||
@ResponseBody
|
||||
public AjaxResult pkout(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
return pdaService.pkout(trayCodeMsg);
|
||||
}
|
||||
/**
|
||||
* 调用wcs接口调用agv
|
||||
*/
|
||||
@RequestMapping("/agvRequest")
|
||||
@ResponseBody
|
||||
public AjaxResult agvRequest(@RequestBody BasContainer basContainer) {
|
||||
if(basContainer.getDetails().isEmpty()){
|
||||
log.error("该料架无物料信息");
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return pdaService.agvRequest(basContainer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手持机获取货位分析数据
|
||||
*/
|
||||
@RequestMapping("/cargoSpaceAnalysis")
|
||||
@ResponseBody
|
||||
public AjaxResult cargoSpaceAnalysis(@RequestParam("warehouseId") String warehouseId){
|
||||
return success(pdaService.cargoSpaceAnalysis(warehouseId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绑定料架
|
||||
* @param trayCodeMakeSure
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bindContainer")
|
||||
@ResponseBody
|
||||
public AjaxResult bindContainer(@RequestBody TrayCodeMakeSure trayCodeMakeSure) {
|
||||
return pdaService.bindContainer(trayCodeMakeSure);
|
||||
}
|
||||
/**
|
||||
* 手持机获取入出库作业数量
|
||||
*/
|
||||
@RequestMapping("/getAisleStatisticsData")
|
||||
@ResponseBody
|
||||
public AjaxResult getAisleStatisticsData(@RequestParam("warehouseId") String warehouseId){
|
||||
return success(pdaService.getAisleStatisticsData(warehouseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定料架
|
||||
*/
|
||||
@RequestMapping("/bindShelf")
|
||||
@ResponseBody
|
||||
public AjaxResult bindShelf(@RequestBody TrayCodeMakeSure trayCodeMakeSure) {
|
||||
return pdaService.bindShelf(trayCodeMakeSure);
|
||||
}
|
||||
|
||||
@RequestMapping("/selectDictData")
|
||||
@ResponseBody
|
||||
public List<SysDictData> selectDictData(@RequestParam("dictType") String dictType) {
|
||||
List<SysDictData> list = dictTypeService.selectDictDataByType(dictType);
|
||||
return list;
|
||||
}
|
||||
|
||||
@RequestMapping("/movePoint")
|
||||
@ResponseBody
|
||||
public AjaxResult movePoint(String startPoint, String endPoint) {
|
||||
return pdaService.movePoint(startPoint,endPoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.pda.service;
|
||||
|
||||
import com.ruoyi.api.domain.RequestEnter;
|
||||
import com.ruoyi.bas.container.domain.BasContainer;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
@@ -9,38 +10,15 @@ import java.util.Map;
|
||||
|
||||
public interface PdaService {
|
||||
|
||||
public AjaxResult emptyTrayIn(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
public AjaxResult emptyBoxIn(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
public AjaxResult emptyTrayOut(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
public AjaxResult emptyBoxOut(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
public AjaxResult bindTrayMsg(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
public AjaxResult addInJob(TrayCodeMsg trayCodeMsg);
|
||||
public AjaxResult addInJob(RequestEnter requestEnter);
|
||||
|
||||
public AjaxResult selectDetailByTray(TrayCodeMakeSure trayCodeMakeSure);
|
||||
|
||||
AjaxResult outMakeSure(TrayCodeMakeSure trayCodeMakeSure);
|
||||
|
||||
AjaxResult checkMakeSure(TrayCodeMakeSure trayCodeMakeSure);
|
||||
|
||||
AjaxResult pkIn(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
AjaxResult pkout(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
AjaxResult outException(TrayCodeMakeSure trayCodeMakeSure);
|
||||
|
||||
AjaxResult agvRequest(BasContainer basContainer);
|
||||
|
||||
Map<String,Object> cargoSpaceAnalysis(String warehouseId);
|
||||
|
||||
Map<String,Object> getAisleStatisticsData(String warehouseId);
|
||||
|
||||
AjaxResult bindContainer(TrayCodeMakeSure trayCodeMakeSure);
|
||||
|
||||
AjaxResult bindShelf(TrayCodeMakeSure trayCodeMakeSure);
|
||||
|
||||
AjaxResult movePoint(String startPoint, String endPoint);
|
||||
}
|
||||
|
||||
@@ -1,64 +1,29 @@
|
||||
package com.ruoyi.pda.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.api.domain.AgvMoveParam;
|
||||
import com.ruoyi.api.service.IToWcsService;
|
||||
import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargoSpace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.bas.container.domain.BasContainer;
|
||||
import com.ruoyi.bas.container.service.IBasContainerService;
|
||||
import com.ruoyi.bas.containerDetails.domain.BasContainerDetails;
|
||||
import com.ruoyi.bas.containerDetails.service.IBasContainerDetailsService;
|
||||
import com.ruoyi.bas.port.domain.BasProductPort;
|
||||
import com.ruoyi.bas.port.mapper.BasProductPortMapper;
|
||||
import com.ruoyi.bas.tag.domain.BasTag;
|
||||
import com.ruoyi.bas.tag.service.IBasTagService;
|
||||
import com.ruoyi.bas.warehouse.domain.BasWarehouse;
|
||||
import com.ruoyi.bas.warehouse.service.IBasWarehouseService;
|
||||
import com.ruoyi.api.domain.RequestEnter;
|
||||
import com.ruoyi.api.service.IToWmsService;
|
||||
import com.ruoyi.check.commit.domain.CheckCommitRecord;
|
||||
import com.ruoyi.check.commit.service.ICheckCommitRecordService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.device.agv.domain.AgvContainerTask;
|
||||
import com.ruoyi.device.agv.service.IAgvContainerTaskService;
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
||||
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||
import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService;
|
||||
import com.ruoyi.job.mydojobfinish.mapper.MydoJobFinishMapper;
|
||||
import com.ruoyi.out.outStockout.domain.OutStockout;
|
||||
import com.ruoyi.out.outStockout.service.IOutStockoutService;
|
||||
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.job.mydojobdetail.service.impl.MydoJobDetailServiceImpl;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import com.ruoyi.pda.domain.TrayCodeMsg;
|
||||
import com.ruoyi.pda.mapper.PdaMapper;
|
||||
import com.ruoyi.pda.trayMsg.domain.TrayMsg;
|
||||
import com.ruoyi.pda.trayMsg.service.ITrayMsgService;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import com.ruoyi.stock.stock.service.IBasStockService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@@ -66,15 +31,8 @@ import java.util.*;
|
||||
public class PdaServiceImp implements PdaService {
|
||||
@Autowired
|
||||
private PdaMapper pdaMapper;
|
||||
@Autowired
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
@Autowired
|
||||
private IMydoJobDetailService mydoJobDetailService;
|
||||
;
|
||||
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
;
|
||||
@Autowired
|
||||
ISysRoleService sysRoleService;
|
||||
@Autowired
|
||||
@@ -82,360 +40,74 @@ public class PdaServiceImp implements PdaService {
|
||||
@Autowired
|
||||
ITrayMsgService trayMsgService;
|
||||
@Autowired
|
||||
private IBasContainerDetailsService basContainerDetailsService;
|
||||
@Autowired
|
||||
private ICheckCommitRecordService checkCommitRecordService;
|
||||
@Autowired
|
||||
private IOutStockoutService outStockoutService;
|
||||
private IToWmsService iToWmsService;
|
||||
@Autowired
|
||||
private IOutStockoutDetailService outStockoutDetailService;
|
||||
@Resource
|
||||
private BasProductPortMapper basProductPortMapper;
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
@Resource
|
||||
private MydoJobFinishMapper mydoJobFinishMapper;
|
||||
@Autowired
|
||||
private IOutPickSubmitService outPickSubmitService;
|
||||
@Autowired
|
||||
private ITagTaskService tagTaskService;
|
||||
@Autowired
|
||||
private IBasTagService basTagService;
|
||||
@Autowired
|
||||
private IBasWarehouseService basWarehouseService;
|
||||
@Autowired
|
||||
private IBasContainerService basContainerService;
|
||||
@Autowired
|
||||
private IToWcsService iToWcsService;
|
||||
@Autowired
|
||||
private IAgvContainerTaskService agvContainerTaskService;
|
||||
private IMydoJobDetailService mydoJobDetailService;
|
||||
|
||||
|
||||
/**
|
||||
* 空托盘入库
|
||||
*
|
||||
* @param trayCodeMsg
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult emptyTrayIn(TrayCodeMsg trayCodeMsg) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", trayCodeMsg.getTrayCode());
|
||||
map.put("v_warehouse_id", trayCodeMsg.getWarehouseId());
|
||||
map.put("v_quantity", "1");
|
||||
map.put("v_cargo_space_id", trayCodeMsg.getCargoSpaceId());
|
||||
pdaMapper.emptyTrayIn(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 空料箱入库
|
||||
*
|
||||
* @param trayCodeMsg
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult emptyBoxIn(TrayCodeMsg trayCodeMsg) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", trayCodeMsg.getTrayCode());
|
||||
map.put("v_warehouse_id", trayCodeMsg.getWarehouseId());
|
||||
map.put("v_entrance_id", trayCodeMsg.getEntranceId());
|
||||
pdaMapper.emptyBoxIn(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
public AjaxResult addInJob(RequestEnter requestEnter) {
|
||||
AjaxResult ajaxResult = iToWmsService.requestEnterByTrayCode(requestEnter);
|
||||
return ajaxResult;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult emptyTrayOut(TrayCodeMsg trayCodeMsg) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_warehouse_id", trayCodeMsg.getWarehouseId());
|
||||
map.put("v_cargo_space_id", trayCodeMsg.getCargoSpaceId());
|
||||
map.put("v_exit_id", trayCodeMsg.getExitId());
|
||||
pdaMapper.emptyTrayOut(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult emptyBoxOut(TrayCodeMsg trayCodeMsg) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_warehouse_id", trayCodeMsg.getWarehouseId());
|
||||
map.put("v_exit_id", trayCodeMsg.getExitId());
|
||||
pdaMapper.emptyBoxOut(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
public AjaxResult selectDetailByTray(TrayCodeMakeSure trayCodeMakeSure) {
|
||||
String trayCode = trayCodeMakeSure.getTrayCode();
|
||||
String[] split = trayCode.split(" ");
|
||||
String productId = split[8].substring(10);
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setExitId(trayCodeMakeSure.getExitId());
|
||||
mydoJob.setProductId(productId);
|
||||
mydoJob.setStatus("3");
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailListByExit(mydoJob);
|
||||
return AjaxResult.success(mydoJobDetails);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult bindTrayMsg(TrayCodeMsg trayCodeMsg) {
|
||||
//判断用户的仓库权限
|
||||
InStockinDetail inStockinDetail1 = new InStockinDetail();
|
||||
inStockinDetail1.setStockinDetailId(trayCodeMsg.getStockinDetailId());
|
||||
InStockinDetail inStockinDetail = inStockinDetailService.selectStockinByDetailById(inStockinDetail1);
|
||||
if (inStockinDetail == null) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message6"));
|
||||
}
|
||||
//判断与已绑定物料是否为同一仓库
|
||||
TrayMsg trayMsg = new TrayMsg();
|
||||
trayMsg.setTrayCode(trayCodeMsg.getTrayCode());
|
||||
List<TrayMsg> trayMsgs = trayMsgService.selectTrayMsgList(trayMsg);
|
||||
if (trayMsgs.size() > 0) {
|
||||
// InStockinDetail inStockinDetail = inStockinDetailService.selectStockinByDetailById(trayCodeMsg.getStockinDetailId());
|
||||
if (!trayMsgs.get(0).getWarehouseId().equals(inStockinDetail.getWarehouseId())) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message7"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", trayCodeMsg.getTrayCode());
|
||||
map.put("v_stockin_detail_id", trayCodeMsg.getStockinDetailId());
|
||||
map.put("v_quantity", Integer.parseInt(trayCodeMsg.getInQuantity()));
|
||||
pdaMapper.bindTrayMsg(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult addInJob(TrayCodeMsg trayCodeMsg) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", trayCodeMsg.getTrayCode());
|
||||
// map.put("v_warehouse_id", trayCodeMsg.getWarehouseId());
|
||||
map.put("v_cargo_space_id", trayCodeMsg.getCargoSpaceId());
|
||||
pdaMapper.addInJob(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult outMakeSure(TrayCodeMakeSure trayCodeMakeSure) {
|
||||
|
||||
//判断任务是否存在
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setTrayCode(trayCodeMakeSure.getTrayCode());
|
||||
// mydoJobParam.setStatus("3");
|
||||
List<MydoJob> mydoJobList = mydoJobService.selectMydoJobListApi(mydoJobParam);
|
||||
if (CollUtil.isEmpty(mydoJobList)) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message1"));
|
||||
String trayCode = trayCodeMakeSure.getTrayCode();
|
||||
String[] split = trayCode.split(" ");
|
||||
String productId = split[8].substring(10);
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setExitId(trayCodeMakeSure.getExitId());
|
||||
mydoJob.setProductId(productId);
|
||||
mydoJob.setStatus("3");
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailListByExit(mydoJob);
|
||||
if(mydoJobDetails.size()==0){
|
||||
return AjaxResult.error("该物料没有出库作业,请检查");
|
||||
}
|
||||
|
||||
|
||||
MydoJobDetail mydoJobDetailParam = new MydoJobDetail();
|
||||
mydoJobDetailParam.setJobId(mydoJobList.get(0).getJobId());
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetailParam);
|
||||
if (CollUtil.isEmpty(mydoJobDetails)) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message2"));
|
||||
}
|
||||
//空托盘空料箱
|
||||
if ("21".equals(mydoJobList.get(0).getInOrOut()) || "22".equals(mydoJobList.get(0).getInOrOut())) {
|
||||
return handleOutType2(trayCodeMakeSure, mydoJobDetails, mydoJobList.get(0));
|
||||
}
|
||||
|
||||
//获取单据类型
|
||||
OutStockout outStockoutParam = new OutStockout();
|
||||
outStockoutParam.setStockoutId(mydoJobDetails.get(0).getInOrOutId());
|
||||
List<OutStockout> outStockouts = outStockoutService.selectOutStockoutListApi(outStockoutParam);
|
||||
if (CollUtil.isEmpty(outStockouts)) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message4"));
|
||||
}
|
||||
String billType = outStockouts.get(0).getOutType();
|
||||
|
||||
switch (billType) {
|
||||
case "1":
|
||||
//拣选单据
|
||||
return handleOutType1(trayCodeMakeSure, mydoJobDetails, mydoJobList.get(0));
|
||||
case "2":
|
||||
//退货单据 不绑定容器
|
||||
return handleOutType2(trayCodeMakeSure, mydoJobDetails, mydoJobList.get(0));
|
||||
default:
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message3"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理退货出库
|
||||
*
|
||||
* @param trayCodeMakeSure
|
||||
* @param mydoJobDetailList
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
|
||||
private AjaxResult handleOutType2(TrayCodeMakeSure trayCodeMakeSure, List<MydoJobDetail> mydoJobDetailList, MydoJob mydoJob) {
|
||||
BasWarehouse basWarehouse = basWarehouseService.selectBasWarehouseByWarehouseId(mydoJob.getWarehouseId());
|
||||
//修改拣选数量
|
||||
for (MydoJobDetail mydoJobDetail : mydoJobDetailList) {
|
||||
//修改拣选数量
|
||||
mydoJobDetail.setPickQuantity(mydoJobDetail.getOutQuantity());
|
||||
mydoJobDetailService.updateMydoJobDetail(mydoJobDetail);
|
||||
|
||||
|
||||
//修改单据实际数量
|
||||
String inOrOutDId = mydoJobDetail.getInOrOutDId();
|
||||
OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByStockoutDetailId(inOrOutDId);
|
||||
if (ObjUtil.isNotNull(outStockoutDetail)) {
|
||||
outStockoutDetail.setAssignNum(outStockoutDetail.getAssignNum().add(Convert.toBigDecimal(mydoJobDetail.getPickQuantity())));
|
||||
outStockoutDetailService.updateOutStockoutDetail(outStockoutDetail);
|
||||
}
|
||||
//修改电子标签
|
||||
if ("2".equals(basWarehouse.getWarehouseType())){
|
||||
updateTagTaskStatus(mydoJobDetail);
|
||||
}
|
||||
|
||||
}
|
||||
//判断拣选数量是否等于出库数量
|
||||
MydoJobDetail mydoJobDetailParam = new MydoJobDetail();
|
||||
mydoJobDetailParam.setJobId(mydoJob.getJobId());
|
||||
List<MydoJobDetail> currentMydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetailParam);
|
||||
boolean flag = currentMydoJobDetails.stream().allMatch(mydoJobDetail -> mydoJobDetail.getPickQuantity().equals(mydoJobDetail.getOutQuantity()));
|
||||
if (flag) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", trayCodeMakeSure.getTrayCode());
|
||||
map.put("v_type", "1");
|
||||
pdaMapper.outMakeSure(map);
|
||||
iToWcsService.pushInMydoJob();
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
//通知wcs 出库确认
|
||||
deleteTagTask(trayCodeMakeSure, basWarehouse, mydoJob);
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
} else {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", mydoJobDetails.get(0).getTrayCode());
|
||||
pdaMapper.outMakeSure(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理正常出库
|
||||
*
|
||||
* @param trayCodeMakeSure
|
||||
* @param mydoJobDetailList
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
private AjaxResult handleOutType1(TrayCodeMakeSure trayCodeMakeSure, List<MydoJobDetail> mydoJobDetailList, MydoJob mydoJob) {
|
||||
|
||||
BasWarehouse basWarehouse = basWarehouseService.selectBasWarehouseByWarehouseId(mydoJob.getWarehouseId());
|
||||
|
||||
for (MydoJobDetail mydoJobDetail : mydoJobDetailList) {
|
||||
|
||||
//修改拣选数量
|
||||
//MydoJobDetail mydoJobDetailOld = mydoJobDetailService.selectMydoJobDetailByJobDetailId(mydoJobDetail.getJobDetailId());
|
||||
/*BigDecimal oldPickQuantity = Convert.toBigDecimal(mydoJobDetailOld.getPickQuantity());
|
||||
BigDecimal newPickQuantity = Convert.toBigDecimal(mydoJobDetail.getOutQuantity());*/
|
||||
mydoJobDetail.setPickQuantity(mydoJobDetail.getOutQuantity());
|
||||
mydoJobDetailService.updateMydoJobDetail(mydoJobDetail);
|
||||
|
||||
//修改单据实际数量
|
||||
String inOrOutDId = mydoJobDetail.getInOrOutDId();
|
||||
OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByStockoutDetailId(inOrOutDId);
|
||||
if (ObjUtil.isNotNull(outStockoutDetail)) {
|
||||
outStockoutDetail.setAssignNum(outStockoutDetail.getAssignNum().add(Convert.toBigDecimal(mydoJobDetail.getPickQuantity())));
|
||||
outStockoutDetailService.updateOutStockoutDetail(outStockoutDetail);
|
||||
}
|
||||
//修改电子标签
|
||||
if ("2".equals(basWarehouse.getWarehouseType())){
|
||||
updateTagTaskStatus(mydoJobDetail);
|
||||
}
|
||||
//插入中间表
|
||||
insertPickSubmitData(mydoJob, mydoJobDetail);
|
||||
|
||||
}
|
||||
|
||||
//判断拣选数量是否等于出库数量
|
||||
MydoJobDetail mydoJobDetailParam = new MydoJobDetail();
|
||||
mydoJobDetailParam.setJobId(mydoJob.getJobId());
|
||||
List<MydoJobDetail> currentMydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetailParam);
|
||||
boolean flag = currentMydoJobDetails.stream().allMatch(mydoJobDetail -> mydoJobDetail.getPickQuantity().equals(mydoJobDetail.getOutQuantity()));
|
||||
if (flag) {
|
||||
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", trayCodeMakeSure.getTrayCode());
|
||||
map.put("v_type", "1");
|
||||
pdaMapper.outMakeSure(map);
|
||||
iToWcsService.pushInMydoJob();
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
deleteTagTask(trayCodeMakeSure, basWarehouse, mydoJob);
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.success();
|
||||
return AjaxResult.error( map.get("v_resultmsg").toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入中间表
|
||||
* @param mydoJob
|
||||
* @param mydoJobDetail
|
||||
*/
|
||||
private void insertPickSubmitData(MydoJob mydoJob, MydoJobDetail mydoJobDetail) {
|
||||
OutPickSubmit outPickSubmitParam = new OutPickSubmit();
|
||||
outPickSubmitParam.setWarehouseId(mydoJob.getWarehouseId());
|
||||
outPickSubmitParam.setExitId(mydoJob.getExitId());
|
||||
outPickSubmitParam.setProductId(mydoJobDetail.getProductId());
|
||||
List<OutPickSubmit> outPickSubmits = outPickSubmitService.selectOutPickSubmitList(outPickSubmitParam);
|
||||
if (outPickSubmits.isEmpty()) {
|
||||
if (Convert.toInt(mydoJobDetail.getPickQuantity())>0){
|
||||
//存入中间表
|
||||
OutPickSubmit outPickSubmit = new OutPickSubmit();
|
||||
outPickSubmit.setJobId(mydoJob.getJobId());
|
||||
outPickSubmit.setJobDetailId(mydoJobDetail.getJobDetailId());
|
||||
outPickSubmit.setProductId(mydoJobDetail.getProductId());
|
||||
outPickSubmit.setQuantity(mydoJobDetail.getPickQuantity());
|
||||
outPickSubmit.setTrayCode(mydoJob.getTrayCode());
|
||||
outPickSubmit.setWarehouseId(mydoJob.getWarehouseId());
|
||||
outPickSubmit.setExitId(mydoJob.getExitId());
|
||||
outPickSubmitService.insertOutPickSubmit(outPickSubmit);
|
||||
}
|
||||
|
||||
} else {
|
||||
OutPickSubmit oldOutPickSubmit = outPickSubmits.get(0);
|
||||
oldOutPickSubmit.setQuantity(Convert.toBigDecimal(oldOutPickSubmit.getQuantity()).add(Convert.toBigDecimal(mydoJobDetail.getPickQuantity())).toString());
|
||||
outPickSubmitService.updateOutPickSubmit(oldOutPickSubmit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
//@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult checkMakeSure(TrayCodeMakeSure trayCodeMakeSure) {
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTrayCode(trayCodeMakeSure.getTrayCode());
|
||||
|
||||
String trayCode = trayCodeMakeSure.getTrayCode();
|
||||
String[] split = trayCode.split(" ");
|
||||
String productId = split[8].substring(10);
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setExitId(trayCodeMakeSure.getExitId());
|
||||
mydoJob.setProductId(productId);
|
||||
mydoJob.setStatus("3");
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailListByExit(mydoJob);
|
||||
|
||||
// MydoJob mydoJob = mydoJobService.selectMydoJobByTrayCode(trayCodeMakeSure.getTrayCode());
|
||||
if (mydoJob == null) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message"));
|
||||
}
|
||||
@@ -470,395 +142,5 @@ public class PdaServiceImp implements PdaService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电子标签数量
|
||||
*
|
||||
* @param mydoJobDetail
|
||||
*/
|
||||
private void updateTagTaskStatus(MydoJobDetail mydoJobDetail) {
|
||||
|
||||
//修改电子标签任务
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电子标签
|
||||
*
|
||||
* @param trayCodeMakeSure
|
||||
* @param basWarehouse
|
||||
*/
|
||||
private void deleteTagTask(TrayCodeMakeSure trayCodeMakeSure, BasWarehouse basWarehouse, MydoJob mydoJob) {
|
||||
if ("2".equals(basWarehouse.getWarehouseType()) && "23".equals(mydoJob.getInOrOut())) {
|
||||
BasTag basTag = basTagService.selectBasTagByTrayCode(trayCodeMakeSure.getTrayCode());
|
||||
basTag.setTrayCode("");
|
||||
basTagService.updateBasTag(basTag);
|
||||
//删除电子标签
|
||||
TagTask param = new TagTask();
|
||||
param.setTagId(basTag.getId());
|
||||
List<TagTask> tagTasks = tagTaskService.selectTagTaskList(param);
|
||||
if (CollUtil.isNotEmpty(tagTasks)) {
|
||||
tagTaskService.deleteTagTaskByIds(tagTasks.stream()
|
||||
.map(TagTask::getId)
|
||||
.toArray(Long[]::new));
|
||||
}
|
||||
if (mydoJob.getExitId().startsWith("fluent")) {
|
||||
//通知wcs出库确认成功
|
||||
HashMap<String, String> outMydojobMakeSureParam = new HashMap<>();
|
||||
outMydojobMakeSureParam.put("trayCode", trayCodeMakeSure.getTrayCode());
|
||||
AjaxResult ajaxResult = iToWcsService.outMydojobMakeSure(outMydojobMakeSureParam);
|
||||
if (!ajaxResult.isSuccess()) {
|
||||
throw new RuntimeException(ajaxResult.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult outException(TrayCodeMakeSure trayCodeMakeSure) {
|
||||
//判断任务是否存在
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setTrayCode(trayCodeMakeSure.getTrayCode());
|
||||
List<MydoJob> mydoJobList = mydoJobService.selectMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isEmpty(mydoJobList)) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message"));
|
||||
}
|
||||
List<MydoJobDetail> pickInfoList = trayCodeMakeSure.getMaterialDetails();
|
||||
|
||||
MydoJob mydoJob = mydoJobList.get(0);
|
||||
|
||||
//判断拣选数量
|
||||
MydoJobDetail param = new MydoJobDetail();
|
||||
param.setJobId(mydoJob.getJobId());
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(param);
|
||||
|
||||
BasWarehouse basWarehouse = basWarehouseService.selectBasWarehouseByWarehouseId(mydoJob.getWarehouseId());
|
||||
|
||||
String stockOutId = "";
|
||||
|
||||
for (MydoJobDetail mydoJobDetail : mydoJobDetails) {
|
||||
//修改拣选数量
|
||||
Optional<MydoJobDetail> first = pickInfoList.stream().filter(x -> x.getJobDetailId().equals(mydoJobDetail.getJobDetailId())).findFirst();
|
||||
if (first.isPresent()) {
|
||||
mydoJobDetail.setPickQuantity(first.get().getPickQuantity());
|
||||
mydoJobDetailService.updateMydoJobDetail(mydoJobDetail);
|
||||
}
|
||||
|
||||
//修改单据实际分配数量
|
||||
BigDecimal pickQuantity = Convert.toBigDecimal(mydoJobDetail.getPickQuantity());
|
||||
BigDecimal outQuantity = Convert.toBigDecimal(mydoJobDetail.getOutQuantity());
|
||||
BigDecimal subQuantity = outQuantity.subtract(pickQuantity);
|
||||
//修改分配数量为 当前分配数量-缺失数量
|
||||
OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByStockoutDetailId(mydoJobDetail.getInOrOutDId());
|
||||
outStockoutDetail.setAllotQuantity(outStockoutDetail.getAllotQuantity().subtract(subQuantity));
|
||||
stockOutId = outStockoutDetail.getStockoutId();
|
||||
outStockoutDetailService.updateOutStockoutDetail(outStockoutDetail);
|
||||
|
||||
//修改库存的实际出库数量
|
||||
BasStock basStock = basStockService.selectBasStockByStockId(mydoJobDetail.getStockId());
|
||||
basStock.setOutQuantity(String.valueOf(pickQuantity));
|
||||
basStockService.updateBasStock(basStock);
|
||||
|
||||
//修改电子标签
|
||||
if ("2".equals(basWarehouse.getWarehouseType())){
|
||||
updateTagTaskStatus(mydoJobDetail);
|
||||
}
|
||||
|
||||
//将数据存入中间表
|
||||
insertPickSubmitData(mydoJob, mydoJobDetail);
|
||||
}
|
||||
//生成回流任务,标记productStatus为异常状态
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", trayCodeMakeSure.getTrayCode());
|
||||
map.put("v_type", "1");
|
||||
pdaMapper.outMakeSureException(map);
|
||||
iToWcsService.pushInMydoJob();
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
//删除电子标签信息
|
||||
deleteTagTask(trayCodeMakeSure, basWarehouse, mydoJob);
|
||||
//自动分配
|
||||
return outStockoutService.autoAllot(stockOutId);
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult pkIn(TrayCodeMsg trayCodeMsg) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_stockin_detail_id", trayCodeMsg.getStockinDetailId());
|
||||
map.put("v_in_quantity", Integer.parseInt(trayCodeMsg.getInQuantity()));
|
||||
|
||||
pdaMapper.pkIn(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
//return AjaxResult.warn(map.get("v_resultmsg").toString());
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult pkout(TrayCodeMsg trayCodeMsg) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_stockout_detail_id", trayCodeMsg.getStockinDetailId());
|
||||
pdaMapper.pkOut(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if ("10".equals(result)) {
|
||||
return AjaxResult.success(map.get("v_resultmsg").toString());
|
||||
} else {
|
||||
throw new RuntimeException(map.get("v_resultmsg").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult agvRequest(BasContainer basContainer) {
|
||||
//缓存站点
|
||||
String endPoint = "456";
|
||||
//判断details中的数量是否都为0
|
||||
if (CollUtil.isNotEmpty(basContainer.getDetails())) {
|
||||
for (BasContainerDetails detail : basContainer.getDetails()) {
|
||||
//如果存在数量不为0的
|
||||
if (detail.getQuantity() != 0) {
|
||||
|
||||
if (StrUtil.isEmpty(basContainer.getSpare1())) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message9"));
|
||||
}
|
||||
//去ctu库站点
|
||||
BasProductPort basProductPort = new BasProductPort();
|
||||
basProductPort.setWarehouseId(basContainer.getSpare1());
|
||||
List<BasProductPort> basProductPorts = basProductPortMapper.selectBasProductPortList(basProductPort);
|
||||
endPoint = basProductPorts.get(0).getId();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//通过料架查找站点
|
||||
BasContainer basContainer1 = basContainerService.selectBasContainerByContainerId(basContainer.getContainerId());
|
||||
String startPoint = basContainer1.getPortName();
|
||||
//todo 调用agv搬运接口
|
||||
//使用HttpUtil post请求,参数为startPoint,endPoint,和containerCode
|
||||
return agvRequest(basContainer.getContainerId(), startPoint, endPoint);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private @NotNull AjaxResult agvRequest(String containerId, String startPoint, String endPoint) {
|
||||
String taskNo = IdUtil.fastSimpleUUID();
|
||||
AgvMoveParam agvMoveParam =new AgvMoveParam();
|
||||
agvMoveParam.setStartPoint(startPoint);
|
||||
agvMoveParam.setEndPoint(endPoint);
|
||||
agvMoveParam.setContainerCode(containerId);
|
||||
agvMoveParam.setTaskNo(taskNo);
|
||||
String result = HttpUtil.post("http://192.168.1.100:8080/agv/api/receiveAgvMoveJob", JSONUtil.toJsonStr( agvMoveParam));
|
||||
//接口的返回结果为AjaxResult,从result中获取code
|
||||
//获取code
|
||||
int code = JSONObject.parseObject(result).getIntValue("code");
|
||||
if (code == 200) {
|
||||
AgvContainerTask agvContainerTask = new AgvContainerTask();
|
||||
agvContainerTask.setContainer(containerId);
|
||||
agvContainerTask.setStartPoint(startPoint);
|
||||
agvContainerTask.setEndPoint(endPoint);
|
||||
agvContainerTask.setStatus("0");
|
||||
agvContainerTask.setTaskNo(taskNo);
|
||||
agvContainerTask.setCreateTime(new Date());
|
||||
agvContainerTaskService.insertAgvContainerTask(agvContainerTask);
|
||||
return AjaxResult.success(result);
|
||||
} else {
|
||||
return AjaxResult.warn(JSONObject.parseObject(result).getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> cargoSpaceAnalysis(String warehouseId) {
|
||||
BasCargoSpace queryParams = new BasCargoSpace();
|
||||
queryParams.setWarehouseId(warehouseId);
|
||||
List<BasCargoSpace> list = basCargoSpaceService.selectBasCargoSpaceList(queryParams);
|
||||
|
||||
// 初始化所有可能的状态,默认值为0
|
||||
Map<String, Integer> statusCount = new LinkedHashMap<>();
|
||||
statusCount.put("空货位", 0);
|
||||
statusCount.put("满货位", 0);
|
||||
statusCount.put("入库分配", 0);
|
||||
statusCount.put("出库分配", 0);
|
||||
statusCount.put("入库需盘点", 0);
|
||||
statusCount.put("出库需盘点", 0);
|
||||
|
||||
// 统计实际存在的状态数量
|
||||
for (BasCargoSpace space : list) {
|
||||
if (space.getStatus() != null) {
|
||||
String statusName;
|
||||
switch (Integer.parseInt(space.getStatus())) {
|
||||
case 1:
|
||||
statusName = "空货位";
|
||||
break;
|
||||
case 2:
|
||||
statusName = "满货位";
|
||||
break;
|
||||
case 3:
|
||||
statusName = "入库分配";
|
||||
break;
|
||||
case 4:
|
||||
statusName = "出库分配";
|
||||
break;
|
||||
case 5:
|
||||
statusName = "入库需盘点";
|
||||
break;
|
||||
case 6:
|
||||
statusName = "出库需盘点";
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
statusCount.put(statusName, statusCount.getOrDefault(statusName, 0) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 转换为要求的格式
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (Map.Entry<String, Integer> entry : statusCount.entrySet()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("name", entry.getKey());
|
||||
item.put("value", entry.getValue());
|
||||
result.add(item);
|
||||
}
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("data", result);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAisleStatisticsData(String warehouseId) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setWarehouseId(warehouseId);
|
||||
mydoJob.setInOut("1");
|
||||
List<MydoJob> mydoJobs = mydoJobFinishMapper.selectMydoJobFinishListByMydoJob(mydoJob);
|
||||
|
||||
MydoJob mydoJob1 = new MydoJob();
|
||||
mydoJob1.setWarehouseId(warehouseId);
|
||||
mydoJob1.setInOut("2");
|
||||
List<MydoJob> mydoJobs1 = mydoJobFinishMapper.selectMydoJobFinishListByMydoJob(mydoJob1);
|
||||
|
||||
map.put("in", mydoJobs.size());
|
||||
map.put("out", mydoJobs1.size());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult bindContainer(TrayCodeMakeSure trayCodeMakeSure) {
|
||||
if (CollUtil.isEmpty(trayCodeMakeSure.getMydoJobDetailList())) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message10"));
|
||||
}
|
||||
if (StrUtil.isEmpty(trayCodeMakeSure.getContainerCode())) {
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message11"));
|
||||
}
|
||||
for (MydoJobDetail mydoJobDetail : trayCodeMakeSure.getMydoJobDetailList()) {
|
||||
//绑定容器
|
||||
BasContainerDetails basContainerDetailsParam = new BasContainerDetails();
|
||||
basContainerDetailsParam.setContainerId(trayCodeMakeSure.getContainerCode());
|
||||
basContainerDetailsParam.setProductId(mydoJobDetail.getProductId());
|
||||
List<BasContainerDetails> basContainerDetails = basContainerDetailsService.selectBasContainerDetailsList(basContainerDetailsParam);
|
||||
if (CollUtil.isNotEmpty(basContainerDetails)) {
|
||||
BasContainerDetails oldBasContainerDetails = basContainerDetails.get(0);
|
||||
oldBasContainerDetails.setQuantity(oldBasContainerDetails.getQuantity() + Convert.toLong(mydoJobDetail.getPickBindQuantity()));
|
||||
basContainerDetailsService.updateBasContainerDetails(oldBasContainerDetails);
|
||||
} else {
|
||||
BasContainerDetails newBasContainerDetails = new BasContainerDetails();
|
||||
newBasContainerDetails.setContainerId(trayCodeMakeSure.getContainerCode());
|
||||
newBasContainerDetails.setProductId(mydoJobDetail.getProductId());
|
||||
newBasContainerDetails.setQuantity(Convert.toLong(mydoJobDetail.getPickBindQuantity()));
|
||||
basContainerDetailsService.insertBasContainerDetails(newBasContainerDetails);
|
||||
}
|
||||
//减少中间表数量
|
||||
OutPickSubmit outPickSubmitParam = new OutPickSubmit();
|
||||
outPickSubmitParam.setWarehouseId(trayCodeMakeSure.getWarehouseId());
|
||||
outPickSubmitParam.setExitId(trayCodeMakeSure.getExitId());
|
||||
outPickSubmitParam.setProductId(mydoJobDetail.getProductId());
|
||||
List<OutPickSubmit> outPickSubmits = outPickSubmitService.selectOutPickSubmitList(outPickSubmitParam);
|
||||
for (OutPickSubmit outPickSubmit : outPickSubmits) {
|
||||
BigDecimal subtract = Convert.toBigDecimal(outPickSubmit.getQuantity()).subtract(Convert.toBigDecimal(mydoJobDetail.getPickBindQuantity()));
|
||||
if (subtract.compareTo(BigDecimal.ZERO) == 0) {
|
||||
//删除缓存信息
|
||||
outPickSubmitService.deleteOutPickSubmitById(outPickSubmit.getId());
|
||||
} else if (subtract.compareTo(BigDecimal.ZERO) < 0) {
|
||||
|
||||
return AjaxResult.warn(MessageUtils.message("warn.message12"));
|
||||
} else {
|
||||
outPickSubmit.setQuantity(subtract.toString());
|
||||
outPickSubmitService.updateOutPickSubmit(outPickSubmit);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult bindShelf(TrayCodeMakeSure trayCodeMakeSure) {
|
||||
BasContainerDetails basContainerDetails = new BasContainerDetails();
|
||||
basContainerDetails.setContainerId(trayCodeMakeSure.getContainerCode());
|
||||
for (MydoJobDetail mydoJobDetail : trayCodeMakeSure.getMydoJobDetailList()) {
|
||||
basContainerDetails.setProductId(mydoJobDetail.getProductId());
|
||||
List<BasContainerDetails> basContainerDetailsList = basContainerDetailsService.selectBasContainerDetailsList(basContainerDetails);
|
||||
if (basContainerDetailsList.isEmpty()) {
|
||||
basContainerDetails.setProductName(mydoJobDetail.getExtraField().getMaterialDesc());
|
||||
basContainerDetails.setQuantity(Convert.toLong(mydoJobDetail.getPickBindQuantity()));
|
||||
basContainerDetailsService.insertBasContainerDetails(basContainerDetails);
|
||||
} else {
|
||||
basContainerDetails.setId(basContainerDetailsList.get(0).getId());
|
||||
basContainerDetails.setQuantity(basContainerDetailsList.get(0).getQuantity() + Convert.toLong(mydoJobDetail.getPickBindQuantity()));
|
||||
basContainerDetailsService.updateBasContainerDetails(basContainerDetails);
|
||||
}
|
||||
|
||||
|
||||
OutPickSubmit outPickSubmitParam = new OutPickSubmit();
|
||||
outPickSubmitParam.setWarehouseId(trayCodeMakeSure.getWarehouseId());
|
||||
outPickSubmitParam.setExitId(trayCodeMakeSure.getExitId());
|
||||
outPickSubmitParam.setProductId(mydoJobDetail.getProductId());
|
||||
List<OutPickSubmit> outPickSubmits = outPickSubmitService.selectOutPickSubmitList(outPickSubmitParam);
|
||||
if (Integer.parseInt(outPickSubmits.get(0).getQuantity()) > Integer.parseInt(mydoJobDetail.getPickBindQuantity())) {
|
||||
outPickSubmitParam.setQuantity(String.valueOf(Integer.parseInt(outPickSubmits.get(0).getQuantity()) - Integer.parseInt(mydoJobDetail.getPickBindQuantity())));
|
||||
outPickSubmitParam.setId(outPickSubmits.get(0).getId());
|
||||
outPickSubmitService.updateOutPickSubmit(outPickSubmitParam);
|
||||
} else {
|
||||
outPickSubmitService.deleteOutPickSubmitById(outPickSubmits.get(0).getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult movePoint(String startPoint, String endPoint) {
|
||||
BasContainerDetails basContainerDetails = new BasContainerDetails();
|
||||
basContainerDetails.setContainerId(startPoint);
|
||||
List<BasContainerDetails> basContainerDetails1 = basContainerDetailsService.selectBasContainerDetailsList(basContainerDetails);
|
||||
if (basContainerDetails1.isEmpty()) {
|
||||
return AjaxResult.error(MessageUtils.message("error.message31"));
|
||||
}
|
||||
BasContainerDetails basContainer = basContainerDetails1.get(0);
|
||||
return agvRequest(basContainer.getContainerId(), startPoint, endPoint);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="spec" column="spec" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="trayCode" column="tray_code" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectMydoJobDetailList" parameterType="MydoJobDetail" resultMap="MydoJobDetailResult">
|
||||
@@ -324,4 +325,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<delete id="deleteMydoJobDetailByJobId">
|
||||
delete from mydo_job_detail where job_id = #{jobId}
|
||||
</delete>
|
||||
|
||||
<select id="selectMydoJobDetailListByExit" parameterType="MydoJob" resultMap="MydoJobDetailResult">
|
||||
select mjd.job_detail_id,
|
||||
mjd.job_id,
|
||||
mjd.stock_id,
|
||||
mjd.lot_no,
|
||||
mjd.in_date,
|
||||
mjd.in_or_out_id,
|
||||
mjd.in_or_out_d_id,
|
||||
mjd.product_guid,
|
||||
mjd.product_id,
|
||||
mjd.stock_status,
|
||||
mjd.in_quantity,
|
||||
mjd.stock_quantity,
|
||||
mjd.out_quantity,
|
||||
mjd.layer_quantity,
|
||||
mjd.out_layer_quantity,
|
||||
mjd.give_num,
|
||||
mjd.stockin_id,
|
||||
mjd.stacking_id,
|
||||
mjd.exit_id,
|
||||
mjd.print_date,
|
||||
mjd.customer_id,
|
||||
mjd.supplier_id,
|
||||
mjd.spare1,
|
||||
mjd.spare2,
|
||||
mjd.spare3,
|
||||
mjd.spare4,
|
||||
mjd.pick_quantity,
|
||||
mjd.out_quantity-mjd.pick_quantity as pick_quantity_real,
|
||||
bp.product_name,
|
||||
mjd.spare5,
|
||||
mjd.spare6,
|
||||
mjd.spare7,
|
||||
mjd.spare8,
|
||||
mjd.spare9,
|
||||
mjd.spec,
|
||||
mjd.unit,
|
||||
mj.tray_code
|
||||
|
||||
from mydo_job_detail mjd
|
||||
left join bas_product bp on mjd.product_id = bp.product_id
|
||||
left join mydo_job mj on mjd.job_id = mj.job_id
|
||||
where mj.exit_id=#{exitId}
|
||||
and mj.status='3'
|
||||
and mjd.product_id=#{productId}
|
||||
and mj.in_or_out>=20
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
<?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>
|
||||
@@ -6,7 +6,6 @@
|
||||
<select id="outMakeSure" parameterType="java.util.Map" statementType="CALLABLE">
|
||||
{call proc_out_makesure(
|
||||
#{v_tray_code,mode=IN,jdbcType=VARCHAR},
|
||||
#{v_type,mode=IN,jdbcType=VARCHAR},
|
||||
#{v_result,mode=OUT,jdbcType=INTEGER},
|
||||
#{v_resultmsg,mode=OUT,jdbcType=VARCHAR}
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user