|
@@ -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
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public SyCostAllocation queryByPlanNum(String plannum, String type) {
|
|
|
+
|
|
|
+ SyCostAllocation syCostAllocation=new SyCostAllocation();
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|