出库回流功能

This commit is contained in:
liuhanqing
2026-01-21 17:37:11 +08:00
parent f4d5e2c714
commit a39c82faa6
8 changed files with 98 additions and 66 deletions

View File

@@ -71,8 +71,11 @@ public class ToWcsServiceImpl implements IToWcsService {
//查询所有未推送的料箱出库作业
MydoJob mydoJobParam = new MydoJob();
List<String> list = new ArrayList<>();
list.add("20");
list.add("21");
list.add("22");
list.add("23");
list.add("24");
list.add("26");
mydoJobParam.setInOutIds(list);
MydoJob mydoJobParam1 = new MydoJob();
@@ -281,7 +284,7 @@ public class ToWcsServiceImpl implements IToWcsService {
MydoJob outJob = outMydoJobs.get(0);
outJob.setExecutionPhase("2");
mydoJobService.updateMydoJob(outJob);
if (outJob.getInOrOut().equals("23")){
if ("24".equals(outJob.getInOrOut())){
String[] jobIds = new String[]{outJob.getJobId()};
mydoJobService.OuthandFinish(jobIds);
}

View File

@@ -67,9 +67,9 @@ public class OutMydoJobController extends BaseController {
@PreAuthorize("@ss.hasPermi('job:outmydoJob:pointOut')")
@Log(title = "指定货位出库", businessType = BusinessType.INSERT)
@RequestMapping("/pointOut")
public AjaxResult pointOut(@RequestParam("stockIds")String[] stockIds,@RequestParam("exitId")String exitId)
public AjaxResult pointOut(@RequestParam("stockIds")String[] stockIds,@RequestParam("exitId")String exitId,@RequestParam("type")String type)
{
return mydoJobService.pointOut(stockIds,exitId);
return mydoJobService.pointOut(stockIds,exitId,type);
}

View File

@@ -97,7 +97,7 @@ public interface IMydoJobService
* @param exitId
* @return
*/
AjaxResult pointOut(String [] stockIds,String exitId);
AjaxResult pointOut(String [] stockIds,String exitId,String type);
/**
* 通过托盘码查询

View File

@@ -15,7 +15,6 @@ import com.ruoyi.check.difference.domain.CheckDifferenceRecord;
import com.ruoyi.check.difference.service.ICheckDifferenceRecordService;
import com.ruoyi.check.stockcheckdetail.domain.CheckStockinDetail;
import com.ruoyi.check.stockcheckdetail.service.ICheckStockinDetailService;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.model.LoginUser;
@@ -38,7 +37,6 @@ import com.ruoyi.stock.stock.service.IBasStockService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
@@ -574,13 +572,14 @@ public class MydoJobServiceImpl implements IMydoJobService {
}
@Override
public AjaxResult pointOut(String[] stockIds, String exitId) {
public AjaxResult pointOut(String[] stockIds, String exitId,String type) {
HashMap<String, Object> map = new HashMap<>();
String msg = "";
String Stringbuilder = "";
for (String stockId : stockIds) {
map.put("v_stock_id", stockId);
map.put("v_exit_id", exitId);
map.put("v_type", type);
mydoJobMapper.pointOut(map);
//iToWcsService.pushOutMydoJob();
String result = map.get("v_result").toString();

View File

@@ -1,12 +1,10 @@
package com.ruoyi.out.outStockout.service.impl;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.api.service.IToWcsService;
import com.ruoyi.bas.basJobId.service.IBasJobIdService;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.out.outStockout.domain.OutStockout;
@@ -16,6 +14,7 @@ import com.ruoyi.out.outStockout.service.IOutStockoutService;
import com.ruoyi.out.outStockoutDetail.domain.OutStockoutDetail;
import com.ruoyi.out.outStockoutDetail.mapper.OutStockoutDetailMapper;
import com.ruoyi.out.outStockoutDetail.service.IOutStockoutDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
@@ -34,8 +33,8 @@ import java.util.List;
* @date 2025-05-20
*/
@Service
public class OutStockoutServiceImpl implements IOutStockoutService
{
@Slf4j
public class OutStockoutServiceImpl implements IOutStockoutService {
@Autowired
private OutStockoutMapper outStockoutMapper;
@Autowired
@@ -55,8 +54,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
* @return 出库主单
*/
@Override
public OutStockout selectOutStockoutByStockoutGuid(String stockoutGuid)
{
public OutStockout selectOutStockoutByStockoutGuid(String stockoutGuid) {
return outStockoutMapper.selectOutStockoutByStockoutGuid(stockoutGuid);
}
@@ -67,8 +65,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
* @return 出库主单
*/
@Override
public List<OutStockout> selectOutStockoutList(OutStockout outStockout)
{
public List<OutStockout> selectOutStockoutList(OutStockout outStockout) {
/*if (!"admin".equals(SecurityUtils.getUsername())){
outStockout.setDepartmentNo(Convert.toStr(SecurityUtils.getDeptId()));
}*/
@@ -82,8 +79,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
* @return 结果
*/
@Override
public int insertOutStockout(OutStockout outStockout)
{
public int insertOutStockout(OutStockout outStockout) {
return outStockoutMapper.insertOutStockout(outStockout);
}
@@ -94,8 +90,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
* @return 结果
*/
@Override
public int updateOutStockout(OutStockout outStockout)
{
public int updateOutStockout(OutStockout outStockout) {
return outStockoutMapper.updateOutStockout(outStockout);
}
@@ -106,8 +101,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
* @return 结果
*/
@Override
public int deleteOutStockoutByStockoutGuids(String[] stockoutGuids)
{
public int deleteOutStockoutByStockoutGuids(String[] stockoutGuids) {
return outStockoutMapper.deleteOutStockoutByStockoutGuids(stockoutGuids);
}
@@ -118,49 +112,62 @@ public class OutStockoutServiceImpl implements IOutStockoutService
* @return 结果
*/
@Override
public int deleteOutStockoutByStockoutGuid(String stockoutGuid)
{
public int deleteOutStockoutByStockoutGuid(String stockoutGuid) {
return outStockoutMapper.deleteOutStockoutByStockoutGuid(stockoutGuid);
}
@Override
@Transactional(rollbackFor = Exception.class)
public String saveBill(OutStockoutVo outStockoutVo) {
OutStockout outStockout = outStockoutVo.getOutStockout();
List<OutStockoutDetail> detailList = outStockoutVo.getDetailList();
String stockOutId = basJobIdService.getJobId("CKD");
outStockout.setStockoutId(stockOutId);
outStockout.setStockoutGuid(UUID.randomUUID().toString());
outStockout.setCreateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
String username = SecurityContextHolder.getContext().getAuthentication().getName();
outStockout.setCreateManId(username);
outStockout.setStatus("1");
outStockout.setStockoutSource(outStockoutVo.getOutStockout().getStockoutSource());
outStockout.setDepartmentNo(SecurityUtils.getDeptId().toString());
// outStockout.setWarehouseId("01");
for (int i = 0; i < detailList.size(); i++) {
OutStockoutDetail outStockoutDetail = detailList.get(i);
outStockoutDetail.setStockoutDetailId(stockOutId + "-" + (i + 1));
outStockoutDetail.setStockoutGuid(outStockout.getStockoutGuid());
outStockoutDetail.setStockoutId(stockOutId);
outStockoutDetail.setAllotQuantity(BigDecimal.ZERO);
outStockoutDetail.setAssignNum(BigDecimal.ZERO);
outStockoutDetailMapper.insertOutStockoutDetail(outStockoutDetail);
OutStockout outStockout = outStockoutVo.getOutStockout();
List<OutStockoutDetail> detailList = outStockoutVo.getDetailList();
String stockOutId = basJobIdService.getJobId("CKD");
outStockout.setStockoutId(stockOutId);
outStockout.setStockoutGuid(UUID.randomUUID().toString());
outStockout.setCreateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
String username = SecurityContextHolder.getContext().getAuthentication().getName();
outStockout.setCreateManId(username);
outStockout.setStatus("1");
outStockout.setStockoutSource(outStockoutVo.getOutStockout().getStockoutSource());
try {
if ("1".equals(outStockoutVo.getOutStockout().getStockoutSource())) {
outStockout.setCreateManId(com.ruoyi.common.core.text.Convert.toStr(SecurityUtils.getUserId()));
outStockout.setDepartmentNo(Convert.toStr(SecurityUtils.getDeptId()));
} else if ("2".equals(outStockoutVo.getOutStockout().getStockoutSource())) {
outStockout.setCreateManId("1");
outStockout.setDepartmentNo("103");
} else if ("3".equals(outStockoutVo.getOutStockout().getStockoutSource())) {
outStockout.setCreateManId("1");
outStockout.setDepartmentNo("104");
}
outStockoutMapper.insertOutStockout(outStockout);
} catch (Exception e) {
log.error("入库单保存异常,无用户信息");
}
// outStockout.setWarehouseId("01");
for (int i = 0; i < detailList.size(); i++) {
OutStockoutDetail outStockoutDetail = detailList.get(i);
outStockoutDetail.setStockoutDetailId(stockOutId + "-" + (i + 1));
outStockoutDetail.setStockoutGuid(outStockout.getStockoutGuid());
outStockoutDetail.setStockoutId(stockOutId);
outStockoutDetail.setAllotQuantity(BigDecimal.ZERO);
outStockoutDetail.setAssignNum(BigDecimal.ZERO);
outStockoutDetailMapper.insertOutStockoutDetail(outStockoutDetail);
}
outStockoutMapper.insertOutStockout(outStockout);
return stockOutId;
}
@Override
public String updateOutStockoutStatus(String[] stockoutIds, String status, String newStatus,String exitId) {
public String updateOutStockoutStatus(String[] stockoutIds, String status, String newStatus, String exitId) {
HashMap<String, String> map = new HashMap<>();
StringBuilder stringBuilder = new StringBuilder();
for(String stockoutId:stockoutIds){
map.put("outStockId",stockoutId);
map.put("status",status);
map.put("newStatus",newStatus);
map.put("exitId",exitId);
for (String stockoutId : stockoutIds) {
map.put("outStockId", stockoutId);
map.put("status", status);
map.put("newStatus", newStatus);
map.put("exitId", exitId);
outStockoutMapper.updateOutStockoutStatus(map);
stringBuilder.append(",").append(map.get("v_resultString"));
}
@@ -171,10 +178,10 @@ public class OutStockoutServiceImpl implements IOutStockoutService
public AjaxResult autoAllot(String stockoutId) {
OutStockout outStockout = outStockoutMapper.selectOutStockoutByStockoutId(stockoutId);
if (outStockout == null){
if (outStockout == null) {
return AjaxResult.warn("单据不存在,请检查!");
}
if ("1".equals(outStockout.getStatus())){
if ("1".equals(outStockout.getStatus())) {
return AjaxResult.warn("单据未审核,请审核无误后再分配!");
}
@@ -184,16 +191,16 @@ public class OutStockoutServiceImpl implements IOutStockoutService
outStockoutDetail.setStockoutId(stockoutId);
List<OutStockoutDetail> outStockoutDetails = outStockoutDetailService.selectOutStockoutDetailList(outStockoutDetail);
for (OutStockoutDetail detail : outStockoutDetails) {
if (detail.getAllotQuantity().compareTo(detail.getQuantity()) < 0){
map.put("v_stockout_detail_id", detail.getStockoutDetailId());
if (detail.getAllotQuantity().compareTo(detail.getQuantity()) < 0) {
map.put("v_stockout_detail_id", detail.getStockoutDetailId());
outStockoutMapper.autoAllot(map);
toWcsService.pushOutMydoJob();
if (!"10".equals(map.get("v_result"))){
if (!"10".equals(map.get("v_result"))) {
stringBuilder.append(",").append(map.get("v_resultString"));
}
}
}
if (!StrUtil.isEmpty(stringBuilder.toString())){
if (!StrUtil.isEmpty(stringBuilder.toString())) {
return AjaxResult.warn(stringBuilder.toString());
}
return AjaxResult.success();
@@ -213,11 +220,11 @@ public class OutStockoutServiceImpl implements IOutStockoutService
map.put("v_stock_id", stock);
outStockoutMapper.manualAllot(map);
toWcsService.pushOutMydoJob();
if (!"10".equals(map.get("v_result"))){
if (!"10".equals(map.get("v_result"))) {
stringBuilder.append(",").append(map.get("v_resultString"));
}
}
if (!StrUtil.isEmpty(stringBuilder.toString())){
if (!StrUtil.isEmpty(stringBuilder.toString())) {
return AjaxResult.warn(stringBuilder.toString());
}
return AjaxResult.success();

View File

@@ -221,6 +221,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
{call proc_point_out(
#{v_stock_id,jdbcType=VARCHAR,mode=IN},
#{v_exit_id,jdbcType=VARCHAR,mode=IN},
#{v_type,jdbcType=VARCHAR,mode=IN},
#{v_result,mode=OUT,jdbcType=INTEGER},
#{v_resultmsg,mode=OUT,jdbcType=VARCHAR}
)}

View File

@@ -35,13 +35,14 @@ export function hangInvalidCheckJob(data) {
})
}
export function pointOut(stockIds,exitId) {
export function pointOut(stockIds,exitId,type) {
return request({
url: '/job/outmydoJob/pointOut',
method: 'get',
params: {
stockIds: stockIds.join(',') ,// 将数组转换为逗号分隔的字符串
exitId:exitId
exitId:exitId,
type:type
}
})
}

View File

@@ -91,6 +91,16 @@
v-hasPermi="['job:outmydoJob:pointOut']"
>指定货位出库 <!-- 指定货位出库 --></el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="pointOut1"
v-hasPermi="['job:outmydoJob:pointOut']"
>出来看看 <!-- 指定货位出库 --></el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -298,7 +308,9 @@ export default {
],
// 选中的库存数据
selectedStockData: []
selectedStockData: [],
// 当前操作类型 1:指定货位出库 2:出来看看
currentOperationType: '1'
}
},
created() {
@@ -421,6 +433,15 @@ export default {
},
/** 指定货位出库按钮操作 */
pointOut() {
this.handlePointOutOperation('1');
},
/** 出来看看按钮操作 */
pointOut1() {
this.handlePointOutOperation('2');
},
handlePointOutOperation(type) {
this.currentOperationType = type;
if (this.ids.length === 0) {
this.$modal.msgError("请至少选择一行数据");
return;
@@ -435,7 +456,7 @@ export default {
if (all02) {
this.exitDialogVisible = false
this.exitForm.exitId = '1'
this.doPointOut('1')
this.doPointOut('1', type)
return
}
this.exitDialogVisible = true
@@ -447,13 +468,13 @@ export default {
submitPointOut() {
this.$refs["exitForm"].validate(valid => {
if (valid) {
this.doPointOut(this.exitForm.exitId)
this.doPointOut(this.exitForm.exitId, this.currentOperationType)
}
})
},
doPointOut(exitId) {
doPointOut(exitId, type) {
const stockIds = this.ids
pointOut(stockIds, exitId).then(response => {
pointOut(stockIds, exitId, type).then(response => {
this.$modal.msgSuccess(response.msg);
this.getList();
this.exitDialogVisible = false;