| | |
| | | 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; |
| | |
| | | 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.common.JSONobj; |
| | | import com.mandi.common.Wxhtmethod; |
| | | import com.mandi.common.ParamFileter.BigDecimalfiter; |
| | |
| | | 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 |
| | |
| | | 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()); |