Browse Source

成本报表 第二版发运明细

liuchaohui 2 years ago
parent
commit
8ac3f2f52e

+ 24 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -246,10 +246,30 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         }
 
         //发运明细
-        String sqlShipdetail = "SELECT sh.cDefine10 as invoiceNum,sh.iExchRate as exchangeRate,sh.cSOCode as orderNum,c.cInvName AS poStyleNum," +
-                "shs.iTaxUnitPrice as exportUnitPrice" +
-                " FROM SaleBillVouch sh join SaleBillVouchs shs on sh.SBVID = shs.SBVID " +
-                " left join Inventory c on c.cInvCode=shs.cInvCode" +
+        String sqlShipdetail = "SELECT  " +
+                "  sh.cDefine10 AS invoiceNum,  " +
+                "  sh.iExchRate AS exchangeRate,  " +
+                "  sh.cSOCode AS orderNum,  " +
+                "  c.cInvName AS poStyleNum,  " +
+                "  shs.iTaxUnitPrice AS exportUnitPrice ,  " +
+                "  so.supplierCode AS processUnit " +
+                "FROM  " +
+                "  SaleBillVouch sh  " +
+                "  JOIN SaleBillVouchs shs ON sh.SBVID = shs.SBVID  " +
+                "  LEFT JOIN Inventory c ON c.cInvCode= shs.cInvCode   " +
+                "  LEFT JOIN rdrecords32 rd ON rd.AutoID = shs.isaleoutid  " +
+                "   JOIN (  " +
+                "    SELECT  " +
+                "      supplierCode,s.iSOsID,s.id  " +
+                "    FROM SO_SODetails s  " +
+                "     JOIN (  " +
+                "          SELECT  " +
+                "            om.cVenCode AS supplierCode,od.cInvCode,od.isosid   " +
+                "          FROM OM_MOMain om  " +
+                "            LEFT JOIN OM_MODetails od ON om.MOID = od.MOID   " +
+                "          WHERE om.cState = 1 AND om.cCode LIKE '"+plannum+"%'   " +
+                "      ) o ON s.isosid = o.isosid AND s.cInvCode = o.cInvCode   " +
+                "  ) so ON so.iSOsID = rd.iorderdid "+
                 " WHERE sh.cSOCode = '"+syCostAllocation.getGarmentContractno()+"'";
         List<Map<String, Object>> listShipdetail  = senYuDataSourceOne.queryForList(sqlShipdetail);
         List<JSONObject> Shipdetail = JsonChangeUtils.toJSONObject(listShipdetail);