|
@@ -10,6 +10,9 @@ import org.jeecg.modules.system.util.oConvertUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -31,7 +34,7 @@ public class Rdrecord11ServiceImpl implements IRdrecord11Service {
|
|
"From rdrecord11 a left join rdrecords11 b on a.id=b.id left join Vendor c on a.cVenCode=c.cVenCode " +
|
|
"From rdrecord11 a left join rdrecords11 b on a.id=b.id left join Vendor c on a.cVenCode=c.cVenCode " +
|
|
"left join Warehouse d on a.cWhCode=d.cWhCode where a.cCode='"+cCode+"'";
|
|
"left join Warehouse d on a.cWhCode=d.cWhCode where a.cCode='"+cCode+"'";
|
|
//子表查询SQl 件数/KG不确认
|
|
//子表查询SQl 件数/KG不确认
|
|
- String bsql="select b.cbatch,b.cbatchproperty9,b.iquantity,b.cfree5,b.cinvcode,b.cfree4,b.cfree1,b.cfree6 " +
|
|
|
|
|
|
+ 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+"'";
|
|
"From rdrecord11 a join rdrecords11 b on a.id=b.id where a.cCode='"+cCode+"'";
|
|
if(org.equals("101")){
|
|
if(org.equals("101")){
|
|
List<Map<String, Object>> hresult = senYuDataSourceOne.queryForList(hsql);
|
|
List<Map<String, Object>> hresult = senYuDataSourceOne.queryForList(hsql);
|
|
@@ -54,19 +57,47 @@ public class Rdrecord11ServiceImpl implements IRdrecord11Service {
|
|
@Override
|
|
@Override
|
|
public JSONObject getRdrecordToPrint(String org, String cCode) throws Exception {
|
|
public JSONObject getRdrecordToPrint(String org, String cCode) throws Exception {
|
|
JSONObject resultJson=new JSONObject();
|
|
JSONObject resultJson=new JSONObject();
|
|
|
|
+
|
|
|
|
+ String finalPath="C:/Users/AF/Desktop/imagePrint";//数据缓存位置
|
|
|
|
+ File file =new File(finalPath);
|
|
|
|
+ //如果文件夹不存在则创建
|
|
|
|
+ if (!file .exists() && !file .isDirectory()){
|
|
|
|
+ file.mkdir();
|
|
|
|
+ }
|
|
//查询SQl
|
|
//查询SQl
|
|
- String sql="select a.csysbarcode as '缸单条码(单据条码)',c.cCusCode as '客户',b.cBatch as '缸号' ,a.cVenCode as '供应商', " +
|
|
|
|
- "'染厂色号',d.cVenCode as '委外供应商',b.iQuantity as '数量',b.csocode as '上游订单号',b.irowno as '匹数(行号)', " +
|
|
|
|
- "b.comcode as '委外订单号',b.cInvCode as '存货名称',a.cCode as '材料出库单号','描述' From rdrecord11 a left join rdrecords11 b " +
|
|
|
|
|
|
+ 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 " +
|
|
"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 " +
|
|
"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+"'";
|
|
"where a.cCode='"+cCode+"'";
|
|
if(org.equals("101")){
|
|
if(org.equals("101")){
|
|
List<Map<String, Object>> result = senYuDataSourceOne.queryForList(sql);
|
|
List<Map<String, Object>> result = senYuDataSourceOne.queryForList(sql);
|
|
if(result.size()==0){
|
|
if(result.size()==0){
|
|
throw new Exception(cCode+"单号查询有误,请确认数据!");
|
|
throw new Exception(cCode+"单号查询有误,请确认数据!");
|
|
}
|
|
}
|
|
|
|
+ List<JSONObject> pljf=JsonChangeUtils.toJSONObject(result);
|
|
|
|
+ //以行明细为单位,每行按照指定数量规则拆分生成二维码,例:两行明细,每行10个,现设置每个二维码数量=匹数(cdefine26)=4个,
|
|
|
|
+ //余数进一,那么第一行明细就会生成3个一模一样的二维码,第二行同理,然后依次打印
|
|
|
|
+ int sum=0;//二维码数量
|
|
|
|
+ int serialNum=0;//流水号,二维码文件名称
|
|
|
|
+ List<String> pathList=new ArrayList<>();
|
|
|
|
+ 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();
|
|
|
|
+ sum=sum+num;
|
|
|
|
+ for(int j=0;j<num;j++){
|
|
|
|
+ serialNum=serialNum+1;
|
|
|
|
+ onejson.put("计数","第"+i+1+"行,"+(j+1)+"/"+num);
|
|
|
|
+ //二维码位置拼名称
|
|
|
|
+ String newFilePath=finalPath+"/"+serialNum+".png";
|
|
|
|
+ pathList.add(newFilePath);
|
|
|
|
+ //生成二维码
|
|
|
|
+ oConvertUtils.generateQRCodeImage(onejson.toString(),200,200,newFilePath);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
resultJson.put("b",JsonChangeUtils.toJSONObject(result));
|
|
resultJson.put("b",JsonChangeUtils.toJSONObject(result));
|
|
- oConvertUtils.generateQRCodeImage(JsonChangeUtils.toJSONObject(result).toString(),350,350,"C:/Users/AF/Desktop/text.png");
|
|
|
|
}else if(org.equals("102")){
|
|
}else if(org.equals("102")){
|
|
|
|
|
|
}else if(org.equals("103")){
|
|
}else if(org.equals("103")){
|
|
@@ -76,4 +107,5 @@ public class Rdrecord11ServiceImpl implements IRdrecord11Service {
|
|
}
|
|
}
|
|
return resultJson;
|
|
return resultJson;
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|