Browse Source

成本报表 表头数据

liuchaohui 2 years ago
parent
commit
4d33ce30af

+ 3 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocation.java

@@ -77,8 +77,10 @@ public class SyCostAllocation implements Serializable {
     @ApiModelProperty(value = "加工单位")
     private String processUnit;
     /**出运日期*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "出运日期")
-    private String outdata;
+    private Date outdata;
     /**计划数量*/
     @ApiModelProperty(value = "计划数量")
     private java.math.BigDecimal planQuantity;

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

@@ -7,6 +7,12 @@ import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.modules.cost.entity.*;
 import org.jeecg.modules.cost.mapper.*;
 import org.jeecg.modules.cost.service.*;
+import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
+import org.jeecg.modules.openApi.service.ISenYuDataSourceThree;
+import org.jeecg.modules.system.util.JsonChangeUtils;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -15,6 +21,7 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -24,7 +31,7 @@ import java.util.stream.Collectors;
  * @Version: V1.0
  */
 @Service
-public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMapper, SyCostAllocation> implements ISyCostAllocationService {
+public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMapper, SyCostAllocation> implements ISyCostAllocationService, ApplicationContextAware {
 
     @Autowired
     private SyCostAllocationMapper syCostAllocationMapper;
@@ -50,6 +57,10 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
     private ISyCostAllocationIngredientService syCostAllocationIngredientService;
     @Autowired
     private ISyCostAllocationShipdetailService syCostAllocationShipdetailService;
+    @Autowired
+    private static ISenYuDataSourceOne senYuDataSourceOne;
+    @Autowired
+    private static ISenYuDataSourceThree senYuDataSourceThree;
     @Override
     @Transactional
     public void saveMain(SyCostAllocation syCostAllocation, List<SyCostAllocationAccident> syCostAllocationAccidentList,List<SyCostAllocationCostpay> syCostAllocationCostpayList,List<SyCostAllocationFabric> syCostAllocationFabricList,List<SyCostAllocationIngredient> syCostAllocationIngredientList,List<SyCostAllocationShipdetail> syCostAllocationShipdetailList) {
@@ -145,8 +156,50 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         }
     }
 
+    //查询森宇u8数据
     @Override
     public SyCostAllocation queryByPlanNum(String plannum, String type) {
+        //返回数据
+        SyCostAllocation syCostAllocation=new SyCostAllocation();
+        //查询U8数据 表头
+        String sqlQueryhard = "SELECT " +
+                "max(o.omCode) as planNum,max(c.cInvName) as poStyleNum,max(pe.cPersonName) as exportSales,max(ss.cSOCode) as garmentContractno," +
+                "max(de.cDepName) as department,max(cc.cCusAbbName) as customerShortame,v.cVenName as processUnit,max(ss.dDate) as outdata" +
+                " FROM" +
+                " SO_SODetails s" +
+                " LEFT JOIN SO_SOMain ss on ss.ID= s.ID" +
+                " right JOIN (" +
+                "SELECT " +
+                "om.cCode AS omCode," +
+                "om.MOID AS ompoId,od.MODetailsID AS ompoIdItem," +
+                "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" +
+                " LEFT JOIN Vendor v ON o.supplierCode= v.cVenCode" +
+                " LEFT JOIN Inventory c on c.cInvCode=s.cInvCode" +
+                " LEFT JOIN Person  pe ON ss.cPersonCode = pe.cPersonCode" +
+                " LEFT JOIN Department de ON ss.cDepCode = de.cDepCode" +
+                " LEFT JOIN Customer cc ON ss.cCusCode = cc.cCusCode" +
+                " WHERE c.cInvCcode like '19%' GROUP BY v.cVenName ";
+        List<Map<String, Object>> list  = senYuDataSourceOne.queryForList(sqlQueryhard);
+        List<JSONObject> jianSon = JsonChangeUtils.toJSONObject(list);
+        syCostAllocation = JSONObject.toJavaObject(jianSon.get(0), SyCostAllocation.class);
+        for (int i=0;i<jianSon.size();i++) {
+            SyCostAllocation objs = JSONObject.toJavaObject(jianSon.get(i), SyCostAllocation.class);
+            if(i>0){
+                syCostAllocation.setProcessUnit(syCostAllocation.getProcessUnit()+","+objs.getProcessUnit());
+            }
+        }
+        syCostAllocation.setPlanNum("");
+        return syCostAllocation;
+    }
+
+    //查询森宇Mysql的数据
+    public SyCostAllocation queryByPlanNum2(String plannum, String type) {
         SyCostAllocation syCostAllocation=new SyCostAllocation();
         if(type.equals("query")){
             QueryWrapper<SyCostAllocation> listQueryWrapper = new QueryWrapper<>();
@@ -202,4 +255,9 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         return syCostAllocation;
     }
 
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        this.senYuDataSourceOne = applicationContext.getBean(ISenYuDataSourceOne.class);
+        this.senYuDataSourceThree = applicationContext.getBean(ISenYuDataSourceThree.class);
+    }
 }