Browse Source

成本报表 辅料物料问题

liuchaohui 2 years ago
parent
commit
dffd20861a

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

@@ -494,7 +494,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                 "  FROM UFDATA_903_2021.dbo.OM_MOMain om LEFT JOIN UFDATA_903_2021.dbo.OM_MODetails od ON om.MOID = od.MOID       " +
                 "  WHERE om.iVerifyStateNew = 2 and om.cCode like '"+plannum+"%'      " +
                 "  ) o ON r.iOMoDID  = o.MODetailsID       " +
-                "     LEFT JOIN (      " +
+                "     JOIN (      " +
                 "         SELECT r1.id,r1.cSource,rs1.cBatch,rs1.cInvCode ,rs1.cPOID,rs1.iQuantity as gou, " +
                 "    isnull(od.iQuantity,0)+ isnull(p.iQuantity,0) as ying,isnull(od.iSendQTY,0)+ isnull(p.iQuantity,0) as yi,    " +
                 "                bi.iCost,bi.iMoney,bi.iOriMoney,bi.iTaxPrice      " +
@@ -527,7 +527,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                 "  FROM OM_MOMain om LEFT JOIN OM_MODetails od ON om.MOID = od.MOID       " +
                 "  WHERE om.iVerifyStateNew = 2 and om.cCode like '"+plannum+"%'      " +
                 "  ) o ON r.iOMoDID  = o.MODetailsID       " +
-                "     LEFT JOIN (      " +
+                "     JOIN (      " +
                 "         SELECT r1.id,r1.cSource,rs1.cBatch,rs1.cInvCode ,rs1.cPOID,rs1.iQuantity as gou, " +
                 "    isnull(od.iQuantity,0)+ isnull(p.iQuantity,0) as ying,isnull(od.iSendQTY,0)+ isnull(p.iQuantity,0) as yi,    " +
                 "                bi.iCost,bi.iMoney,bi.iOriMoney,bi.iTaxPrice      " +
@@ -544,40 +544,6 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                 "                LEFT JOIN Vendor v ON o.cVenCode= v.cVenCode      " +
                 "                GROUP BY c.cInvName,r.cBatch,b.cSource,b.cPOID,v.cVenName ,r.cInvCode   " +
                 "        ) as ta GROUP BY cInvName,processUnit";
-//                "SELECT cInvName as goodsName,sum(yi) as usageQuantity,sum(gou) as purchaseQuantity," +
-//                "processUnit,isnull(sum(gou),0)-isnull(sum(yuu),0) as ingredientsRemainingQuantity,sum(yu) as ingredientsTransferQuantity, " +
-//                "sum(transferCost) as transferCost,sum(rmbAmount) as rmbAmount,sum(usdAmount) as usdAmount,sum(priceExcludingtax) as priceExcludingtax " +
-//                "FROM (  " +
-//                "                select sum(r.iQuantity) as yu,r.cBatch ,b.cSource,b.cPOID,sum(b.gou) as gou,sum(b.yi) as yi,sum(b.ying) as ying " +
-//                "    ,c.cInvName ,v.cVenName as processUnit,sum(b.iCost) as transferCost,sum(b.iMoney) as rmbAmount,sum(b.iOriMoney) as usdAmount,sum(b.iTaxPrice) as priceExcludingtax ,( " +
-//                "                    SELECT sum(r.iQuantity) " +
-//                "                    FROM rdrecords01 rs1  " +
-//                "          left join rdrecord01 r1 on r1.id=rs1.id " +
-//                "          where rs1.cBatch = '"+plannum+"' and rs1.cPOID  like '"+plannum+"%' and " +
-//                "                     r.cBatch = rs1.cBatch and rs1.cInvCode=r.cInvCode  " +
-//                "    group by rs1.cInvCode, rs1.cBatch  ) as yuu " +
-//                "                 FROM rdrecords11  r  " +
-//                "                  JOIN (  " +
-//                "                   SELECT od.MODetailsID,od.cInvCode,om.cVenCode    " +
-//                "                   FROM OM_MOMain om LEFT JOIN OM_MODetails od ON om.MOID = od.MOID   " +
-//                "                   WHERE om.iVerifyStateNew = 2 and om.cCode like '"+plannum+"%'  " +
-//                "                   ) o ON r.iOMoDID  = o.MODetailsID   " +
-//                "                  LEFT JOIN (  " +
-//                "                    SELECT r1.id,r1.cSource,rs1.cBatch,rs1.cInvCode ,rs1.cPOID, " +
-//                "     rs1.iQuantity as gou,isnull(od.iQuantity,0)+isnull(p.iQuantity,0) as ying,isnull(od.iSendQTY,0)+isnull(p.iQuantity,0) as yi," +
-//                "bi.iCost,bi.iMoney,bi.iOriMoney,bi.iTaxPrice  " +
-//                "                    FROM rdrecords01 rs1  " +
-//                "          left join rdrecord01 r1 on r1.id=rs1.id " +
-//                "          left join PO_Podetails p on p.ID=rs1.iPOsID " +
-//                "          left join PurBillVouchs bi  on bi.iPOsID=p.ID " +
-//                "          left join OM_MODetails o on o.MODetailsID =rs1.iOMoDID " +
-//                "          left join OM_MOMaterials od on od.MoDetailsID=o.MODetailsID  " +
-//                "          where rs1.cBatch = '"+plannum+"' " +
-//                "                    ) b on r.cBatch = b.cBatch and b.cInvCode=r.cInvCode   " +
-//                "     LEFT JOIN (SELECT * FROM  Inventory where (cInvCCode like '05%' or cInvCCode like '06%' or cInvCCode like '07%' ) ) c on c.cInvCode=r.cInvCode" +
-//                "                 LEFT JOIN Vendor v ON o.cVenCode= v.cVenCode  " +
-//                "                  GROUP BY c.cInvName,r.cBatch,b.cSource,b.cPOID,v.cVenName ,r.cInvCode " +
-//                "         ) as ta GROUP BY cInvName,processUnit;";
         List<Map<String, Object>> list2  = senYuDataSourceOne.queryForList(sqlIngredient);
         List<JSONObject> jianSon2 = JsonChangeUtils.toJSONObject(list2);
         List<SyCostAllocationIngredient> list4 = new ArrayList<>();