diff --git a/src/main/java/com/zzjee/tms/controller/TmsYwDingdanController.java b/src/main/java/com/zzjee/tms/controller/TmsYwDingdanController.java index 6731c1c8..6adb1717 100644 --- a/src/main/java/com/zzjee/tms/controller/TmsYwDingdanController.java +++ b/src/main/java/com/zzjee/tms/controller/TmsYwDingdanController.java @@ -1,10 +1,16 @@ package com.zzjee.tms.controller; import com.alibaba.fastjson.JSONArray; +import com.zzjee.md.entity.MdGoodsEntity; import com.zzjee.tms.entity.DdPage; import com.zzjee.tms.entity.TmsMdDzEntity; import com.zzjee.tms.entity.TmsYwDingdanEntity; import com.zzjee.tms.service.TmsYwDingdanServiceI; +import com.zzjee.wm.entity.WmOmNoticeHEntity; +import com.zzjee.wm.entity.WmOmNoticeIEntity; +import com.zzjee.wm.entity.WmTmsNoticeHEntity; +import com.zzjee.wm.service.WmOmNoticeHServiceI; +import com.zzjee.wmutil.wmUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -75,8 +81,9 @@ public class TmsYwDingdanController extends BaseController { private Validator validator; @Autowired private CgFormFieldServiceI cgFormFieldService; - + @Autowired + private WmOmNoticeHServiceI wmOmNoticeHService; /** * 运输订单列表 页面跳转 @@ -397,10 +404,77 @@ public class TmsYwDingdanController extends BaseController { tmsYwDingdanService.updateEntitie(tmsYwDingdan); systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); } - for(String id1:id.split(",")) { + Map maphz = new HashMap<>(); + + for(String id1:id.split(",")) {//计算总货主和单数 + TmsYwDingdanEntity tmsYwDingdan1 = systemService.getEntity(TmsYwDingdanEntity.class, + id1); + WmTmsNoticeHEntity wmsom = systemService.findUniqueByProperty(WmTmsNoticeHEntity.class,"omNoticeId",tmsYwDingdan1.getFadh()); + if(!maphz.containsKey(wmsom.getCusCode())){ + maphz.put(wmsom.getCusCode(),wmsom.getOmNoticeId()); + }else{ + String ys = maphz.get(wmsom.getCusCode()); + ys = ys+";"+wmsom.getOmNoticeId(); + maphz.put(wmsom.getCusCode(),ys); + } + } + Set keySets = maphz.keySet(); + Iterator ki = keySets.iterator(); + while(ki.hasNext()){ + String mapkey = ki.next(); + String mapvv = maphz.get(mapkey); + String[] strva= mapkey.split(";"); + String sqla = "(" ; + for(int a = 0;a> resultz = systemService + .findForJdbc(tsql); + System.out.print("****************tsqlz" + tsql); + WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity(); + String noticeid = wmUtil.getNextomNoticeId(""); + wmOmNoticeH.setOmNoticeId(noticeid); + List wmOmNoticeIListnew = new ArrayList<>(); + wmOmNoticeH.setCusCode(mapkey); + if (resultz != null && resultz.size() > 0) { + for (int i = 0; i < resultz.size(); i++) { + WmOmNoticeIEntity t = new WmOmNoticeIEntity(); + String goods_id = ""; + try { + goods_id= resultz.get(i) + .get("goods_id").toString() ; + } catch (Exception e) { + + } + String bin_qua = resultz.get(i) + .get("goodsqua").toString(); + t.setGoodsId(goods_id); + t.setGoodsQua(bin_qua); + wmOmNoticeIListnew.add(t); + } + } + + + + + + wmOmNoticeHService.addMain(wmOmNoticeH, wmOmNoticeIListnew); + } + + + }catch(Exception e){ e.printStackTrace(); message = "运输订单派车失败"; diff --git a/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java b/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java index 907aa33c..8ee6e96f 100644 --- a/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java +++ b/src/main/java/com/zzjee/wm/controller/WmOmNoticeHController.java @@ -2446,7 +2446,7 @@ public class WmOmNoticeHController extends BaseController { ResultDO D0 = new ResultDO(); //保存 List wmOmNoticeIList = wmOmNoticeHPage.getWmOmNoticeIList(); - String noticeid = wmUtil.getNextomNoticeId(wmOmNoticeHPage.getOrderTypeCode()); + String noticeid = wmUtil.getNextomNoticeIdtms(wmOmNoticeHPage.getOrderTypeCode()); wmOmNoticeHPage.setOmNoticeId(noticeid); WmTmsNoticeHEntity wmOmNoticeH = new WmTmsNoticeHEntity(); try{ diff --git a/src/main/java/com/zzjee/wmutil/wmUtil.java b/src/main/java/com/zzjee/wmutil/wmUtil.java index 6a21b425..5629c623 100644 --- a/src/main/java/com/zzjee/wmutil/wmUtil.java +++ b/src/main/java/com/zzjee/wmutil/wmUtil.java @@ -110,7 +110,44 @@ public class wmUtil { return noticeid; } + public static String getNextomNoticeIdtms(String orderType){ + SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class); + Map countMap = systemService + .findOneForJdbc("SELECT cast(right(ifnull((om_notice_id),0),4)+1 as SIGNED) as count FROM tms_om_notice_h t where TO_DAYS(t.create_date) = TO_DAYS(NOW()) order by create_date desc limit 1"); + String noticeid = null; + int newcount = 1; + try{ + newcount= ((Long) countMap.get("count")).intValue(); + }catch (Exception e){ + } + if (StringUtil.isEmpty(orderType)){ + orderType = "11"; + } + if(orderType.equals("19")){ + noticeid = "QTCK" + + DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd) + + "-" + + StringUtil.leftPad( + newcount, 4, + '0'); + }else if (orderType.equals("11")){ + noticeid = "CK" + + DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd) + + "-" + + StringUtil.leftPad( + newcount, 4, + '0'); + }else { + noticeid = "QT" + + DateUtils.date2Str(new Date(), DateUtils.yyyyMMdd) + + "-" + + StringUtil.leftPad( + newcount, 4, + '0'); + } + return noticeid; + } public static String getNextomNoticeId(String orderType){ SystemService systemService =ApplicationContextUtil.getContext().getBean(SystemService.class); Map countMap = systemService