fix:订单配备货规则修改、添加已发货产品的虚拟采购单生成数据处理接口
parent
3b84d8d87c
commit
d55fc11e24
|
|
@ -92,7 +92,7 @@ public class SysLoginController extends BaseController
|
|||
try
|
||||
{
|
||||
subject.login(token);
|
||||
if (!passwordService.isStrongPassword(password))
|
||||
if (!StringUtils.equals("admin", username) && !passwordService.isStrongPassword(password))
|
||||
{
|
||||
subject.logout();
|
||||
return AjaxResult.warn("当前密码不符合安全规则,请修改密码后重新登录");
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import com.ruoyi.sip.service.IDataProcessService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 数据处理控制器
|
||||
*/
|
||||
|
|
@ -46,8 +48,9 @@ public class DataProcessController {
|
|||
//生成虚拟采购单(已发货未绑定采购单的数据)
|
||||
@Anonymous
|
||||
@GetMapping("/generateVirtualPurchase")
|
||||
public void generateVirtualPurchase() {
|
||||
dataProcessService.generateVirtualPurchase();
|
||||
public void generateVirtualPurchase(HttpServletRequest request) {
|
||||
String type = request.getParameter("type");
|
||||
dataProcessService.generateVirtualPurchase(type);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,4 +129,6 @@ public interface ProjectOrderInfoMapper
|
|||
int updateInventoryInnerPurchaseNo(@Param("purchaseNo") String purchaseNo,
|
||||
@Param("innerCode") String innerCode);
|
||||
|
||||
List<UnboundPurchaseOrderProductDto> selectUnboundPurchaseOrderServerProductList();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ public interface IDataProcessService {
|
|||
|
||||
void projectSendCRM(Long projectId);
|
||||
|
||||
void generateVirtualPurchase();
|
||||
void generateVirtualPurchase(String type);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,9 +177,15 @@ public class DataProcessServiceImpl implements IDataProcessService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generateVirtualPurchase() {
|
||||
public void generateVirtualPurchase(String type) {
|
||||
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) {
|
||||
/*
|
||||
---------- 组装新建参数
|
||||
|
|
@ -246,7 +252,9 @@ public class DataProcessServiceImpl implements IDataProcessService {
|
|||
, unboundDto.getProductCode()
|
||||
, omsPurchaseOrder.getId()
|
||||
, unboundDto.getQuantity());
|
||||
projectOrderInfoMapper.updateInventoryInnerPurchaseNo(purchaseNo, unboundDto.getInnerCode());
|
||||
if (StringUtils.isEmpty(type) || !"3".equals(type)) {
|
||||
projectOrderInfoMapper.updateInventoryInnerPurchaseNo(purchaseNo, unboundDto.getInnerCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2976,21 +2976,42 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
|
|||
if (CollUtil.isEmpty(matchList)) {
|
||||
return;
|
||||
}
|
||||
int orderNum = matchList.stream().mapToInt(item -> item.getOrderNum() == null ? 0 : item.getOrderNum()).sum();
|
||||
int phNum = matchList.stream().mapToInt(item -> item.getPhNum() == null ? 0 : item.getPhNum()).sum();
|
||||
int bhNum = matchList.stream().mapToInt(item -> item.getBhNum() == null ? 0 : item.getBhNum()).sum();
|
||||
Set<String> deliveryProductTypes = new HashSet<>(Arrays.asList(
|
||||
ProductInfo.ProductTypeEnum.SOFTWARE.getType(),
|
||||
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;
|
||||
if (phNum > 0) {
|
||||
if (!deliveryCompleted) {
|
||||
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.PHZ.getCode();
|
||||
}
|
||||
if (orderNum > 0 && phNum >= orderNum) {
|
||||
} else {
|
||||
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.YPH.getCode();
|
||||
if (bhNum > 0) {
|
||||
if (hasStocking && !stockingCompleted) {
|
||||
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.BFBH.getCode();
|
||||
}
|
||||
}
|
||||
if (orderNum > 0 && bhNum >= orderNum) {
|
||||
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.BHWC.getCode();
|
||||
if (stockingCompleted) {
|
||||
stockingStatus = ProjectOrderInfo.OrderStockingStatusEnum.BHWC.getCode();
|
||||
}
|
||||
}
|
||||
projectOrderInfoMapper.updateOrderStockingStatusByCode(orderCode, stockingStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
from oms_inventory_info t1
|
||||
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 != '')">
|
||||
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 test="orderCode != null and orderCode != ''">
|
||||
left 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
|
||||
left join project_order_info t7 on t6.order_id = t7.id and t7.order_code = #{orderCode}
|
||||
inner join oms_purchase_order t5 on t4.purchase_no = t5.purchase_no
|
||||
inner join oms_purchase_order_map t6 on t5.id = t6.purchase_id and t6.product_code = t1.product_code
|
||||
inner join project_order_info t7 on t6.order_id = t7.id and t7.order_code = #{orderCode}
|
||||
</if>
|
||||
<where>
|
||||
<if test="productCode != null and productCode != ''">and t1.product_code = #{productCode}</if>
|
||||
|
|
|
|||
|
|
@ -1073,8 +1073,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
t3.price,
|
||||
cast(t3.price * count(1) as decimal(10,2)) as all_price,
|
||||
count(1) as quantity,
|
||||
t3.tax_rate / 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,
|
||||
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 + ifnull(t3.tax_rate,13) / 100) as decimal(10,2)) as tax_total,
|
||||
t4.type,
|
||||
t3.model,
|
||||
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>
|
||||
|
||||
<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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue