| | |
| | | package com.mandi.webservice.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.mandi.fendan.util.ConvertTool; |
| | | import com.mandi.servlet.file.impl.FileLoadImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.log4j.Logger; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.google.gson.JsonArray; |
| | | import com.google.gson.JsonElement; |
| | | import com.google.gson.JsonObject; |
| | | import com.google.gson.JsonParser; |
| | | import com.mandi.basicconfig.mapper.FdRepertoryNexusMapper; |
| | | import com.mandi.basicconfig.mapper.NczsjMapper; |
| | | import com.mandi.basicconfig.persist.FdRepertoryNexus; |
| | | import com.mandi.basicconfig.persist.Ncck; |
| | | import com.mandi.basicconfig.persist.Ncdepart; |
| | | import com.mandi.basicconfig.persist.Ncworker; |
| | | import com.mandi.basicconfig.persist.Ncywdy; |
| | | import com.mandi.basicconfig.persist.*; |
| | | import com.mandi.common.JSONobj; |
| | | import com.mandi.common.Wxhtmethod; |
| | | import com.mandi.common.ParamFileter.BigDecimalfiter; |
| | | import com.mandi.common.SpringContext; |
| | | import com.mandi.common.Wxhtmethod; |
| | | import com.mandi.dao.common.ObjectResult; |
| | | import com.mandi.dao.common.PageResult; |
| | | import com.mandi.fendan.mapper.BsheetEcgbMapper; |
| | | import com.mandi.fendan.mapper.BusinessMapper; |
| | | import com.mandi.fendan.mapper.Fd_BsheetMapper; |
| | | import com.mandi.fendan.mapper.Fd_CompanyMapper; |
| | | import com.mandi.fendan.mapper.Fd_GbxstdMapper; |
| | | import com.mandi.fendan.mapper.Fd_GbxstdmxMapper; |
| | | import com.mandi.fendan.mapper.Fd_VehicleMapper; |
| | | import com.mandi.fendan.mapper.Fd_XSTDMXMapper; |
| | | import com.mandi.fendan.mapper.Fd_XSTDMapper; |
| | | import com.mandi.fendan.mapper.Fd_YKTMapper; |
| | | import com.mandi.fendan.mapper.VehicleXSTDMapper; |
| | | import com.mandi.fendan.persist.BsheetEcgb; |
| | | import com.mandi.fendan.persist.Fd_Bsheet; |
| | | import com.mandi.fendan.persist.Fd_Company; |
| | | import com.mandi.fendan.persist.Fd_Gbxstd; |
| | | import com.mandi.fendan.persist.Fd_Gbxstdmx; |
| | | import com.mandi.fendan.persist.Fd_XSTD; |
| | | import com.mandi.fendan.persist.Fd_XSTDMX; |
| | | import com.mandi.fendan.persist.Vehicle_XSTD; |
| | | import com.mandi.fendan.mapper.*; |
| | | import com.mandi.fendan.persist.*; |
| | | import com.mandi.fendan.util.Contants; |
| | | import com.mandi.fendan.util.ConvertTool; |
| | | import com.mandi.fendan.util.ThreadPoolUtil; |
| | | import com.mandi.fendan.util.persist.Serviceenum; |
| | | import com.mandi.fendan.util.persist.WaitXSTDMX; |
| | | import com.mandi.fendan.util.persist.Yktbsitem; |
| | | import com.mandi.servlet.file.impl.FileLoadImpl; |
| | | import com.mandi.webservice.service.IFdXSTDService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.log4j.Logger; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class FdXSTDService implements IFdXSTDService{ |
| | |
| | | private FdRepertoryNexusMapper reNxPer; |
| | | |
| | | private Logger log= Logger.getLogger(FileLoadImpl.class); |
| | | |
| | | public static Boolean refreshMsLedLock = false; |
| | | public static Boolean refreshYrLedLock = false; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor=Exception.class) |
| | |
| | | prr.setCode(1); |
| | | prr.setErrmsg("一卡通业务单未找到,请确认单号是否正确!"); |
| | | return prr; |
| | | }else{ |
| | | if(fdb.getStatus()!=Serviceenum.在办){ |
| | | prr.setCode(2); |
| | | prr.setErrmsg("一卡通业务单不是在办状态,系统不做处理!"); |
| | | return prr; |
| | | } |
| | | if(StringUtils.isBlank(cardID)){ |
| | | prr.setCode(1); |
| | | prr.setErrmsg("参数:一卡通卡号为空!"); |
| | | return prr; |
| | | } |
| | | if(dataArr==null){ |
| | | prr.setCode(1); |
| | | prr.setErrmsg("参数:批次号为空!"); |
| | | return prr; |
| | | } |
| | | |
| | | Map<String, Object> mp=this.yktper.getcardinuse(cardID); |
| | | if(mp==null){ |
| | | throw new Exception("卡号不正确未找到在用卡!"); |
| | | } |
| | | vehicleId=mp.get("numberplates")==null?"":mp.get("numberplates").toString(); |
| | | if(!vehicleId.equals(fdb.getVehicleId())){ |
| | | prr.setCode(1); |
| | | prr.setErrmsg("参数:卡号关联的车牌号和业务单关联的车牌号不一致"); |
| | | return prr; |
| | | } |
| | | yktywdh=fdb.getBsNo(); |
| | | } |
| | | |
| | | if (fdb.getStatus() != Serviceenum.在办) { |
| | | prr.setCode(2); |
| | | prr.setErrmsg("一卡通业务单不是在办状态,系统不做处理!"); |
| | | return prr; |
| | | } |
| | | if (StringUtils.isBlank(cardID)) { |
| | | prr.setCode(1); |
| | | prr.setErrmsg("参数:一卡通卡号为空!"); |
| | | return prr; |
| | | } |
| | | if (dataArr == null) { |
| | | prr.setCode(1); |
| | | prr.setErrmsg("参数:批次号为空!"); |
| | | return prr; |
| | | } |
| | | |
| | | Map<String, Object> mp = this.yktper.getcardinuse(cardID); |
| | | if (mp == null) { |
| | | throw new Exception("卡号不正确未找到在用卡!"); |
| | | } |
| | | vehicleId = mp.get("numberplates") == null ? "" : mp.get("numberplates").toString(); |
| | | if (!vehicleId.equals(fdb.getVehicleId())) { |
| | | prr.setCode(1); |
| | | prr.setErrmsg("参数:卡号关联的车牌号和业务单关联的车牌号不一致"); |
| | | return prr; |
| | | } |
| | | // yktywdh = fdb.getBsNo(); |
| | | |
| | | int wcnum=this.bsper.getweightDoc(vehicleId, fdb.getBsNo()); |
| | | if(wcnum<=0){ |
| | |
| | | // TODO: handle exception |
| | | } |
| | | |
| | | |
| | | String currPch="";// 当前批次号 |
| | | //第一次添加装卸记录发送装车信息 |
| | | int sfzc=this.fbper.getbsitembyNo(fdb.getBsNo()); |
| | | if(sfzc<=0) { |
| | | //发送微信公众号提醒信息 |
| | | String url=Contants.yktLocalAdd+"/routine/sendZcMsg.htm"; |
| | | Map<String, String> mp=new HashMap<String, String>(); |
| | | Map<String, String> paramMp=new HashMap<String, String>(); |
| | | mp.put("sdepartNo", fdb.getSdepartNo()); |
| | | mp.put("vehicleId", vehicleId); |
| | | mp.put("businessNo", fdb.getBsNo()); |
| | | Wxhtmethod.postJson(url, mp); |
| | | Wxhtmethod.postJson(url, paramMp); |
| | | } |
| | | //现场过完毛重后出现扫码装车的,必须重新过磅 |
| | | // 现场过完毛重后出现扫码装车的,必须重新过磅 |
| | | int grossNum=this.bsper.getgrosstDoc(vehicleId, fdb.getBsNo()); |
| | | |
| | | for (JsonElement je : dataArr) { |
| | |
| | | bsi.setRecompany(wx.getTdmx_shdw()); |
| | | }else{ |
| | | bsi.setRecompany( |
| | | /*xstd.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ)?"郑州报关": |
| | | xstd.getTd_ywdybh().equals(Contants.nc_ywdy_MT)?"河南报关": |
| | | xstd.getTd_ywdybh().equals(Contants.nc_ywdy_MS)?"明晟报关": |
| | | "科技报关"*/ |
| | | ConvertTool.covertToCustoms(xstd.getTd_ywdybh()) |
| | | ); |
| | | } |
| | | bsi.setReID(""); |
| | | /*bsi.setDecompany(xstd.getTd_ywdybh().equals(Contants.nc_ywdy_ZZ)?"郑州明泰": |
| | | xstd.getTd_ywdybh().equals(Contants.nc_ywdy_MS)?"河南明晟新材料": |
| | | "眀泰科技");*/ |
| | | bsi.setDecompany(ConvertTool.ncCovertToFactoryName(xstd.getTd_ywdybh())); |
| | | bsi.setDeID(""); |
| | | bsi.setFrombatch("ERP系统"); |
| | |
| | | remp.put("td_tdls",tdmx.getTdmx_tdls()); |
| | | remp.put("tdmx_tdfl",tdmx.getTdmx_tdfl()); |
| | | relist.add(remp); |
| | | currPch = tdmx.getTdmx_pch(); |
| | | } |
| | | |
| | | if(grossNum>0) { |
| | |
| | | // this.bsper.delvehicleQ(vehicleId); |
| | | //删除车辆排队信息 |
| | | String url=Contants.yktLocalAdd+"/search/vehicleQueue/delItem.htm"; |
| | | Map<String, String> mp=new HashMap<String, String>(); |
| | | Map<String, String> paramMp=new HashMap<String, String>(); |
| | | mp.put("vehicleID", vehicleId); |
| | | Wxhtmethod.postJson(url, mp); |
| | | Wxhtmethod.postJson(url, paramMp); |
| | | } |
| | | } |
| | | |
| | | // 此处异步触发一下明晟发车 |
| | | if("06".equals(fdb.getSdepartNo())) { |
| | | final String cph = currPch; |
| | | ThreadPoolUtil.getInstance().execute(()->{ |
| | | try { |
| | | synchronized (FdXSTDService.refreshMsLedLock) { |
| | | if (FdXSTDService.refreshMsLedLock) { // 系统繁忙 |
| | | return ; |
| | | } |
| | | FdXSTDService.refreshMsLedLock = true; |
| | | } |
| | | sendToMsLed(cph); |
| | | } catch (Exception e) { |
| | | log.error(e); |
| | | } finally { |
| | | synchronized (FdXSTDService.refreshMsLedLock) { |
| | | FdXSTDService.refreshMsLedLock = false; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | if("08".equals(fdb.getSdepartNo())) { |
| | | final String cph = currPch; |
| | | ThreadPoolUtil.getInstance().execute(()->{ |
| | | try { |
| | | synchronized (FdXSTDService.refreshYrLedLock) { |
| | | if (FdXSTDService.refreshYrLedLock) { // 系统繁忙 |
| | | return ; |
| | | } |
| | | FdXSTDService.refreshYrLedLock = true; |
| | | } |
| | | sendToYrLed(cph); |
| | | } catch (Exception e) { |
| | | log.error(e); |
| | | } finally { |
| | | synchronized (FdXSTDService.refreshYrLedLock) { |
| | | FdXSTDService.refreshYrLedLock = false; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | prr.setCode(0); |
| | | prr.setErrmsg("装车操作成功!"); |
| | | prr.setList(relist); |
| | | return prr; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param currPch 当前批次号 |
| | | */ |
| | | public void sendToMsLed(String currPch){ |
| | | //A区 76-86 + 99-1 |
| | | //B区 14-33 + 99-2 |
| | | //C区 53-67 + 99-3 |
| | | log.info("LED-ABC当前扫码批次号:" + currPch); |
| | | List<Map> totalList = tdmxper.getHwList("06"); // 获取明晟所有在办业务单的信息 |
| | | log.info("LED-ABC获取信息条数:" + totalList.size()); |
| | | Map<String,List<Map>> ywbhListMap = new HashMap<>(); |
| | | for (Map map : totalList) { |
| | | String ywdw = (String) map.get("tdmx_fdywbh"); |
| | | if(ywbhListMap.get(ywdw) == null) { |
| | | ywbhListMap.put(ywdw, new ArrayList<>()); |
| | | } |
| | | ywbhListMap.get(ywdw).add(map); |
| | | } |
| | | String str1 = " 车号 A区 B区 C区" + "\r\n", str2=""; |
| | | //"(车牌号)\\-(A区已装车)/(A区总计)\\-(B区已装车)/(B区总计)\\-(C区已装车)/(C区总计)\\r\\n"; |
| | | String formatStr = "%s %s/%s %s/%s %s/%s\r\n"; |
| | | // 只有1个区 |
| | | String speakTxtFormatStr1 = "车号%s ,装货%d件已完成,请司机清点货物后尽快驶离装货区。"; |
| | | // 只有2个区 |
| | | String speakTxtFormatStr2 = "车号%s,%s区装货%d件已全部扫描完成,请司机清点货物后去%s区装货。"; |
| | | // 只有3个区 |
| | | String speakTxtFormatStr3 = "车号%s,%s区装货%d件已全部扫描完成,请司机清点货物后去%s区%s区装货。"; |
| | | Map speakParam = new HashMap(1); |
| | | for (Map.Entry<String, List<Map>> entry : ywbhListMap.entrySet()) { |
| | | // 遍历每个业务单的 |
| | | // 当前装车A、B、C区 |
| | | boolean currA = false,currB = false, currC = false; |
| | | boolean hasZcwc = false; // 保证已经完成了 |
| | | // String ywhb = entry.getKey(); |
| | | List<Map> vehicleIdTotalList = entry.getValue(); |
| | | Map<String, Integer> totalAbcMap = new HashMap(3); // 总计信息 |
| | | totalAbcMap.put("A", 0); |
| | | totalAbcMap.put("B", 0); |
| | | totalAbcMap.put("C", 0); |
| | | Map<String, Integer> abcMap = new HashMap(3); // 已装信息 |
| | | abcMap.put("A", 0); |
| | | abcMap.put("B", 0); |
| | | abcMap.put("C", 0); |
| | | String cph = ""; // 车牌号 |
| | | for (Map map : vehicleIdTotalList) { |
| | | String hw = (String) map.get("tdmx_hwmc"); |
| | | String pch = (String) map.get("tdmx_pch"); |
| | | if("".equals(cph)) cph = (String) map.get("tdmx_fdcph"); |
| | | Integer zcbz = (Integer) map.get("tdmx_zcbz"); |
| | | String hh = hw.replaceAll("\\-.*",""); |
| | | hh = hh.substring(hh.length()-2); // 取最后两位 |
| | | int num = Integer.parseInt(hh); |
| | | if (num >= 76 && num <= 86 || hw.lastIndexOf("99-1") >= 0) { // A区 |
| | | totalAbcMap.put("A",totalAbcMap.get("A") + 1); |
| | | if (zcbz != null && zcbz == 1) { // 装车完成 |
| | | abcMap.put("A", abcMap.get("A") + 1); |
| | | hasZcwc = true; |
| | | } |
| | | if(pch.equals(currPch)) { |
| | | currA = true; currB = false;currC =false; |
| | | } |
| | | } else if (num >= 14 && num <= 33 || hw.lastIndexOf("99-2") >= 0) { // B区 |
| | | totalAbcMap.put("B", totalAbcMap.get("B") + 1); |
| | | if (zcbz != null && zcbz == 1) { |
| | | abcMap.put("B", abcMap.get("B") + 1); |
| | | hasZcwc = true; |
| | | } |
| | | if(pch.equals(currPch)) { |
| | | currA = false; currB = true;currC =false; |
| | | } |
| | | } else if (num >= 53 && num <= 67 || hw.lastIndexOf("99-3") >= 0) { // C区 |
| | | totalAbcMap.put("C", totalAbcMap.get("C") + 1); |
| | | if (zcbz != null && zcbz == 1) { |
| | | abcMap.put("C", abcMap.get("C") + 1); |
| | | hasZcwc = true; |
| | | } |
| | | if(pch.equals(currPch)) { |
| | | currA = false; currB = false; currC =true; |
| | | } |
| | | } |
| | | } |
| | | // if (!hasZcwc) continue; //没有装车完成的也跳过 |
| | | /*if (!(currA || currB || currC) && abcMap.get("A") + abcMap.get("B") + abcMap.get("C") == |
| | | totalAbcMap.get("A") + totalAbcMap.get("B") + totalAbcMap.get("C")) { // 非当前车牌号,已经装车完成但是未出厂 |
| | | continue; |
| | | }*/ |
| | | str2 += String.format(formatStr, cph, fillWithZero(abcMap.get("A")), fillWithZero(totalAbcMap.get("A")), |
| | | fillWithZero(abcMap.get("B")), fillWithZero(totalAbcMap.get("B")), |
| | | fillWithZero(abcMap.get("C")), fillWithZero(totalAbcMap.get("C"))); |
| | | // 开始准备语音 |
| | | int total = 0; |
| | | if(currA && abcMap.get("A") == totalAbcMap.get("A")) { // 当前车在A区装车完成 |
| | | total = totalAbcMap.get("A"); |
| | | } |
| | | if(currB && abcMap.get("B") == totalAbcMap.get("B")) {// 当前车在B区装车完成 |
| | | total = totalAbcMap.get("B"); |
| | | } |
| | | if(currC && abcMap.get("C") == totalAbcMap.get("C")) {// 当前车在C区装车完成 |
| | | total = totalAbcMap.get("C"); |
| | | } |
| | | if(total > 0) { // 播放语音,请离开区域 |
| | | speakParam.clear(); |
| | | String speakTxt=null ; |
| | | if( (abcMap.get("A")>0 && totalAbcMap.get("B")==0 && totalAbcMap.get("C")==0) || |
| | | (abcMap.get("B")>0 && totalAbcMap.get("A")==0 && totalAbcMap.get("C")==0) || |
| | | (abcMap.get("C")>0 && totalAbcMap.get("B")==0 && totalAbcMap.get("D")==0) |
| | | ) { // 只有一个区域有货物 |
| | | speakTxt= String.format(speakTxtFormatStr1, cph, total); |
| | | }else if(totalAbcMap.get("A")>0 && totalAbcMap.get("B")>0 && |
| | | (totalAbcMap.get("C")==0 || totalAbcMap.get("C") == abcMap.get("C"))){ // AB都有货 C区已完或无货 |
| | | if(totalAbcMap.get("C")>0 && abcMap.get("A")< totalAbcMap.get("A") && abcMap.get("B")< totalAbcMap.get("B")) { // C装完AB未装完 |
| | | speakTxt= String.format(speakTxtFormatStr3, cph,"C", total,"A","B"); |
| | | } else if(abcMap.get("A")== totalAbcMap.get("A") && abcMap.get("B")< totalAbcMap.get("B")) { //A完B未完 |
| | | speakTxt = String.format(speakTxtFormatStr2, cph, "A", total, "B"); |
| | | }else if(abcMap.get("B")== totalAbcMap.get("B") && abcMap.get("A")< totalAbcMap.get("A")) {//B完A未完 |
| | | speakTxt = String.format(speakTxtFormatStr2, cph, "B", total, "A"); |
| | | }else { // 全部装完 |
| | | speakTxt= String.format(speakTxtFormatStr1, cph, total); |
| | | } |
| | | }else if(totalAbcMap.get("C")>0 && totalAbcMap.get("B")>0 && |
| | | (totalAbcMap.get("A")==0 || totalAbcMap.get("A") == abcMap.get("A")) ){ //BC有货 A区已完或无货 |
| | | if(totalAbcMap.get("A")>0 && abcMap.get("C")< totalAbcMap.get("C") && abcMap.get("B")< totalAbcMap.get("B")) { // A装完BC未装完 |
| | | speakTxt= String.format(speakTxtFormatStr3, cph,"A", total,"B","C"); |
| | | } else if(abcMap.get("C")== totalAbcMap.get("C") && abcMap.get("B")< totalAbcMap.get("B")) { // C完B未装完 |
| | | speakTxt = String.format(speakTxtFormatStr2, cph, "C", total, "B"); |
| | | }else if(abcMap.get("B")== totalAbcMap.get("B") && abcMap.get("C")< totalAbcMap.get("C")) {// B完C未装完 |
| | | speakTxt = String.format(speakTxtFormatStr2, cph, "B", total, "C"); |
| | | }else { // 全部装完 |
| | | speakTxt= String.format(speakTxtFormatStr1, cph, total); |
| | | } |
| | | }else if (totalAbcMap.get("A")>0 && totalAbcMap.get("C")>0 && |
| | | (totalAbcMap.get("B")==0 || totalAbcMap.get("B") == abcMap.get("B")) ) { //AC有货 |
| | | if(totalAbcMap.get("B")>0 && abcMap.get("A")< totalAbcMap.get("A") && abcMap.get("C")< totalAbcMap.get("C")) { |
| | | speakTxt= String.format(speakTxtFormatStr3, cph,"B", total,"A","C"); |
| | | } else if(abcMap.get("A")== totalAbcMap.get("A") && abcMap.get("C")< totalAbcMap.get("C")) { // A装完C未装完 |
| | | speakTxt = String.format(speakTxtFormatStr2, cph, "A", total, "C"); |
| | | }else if(abcMap.get("C")== totalAbcMap.get("C") && abcMap.get("A")< totalAbcMap.get("A")) {// C装完A未装完 |
| | | speakTxt = String.format(speakTxtFormatStr2, cph, "C", total, "A"); |
| | | }else { // 全部装完 |
| | | speakTxt= String.format(speakTxtFormatStr1, cph, total); |
| | | } |
| | | }else if(totalAbcMap.get("A")>0 && totalAbcMap.get("B")>0 && totalAbcMap.get("C")>0) { // 3区都有货物,且只有一个取装完了 |
| | | if(abcMap.get("A")>0 && abcMap.get("B")<totalAbcMap.get("B") && abcMap.get("C")<totalAbcMap.get("C")) { |
| | | speakTxt= String.format(speakTxtFormatStr3, cph,"A", total,"B","C"); |
| | | } else if(abcMap.get("B")>0 && abcMap.get("C")==0 && abcMap.get("A")==0) { |
| | | speakTxt= String.format(speakTxtFormatStr3, cph,"B", total,"A","C"); |
| | | } else if(abcMap.get("C")>0 && abcMap.get("A")==0 && abcMap.get("B")==0) { |
| | | speakTxt= String.format(speakTxtFormatStr3, cph,"C", total,"A","B"); |
| | | } else { // 全部装完 |
| | | speakTxt= String.format(speakTxtFormatStr1, cph, total); |
| | | } |
| | | } else { |
| | | speakTxt= String.format(speakTxtFormatStr1, cph, total); |
| | | } |
| | | speakParam.put("SpeakTxt", speakTxt); |
| | | log.info("SpeakTxt:"+ speakTxt); |
| | | } |
| | | // 单辆车的单个业务单的信息结束 |
| | | } |
| | | if(StringUtils.isBlank(str2)) { |
| | | str2 = "无车辆"; |
| | | } |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("strTitle",str1); |
| | | paramMap.put("strContent",str2); |
| | | try { |
| | | log.info("LED-ABC webServiceAddrss:"+Contants.msLedServiceAddr+"st1::" +str1+";;;;;str2::"+str2); |
| | | String re = Wxhtmethod.post(Contants.msLedServiceAddr + "/SendLED",paramMap); |
| | | log.info("LED-ABC result:"+re); |
| | | // 语音只播一条 |
| | | String re1 = Wxhtmethod.post(Contants.msLedServiceAddr + "/Speak",speakParam); |
| | | }catch (Exception e){} |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void sendToYrLed(String currPch) { |
| | | // 状态 一磅后,待装;PDA扫码 在装; 二次过磅后消失 |
| | | // 装车区 两个汉字加两个英文或数字 |
| | | String strTitle="序号 车号 装车区 状态\r\n"; |
| | | String strContent = ""; |
| | | String contentFormatStr = "%s %s %s %s\r\n"; |
| | | List<Map> list = tdmxper.yRZcList("08"); |
| | | int index = 1; |
| | | for (Map map : list) { |
| | | String numberplates = (String) map.get("numberplates"); // 车牌号 |
| | | String zcWz = (String) map.get("zcWz"); // 装车位置 |
| | | if(StringUtils.isNotBlank(zcWz)){ |
| | | zcWz = zcWz.substring(0,4); |
| | | } else { |
| | | zcWz = " "; |
| | | } |
| | | String zcStatus = (String) map.get("zcStatus"); // 装车位置 在办/待办 |
| | | strContent += String.format(contentFormatStr, fillWithZero(index++), numberplates, zcWz, zcStatus); |
| | | } |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("strTitle",strTitle); |
| | | paramMap.put("strContent",strContent); |
| | | Wxhtmethod.post(Contants.yr_zcLedUrl + "/SendLED",paramMap); |
| | | log.info("yr_zcLedUrl: " + Contants.yr_zcLedUrl + ";title:" + strTitle + ",content:" + strContent); |
| | | } |
| | | |
| | | String fillWithZero(int str){ |
| | | String s; |
| | | if(str<10 && str>=0) s= "0" + str; |
| | | else s=String.valueOf(str); |
| | | return s; |
| | | } |
| | | |
| | | @Override |
| | |
| | | String tdmx_pch=jo.get("tdmx_pch").getAsString(); |
| | | // Fd_XSTDMX tdmx=this.tdmxper.getbyPCH(tdmx_pch); |
| | | Fd_XSTDMX tdmx=this.tdmxper.getbyPCHONE(tdmx_pch,vehicleId); |
| | | if(tdmx == null) { |
| | | String errMsg = "一卡通卸车失败,请查看【" + tdmx_pch +"】出库关闭标志!"; |
| | | throw new Exception(errMsg); |
| | | } |
| | | // if(tdmx.getTdmx_zcbz()!=1){ |
| | | //// throw new Exception("批次号:"+tdmx_pch+" 已经提交装车,不能重复提交装车!"); |
| | | // continue; |
| | |
| | | return orr; |
| | | } |
| | | String vehicleId=mp.get("numberplates")==null?"":mp.get("numberplates").toString(); |
| | | |
| | | String type = (String)mp.get("type"); |
| | | String sdepartNo = null; |
| | | if(type.equals("外来车辆卡")) { |
| | | sdepartNo = (String) mp.get("sdepartNo"); |
| | | } |
| | | |
| | | List<Fd_Bsheet> fd_bList = this.fbper.getListbyVehicleId(vehicleId, Serviceenum.在办); |
| | | if (fd_bList == null||fd_bList.isEmpty()) { |
| | | orr.setCode(1); |
| | |
| | | return orr; |
| | | } |
| | | } |
| | | String businessNo = bsper.getBusinessNoByCardNo(cardID); |
| | | // 改成使用在用卡的卡号、车牌号码、厂区来确认是否有销售的业务单 btid=3 businesstype00002 |
| | | String businessNo = bsper.getBusinessNoByCardNo(cardID,vehicleId,sdepartNo); |
| | | if(StringUtils.isBlank(businessNo)) { |
| | | orr.setCode(1); |
| | | orr.setErrmsg("未找到该卡的在办业务单!"); |
| | |
| | | // List<Vehicle_XSTD> vxl=this.vhxper.getlistbyVehicleId(vehicleId); |
| | | List<Vehicle_XSTD> vxl= this.vhxper.getlistbyVehicleIdandbsNoGp(vehicleId, businessNo); |
| | | List<Map<String, Object>> datamp=new ArrayList<Map<String, Object>>(); |
| | | Map<String,Fd_XSTD> xstdMap = new HashMap(); // 缓存Fd_XSTD,避免多查 |
| | | for (Vehicle_XSTD vx : vxl) { |
| | | String tdbh=vx.getXstdNo(); |
| | | Fd_XSTD td=this.tdper.getbyTDBH(tdbh); |
| | |
| | | tdm.put("td_tdbh", td.getTd_tdbh()); |
| | | tdm.put("td_tdls", td.getTd_tdls()); |
| | | tdm.put("td_jylx", td.getTd_jylx()); |
| | | Fd_XSTD fd_xstd = xstdMap.get(td.getTd_tdbh()); |
| | | if(xstdMap.get(td.getTd_tdbh())==null) { // 保证同一个提单只查一遍 |
| | | fd_xstd = tdper.getbyttdbh(td.getTd_tdbh()); |
| | | } |
| | | //增加客户名称 备注 |
| | | if(StringUtils.isBlank(fd_xstd.getTd_fpbh())){ |
| | | Nckh nckh = zsjper.getNckhbyCode(fd_xstd.getTd_khbh());// 客户不存在的特殊情况是不应该存在的,以防万一,加判空。 |
| | | tdm.put("td_khmc",nckh!=null?nckh.getName():""); |
| | | }else { |
| | | String name = ConvertTool.covertToCustoms(fd_xstd.getTd_ywdybh()); |
| | | tdm.put("td_khmc", name); |
| | | } |
| | | tdm.put("td_bz",fd_xstd.getTd_bz()); |
| | | mm.put("td", tdm); |
| | | mm.put("tdmx", tdmxl); |
| | | datamp.add(mm); |
| | | } |
| | | |
| | | |
| | | rem.put("cph", vehicleId); |
| | | rem.put("sjmc", fd_b.getDriver()); |
| | | rem.put("dh", fd_b.getPhone()); |