zengtx преди 1 година
родител
ревизия
318725ab26

+ 6 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/xml/SyShippingOrderMapper.xml

@@ -209,17 +209,12 @@ group by c.group_id) t group by t.elementsId,t.styleNumber,t.smailPo,t.unitPrice
 
 
     <select id="qeuryItemInfo" resultType="org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem">
-        SELECT GROUP_CONCAT(id) as id, sy_shipping_order_item_id as syShippingOrderItemId, english_name as englishName, style_number as styleNumber, smail_po as smailPo,create_by as createBy,order_number as orderNumber,
-sum(number) as number,pk_org as pkOrg,
-case when ready_fabric != '成衣' then sum(box_number) else box_number end as boxNumber,
-case when ready_fabric != '成衣' then sum(gross_weight) else gross_weight end as grossWeight,
-case when ready_fabric != '成衣' then sum(net_weight) else net_weight end as netWeight,
-case when ready_fabric != '成衣' then volume else volume end as volume,round(sum(total_price),2) as totalPrice,
-distribution_point as distributionPoint, container_code as containerCode, container_number as containerNumber, unit_price as unitPrice, pre_shipment_date as preShipmentDate,
-salesman, operating_department as operatingDepartment, purchase_outsourcing_order_no as purOrSubOrder, outsourcing_factory_for_procurement as outsourcingFactoryForProcurement,
- memo, sort, ready_fabric as readyFabric, tailoring_fabric_id as tailoringFabricId, tailoring_fabric_item_id as tailoringFabricItemId,client_abbreviation as clientAbbreviation
- FROM sy_shipping_order_item where del_flag = 0 and sy_shipping_order_item_id = #{id}
-group by order_number
+
+select sum(t.grossWeight) as grossWeight,t.orderNumber,t.tailoringFabricItemId,t.pkOrg from (
+select order_number as orderNumber,case when ready_fabric != '成衣' then sum(gross_weight) else gross_weight end as grossWeight,
+tailoring_fabric_item_id as tailoringFabricItemId,pk_org as pkOrg
+from sy_shipping_order_item
+where del_flag = 0 and sy_shipping_order_item_id = #{id}  group by group_id) t  group by t.orderNumber
     </select>
 
 

+ 5 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/service/impl/SyShippingOrderServiceImpl.java

@@ -623,7 +623,9 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
                     //添加子表信息
                     Map<String, Object> maps = new HashMap<>();
                     maps.put("cSPVCode", cCode);//销售支出单号
-                    maps.put("iMoney", rmb.get("amount"));
+                    //金额 = 以销售订单号为维度计算对应销售订单号下的毛重合计数/总毛重“费用支出金额
+                    double money = Double.parseDouble(li.get("grossWeight").toString()) / Double.parseDouble(map1.get("totalGrossWeight").toString());
+                    maps.put("iMoney", money*Double.parseDouble(rmb.get("amount").toString()));
                     maps.put("cExpCode", rmb.get("itemColumn"));//项目编码
                     maps.put("ID", id);
                     maps.put("irowno", ii);//行号
@@ -675,9 +677,9 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
                     //添加子表信息
                     Map<String, Object> maps = new HashMap<>();
                     maps.put("cSPVCode", cCode);//销售支出单号
-                    maps.put("iMoney", usd.get("amount"));
+                    double money = Double.parseDouble(li.get("grossWeight").toString()) / Double.parseDouble(map1.get("totalGrossWeight").toString());
+                    maps.put("iMoney", money*Double.parseDouble(usd.get("amount").toString()));
                     maps.put("cExpCode",usd.get("itemColumn"));//项目编码
-
                     maps.put("ID", id);
                     maps.put("irowno", ii);//行号
                     listmaps.add(maps);