| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.mandi.basicconfig.persist.*; |
| | | import com.mandi.fendan.util.ConvertTool; |
| | | import com.mandi.fendan.util.ThreadPoolUtil; |
| | | import com.mandi.servlet.file.impl.FileLoadImpl; |
| | | import javafx.concurrent.Task; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.log4j.Logger; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | 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){ |
| | |
| | | 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系统"); |
| | |
| | | // 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())) { |
| | | ThreadPoolUtil.getInstance().execute(()->sendToMsLed()); |
| | | } |
| | | prr.setCode(0); |
| | | prr.setErrmsg("装车操作成功!"); |
| | | prr.setList(relist); |
| | | return prr; |
| | | } |
| | | |
| | | public void sendToMsLed(){ // todo 明天需要测试一下 |
| | | //A区 76-86 + 99-1 |
| | | //B区 14-33 + 99-2 |
| | | //C区 53-67 + 99-3 |
| | | List<Map> totalList = tdmxper.getHwList("06"); // 获取明晟所有在办业务单的信息 |
| | | 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-%d/%d- %d/%d-%d/%d\r\n"; |
| | | for (Map.Entry<String, List<Map>> entry : ywbhListMap.entrySet()) { // 遍历每个业务单的 |
| | | 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"); |
| | | if(!"".equals(cph)) cph = (String) map.get("tdmx_zccph"); |
| | | 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", 1); |
| | | if (zcbz != null && zcbz == 1) { // 装车完成 |
| | | abcMap.put("A", abcMap.get("A") + 1); |
| | | hasZcwc = true; |
| | | } |
| | | } else if (num >= 14 && num <= 33 || hw.lastIndexOf("99-2") >= 0) { // B区 |
| | | totalAbcMap.put("B", 1); |
| | | if (zcbz != null && zcbz == 1) { |
| | | abcMap.put("B", abcMap.get("B") + 1); |
| | | hasZcwc = true; |
| | | } |
| | | } else if (num >= 53 && num <= 67 || hw.lastIndexOf("99-3") >= 0) { // C区 |
| | | totalAbcMap.put("C", 1); |
| | | if (zcbz != null && zcbz == 1) { |
| | | abcMap.put("C", abcMap.get("C") + 1); |
| | | hasZcwc = true; |
| | | } |
| | | } |
| | | } |
| | | if (!hasZcwc) continue; |
| | | str2 += String.format(formatStr, cph, abcMap.get("A"), totalAbcMap.get("A"), |
| | | abcMap.get("B"), totalAbcMap.get("B"), |
| | | abcMap.get("C"), totalAbcMap.get("C")); |
| | | // 单辆车的单个业务单的信息结束 |
| | | } |
| | | Map paramMap = new HashMap(); |
| | | paramMap.put("str1",str1); |
| | | paramMap.put("str2",str2); |
| | | Wxhtmethod.post("192.168.112.21/api/xxx",paramMap); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor=Exception.class) |
| | | public ObjectResult<Boolean> delZCMX(String cardID, String yktywdh,JsonArray dataArr) throws Exception { |