diff --git a/oms_web/oms_vue/src/views/inventory/execution/index.vue b/oms_web/oms_vue/src/views/inventory/execution/index.vue
index 159c5af6..cffbd822 100644
--- a/oms_web/oms_vue/src/views/inventory/execution/index.vue
+++ b/oms_web/oms_vue/src/views/inventory/execution/index.vue
@@ -244,7 +244,7 @@
产品型号:
{{ item.model || '-' }}
-
-
+
+
-
+
-
-
+
+
{{ parseTime(scope.row.createTime) }}
diff --git a/oms_web/oms_vue/src/views/inventory/info/outerLog.vue b/oms_web/oms_vue/src/views/inventory/info/outerLog.vue
index 4ce33228..022d0b9d 100644
--- a/oms_web/oms_vue/src/views/inventory/info/outerLog.vue
+++ b/oms_web/oms_vue/src/views/inventory/info/outerLog.vue
@@ -1,16 +1,16 @@
-
+
-
-
+
+
-
+
{{ parseTime(scope.row.createTime) }}
diff --git a/oms_web/oms_vue/src/views/inventory/inner/index.vue b/oms_web/oms_vue/src/views/inventory/inner/index.vue
index 6cd1d18b..d8eea961 100644
--- a/oms_web/oms_vue/src/views/inventory/inner/index.vue
+++ b/oms_web/oms_vue/src/views/inventory/inner/index.vue
@@ -383,7 +383,7 @@ export default {
return;
}
this.form.inventoryInfoList=[]
- let quantity = Number(this.form.quantity);
+ let quantity = Number(this.form.quantity) - Number(this.form.innerQuantity || 0);
let productSn = this.inputSn;
let snPrefix = "";
let snNumber = "";
diff --git a/oms_web/oms_vue/src/views/purchaseorder/components/PurchaseOrderSelectDialog.vue b/oms_web/oms_vue/src/views/purchaseorder/components/PurchaseOrderSelectDialog.vue
index a7373986..2bd624e1 100644
--- a/oms_web/oms_vue/src/views/purchaseorder/components/PurchaseOrderSelectDialog.vue
+++ b/oms_web/oms_vue/src/views/purchaseorder/components/PurchaseOrderSelectDialog.vue
@@ -2,7 +2,7 @@
-
+
- {{ scope.row.quantity * scope.row.price}}
+ {{ ((Number(scope.row.quantity) || 0) * (Number(scope.row.price) || 0)).toFixed(2) }}
@@ -129,6 +129,8 @@ export default {
watch: {
visible(val) {
if (val) {
+ this.queryParams.type = this.type;
+ this.queryParams.productCode = this.productCode;
this.getList();
}
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/OrderProductBindAmountDto.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/OrderProductBindAmountDto.java
new file mode 100644
index 00000000..e09442d3
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/OrderProductBindAmountDto.java
@@ -0,0 +1,34 @@
+package com.ruoyi.sip.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class OrderProductBindAmountDto {
+
+ /** 产品编码 */
+ private String productCode;
+
+ /** 成本含税 */
+ private BigDecimal costWithTax;
+
+ /** 成本不含税 */
+ private BigDecimal costWithoutTax;
+
+ /** 不含税收入 */
+ private BigDecimal amountWithoutTax;
+
+ /** 毛利 */
+ private BigDecimal grossProfit;
+
+ /** 毛利率 */
+ private BigDecimal grossProfitRate;
+
+ /** 订单备货状态(true: 已备货完成,false: 未备货完成) */
+ private Boolean orderStockingStatus;
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/UnboundPurchaseOrderProductDto.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/UnboundPurchaseOrderProductDto.java
new file mode 100644
index 00000000..c03c7b5c
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/UnboundPurchaseOrderProductDto.java
@@ -0,0 +1,20 @@
+package com.ruoyi.sip.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class UnboundPurchaseOrderProductDto {
+
+ /** 合同编号 */
+ private String orderCode;
+
+ /** 产品编码 */
+ private String productCode;
+
+ /** 入库单号 */
+ private String innerCode;
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java
index 5a4added..b675e038 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java
@@ -12,11 +12,9 @@ import com.ruoyi.sip.domain.OmsReceivableBill;
import com.ruoyi.sip.domain.ProjectInfo;
import com.ruoyi.sip.domain.ProjectOrderInfo;
import com.ruoyi.sip.domain.ProjectProductInfo;
+import com.ruoyi.sip.dto.OrderProductBindAmountDto;
import com.ruoyi.sip.llm.tools.support.AbstractMcpToolProvider;
-import com.ruoyi.sip.mapper.InventoryInfoMapper;
-import com.ruoyi.sip.mapper.OmsInventoryInnerMapper;
-import com.ruoyi.sip.mapper.OmsPurchaseOrderMapper;
-import com.ruoyi.sip.mapper.ProjectInfoMapper;
+import com.ruoyi.sip.mapper.*;
import com.ruoyi.sip.service.IInventoryInfoService;
import com.ruoyi.sip.service.IInventoryOuterService;
import com.ruoyi.sip.service.IOmsReceivableBillService;
@@ -43,7 +41,7 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
private static final String INDUSTRY_TYPE_DICT_TYPE = "bg_hysy";
private static final String INDUSTRY_TYPE_YYS_DICT_TYPE = "bg_yys";
private static final String PROJECT_STAGE_DICT_TYPE = "project_stage";
- private static final String NOT_DELIVERED_TEXT = "未发货完成";
+ private static final String NOT_DELIVERED_TEXT = "未配货完成";
@Autowired
private IProjectOrderInfoService projectOrderInfoService;
@@ -72,6 +70,9 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
@Autowired
private IOmsReceivableBillService omsReceivableBillService;
+ @Autowired
+ private ProjectOrderInfoMapper projectOrderInfoMapper;
+
@Override
protected String getToolName() {
return "project_order_info";
@@ -195,11 +196,11 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
item.put("archiveTime", formatDateTime(orderInfo.getApproveTime()));
ProductGroupSummary softwareSummary = appendProductFields(item, "software", softwareList,
- orderShipmentMap, Collections.emptyMap(), true);
+ orderShipmentMap, Collections.emptyMap(), true, orderInfo.getOrderCode());
ProductGroupSummary hardwareSummary = appendProductFields(item, "hardware", hardwareList,
- orderShipmentMap, Collections.emptyMap(), true);
+ orderShipmentMap, Collections.emptyMap(), true, orderInfo.getOrderCode());
ProductGroupSummary serviceSummary = appendProductFields(item, "service", serviceList,
- Collections.emptyMap(), serviceCostMap.getOrDefault(orderInfo.getOrderCode(), Collections.emptyMap()), false);
+ Collections.emptyMap(), serviceCostMap.getOrDefault(orderInfo.getOrderCode(), Collections.emptyMap()), false, orderInfo.getOrderCode());
BigDecimal orderAmountWithTax = defaultValue(orderInfo.getShipmentAmount());
BigDecimal discountAmountWithTax = softwareSummary.salesWithTax
@@ -208,20 +209,21 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
BigDecimal discountAmountWithoutTax = softwareSummary.salesWithoutTax
.add(hardwareSummary.salesWithoutTax)
.add(serviceSummary.salesWithoutTax);
- boolean allDelivered = softwareSummary.allDelivered && hardwareSummary.allDelivered && serviceSummary.allDelivered;
+ boolean allStocked = softwareSummary.allStocked && hardwareSummary.allStocked && serviceSummary.allStocked;
BigDecimal costWithTax = softwareSummary.costWithTax.add(hardwareSummary.costWithTax).add(serviceSummary.costWithTax);
BigDecimal costWithoutTax = softwareSummary.costWithoutTax.add(hardwareSummary.costWithoutTax).add(serviceSummary.costWithoutTax);
item.put("orderAmountWithTax", orderAmountWithTax);
item.put("discountedOrderAmountWithTax", discountAmountWithTax);
item.put("discountedOrderAmountWithoutTax", discountAmountWithoutTax);
- item.put("costTotalWithTax", allDelivered ? costWithTax : NOT_DELIVERED_TEXT);
- item.put("costTotalWithoutTax", allDelivered ? costWithoutTax : NOT_DELIVERED_TEXT);
+ item.put("costTotalWithTax", allStocked ? costWithTax : NOT_DELIVERED_TEXT);
+ item.put("costTotalWithoutTax", allStocked ? costWithoutTax : NOT_DELIVERED_TEXT);
- if (allDelivered) {
- BigDecimal grossProfit = discountAmountWithoutTax.subtract(costWithoutTax);
- item.put("grossProfit", grossProfit);
- item.put("grossProfitRate", percentage(grossProfit, costWithoutTax));
+ if (allStocked) {
+ BigDecimal totalGrossProfit = softwareSummary.grossProfit.add(hardwareSummary.grossProfit).add(serviceSummary.grossProfit);
+ BigDecimal totalAmountWithoutTax = softwareSummary.amountWithoutTax.add(hardwareSummary.amountWithoutTax).add(serviceSummary.amountWithoutTax);
+ item.put("grossProfit", totalGrossProfit);
+ item.put("grossProfitRate", percentage(totalGrossProfit, totalAmountWithoutTax));
} else {
item.put("grossProfit", NOT_DELIVERED_TEXT);
item.put("grossProfitRate", NOT_DELIVERED_TEXT);
@@ -501,7 +503,8 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
List productInfos,
Map shipmentMap,
Map serviceCostMap,
- boolean shipmentRequired) {
+ boolean shipmentRequired,
+ String orderCode) {
ProductGroupSummary summary = new ProductGroupSummary();
if (CollUtil.isEmpty(productInfos)) {
return summary;
@@ -509,9 +512,29 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
for (int i = 0; i < productInfos.size(); i++) {
int index = i + 1;
ProjectProductInfo productInfo = productInfos.get(i);
- ProductCostDisplay costDisplay = shipmentRequired
- ? buildShipmentProductCostDisplay(productInfo, shipmentMap.get(productInfo.getProductBomCode()))
- : buildServiceProductCostDisplay(serviceCostMap.get(productInfo.getProductBomCode()));
+
+ OrderProductBindAmountDto bindAmountDto = projectOrderInfoMapper.selectOrderProductBindAmount(
+ orderCode, productInfo.getProductBomCode());
+
+ ProductCostDisplay costDisplay = new ProductCostDisplay();
+ if (bindAmountDto != null) {
+ costDisplay.delivered = bindAmountDto.getOrderStockingStatus() != null && bindAmountDto.getOrderStockingStatus();
+ costDisplay.costWithTax = defaultValue(bindAmountDto.getCostWithTax());
+ costDisplay.costWithoutTax = defaultValue(bindAmountDto.getCostWithoutTax());
+ costDisplay.displayValue = costDisplay.costWithTax;
+
+ summary.amountWithoutTax = summary.amountWithoutTax.add(defaultValue(bindAmountDto.getAmountWithoutTax()));
+ summary.grossProfit = summary.grossProfit.add(defaultValue(bindAmountDto.getGrossProfit()));
+ summary.grossProfitRate = defaultValue(bindAmountDto.getGrossProfitRate());
+ summary.orderStockingStatus = bindAmountDto.getOrderStockingStatus();
+ if (bindAmountDto.getOrderStockingStatus() == null || !bindAmountDto.getOrderStockingStatus()) {
+ summary.allStocked = false;
+ }
+ } else {
+ costDisplay.delivered = false;
+ costDisplay.displayValue = NOT_DELIVERED_TEXT;
+ summary.allStocked = false;
+ }
item.put(prefix + "Code" + index, productInfo.getProductBomCode());
item.put(prefix + "Level2Type" + index, productInfo.getLevel2Type());
@@ -520,6 +543,9 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
item.put(prefix + "SalesAmount" + index, defaultValue(productInfo.getAllPrice()));
item.put(prefix + "CostAmount" + index, costDisplay.displayValue);
item.put(prefix + "TaxRate" + index, productInfo.getTaxRate());
+ item.put(prefix + "GrossProfit" + index, bindAmountDto != null ? defaultValue(bindAmountDto.getGrossProfit()) : BigDecimal.ZERO);
+ item.put(prefix + "GrossProfitRate" + index, bindAmountDto != null ? defaultValue(bindAmountDto.getGrossProfitRate()) : BigDecimal.ZERO);
+ item.put(prefix + "OrderStockingStatus" + index, bindAmountDto != null ? bindAmountDto.getOrderStockingStatus() : false);
summary.salesWithTax = summary.salesWithTax.add(defaultValue(productInfo.getAllPrice()));
summary.salesWithoutTax = summary.salesWithoutTax.add(toOrderAmountWithoutTax(defaultValue(productInfo.getAllPrice()), productInfo.getTaxRate()));
@@ -705,7 +731,7 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
"softwareCodeX", "软件产品第 X 行编码,对应 softwareLevel2TypeX/softwareModelX/softwareQuantityX/softwareSalesAmountX/softwareCostAmountX/softwareTaxRateX",
"hardwareCodeX", "硬件产品第 X 行编码,对应 hardwareLevel2TypeX/hardwareModelX/hardwareQuantityX/hardwareSalesAmountX/hardwareCostAmountX/hardwareTaxRateX",
"serviceCodeX", "服务产品第 X 行编码,对应 serviceLevel2TypeX/serviceModelX/serviceQuantityX/serviceSalesAmountX/serviceCostAmountX/serviceTaxRateX",
- "cost_rule", "软件和硬件未发货完成时成本字段返回“未发货完成”;服务默认视为已完成;订单不含税成本为各产品按各自税率换算后求和"
+ "cost_rule", "所有产品未配货完成时成本字段返回“未配货完成”;订单不含税成本为各产品按各自税率换算后求和"
));
return metadata;
}
@@ -813,10 +839,15 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
private static class ProductGroupSummary {
private boolean allDelivered = true;
+ private boolean allStocked = true;
private BigDecimal salesWithTax = BigDecimal.ZERO;
private BigDecimal salesWithoutTax = BigDecimal.ZERO;
+ private BigDecimal amountWithoutTax = BigDecimal.ZERO;
private BigDecimal costWithTax = BigDecimal.ZERO;
private BigDecimal costWithoutTax = BigDecimal.ZERO;
+ private BigDecimal grossProfit = BigDecimal.ZERO;
+ private BigDecimal grossProfitRate = BigDecimal.ZERO;
+ private Boolean orderStockingStatus = false;
}
private static class ReceivableSummary {
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProjectOrderInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProjectOrderInfoMapper.java
index 0720fb12..a083e11b 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProjectOrderInfoMapper.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProjectOrderInfoMapper.java
@@ -5,10 +5,12 @@ import java.util.List;
import com.ruoyi.sip.domain.InventoryDelivery;
import com.ruoyi.sip.domain.ProjectOrderInfo;
import com.ruoyi.sip.dto.HomepageQueryDto;
+import com.ruoyi.sip.dto.OrderProductBindAmountDto;
import com.ruoyi.sip.dto.OrderProductMatchBindDto;
import com.ruoyi.sip.dto.OrderProductMatchDto;
import com.ruoyi.sip.dto.OrderProductMatchSnDetailDto;
import com.ruoyi.sip.dto.StatisticsDetailDto;
+import com.ruoyi.sip.dto.UnboundPurchaseOrderProductDto;
import com.ruoyi.sip.vo.OrderInfoVo;
import org.apache.ibatis.annotations.Param;
@@ -113,4 +115,9 @@ public interface ProjectOrderInfoMapper
List selectProductMatchSnDetailList(@Param("purchaseNo") String purchaseNo,
@Param("productCode") String productCode);
+ OrderProductBindAmountDto selectOrderProductBindAmount(@Param("orderCode") String orderCode,
+ @Param("productCode") String productCode);
+
+ List selectUnboundPurchaseOrderProductList();
+
}
diff --git a/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml
index 418dc9f5..e0bc9b6c 100644
--- a/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml
@@ -951,7 +951,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) t6 on t3.product_code = t6.product_code
left join oms_vendor_info as t7 on t3.vendor_code = t7.vendor_code
where t2.order_code = #{orderCode}
- and t3.type in (1, 2)
group by t3.product_code, t3.model
order by t3.type, t3.product_code
@@ -1026,13 +1025,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.order_code,
t1.outer_code
from oms_inventory_info as t1
- inner join oms_inventory_inner as t2
- on t1.inner_code = t2.inner_code
- left join oms_warehouse_info as t3
- on t2.warehouse_id = t3.id
+ inner join oms_inventory_inner as t2 on t1.inner_code = t2.inner_code
+ left join oms_warehouse_info as t3 on t2.warehouse_id = t3.id
where t2.purchase_no = #{purchaseNo}
and t1.product_code = #{productCode}
order by t1.product_sn
+
+
+
+