fix:订单配备货规则修改、添加已发货产品的虚拟采购单生成数据处理接口

dev_1.0.2
jiangpeng 2026-06-09 01:28:30 +08:00
parent 3b84d8d87c
commit d55fc11e24
8 changed files with 100 additions and 24 deletions

View File

@ -92,7 +92,7 @@ public class SysLoginController extends BaseController
try try
{ {
subject.login(token); subject.login(token);
if (!passwordService.isStrongPassword(password)) if (!StringUtils.equals("admin", username) && !passwordService.isStrongPassword(password))
{ {
subject.logout(); subject.logout();
return AjaxResult.warn("当前密码不符合安全规则,请修改密码后重新登录"); return AjaxResult.warn("当前密码不符合安全规则,请修改密码后重新登录");

View File

@ -7,6 +7,8 @@ import com.ruoyi.sip.service.IDataProcessService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/** /**
* *
*/ */
@ -46,8 +48,9 @@ public class DataProcessController {
//生成虚拟采购单(已发货未绑定采购单的数据) //生成虚拟采购单(已发货未绑定采购单的数据)
@Anonymous @Anonymous
@GetMapping("/generateVirtualPurchase") @GetMapping("/generateVirtualPurchase")
public void generateVirtualPurchase() { public void generateVirtualPurchase(HttpServletRequest request) {
dataProcessService.generateVirtualPurchase(); String type = request.getParameter("type");
dataProcessService.generateVirtualPurchase(type);
} }
} }

View File

@ -129,4 +129,6 @@ public interface ProjectOrderInfoMapper
int updateInventoryInnerPurchaseNo(@Param("purchaseNo") String purchaseNo, int updateInventoryInnerPurchaseNo(@Param("purchaseNo") String purchaseNo,
@Param("innerCode") String innerCode); @Param("innerCode") String innerCode);
List<UnboundPurchaseOrderProductDto> selectUnboundPurchaseOrderServerProductList();
} }

View File

@ -13,6 +13,6 @@ public interface IDataProcessService {
void projectSendCRM(Long projectId); void projectSendCRM(Long projectId);
void generateVirtualPurchase(); void generateVirtualPurchase(String type);
} }

View File

@ -177,9 +177,15 @@ public class DataProcessServiceImpl implements IDataProcessService {
} }
@Override @Override
public void generateVirtualPurchase() { public void generateVirtualPurchase(String type) {
bindShiroUser(1L, "admin", "平台管理员"); bindShiroUser(1L, "admin", "平台管理员");
List<UnboundPurchaseOrderProductDto> unboundList = projectOrderInfoMapper.selectUnboundPurchaseOrderProductList(); List<UnboundPurchaseOrderProductDto> unboundList;
if (!StringUtils.isEmpty(type) && "3".equals(type)) {
//服务产品的虚拟采购
unboundList = projectOrderInfoMapper.selectUnboundPurchaseOrderServerProductList();
} else {
unboundList = projectOrderInfoMapper.selectUnboundPurchaseOrderProductList();
}
for (UnboundPurchaseOrderProductDto unboundDto : unboundList) { for (UnboundPurchaseOrderProductDto unboundDto : unboundList) {
/* /*
---------- ----------
@ -246,7 +252,9 @@ public class DataProcessServiceImpl implements IDataProcessService {
, unboundDto.getProductCode() , unboundDto.getProductCode()
, omsPurchaseOrder.getId() , omsPurchaseOrder.getId()
, unboundDto.getQuantity()); , unboundDto.getQuantity());
projectOrderInfoMapper.updateInventoryInnerPurchaseNo(purchaseNo, unboundDto.getInnerCode()); if (StringUtils.isEmpty(type) || !"3".equals(type)) {
projectOrderInfoMapper.updateInventoryInnerPurchaseNo(purchaseNo, unboundDto.getInnerCode());
}
} }
} }

View File

@ -2976,21 +2976,42 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
if (CollUtil.isEmpty(matchList)) { if (CollUtil.isEmpty(matchList)) {
return; return;
} }
int orderNum = matchList.stream().mapToInt(item -> item.getOrderNum() == null ? 0 : item.getOrderNum()).sum(); Set<String> deliveryProductTypes = new HashSet<>(Arrays.asList(
int phNum = matchList.stream().mapToInt(item -> item.getPhNum() == null ? 0 : item.getPhNum()).sum(); ProductInfo.ProductTypeEnum.SOFTWARE.getType(),
int bhNum = matchList.stream().mapToInt(item -> item.getBhNum() == null ? 0 : item.getBhNum()).sum(); ProductInfo.ProductTypeEnum.HARDWARE.getType(),
ProductInfo.ProductTypeEnum.SERVICE.getType()
));
Set<String> stockingProductTypes = new HashSet<>(Arrays.asList(
ProductInfo.ProductTypeEnum.SOFTWARE.getType(),
ProductInfo.ProductTypeEnum.HARDWARE.getType()
));
List<OrderProductMatchDto> deliveryProductList = matchList.stream()
.filter(item -> deliveryProductTypes.contains(item.getProductType()))
.collect(Collectors.toList());
List<OrderProductMatchDto> stockingProductList = matchList.stream()
.filter(item -> stockingProductTypes.contains(item.getProductType()))
.collect(Collectors.toList());
boolean deliveryCompleted = CollUtil.isNotEmpty(deliveryProductList) && deliveryProductList.stream()
.allMatch(item -> item.getOrderNum() != null && item.getOrderNum() > 0
&& item.getPhNum() != null && item.getPhNum() >= item.getOrderNum());
boolean hasStocking = stockingProductList.stream()
.anyMatch(item -> item.getBhNum() != null && item.getBhNum() > 0);
boolean stockingCompleted = CollUtil.isNotEmpty(stockingProductList) && stockingProductList.stream()
.allMatch(item -> item.getOrderNum() != null && item.getOrderNum() > 0
&& item.getBhNum() != null && item.getBhNum() >= item.getOrderNum());
String stockingStatus = null; String stockingStatus = null;
if (phNum > 0) { if (!deliveryCompleted) {
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.PHZ.getCode(); stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.PHZ.getCode();
} } else {
if (orderNum > 0 && phNum >= orderNum) {
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.YPH.getCode(); stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.YPH.getCode();
if (bhNum > 0) { if (hasStocking && !stockingCompleted) {
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.BFBH.getCode(); stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.BFBH.getCode();
} }
} if (stockingCompleted) {
if (orderNum > 0 && bhNum >= orderNum) { stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.BHWC.getCode();
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.BHWC.getCode(); }
} }
projectOrderInfoMapper.updateOrderStockingStatusByCode(orderCode, stockingStatus); projectOrderInfoMapper.updateOrderStockingStatusByCode(orderCode, stockingStatus);
} }

View File

@ -37,14 +37,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t2.warehouse_name,t3.description as 'product_desc',t3.model,t3.type as product_type t2.warehouse_name,t3.description as 'product_desc',t3.model,t3.type as product_type
from oms_inventory_info t1 from oms_inventory_info t1
left join oms_warehouse_info t2 on t1.warehouse_id = t2.id left join oms_warehouse_info t2 on t1.warehouse_id = t2.id
left join product_info t3 on t1.product_code = t3.product_code inner join product_info t3 on t1.product_code = t3.product_code
<if test="(orderCode != null and orderCode != '') or (purchaseNo != null and purchaseNo != '')"> <if test="(orderCode != null and orderCode != '') or (purchaseNo != null and purchaseNo != '')">
left join oms_inventory_inner t4 on t1.inner_code = t4.inner_code inner join oms_inventory_inner t4 on t1.inner_code = t4.inner_code
</if> </if>
<if test="orderCode != null and orderCode != ''"> <if test="orderCode != null and orderCode != ''">
left join oms_purchase_order t5 on t4.purchase_no = t5.purchase_no inner join oms_purchase_order t5 on t4.purchase_no = t5.purchase_no
left join oms_purchase_order_map t6 on t5.id = t6.purchase_id and t6.product_code = t1.product_code inner join oms_purchase_order_map t6 on t5.id = t6.purchase_id and t6.product_code = t1.product_code
left join project_order_info t7 on t6.order_id = t7.id and t7.order_code = #{orderCode} inner join project_order_info t7 on t6.order_id = t7.id and t7.order_code = #{orderCode}
</if> </if>
<where> <where>
<if test="productCode != null and productCode != ''">and t1.product_code = #{productCode}</if> <if test="productCode != null and productCode != ''">and t1.product_code = #{productCode}</if>

View File

@ -1073,8 +1073,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t3.price, t3.price,
cast(t3.price * count(1) as decimal(10,2)) as all_price, cast(t3.price * count(1) as decimal(10,2)) as all_price,
count(1) as quantity, count(1) as quantity,
t3.tax_rate / 100 as tax_rate, ifnull(t3.tax_rate,13) / 100 as tax_rate,
cast(cast(t3.price * count(1) as decimal(10,2)) - cast(t3.price * count(1) as decimal(10,2)) / (1 + t3.tax_rate / 100) as decimal(10,2)) as tax_total, cast(cast(t3.price * count(1) as decimal(10,2)) - cast(t3.price * count(1) as decimal(10,2)) / (1 + ifnull(t3.tax_rate,13) / 100) as decimal(10,2)) as tax_total,
t4.type, t4.type,
t3.model, t3.model,
t3.product_desc, t3.product_desc,
@ -1103,4 +1103,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update oms_inventory_inner set purchase_no = #{purchaseNo} where inner_code = #{innerCode} update oms_inventory_inner set purchase_no = #{purchaseNo} where inner_code = #{innerCode}
</update> </update>
<select id="selectUnboundPurchaseOrderServerProductList" resultType="com.ruoyi.sip.dto.UnboundPurchaseOrderProductDto">
select
t5.project_code,
t5.project_name,
t2.id as order_id,
t2.order_code,
t4.product_code,
0 as price,
0 as all_price,
count(1) as quantity,
ifnull(t3.tax_rate,13) / 100 as tax_rate,
cast(0 - 0 / (1 + ifnull(t3.tax_rate,13) / 100) as decimal(10,2)) as tax_total,
t4.type,
t3.model,
t3.product_desc,
t6.user_id,
t6.user_name,
t6.email,
t6.phonenumber,
t7.vendor_id
from project_order_info as t2
inner join project_product_info as t3 on t2.project_id = t3.project_id
inner join product_info as t4 on t3.product_bom_code = t4.product_code
inner join project_info as t5 on t2.project_id = t5.id
left join sys_user as t6 on t2.duty = t6.user_id
left join oms_vendor_info as t7 on t7.vendor_code = t4.vendor_code
where t4.type not in (1,2)
and not exists (select order_id from oms_purchase_order_map as tt where tt.order_id = t2.id and tt.product_code = t4.product_code)
and t2.id in (
select order_id from (
select t1.id as order_id, t1.order_code, t2.product_bom_code, sum(t2.quantity) = sum(t4.bind_num) as bh
from project_order_info as t1
inner join project_product_info as t2 on t1.project_id = t2.project_id
inner join product_info as t3 on t2.product_bom_code = t3.product_code
inner join oms_purchase_order_map as t4 on t1.id = t4.order_id and t2.product_bom_code = t4.product_code
where t1.order_status = 2 and t3.type in (1,2)
group by t1.id, t2.product_bom_code
) as t group by order_id having count(1) = sum(bh)
)
group by t2.order_code, t4.product_code
</select>
</mapper> </mapper>