From f8d79370f941d8d6cb7d1feb7d4d4417df91a6ea Mon Sep 17 00:00:00 2001 From: Limy <1353020654@qq.com> Date: Tue, 26 Jan 2021 16:37:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=8D=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nanjing/TBdSubstationController.java | 69 +++++- .../TRpProductchangeinfoController.java | 44 +++- .../ProductChangeInfo/ProductChangeInfo.html | 76 +++--- .../nanjing/SubStation/SubStation.html | 224 ++---------------- .../templates/nanjing/SubStation/add.html | 143 ++--------- .../templates/nanjing/SubStation/edit.html | 132 ++--------- .../ruoyi/nanjing/domain/TBdSubstation.java | 19 ++ .../nanjing/mapper/TBdSubstationMapper.java | 12 + .../service/ITBdSubstationService.java | 12 + .../impl/TBdSubstationServiceImpl.java | 27 +++ .../mapper/nanjing/TBdSubstationMapper.xml | 106 ++++++--- 11 files changed, 344 insertions(+), 520 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java index 7a79284b..3cbbe3e2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java @@ -1,6 +1,16 @@ package com.ruoyi.web.controller.nanjing; +import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; + +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.nanjing.domain.TBdLinetype; +import com.ruoyi.nanjing.domain.TBdProductinfo; +import com.ruoyi.nanjing.domain.TBdStationtype; +import com.ruoyi.nanjing.service.ITBdLinetypeService; +import com.ruoyi.nanjing.service.ITBdStationtypeService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -33,11 +43,19 @@ public class TBdSubstationController extends BaseController @Autowired private ITBdSubstationService tBdSubstationService; + @Autowired + private ITBdLinetypeService linetypeService; + @Autowired + private ITBdStationtypeService stationtypeService; @RequiresPermissions("nanjing:SubStation:view") @GetMapping() - public String SubStation() + public String SubStation(ModelMap map) { + List linetypes = linetypeService.selectTBdLinetypeList(new TBdLinetype()); + List stationtypes = stationtypeService.selectTBdStationtypeList(new TBdStationtype()); + map.addAttribute("linename",linetypes); + map.addAttribute("stationtype",stationtypes); return prefix + "/SubStation"; } @@ -72,8 +90,23 @@ public class TBdSubstationController extends BaseController * 新增工位管理 */ @GetMapping("/add") - public String add() + public String add(ModelMap map) { + //工位序号+ + List list = tBdSubstationService.selectStationcode(); + int max = Convert.toInt(list.get(0).getStationID()); + list.get(0).setStationID(max+1L); + //排序id+ + List list1 = tBdSubstationService.selectOrderid(); + int max1 = Convert.toInt(list.get(0).getOrderID()); + list.get(0).setOrderID(max1+1L); + + List linetypes = linetypeService.selectTBdLinetypeList(new TBdLinetype()); + List stationtypes = stationtypeService.selectTBdStationtypeList(new TBdStationtype()); + map.addAttribute("si",list); + map.addAttribute("oi",list); + map.addAttribute("linename",linetypes); + map.addAttribute("stationtype",stationtypes); return prefix + "/add"; } @@ -86,7 +119,14 @@ public class TBdSubstationController extends BaseController @ResponseBody public AjaxResult addSave(TBdSubstation tBdSubstation) { - return toAjax(tBdSubstationService.insertTBdSubstation(tBdSubstation)); + int result = tBdSubstationService.insertTBdSubstation(tBdSubstation); + if (result>0){ + Map map = new HashMap(); + map.put("tableName",tBdSubstation.getTableName()); + map.put("ParaAmount",tBdSubstation.getParaCount()); + tBdSubstationService.createTable(map); + } + return toAjax(result); } /** @@ -95,6 +135,10 @@ public class TBdSubstationController extends BaseController @GetMapping("/edit/{ID}") public String edit(@PathVariable("ID") Long ID, ModelMap mmap) { + List linetypes = linetypeService.selectTBdLinetypeList(new TBdLinetype()); + List stationtypes = stationtypeService.selectTBdStationtypeList(new TBdStationtype()); + mmap.addAttribute("linename",linetypes); + mmap.addAttribute("stationtype",stationtypes); TBdSubstation tBdSubstation = tBdSubstationService.selectTBdSubstationById(ID); mmap.put("tBdSubstation", tBdSubstation); return prefix + "/edit"; @@ -109,7 +153,16 @@ public class TBdSubstationController extends BaseController @ResponseBody public AjaxResult editSave(TBdSubstation tBdSubstation) { - return toAjax(tBdSubstationService.updateTBdSubstation(tBdSubstation)); + tBdSubstation.setUpdateTime(new Date()); + int result = tBdSubstationService.updateTBdSubstation(tBdSubstation); + if(result>0){ + Map map = new HashMap(); + map.put("paraCount",tBdSubstation.getParaCount()); + map.put("tableName",tBdSubstation.getTableName()); + map.put("stationID",tBdSubstation.getStationID()); + tBdSubstationService.updateTable(map); + } + return toAjax(result); } /** @@ -121,6 +174,12 @@ public class TBdSubstationController extends BaseController @ResponseBody public AjaxResult remove(String ids) { - return toAjax(tBdSubstationService.deleteTBdSubstationByIds(ids)); + int result = tBdSubstationService.deleteTBdSubstationByIds(ids); + if(result>0){ + Map map = new HashMap(); + map.put("stationID",ids); + tBdSubstationService.deletePara(map); + } + return toAjax(result); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TRpProductchangeinfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TRpProductchangeinfoController.java index e1b16243..bde1b0f6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TRpProductchangeinfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TRpProductchangeinfoController.java @@ -4,6 +4,7 @@ import java.util.Date; import java.util.List; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.nanjing.domain.TBdProductinfo; import com.ruoyi.nanjing.service.ITBdProductinfoService; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -128,20 +129,57 @@ public class TRpProductchangeinfoController extends BaseController return toAjax(tRpProductchangeinfoService.updateTRpProductchangeinfo(tRpProductchangeinfo)); } + /** + * 机种切换开始 + */ @RequiresPermissions("nanjing:ProductChangeInfo:start") @PostMapping("/start") @ResponseBody public AjaxResult start(HttpServletRequest request){ String ids = request.getParameter("id"); + String msg = ""; TRpProductchangeinfo tRpProductchangeinfo = tRpProductchangeinfoService.selectTRpProductchangeinfoById(Convert.toLong(ids)); if(tRpProductchangeinfo.getBeginTime()==null){ tRpProductchangeinfo.setBeginTime(new Date()); - return toAjax(tRpProductchangeinfoService.updateTRpProductchangeinfo(tRpProductchangeinfo)); - }else{ - return toAjax(0); + tRpProductchangeinfo.setOperator(ShiroUtils.getLoginName()); + int res = tRpProductchangeinfoService.updateTRpProductchangeinfo(tRpProductchangeinfo); + if(res>0){ + msg = "已开始!"; + return AjaxResult.success(msg); + } + } + else + { + msg="不能重复开始!"; } + return AjaxResult.error(msg); } + /** + * 机种切换结束 + */ + @RequiresPermissions("nanjing:ProductChangeInfo:end") + @PostMapping("/end") + @ResponseBody + public AjaxResult end(HttpServletRequest request){ + String ids = request.getParameter("id"); + String msg = ""; + TRpProductchangeinfo tRpProductchangeinfo = tRpProductchangeinfoService.selectTRpProductchangeinfoById(Convert.toLong(ids)); + if(tRpProductchangeinfo.getBeginTime()==null){ + msg= "未开始,不能结束!"; + } + else + { + tRpProductchangeinfo.setEndTime(new Date()); + tRpProductchangeinfo.setOperator(ShiroUtils.getLoginName()); + int res = tRpProductchangeinfoService.updateTRpProductchangeinfo(tRpProductchangeinfo); + if(res>0){ + msg = "已结束!"; + return AjaxResult.success(msg); + } + } + return AjaxResult.error(msg); + } /** * 删除机种切换管理 */ diff --git a/ruoyi-admin/src/main/resources/templates/nanjing/ProductChangeInfo/ProductChangeInfo.html b/ruoyi-admin/src/main/resources/templates/nanjing/ProductChangeInfo/ProductChangeInfo.html index 48011b74..67a8d1ef 100644 --- a/ruoyi-admin/src/main/resources/templates/nanjing/ProductChangeInfo/ProductChangeInfo.html +++ b/ruoyi-admin/src/main/resources/templates/nanjing/ProductChangeInfo/ProductChangeInfo.html @@ -6,50 +6,10 @@
-
-
-
- -
-
+ - - - - - - - - - - - - -
@@ -123,10 +83,34 @@ contentType: false, processData: false, dataType: "json", - success: function (res) { - console.log(res) - if (res >0) + success: function (result) { + console.log(result.msg); + if (result.code == web_status.SUCCESS){ + $.table.refresh(); + }else{ + alert(result.msg); + } + } + }) + } + + function endP(id){ + var formData = new FormData(); + formData.append("id",id); + $.ajax({ + type: "post", + url: prefix+"/end", + data: formData, + contentType: false, + processData: false, + dataType: "json", + success: function (result) { + console.log(result.msg); + if (result.code == web_status.SUCCESS){ $.table.refresh(); + }else{ + alert(result.msg); + } } }) } diff --git a/ruoyi-admin/src/main/resources/templates/nanjing/SubStation/SubStation.html b/ruoyi-admin/src/main/resources/templates/nanjing/SubStation/SubStation.html index ff61400e..12945743 100644 --- a/ruoyi-admin/src/main/resources/templates/nanjing/SubStation/SubStation.html +++ b/ruoyi-admin/src/main/resources/templates/nanjing/SubStation/SubStation.html @@ -2,6 +2,7 @@ +
@@ -11,146 +12,43 @@
    - - + + -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • - - - - - - -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - - +
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • + 新增工位  搜索 -  重置 +  查询全部
- -
+ \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/nanjing/SubStation/edit.html b/ruoyi-admin/src/main/resources/templates/nanjing/SubStation/edit.html index ee9f13ed..78d67cd2 100644 --- a/ruoyi-admin/src/main/resources/templates/nanjing/SubStation/edit.html +++ b/ruoyi-admin/src/main/resources/templates/nanjing/SubStation/edit.html @@ -8,129 +8,35 @@
- +
- +
-
- -
- -
-
-
- -
- - 代码生成请选择字典属性 -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
+
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- +
- +
- +
- + - 代码生成请选择字典属性
- +
- +
@@ -146,21 +52,19 @@
- +
- -
-
-
- -
- +
- +
- +
diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/TBdSubstation.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/TBdSubstation.java index 33bde55a..9c96d1b5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/TBdSubstation.java +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/domain/TBdSubstation.java @@ -116,6 +116,25 @@ public class TBdSubstation extends BaseEntity // @Excel(name = "图片路径") private String ImageUrl; + public TBdLinetype getLinetype() { + return linetype; + } + + public void setLinetype(TBdLinetype linetype) { + this.linetype = linetype; + } + + public TBdStationtype getStationtype() { + return stationtype; + } + + public void setStationtype(TBdStationtype stationtype) { + this.stationtype = stationtype; + } + + private TBdLinetype linetype; + + private TBdStationtype stationtype; @Override public Date getUpdateTime() { return UpdateTime; diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/mapper/TBdSubstationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/mapper/TBdSubstationMapper.java index d4b286ef..0c5829d7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/nanjing/mapper/TBdSubstationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/mapper/TBdSubstationMapper.java @@ -1,6 +1,8 @@ package com.ruoyi.nanjing.mapper; import java.util.List; +import java.util.Map; + import com.ruoyi.nanjing.domain.TBdSubstation; /** @@ -58,4 +60,14 @@ public interface TBdSubstationMapper * @return 结果 */ public int deleteTBdSubstationByIds(String[] IDs); + + List selectStationcode(); + + List selectOrderid(); + + void createTable(Map map); + + void updateTable(Map map); + + void deletePara(Map map); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/ITBdSubstationService.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/ITBdSubstationService.java index fefa76a2..336c6772 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/ITBdSubstationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/ITBdSubstationService.java @@ -1,6 +1,8 @@ package com.ruoyi.nanjing.service; import java.util.List; +import java.util.Map; + import com.ruoyi.nanjing.domain.TBdSubstation; /** @@ -58,4 +60,14 @@ public interface ITBdSubstationService * @return 结果 */ public int deleteTBdSubstationById(Long ID); + + List selectStationcode(); + + List selectOrderid(); + + void createTable(Map map); + + void updateTable(Map map); + + void deletePara(Map map); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/impl/TBdSubstationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/impl/TBdSubstationServiceImpl.java index 8be8f691..ceefdc7b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/impl/TBdSubstationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/nanjing/service/impl/TBdSubstationServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.nanjing.service.impl; import java.util.List; +import java.util.Map; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.nanjing.mapper.TBdSubstationMapper; @@ -91,4 +93,29 @@ public class TBdSubstationServiceImpl implements ITBdSubstationService { return tBdSubstationMapper.deleteTBdSubstationById(ID); } + + @Override + public List selectStationcode() { + return tBdSubstationMapper.selectStationcode(); + } + + @Override + public List selectOrderid() { + return tBdSubstationMapper.selectOrderid(); + } + + @Override + public void createTable(Map map) { + tBdSubstationMapper.createTable(map); + } + + @Override + public void updateTable(Map map) { + tBdSubstationMapper.updateTable(map); + } + + @Override + public void deletePara(Map map) { + tBdSubstationMapper.deletePara(map); + } } diff --git a/ruoyi-system/src/main/resources/mapper/nanjing/TBdSubstationMapper.xml b/ruoyi-system/src/main/resources/mapper/nanjing/TBdSubstationMapper.xml index bc960beb..e1f2cc97 100644 --- a/ruoyi-system/src/main/resources/mapper/nanjing/TBdSubstationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/nanjing/TBdSubstationMapper.xml @@ -32,47 +32,97 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + - select ID, StationID, StationCode, StationType, MachineID, UniteID, CustomerCode, StationName, ParentStationID, ParentStationCode, ParentStationName, PreStationID, PreStationCode, Reamark, UserID, UpdateTime, TableName, IsSemi, IsNGStation, HaveData, IsShow, UseFlag, paraCount, OrderID, LimitID, ImageUrl, LineID from T_BD_SubStation + select t1.ID,t1.StationID, t1.StationCode, t1.StationType, t1.MachineID, t1.UniteID, + t1.CustomerCode, t1.StationName, t1.ParentStationID, t1.ParentStationCode, t1.ParentStationName, + t1.PreStationID, t1.PreStationCode, t1.Reamark, t1.UserID, t1.UpdateTime, t1.TableName, t1.IsSemi, + t1.IsNGStation, t1.HaveData, t1.IsShow, t1.UseFlag, t1.paraCount, t1.OrderID,t1.LimitID, t1.ImageUrl, t1.LineID, + t2.LineTypeName,t3.Type_Name from T_BD_SubStation t1 + left join T_BD_LineType t2 on t1.LineID = t2.LineID + left join T_BD_StationType t3 on t1.StationType = t3.ID + + + + + + + { + call SP_Pro_UpdateParaTable( + #{paraCount,mode=IN,jdbcType=BIGINT}, + #{tableName,mode=IN,jdbcType=VARCHAR}, + #{stationID,mode=IN,jdbcType=BIGINT} + ) + } + + + { + call SP_Pro_DeleteStationPara( + #{stationID,mode=IN,jdbcType=VARCHAR} + ) + } +