出库自动分配

This commit is contained in:
liuhanqing
2025-06-16 16:26:18 +08:00
parent 43797aa35a
commit f54721f937
7 changed files with 75 additions and 15 deletions

View File

@@ -128,4 +128,12 @@ public class OutStockoutController extends BaseController {
String s = outStockoutService.updateOutStockoutStatus(stockoutIds, status, newStatus);
return s;
}
@PreAuthorize("@ss.hasPermi('out:outStockout:autoAllot')")
@Log(title = "出库单自动分配", businessType = BusinessType.OTHER)
@GetMapping("/autoAllot")
@ResponseBody
public AjaxResult autoAllot(@RequestParam("stockoutId") String stockoutId) {
return outStockoutService.autoAllot(stockoutId);
}
}

View File

@@ -61,4 +61,6 @@ public interface OutStockoutMapper
public int deleteOutStockoutByStockoutGuids(String[] stockoutGuids);
public void updateOutStockoutStatus(HashMap<String,String> map);
void autoAllot(HashMap<String, String> map);
}

View File

@@ -1,6 +1,8 @@
package com.ruoyi.out.outStockout.service;
import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.out.outStockout.domain.OutStockout;
import com.ruoyi.out.outStockout.domain.OutStockoutVo;
@@ -65,4 +67,6 @@ public interface IOutStockoutService
public String saveBill(OutStockoutVo outStockoutVo);
public String updateOutStockoutStatus(String[] stockoutIds, String status,String newStatus);
AjaxResult autoAllot(String stockoutId);
}

View File

@@ -7,6 +7,7 @@ import java.util.HashMap;
import java.util.List;
import com.ruoyi.bas.basJobId.service.IBasJobIdService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.out.outStockout.domain.OutStockoutVo;
import com.ruoyi.out.outStockoutDetail.domain.OutStockoutDetail;
@@ -22,12 +23,12 @@ import org.springframework.transaction.annotation.Transactional;
/**
* 出库主单Service业务层处理
*
*
* @author ruoyi
* @date 2025-05-20
*/
@Service
public class OutStockoutServiceImpl implements IOutStockoutService
public class OutStockoutServiceImpl implements IOutStockoutService
{
@Autowired
private OutStockoutMapper outStockoutMapper;
@@ -36,10 +37,12 @@ public class OutStockoutServiceImpl implements IOutStockoutService
@Autowired
private OutStockoutDetailMapper outStockoutDetailMapper;
@Autowired
private IOutStockoutDetailService outStockoutDetailService;
/**
* 查询出库主单
*
*
* @param stockoutGuid 出库主单主键
* @return 出库主单
*/
@@ -51,7 +54,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
/**
* 查询出库主单列表
*
*
* @param outStockout 出库主单
* @return 出库主单
*/
@@ -63,7 +66,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
/**
* 新增出库主单
*
*
* @param outStockout 出库主单
* @return 结果
*/
@@ -75,7 +78,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
/**
* 修改出库主单
*
*
* @param outStockout 出库主单
* @return 结果
*/
@@ -87,7 +90,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
/**
* 批量删除出库主单
*
*
* @param stockoutGuids 需要删除的出库主单主键
* @return 结果
*/
@@ -99,7 +102,7 @@ public class OutStockoutServiceImpl implements IOutStockoutService
/**
* 删除出库主单信息
*
*
* @param stockoutGuid 出库主单主键
* @return 结果
*/
@@ -149,4 +152,24 @@ public class OutStockoutServiceImpl implements IOutStockoutService
}
return stringBuilder.toString();
}
@Override
public AjaxResult autoAllot(String stockoutId) {
HashMap<String, String> map = new HashMap<>();
StringBuilder stringBuilder = new StringBuilder();
OutStockoutDetail outStockoutDetail = new OutStockoutDetail();
outStockoutDetail.setStockoutId(stockoutId);
List<OutStockoutDetail> outStockoutDetails = outStockoutDetailService.selectOutStockoutDetailList(outStockoutDetail);
for (OutStockoutDetail detail : outStockoutDetails) {
map.put("v_stockout_detail_id", detail.getStockoutDetailId());
outStockoutMapper.autoAllot(map);
if (!"10".equals(map.get("v_result"))){
stringBuilder.append(",").append(map.get("v_resultString"));
}
}
if (stringBuilder.length()>0){
return AjaxResult.warn(stringBuilder.toString());
}
return AjaxResult.success();
}
}