From 57ea4dbfb85f1d8a9d538199bfe20fd901fa8516 Mon Sep 17 00:00:00 2001 From: e Date: Sun, 23 Sep 2018 23:49:42 +0800 Subject: [PATCH] =?UTF-8?q?1,=E6=A0=B9=E6=8D=AE=E6=95=88=E6=9C=9F=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E8=BD=AC=E7=A7=BB=E4=BB=BB=E5=8A=A1=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WmToMoveGoodsController.java | 33 +++++++- .../com/zzjee/wm/entity/WvStockEntity.java | 12 ++- .../system/sms/util/task/GoodsMoveTask.java | 81 +++++++++++-------- .../com/zzjee/wm/wmToMoveGoodsList.jsp | 35 ++++++++ 4 files changed, 125 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/zzjee/wm/controller/WmToMoveGoodsController.java b/src/main/java/com/zzjee/wm/controller/WmToMoveGoodsController.java index a17f3687..82730d44 100644 --- a/src/main/java/com/zzjee/wm/controller/WmToMoveGoodsController.java +++ b/src/main/java/com/zzjee/wm/controller/WmToMoveGoodsController.java @@ -157,7 +157,36 @@ public class WmToMoveGoodsController extends BaseController { j.setMsg(message); return j; } - + + /** + * 批量删除库存转移 + * + * @return + */ + @RequestMapping(params = "doBatchUpdate") + @ResponseBody + public AjaxJson doBatchUpdate(String ids,String moveSta,HttpServletRequest request){ + String message = null; + AjaxJson j = new AjaxJson(); + message = "批量设置状态成功"; + try{ + for(String id:ids.split(",")){ + WmToMoveGoodsEntity wmToMoveGoods = systemService.getEntity(WmToMoveGoodsEntity.class, + id + ); + wmToMoveGoods.setMoveSta(moveSta); + wmToMoveGoodsService.updateEntitie(wmToMoveGoods); + systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); + } + }catch(Exception e){ + e.printStackTrace(); + message = "批量设置状态失败"; + throw new BusinessException(e.getMessage()); + } + j.setMsg(message); + return j; + } + /** * 批量删除库存转移 * @@ -188,6 +217,8 @@ public class WmToMoveGoodsController extends BaseController { } + + @RequestMapping(params = "doGetstock", method = { RequestMethod.GET, RequestMethod.POST }) @ResponseBody diff --git a/src/main/java/com/zzjee/wm/entity/WvStockEntity.java b/src/main/java/com/zzjee/wm/entity/WvStockEntity.java index 86752199..1046e429 100644 --- a/src/main/java/com/zzjee/wm/entity/WvStockEntity.java +++ b/src/main/java/com/zzjee/wm/entity/WvStockEntity.java @@ -71,6 +71,9 @@ public class WvStockEntity implements java.io.Serializable { /**保质期*/ @Excel(name="保质期") private java.lang.String bzhiQi; + //允收天数 + private java.lang.String yushoutianshu; + /**单位*/ @Excel(name="单位") private java.lang.String goodsUnit; @@ -363,5 +366,12 @@ public class WvStockEntity implements java.io.Serializable { public void setMoveSta(java.lang.String moveSta) { this.moveSta = moveSta; } - + @Column(name ="yushoutianshu",nullable=true,length=36) + public String getYushoutianshu() { + return yushoutianshu; + } + + public void setYushoutianshu(String yushoutianshu) { + this.yushoutianshu = yushoutianshu; + } } diff --git a/src/main/java/org/jeecgframework/web/system/sms/util/task/GoodsMoveTask.java b/src/main/java/org/jeecgframework/web/system/sms/util/task/GoodsMoveTask.java index c6648d5b..c97780f7 100644 --- a/src/main/java/org/jeecgframework/web/system/sms/util/task/GoodsMoveTask.java +++ b/src/main/java/org/jeecgframework/web/system/sms/util/task/GoodsMoveTask.java @@ -61,40 +61,53 @@ public class GoodsMoveTask { org.jeecgframework.core.util.LogUtil.info("转移定时任务总耗时" + times + "毫秒"); } public void goodsMove(String binstrore,String moveStatus ){ + //转移到B + String tsql = "SELECT id FROM zzjee.wv_stock_stt " + + "where yushoutianshu <> bzhi_qi " + + "and bzhi_qi > 0 " + + "and bin_id = 'A' " + + "and to_days(`goods_pro_data` + interval (bzhi_qi - yushoutianshu) day) < to_days(now()) " + + "and to_days(`goods_pro_data` + interval (bzhi_qi ) day) > to_days(now())"; + this.genGoodsMove(tsql,"B","",moveStatus); - String tsql = ""; - List> resulmove = systemService - .findForJdbc(tsql, binstrore); - //生成任务 - for (int i = 0; i < resulmove.size(); i++) { - - WvStockEntity t = systemService.get(WvStockEntity.class,resulmove.get(i).get("id").toString()); - try { - WmToMoveGoodsEntity wmtomove = new WmToMoveGoodsEntity(); - wmtomove.setOrderTypeCode("TPZY"); - wmtomove.setBinFrom(t.getKuWeiBianMa()); - wmtomove.setBinTo(t.getKuWeiBianMa()); - wmtomove.setCusCode(t.getCusCode()); - wmtomove.setCusName(t.getZhongWenQch()); - wmtomove.setToCusCode(t.getCusCode()); - wmtomove.setToCusName(t.getZhongWenQch()); - wmtomove.setGoodsId(t.getGoodsId()); - wmtomove.setGoodsName(t.getShpMingCheng()); - wmtomove.setGoodsProData(t.getGoodsProData()); - wmtomove.setGoodsQua(t.getGoodsQua().toString()); - wmtomove.setGoodsUnit(t.getGoodsUnit()); - wmtomove.setBaseGoodscount(t.getGoodsQua().toString()); - wmtomove.setBaseUnit(t.getGoodsUnit()); - wmtomove.setMoveSta(moveStatus); - wmtomove.setTinFrom(t.getBinId()); - wmtomove.setTinId("B"); - systemService.save(wmtomove); - }catch (Exception e){ - } - - - - } - + //转移到C + tsql = "SELECT id FROM zzjee.wv_stock_stt " + + "where yushoutianshu <> bzhi_qi " + + "and bzhi_qi > 0 " + + "and bin_id in ('A','B') " + + "and to_days(`goods_pro_data` + interval (bzhi_qi ) day) <= to_days(now())"; + this.genGoodsMove(tsql,"C","",moveStatus); } + + private void genGoodsMove(String Tsql,String TinId,String binstrore,String moveStatus ){ + List> resulmovea = systemService + .findForJdbc(Tsql, binstrore); + //生成任务转B + for (int i = 0; i < resulmovea.size(); i++) { + WvStockEntity t = systemService.get(WvStockEntity.class,resulmovea.get(i).get("id").toString()); + try { + WmToMoveGoodsEntity wmtomove = new WmToMoveGoodsEntity(); + wmtomove.setOrderTypeCode("TPZY"); + wmtomove.setBinFrom(t.getKuWeiBianMa()); + wmtomove.setBinTo(t.getKuWeiBianMa()); + wmtomove.setCusCode(t.getCusCode()); + wmtomove.setCusName(t.getZhongWenQch()); + wmtomove.setToCusCode(t.getCusCode()); + wmtomove.setToCusName(t.getZhongWenQch()); + wmtomove.setGoodsId(t.getGoodsId()); + wmtomove.setGoodsName(t.getShpMingCheng()); + wmtomove.setGoodsProData(t.getGoodsProData()); + wmtomove.setGoodsQua(t.getGoodsQua().toString()); + wmtomove.setGoodsUnit(t.getGoodsUnit()); + wmtomove.setBaseGoodscount(t.getGoodsQua().toString()); + wmtomove.setBaseUnit(t.getGoodsUnit()); + wmtomove.setMoveSta(moveStatus); + wmtomove.setTinFrom(t.getBinId()); + wmtomove.setTinId(TinId); + systemService.save(wmtomove); + }catch (Exception e){ + } + } + + } } diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmToMoveGoodsList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmToMoveGoodsList.jsp index c5d1a0a4..45c07f53 100644 --- a/src/main/webapp/webpage/com/zzjee/wm/wmToMoveGoodsList.jsp +++ b/src/main/webapp/webpage/com/zzjee/wm/wmToMoveGoodsList.jsp @@ -43,6 +43,7 @@ + @@ -58,6 +59,40 @@ }); + function dobatchUpdate(){ + var moveSta = "已完成"; + + var ids = []; + var rows = $('#wmToMoveGoodsList').datagrid('getSelections'); + + for(var i=0; i