diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/controller/OutStockoutController.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/controller/OutStockoutController.java index 9c0b695..351390e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/controller/OutStockoutController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/controller/OutStockoutController.java @@ -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); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/mapper/OutStockoutMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/mapper/OutStockoutMapper.java index 0358171..f7a988e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/mapper/OutStockoutMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/mapper/OutStockoutMapper.java @@ -61,4 +61,6 @@ public interface OutStockoutMapper public int deleteOutStockoutByStockoutGuids(String[] stockoutGuids); public void updateOutStockoutStatus(HashMap map); + + void autoAllot(HashMap map); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/IOutStockoutService.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/IOutStockoutService.java index 7f2404b..bf34476 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/IOutStockoutService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/IOutStockoutService.java @@ -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); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImpl.java index bdccf8c..c4e6adf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/out/outStockout/service/impl/OutStockoutServiceImpl.java @@ -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 map = new HashMap<>(); + StringBuilder stringBuilder = new StringBuilder(); + OutStockoutDetail outStockoutDetail = new OutStockoutDetail(); + outStockoutDetail.setStockoutId(stockoutId); + List 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(); + } } diff --git a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml index 7e93c88..de45087 100644 --- a/ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join bas_customer bc on bc.customer_no = o.customer_no left join out_stockout_detail d on d.stockout_id = o.stockout_id left join bas_product bp on bp.product_id = d.product_id - + and o.stockout_guid = #{stockoutGuid} and o.stockout_id = #{stockoutId} and o.out_type = #{outType} @@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bc.customer_name like concat('%', #{customerName}, '%') - + - \ No newline at end of file + + diff --git a/ruoyi-ui/src/api/out/outStockout.js b/ruoyi-ui/src/api/out/outStockout.js index 62cd2e6..3713653 100644 --- a/ruoyi-ui/src/api/out/outStockout.js +++ b/ruoyi-ui/src/api/out/outStockout.js @@ -56,5 +56,13 @@ export function getOutStockoutDetail(query) { }) } + export function autoAllot(data) { + return request({ + url: '/out/outStockout/autoAllot', + method: 'get', + params: data + }) + } + diff --git a/ruoyi-ui/src/views/out/outStockoutManage.vue b/ruoyi-ui/src/views/out/outStockoutManage.vue index 7e707d1..d1aad87 100644 --- a/ruoyi-ui/src/views/out/outStockoutManage.vue +++ b/ruoyi-ui/src/views/out/outStockoutManage.vue @@ -189,7 +189,7 @@