出库自动分配

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();
}
}

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.out.outStockout.mapper.OutStockoutMapper">
<resultMap type="OutStockout" id="OutStockoutResult">
<result property="stockoutGuid" column="stockout_guid" />
<result property="stockoutId" column="stockout_id" />
@@ -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
<where>
<where>
<if test="stockoutGuid != null and stockoutGuid != ''"> and o.stockout_guid = #{stockoutGuid}</if>
<if test="stockoutId != null and stockoutId != ''"> and o.stockout_id = #{stockoutId}</if>
<if test="outType != null and outType != ''"> and o.out_type = #{outType}</if>
@@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customerName != null and customerName != ''"> and bc.customer_name like concat('%', #{customerName}, '%')</if>
</where>
</select>
<select id="selectOutStockoutByStockoutGuid" parameterType="String" resultMap="OutStockoutResult">
<include refid="selectOutStockoutVo"/>
where stockout_guid = #{stockoutGuid}
@@ -131,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteOutStockoutByStockoutGuids" parameterType="String">
delete from out_stockout where stockout_guid in
delete from out_stockout where stockout_guid in
<foreach item="stockoutGuid" collection="array" open="(" separator="," close=")">
#{stockoutGuid}
</foreach>
@@ -148,4 +148,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
}
</select>
</mapper>
<select id="autoAllot" parameterType="java.util.Map" statementType="CALLABLE">
{
call proc_update_outbill_status(
#{v_stockout_detail_id,mode=IN,jdbcType=VARCHAR},
#{v_result,mode=OUT,jdbcType=VARCHAR},
#{v_resultString,mode=OUT,jdbcType=VARCHAR}
)
}
</select>
</mapper>

View File

@@ -56,5 +56,13 @@ export function getOutStockoutDetail(query) {
})
}
export function autoAllot(data) {
return request({
url: '/out/outStockout/autoAllot',
method: 'get',
params: data
})
}

View File

@@ -189,7 +189,7 @@
</template>
<script>
import { listOutStockout } from "@/api/out/outStockout"
import { listOutStockout,autoAllot } from "@/api/out/outStockout"
import { getOutStockoutDetail,updateOutStockStatus } from "@/api/out/outStockout"
export default {
@@ -319,8 +319,14 @@ export default {
return
}
const stockoutIds = this.selectedRows.map(row => row.stockoutId)
// TODO: 调用自动分配接口
console.log("自动分配:", stockoutIds)
let data = {
stockoutIds: stockoutIds
}
autoAllot(data).then(response => {
this.$modal.msgSuccess(response)
this.getList()
})
},
/** 手动分配按钮操作 */
handleManualAllot() {