|
@@ -2,15 +2,14 @@ package org.jeecg.modules.openApi.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import org.jeecg.modules.openApi.service.IRdrecord11Service;
|
|
|
-import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
|
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceThree;
|
|
|
-import org.jeecg.modules.openApi.service.ISenYuDataSourceTwo;
|
|
|
import org.jeecg.modules.system.util.JsonChangeUtils;
|
|
|
import org.jeecg.modules.system.util.oConvertUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
+import javax.swing.filechooser.FileSystemView;
|
|
|
import java.awt.*;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.File;
|
|
@@ -22,10 +21,6 @@ import java.util.Map;
|
|
|
@Service
|
|
|
public class Rdrecord11ServiceImpl implements IRdrecord11Service {
|
|
|
|
|
|
- @Autowired
|
|
|
- private ISenYuDataSourceOne senYuDataSourceOne;
|
|
|
- @Autowired
|
|
|
- private ISenYuDataSourceTwo senYuDataSourceTwo;
|
|
|
@Autowired
|
|
|
private ISenYuDataSourceThree senYuDataSourceThree;
|
|
|
|
|
@@ -39,20 +34,16 @@ public class Rdrecord11ServiceImpl implements IRdrecord11Service {
|
|
|
//子表查询SQl 件数/KG不确认
|
|
|
String bsql="select b.cbatch,b.cbatchproperty9,b.iquantity,b.cdefine26,b.cinvcode,b.cfree4,b.cfree1,b.cfree6 " +
|
|
|
"From rdrecord11 a join rdrecords11 b on a.id=b.id where a.cCode='"+cCode+"'";
|
|
|
- if(org.equals("101")){
|
|
|
- List<Map<String, Object>> hresult = senYuDataSourceOne.queryForList(hsql);
|
|
|
- List<Map<String, Object>> bresult = senYuDataSourceOne.queryForList(bsql);
|
|
|
+ if(org.equals("103")){
|
|
|
+ List<Map<String, Object>> hresult = senYuDataSourceThree.queryForList(hsql);
|
|
|
+ List<Map<String, Object>> bresult = senYuDataSourceThree.queryForList(bsql);
|
|
|
if(hresult.size()!=1||bresult.size()==0){
|
|
|
throw new Exception(cCode+"单号查询有误,请确认数据!");
|
|
|
}
|
|
|
resultJson=JsonChangeUtils.toJSONObject(hresult).get(0);
|
|
|
resultJson.put("b",JsonChangeUtils.toJSONObject(bresult));
|
|
|
- }else if(org.equals("102")){
|
|
|
-
|
|
|
- }else if(org.equals("103")){
|
|
|
-
|
|
|
}else{
|
|
|
- throw new Exception(org+"该账套号不存在!");
|
|
|
+ throw new Exception("账套号不是103,请确认!");
|
|
|
}
|
|
|
return resultJson;
|
|
|
}
|
|
@@ -61,21 +52,23 @@ public class Rdrecord11ServiceImpl implements IRdrecord11Service {
|
|
|
public JSONObject getRdrecordToPrint(String org, String cCode) throws Exception {
|
|
|
JSONObject resultJson=new JSONObject();
|
|
|
|
|
|
- String finalPath="C:/Users/AF/Desktop/imagePrint";//数据缓存位置
|
|
|
- File file =new File(finalPath);
|
|
|
+ FileSystemView fsv = FileSystemView.getFileSystemView();
|
|
|
+ File com = fsv.getHomeDirectory(); //这两行行是获取桌面路径的具体方法
|
|
|
+ String finalPath=com.getPath()+"/imagePrint";//数据缓存位置,默认放在桌面
|
|
|
+ File file =new File(finalPath.replaceAll("\\\\","/"));
|
|
|
//如果文件夹不存在则创建
|
|
|
if (!file .exists() && !file .isDirectory()){
|
|
|
file.mkdir();
|
|
|
}
|
|
|
//查询SQl
|
|
|
- String sql="select a.cCode+'_'+b.cBatch as code,c.cCusCode,b.cBatch,e.cVenName," +
|
|
|
- "b.cbatchproperty9,d.cVenCode,b.iQuantity,b.csocode,b.cdefine26," +
|
|
|
- "b.comcode,f.cInvName,a.cCode,'描述' as text From rdrecord11 a left join rdrecords11 b " +
|
|
|
+ String sql="select a.cCode+'_'+b.cBatch as 缸单条码,c.cCusCode as 客户,b.cBatch as 缸号,e.cVenName as 供应商," +
|
|
|
+ "b.cbatchproperty9 as 染厂色号,d.cVenCode as 接收方,b.iQuantity as 数量,b.csocode as 上游订单,b.cdefine26 as 匹数," +
|
|
|
+ "b.comcode as 下游订单,f.cInvName as 物料,a.cCode as 发货单,'描述' as 描述 From rdrecord11 a left join rdrecords11 b " +
|
|
|
"on a.id=b.id left join SO_SOMain c on b.csocode=c.csocode left join OM_MOMain d on b.comcode=d.cCode " +
|
|
|
"left join Vendor e on a.cVenCode=e.cVenCode left join Inventory f on b.cInvCode=f.cInvCode " +
|
|
|
"where a.cCode='"+cCode+"'";
|
|
|
- if(org.equals("101")){
|
|
|
- List<Map<String, Object>> result = senYuDataSourceOne.queryForList(sql);
|
|
|
+ if(org.equals("103")){
|
|
|
+ List<Map<String, Object>> result = senYuDataSourceThree.queryForList(sql);
|
|
|
if(result.size()==0){
|
|
|
throw new Exception(cCode+"单号查询有误,请确认数据!");
|
|
|
}
|
|
@@ -88,7 +81,7 @@ public class Rdrecord11ServiceImpl implements IRdrecord11Service {
|
|
|
for(int i=0;i<pljf.size();i++){
|
|
|
JSONObject onejson=pljf.get(i);
|
|
|
//生成二维码数量=
|
|
|
- int num=(onejson.getBigDecimal("iQuantity").divide(new BigDecimal("15000"),0,BigDecimal.ROUND_UP)).intValue();
|
|
|
+ int num=(onejson.getBigDecimal("数量").divide(new BigDecimal("15000"),0,BigDecimal.ROUND_UP)).intValue();
|
|
|
sum=sum+num;
|
|
|
for(int j=0;j<num;j++){
|
|
|
serialNum=serialNum+1;
|
|
@@ -133,15 +126,11 @@ public class Rdrecord11ServiceImpl implements IRdrecord11Service {
|
|
|
}
|
|
|
}
|
|
|
//图片全部生成后打印
|
|
|
- oConvertUtils.print(pathList,"test");
|
|
|
+ oConvertUtils.print(pathList);
|
|
|
|
|
|
resultJson.put("b",JsonChangeUtils.toJSONObject(result));
|
|
|
- }else if(org.equals("102")){
|
|
|
-
|
|
|
- }else if(org.equals("103")){
|
|
|
-
|
|
|
}else{
|
|
|
- throw new Exception(org+"该账套号不存在!");
|
|
|
+ throw new Exception("账套号不是103,请确认!");
|
|
|
}
|
|
|
return resultJson;
|
|
|
}
|