|
|
@@ -1,23 +1,21 @@
|
|
|
package com.uas.mes.pda.service.impl;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
import com.uas.mes.common.data.BaseDao;
|
|
|
import com.uas.mes.common.util.BaseUtil;
|
|
|
import com.uas.mes.core.data.SqlRowList;
|
|
|
import com.uas.mes.core.exception.APIErrorException;
|
|
|
-import com.uas.mes.core.exception.SystemException;
|
|
|
import com.uas.mes.core.exception.APIErrorException.APIErrorCode;
|
|
|
import com.uas.mes.core.util.FlexJsonUtil;
|
|
|
import com.uas.mes.core.util.StringUtil;
|
|
|
import com.uas.mes.pda.dao.PdaPrintDao;
|
|
|
import com.uas.mes.pda.service.PdaPrintService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Service("pdaPrintService")
|
|
|
public class PdaPrintServiceImpl implements PdaPrintService {
|
|
|
@@ -143,5 +141,80 @@ public class PdaPrintServiceImpl implements PdaPrintService {
|
|
|
} else {
|
|
|
throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"未配置相应的打印模板");
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> vendorOrderPrint(String caller, String data,String type,String printer,Integer fmid) {
|
|
|
+ SqlRowList rs1, rs2;
|
|
|
+ Map<Object,Object> map = BaseUtil.parseFormStoreToMap(data);
|
|
|
+ Object condition = map.get("condition");
|
|
|
+ int page = 0;
|
|
|
+ int pageSize = 0;
|
|
|
+ if(!StringUtil.hasText(map.get("condition"))){
|
|
|
+ BaseUtil.showError("请传递打印条件!");
|
|
|
+ }
|
|
|
+ if(map.get("page") != null && !("").equals(map.get("page"))){
|
|
|
+ page = Integer.valueOf(map.get("page").toString());
|
|
|
+ }
|
|
|
+ if(map.get("pageSize") != null && !("").equals(map.get("pageSize"))){
|
|
|
+ pageSize = Integer.valueOf(map.get("pageSize").toString());
|
|
|
+ }
|
|
|
+ int start = ((page - 1) * pageSize + 1);
|
|
|
+ int end = page * pageSize;
|
|
|
+ caller = "Barcode!Print";
|
|
|
+ SqlRowList rs0 = baseDao.queryForRowSet("select la_id,la_sql,la_width,la_height,la_type,la_name from label where la_formcaller=? ",caller);
|
|
|
+ if (rs0.next()) {
|
|
|
+ String va ="";
|
|
|
+ String regex = "\\{(?:[A-Za-z][A-Za-z0-9_]*)\\}";
|
|
|
+ va = rs0.getString("la_sql").replaceAll(regex,"where "+condition);
|
|
|
+ String logCaller = caller;
|
|
|
+// if("NewBar!BaPrint".equals(caller)){
|
|
|
+// caller = "Barcode!Print";
|
|
|
+// }
|
|
|
+// if ("BarcodeInPrint".equals(caller) ) {
|
|
|
+// baseDao.execute("update barcodeio set bi_printstatus = 1,bi_lastprintdate=sysdate,bi_lastprintman='"+ SystemSession.getUser().getEm_name()+"',bi_printcount =nvl(bi_printcount,0)+1 where "+ condition);
|
|
|
+// baseDao.execute("insert into barcodeprintlog(bl_id,bl_date,bl_man,bl_content,bl_caller,bl_barcode) select "
|
|
|
+// + " barcodeprintlog_seq.nextval,sysdate,'"+SystemSession.getUser().getEm_name()+"','入库单打印成功','"+logCaller+"', bi_barcode from "
|
|
|
+// + " barcodeio where "+condition);
|
|
|
+// }else if ("Barcode!Print".equals(caller)){
|
|
|
+// baseDao.execute("update barcode set bar_lastprintdate=sysdate,bar_printcount=nvl(bar_printcount,0)+1 ,bar_lastprintman = '"+SystemSession.getUser().getEm_name()+"' where "+condition);
|
|
|
+// baseDao.execute("insert into barcodeprintlog(bl_id,bl_date,bl_man,bl_content,bl_caller,bl_barcode) select "
|
|
|
+// + " barcodeprintlog_seq.nextval,sysdate,'"+SystemSession.getUser().getEm_name()+"','"+("NewBar!BaPrint".equals(logCaller)?"新拆分条码":"库存条码")+"打印成功','"+logCaller+"', bar_code from "
|
|
|
+// + " barcode where "+condition);
|
|
|
+// }else if(("VendBarcodeInPrint").equals(caller)){
|
|
|
+// baseDao.execute("update baracceptnotify set ban_printstatus=-1 where "+condition);
|
|
|
+// }
|
|
|
+// if(page >0 && pageSize >0){
|
|
|
+// SqlRowList lpname = baseDao.queryForRowSet(" SELECT wm_concat(lp_name) lp_name from labelparameter where lp_laid = ?",rs0.getInt("la_id"));
|
|
|
+// if(lpname.next() && lpname.getString("lp_name")!= null){
|
|
|
+// va = "select "+lpname.getString("lp_name")+" from (select tt.*,rownum rn from ( "+va+" )tt where rownum<="+end+" )where rn>="+start;
|
|
|
+// }
|
|
|
+// }
|
|
|
+ rs1 = baseDao.queryForRowSet(va);
|
|
|
+ rs2 = baseDao.queryForRowSet("select la_width,la_height,lp_id,lp_valuetype,lp_encode,lp_name,lp_leftrate,lp_toprate,lp_width,lp_ifshownote,lp_font,lp_size,lp_notealignjustify,lp_height from labelParameter left join label on la_id=lp_laid where la_id=?", rs0.getInt("la_id"));
|
|
|
+ List<Map<String,Object>> parameter = new ArrayList<Map<String, Object>>();
|
|
|
+ List<Map<String,Object>> barcode = new ArrayList<Map<String, Object>>();
|
|
|
+ Map<String,Object> re = new HashMap<>();
|
|
|
+ if(rs1.next()){
|
|
|
+ barcode = rs1.getResultList();
|
|
|
+ }
|
|
|
+ if(rs2.next()){
|
|
|
+ parameter = rs2.getResultList();
|
|
|
+ }
|
|
|
+ re.put("parameter",parameter);
|
|
|
+ re.put("barcode",barcode);
|
|
|
+ re.put("type", type);
|
|
|
+ re.put("label_type",rs0.getString("la_type"));
|
|
|
+ re.put("label_name", rs0.getString("la_name"));
|
|
|
+ if(printer !=null && !("").equals(printer)){
|
|
|
+ re.put("chooseprintername", printer);
|
|
|
+ }
|
|
|
+ return re;
|
|
|
+ } else {
|
|
|
+ throw new APIErrorException(APIErrorCode.BUSINESS_FAILED,"未配置相应的打印模板");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|