| | |
| | | import com.mandi.basicconfig.persist.*; |
| | | import com.mandi.common.JSONobj; |
| | | 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.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; |
| | | |
| | |
| | | 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) |
| | |
| | | // 此处异步触发一下明晟发车 |
| | | if("06".equals(fdb.getSdepartNo())) { |
| | | final String cph = currPch; |
| | | ThreadPoolUtil.getInstance().execute(()->sendToMsLed(cph)); |
| | | 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("装车操作成功!"); |
| | |
| | | //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"); |
| | |
| | | // 只有3个区 |
| | | String speakTxtFormatStr3 = "车号%s,%s区装货%d件已全部扫描完成,请司机清点货物后去%s区%s区装货。"; |
| | | Map speakParam = new HashMap(1); |
| | | for (Map.Entry<String, List<Map>> entry : ywbhListMap.entrySet()) { // 遍历每个业务单的 |
| | | for (Map.Entry<String, List<Map>> entry : ywbhListMap.entrySet()) { |
| | | // 遍历每个业务单的 |
| | | // 当前装车A、B、C区 |
| | | boolean currA = false,currB = false, currC = false; |
| | | boolean hasZcwc = false; // 保证已经完成了 |
| | |
| | | } |
| | | } |
| | | } |
| | | if (!hasZcwc) continue; //没有装车完成的也跳过 |
| | | if (!(currA || currB || currC) && abcMap.get("A") + abcMap.get("B") + abcMap.get("C") == |
| | | // 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, fillSpace(abcMap.get("A")), fillSpace(totalAbcMap.get("A")), |
| | | fillSpace(abcMap.get("B")), fillSpace(totalAbcMap.get("B")), |
| | | fillSpace(abcMap.get("C")), fillSpace(totalAbcMap.get("C"))); |
| | | }*/ |
| | | 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区装车完成 |
| | |
| | | } |
| | | // 单辆车的单个业务单的信息结束 |
| | | } |
| | | if(StringUtils.isBlank(str2)) { |
| | | str2 = "无车辆"; |
| | | } |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("strTitle",str1); |
| | | paramMap.put("strContent",str2); |
| | | try { |
| | | String re = Wxhtmethod.post(Contants.msLedServiceAddr + "/SendLED",paramMap); |
| | | // 语音只播一条 |
| | | String re1 = Wxhtmethod.post(Contants.msLedServiceAddr + "/Speak",speakParam); |
| | | 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){} |
| | | |
| | | |
| | | } |
| | | String fillSpace(int str){ |
| | | |
| | | @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 { // 空是6个位置 |
| | | 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); |