Forráskód Böngészése

成本报表 辅料费用

liuchaohui 2 éve
szülő
commit
3853838f48

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

@@ -327,6 +327,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                 Fabric.setSyTransfers(syTransferList);
             }else{
                 Fabric.setFabrictransferQuantity(BigDecimal.ZERO);
+                Fabric.setTransferCost(BigDecimal.ZERO);
             }
             list3.add(Fabric);
         }
@@ -334,10 +335,11 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 
         //查询U8数据 辅料
         String sqlIngredient ="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 FROM (  " +
-                " " +
+                "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 ,( " +
+                "    ,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 " +
@@ -352,19 +354,19 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                 "                   ) 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 " +
+                "     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);
@@ -448,6 +450,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                 Ingredient.setSyTransfers(syTransferList);
             }else{
                 Ingredient.setIngredientsTransferQuantity(BigDecimal.ZERO);
+                Ingredient.setTransferCost(BigDecimal.ZERO);
             }
             list4.add(Ingredient);
         }