From 3607120391262c67d354a2f9dcf477fddebf972f Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Mon, 11 Sep 2023 09:37:01 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=A8=A1=E5=9D=97(?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E6=9F=A5=E8=AF=A2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml index d37c4669..181039a5 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml @@ -45,8 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and plan_factory_code = #{planFactoryCode} and factory_code = #{factoryCode} and order_type = #{orderType} - and order_code = #{orderCode} - and prod_code = #{prodCode} + and order_code like concat('%', #{orderCode}, '%') + and prod_code like concat('%', #{prodCode}, '%') and prod_desc like concat('%', #{prodDesc}, '%') and quantity = #{quantity} and unit = #{unit} From aae8fc7dc1c4631c44aeb113d6722e68f5d6ac72 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Mon, 11 Sep 2023 10:58:47 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=A8=A1=E5=9D=97(?= =?UTF-8?q?=E8=BD=A6=E6=95=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/op/plan/domain/ProOrder.java | 12 ++++++++++++ .../java/com/op/plan/domain/ProOrderWorkorder.java | 12 ++++++++++++ .../java/com/op/plan/domain/dto/ProOrderDTO.java | 10 ++++++++++ .../op/plan/service/impl/ProOrderServiceImpl.java | 6 ++++++ .../service/impl/ProOrderWorkorderServiceImpl.java | 7 +++++++ .../main/resources/mapper/plan/ProOrderMapper.xml | 5 ++++- .../mapper/plan/ProOrderWorkorderMapper.xml | 6 +++++- 7 files changed, 56 insertions(+), 2 deletions(-) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java index 145b8157..9a7b387f 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java @@ -132,6 +132,17 @@ public class ProOrder extends TreeEntity { @Excel(name = "更新日期", width = 20, dateFormat = "yyyy-MM-dd") private Date updateTime; + // 车数 + private Integer carNum; + + public Integer getCarNum() { + return carNum; + } + + public void setCarNum(Integer carNum) { + this.carNum = carNum; + } + @Override public Date getCreateTime() { return createTime; @@ -324,6 +335,7 @@ public class ProOrder extends TreeEntity { .append("prodSpc", getProdSpc()) .append("planDateStart",getPlanDateStart()) .append("planDateEnd",getPlanDateEnd()) + .append("carNum",getCarNum()) .toString(); } } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java index 39756518..f3f03736 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java @@ -148,6 +148,17 @@ public class ProOrderWorkorder extends TreeEntity { /** 班次名称(数据库无该字段,需自行查询) */ private String shiftDesc; + // 车数 + private Integer carNum; + + public Integer getCarNum() { + return carNum; + } + + public void setCarNum(Integer carNum) { + this.carNum = carNum; + } + // 料罐id(湿料计划模块使用) private Integer bucketId; @@ -512,6 +523,7 @@ public class ProOrderWorkorder extends TreeEntity { .append("bucketName",getBucketName()) .append("routeName",getRouteName()) .append("prodLineName",getProdLineName()) + .append("carNum",getCarNum()) .toString(); } } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/ProOrderDTO.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/ProOrderDTO.java index c85166b5..a2632e3e 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/ProOrderDTO.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/ProOrderDTO.java @@ -63,6 +63,16 @@ public class ProOrderDTO { private String planFactoryCode; + private Integer carNum; + + public Integer getCarNum() { + return carNum; + } + + public void setCarNum(Integer carNum) { + this.carNum = carNum; + } + public String getPlanFactoryCode() { return planFactoryCode; } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index bc9b61fa..e6460f26 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -154,6 +154,12 @@ public class ProOrderServiceImpl implements IProOrderService { workOrder.setWorkorderCode(proOrder.getOrderCode() + "-" + endCode); // 3.设置父工单 workOrder.setParentOrder(parentOrder.toString()); + // 工单对应车数-白坯订单操作 + if (proOrder.getProdType().equals("white")) { + int everyNum = (int) Math.ceil(proOrder.getQuantity() / proOrder.getCarNum()); + int carNum = (int) Math.ceil(splitOrderDTO.getSplitNum() / everyNum); + workOrder.setCarNum(carNum); + } // 将工单信息更新至数据库 proOrderWorkorderMapper.insertProOrderWorkorder(workOrder); // 生成批次表信息并更新至数据库 diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java index 293ce3f1..7ed4ab9c 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java @@ -525,6 +525,13 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { if (splitOrderDTO.getRouteCode() != null){ proOrderWorkorder.setRouteCode(splitOrderDTO.getRouteCode()); } + // 白坯工单返修-车数 + if (proOrderWorkorder.getProdType().equals("white")) { + int everyNum = (int) Math.ceil(proOrder.getQuantity() / proOrder.getCarNum()); + int carNum = (int) Math.ceil(splitOrderDTO.getSplitNum() / everyNum); + proOrderWorkorder.setCarNum(carNum); + } + proOrderWorkorderMapper.updateProOrderWorkorder(proOrderWorkorder); // System.out.println("这里是workorderCode------------》"+proOrderWorkorder.getWorkorderCode()); diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml index 181039a5..b9ced4b7 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml @@ -29,13 +29,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select id, plan_factory_code, order_type, order_code, prod_code, prod_desc, quantity, quantity_split, unit, worker_order, plan_pro_date, plan_complete, atrr1, atrr2, atrr3, status, parent_order, create_by, create_time, update_by, update_time, prod_type, - factory_code, prod_spc + factory_code, prod_spc ,car_num from pro_order @@ -197,6 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time, prod_type, prod_spc, + car_num, #{id}, @@ -223,6 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateTime}, #{prodType}, #{prodSpc}, + #{carNum}, diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index 2f52d1a4..645f97de 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -36,13 +36,14 @@ + select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name, product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date, shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, - update_by, update_time, prod_type, factory_code , end_flag + update_by, update_time, prod_type, factory_code , end_flag , car_num from pro_order_workorder @@ -184,6 +185,7 @@ prod_type, factory_code, end_flag, + car_num, #{workorderId}, @@ -217,6 +219,7 @@ #{prodType}, #{factoryCode}, #{endFlag}, + #{carNum}, @@ -368,6 +371,7 @@ prod_type = #{prodType}, factory_code = #{factoryCode}, end_flag = #{endFlag}, + car_num = #{carNum}, where workorder_id = #{workorderId} From 9771ab2ff308be42cefd5f71ff27eb6c89f6b6f2 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Mon, 11 Sep 2023 15:49:09 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=A4=87=E6=96=99?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MesPrepareDetailController.java | 11 +++++++ .../com/op/mes/domain/vo/PrintPrepareVo.java | 32 +++++++++++++++++++ .../op/mes/mapper/MesPrepareDetailMapper.java | 8 +++++ .../com/op/mes/mapper/MesPrepareMapper.java | 8 +++++ .../mes/service/IMesPrepareDetailService.java | 8 +++++ .../impl/MesPrepareDetailServiceImpl.java | 23 +++++++++++++ .../mapper/mes/MesPrepareDetailMapper.xml | 13 ++++++-- .../resources/mapper/mes/MesPrepareMapper.xml | 7 +++- 8 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/domain/vo/PrintPrepareVo.java diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesPrepareDetailController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesPrepareDetailController.java index 5d5c634e..2382a30d 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesPrepareDetailController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesPrepareDetailController.java @@ -33,6 +33,17 @@ public class MesPrepareDetailController extends BaseController { @Autowired private IMesPrepareDetailService mesPrepareDetailService; + /** + * 通过备料工单code打印备料单 + * @return + */ + @RequiresPermissions("mes:prepareDetail:export") + @Log(title = "mes备料打印", businessType = BusinessType.EXPORT) + @GetMapping("/printPrepareByCode/{workorderCode}") + public AjaxResult printPrepareByCode(@PathVariable("workorderCode") String workorderCode) { + return mesPrepareDetailService.printPrepareByCode(workorderCode); + } + /** * 查询mes备料单明细列表 */ diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/PrintPrepareVo.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/PrintPrepareVo.java new file mode 100644 index 00000000..0c2733e4 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/PrintPrepareVo.java @@ -0,0 +1,32 @@ +package com.op.mes.domain.vo; + +import com.op.mes.domain.MesPrepare; +import com.op.mes.domain.MesPrepareDetail; + +import java.util.Date; +import java.util.List; + +// 打印备料单返回实体 +public class PrintPrepareVo { + private MesPrepare mesPrepare; + private List mesPrepareDetailList; + + public PrintPrepareVo() { + } + + public MesPrepare getMesPrepare() { + return mesPrepare; + } + + public void setMesPrepare(MesPrepare mesPrepare) { + this.mesPrepare = mesPrepare; + } + + public List getMesPrepareDetailList() { + return mesPrepareDetailList; + } + + public void setMesPrepareDetailList(List mesPrepareDetailList) { + this.mesPrepareDetailList = mesPrepareDetailList; + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareDetailMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareDetailMapper.java index 94088b91..dcf271f2 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareDetailMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareDetailMapper.java @@ -2,6 +2,7 @@ package com.op.mes.mapper; import java.util.List; +import com.baomidou.dynamic.datasource.annotation.DS; import com.op.mes.domain.MesPrepareDetail; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -63,4 +64,11 @@ public interface MesPrepareDetailMapper { public int deleteMesPrepareDetailByRecordIds(String[] recordIds); public void insertMesPrepareDetails(@Param("list") List details); + + /** + * 通过主领料单id查询领料详情list + * @param prepareId + * @return + */ + List selectPrintPrepareDetailList(String prepareId); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareMapper.java index 3d7e2795..dd11c6ce 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesPrepareMapper.java @@ -2,6 +2,7 @@ package com.op.mes.mapper; import java.util.List; +import com.baomidou.dynamic.datasource.annotation.DS; import com.op.mes.domain.MesPrepare; import org.apache.ibatis.annotations.Mapper; @@ -62,4 +63,11 @@ public interface MesPrepareMapper { public int deleteMesPrepareByPrepareIds(String[] prepareIds); public List getParentWorkOrderT1(MesPrepare qo); + + /** + * 通过工单code查询主领料信息 + * @param workorderCode + * @return + */ + MesPrepare selectMesPrepareByCode(String workorderCode); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesPrepareDetailService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesPrepareDetailService.java index 75b0c857..4e0dae19 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesPrepareDetailService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesPrepareDetailService.java @@ -1,6 +1,8 @@ package com.op.mes.service; import java.util.List; + +import com.op.common.core.web.domain.AjaxResult; import com.op.mes.domain.MesPrepareDetail; /** @@ -57,4 +59,10 @@ public interface IMesPrepareDetailService { * @return 结果 */ public int deleteMesPrepareDetailByRecordId(String recordId); + + /** + * 通过备料工单code打印备料单 + * @return + */ + AjaxResult printPrepareByCode(String workorderCode); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareDetailServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareDetailServiceImpl.java index bda7f3fc..fe9e9250 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareDetailServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareDetailServiceImpl.java @@ -1,7 +1,13 @@ package com.op.mes.service.impl; import java.util.List; + +import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; +import com.op.common.core.web.domain.AjaxResult; +import com.op.mes.domain.MesPrepare; +import com.op.mes.domain.vo.PrintPrepareVo; +import com.op.mes.mapper.MesPrepareMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.mes.mapper.MesPrepareDetailMapper; @@ -18,6 +24,8 @@ import com.op.mes.service.IMesPrepareDetailService; public class MesPrepareDetailServiceImpl implements IMesPrepareDetailService { @Autowired private MesPrepareDetailMapper mesPrepareDetailMapper; + @Autowired + private MesPrepareMapper mesPrepareMapper; /** * 查询mes备料单明细 @@ -86,4 +94,19 @@ public class MesPrepareDetailServiceImpl implements IMesPrepareDetailService { public int deleteMesPrepareDetailByRecordId(String recordId) { return mesPrepareDetailMapper.deleteMesPrepareDetailByRecordId(recordId); } + + /** + * 通过备料工单code打印备料单 + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult printPrepareByCode(String workorderCode) { + MesPrepare mesPrepare = mesPrepareMapper.selectMesPrepareByCode(workorderCode); + List mesPrepareDetailList = mesPrepareDetailMapper.selectPrintPrepareDetailList(mesPrepare.getPrepareId()); + PrintPrepareVo printPrepareVo = new PrintPrepareVo(); + printPrepareVo.setMesPrepare(mesPrepare); + printPrepareVo.setMesPrepareDetailList(mesPrepareDetailList); + return AjaxResult.success(printPrepareVo); + } } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareDetailMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareDetailMapper.xml index 4aa93c7a..61756be1 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareDetailMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareDetailMapper.xml @@ -8,8 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - + + @@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -61,6 +62,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where record_id = #{recordId} + + insert into mes_prepare_detail diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareMapper.xml index d103763c..85b01bd1 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesPrepareMapper.xml @@ -110,7 +110,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and CONVERT(varchar(100), product_date, 23) = #{dayStr} - + + + insert into mes_prepare prepare_id, From e4b411850497eff3e8a491307f64feddc4a5b9bd Mon Sep 17 00:00:00 2001 From: A0010407 Date: Mon, 11 Sep 2023 17:20:34 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=8A=A5=E5=B7=A5-?= =?UTF-8?q?=E7=8F=AD=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/controller/BaseTeamTController.java | 2 + .../controller/BaseTeamUserController.java | 109 +++++++++++++++++ .../java/com/op/wms/domain/BaseTeamT.java | 22 ++++ .../java/com/op/wms/domain/BaseTeamUser.java | 86 +++++++++++++ .../com/op/wms/mapper/BaseTeamTMapper.java | 3 + .../com/op/wms/mapper/BaseTeamUserMapper.java | 71 +++++++++++ .../com/op/wms/service/IBaseTeamTService.java | 1 + .../op/wms/service/IBaseTeamUserService.java | 62 ++++++++++ .../service/impl/BaseTeamTServiceImpl.java | 38 +++++- .../service/impl/BaseTeamUserServiceImpl.java | 103 ++++++++++++++++ .../mapper/wms/BaseTeamUserMapper.xml | 113 ++++++++++++++++++ 11 files changed, 609 insertions(+), 1 deletion(-) create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamUserController.java create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamUser.java create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamUserMapper.java create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamUserService.java create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamUserServiceImpl.java create mode 100644 op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamUserMapper.xml diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamTController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamTController.java index 6a023701..ed102dc9 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamTController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamTController.java @@ -2,6 +2,8 @@ package com.op.wms.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.op.wms.domain.BaseTeamUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamUserController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamUserController.java new file mode 100644 index 00000000..0a60cc91 --- /dev/null +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamUserController.java @@ -0,0 +1,109 @@ +package com.op.wms.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.op.common.log.annotation.Log; +import com.op.common.log.enums.BusinessType; +import com.op.common.security.annotation.RequiresPermissions; +import com.op.wms.domain.BaseTeamUser; +import com.op.wms.service.IBaseTeamUserService; +import com.op.common.core.web.controller.BaseController; +import com.op.common.core.web.domain.AjaxResult; +import com.op.common.core.utils.poi.ExcelUtil; +import com.op.common.core.web.page.TableDataInfo; + +/** + * 班组人员Controller + * + * @author Open Platform + * @date 2023-08-29 + */ +@RestController +@RequestMapping("/teamUser") +public class BaseTeamUserController extends BaseController { + @Autowired + private IBaseTeamUserService baseTeamUserService; + + /** + * 查询班组人员列表 + */ + @RequiresPermissions("wms:teamUser:list") + @GetMapping("/list") + public TableDataInfo list(BaseTeamUser baseTeamUser) { + startPage(); + List list = baseTeamUserService.selectBaseTeamUserList(baseTeamUser); + return getDataTable(list); + } + + + /** + * 查询班组人员列表 + */ + @RequiresPermissions("wms:teamUser:listTeamMembers") + @GetMapping("/listTeamMembers") + public TableDataInfo listTeamMembers(BaseTeamUser baseTeamUser) { + startPage(); + List list = baseTeamUserService.selectTeamMembers(baseTeamUser); + return getDataTable(list); + } + + /** + * 导出班组人员列表 + */ + @RequiresPermissions("wms:teamUser:export") + @Log(title = "班组人员", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BaseTeamUser baseTeamUser) { + List list = baseTeamUserService.selectBaseTeamUserList(baseTeamUser); + ExcelUtil util = new ExcelUtil(BaseTeamUser.class); + util.exportExcel(response, list, "班组人员数据"); + } + + /** + * 获取班组人员详细信息 + */ + @RequiresPermissions("wms:teamUser:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) { + return success(baseTeamUserService.selectBaseTeamUserById(id)); + } + + /** + * 新增班组人员 + */ + @RequiresPermissions("wms:teamUser:add") + @Log(title = "班组人员", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BaseTeamUser baseTeamUser) { + return toAjax(baseTeamUserService.insertBaseTeamUser(baseTeamUser)); + } + + /** + * 修改班组人员 + */ + @RequiresPermissions("wms:teamUser:edit") + @Log(title = "班组人员", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BaseTeamUser baseTeamUser) { + return toAjax(baseTeamUserService.updateBaseTeamUser(baseTeamUser)); + } + + /** + * 删除班组人员 + */ + @RequiresPermissions("wms:teamUser:remove") + @Log(title = "班组人员", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) { + return toAjax(baseTeamUserService.deleteBaseTeamUserByIds(ids)); + } +} diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamT.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamT.java index fcfa0894..4320270a 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamT.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamT.java @@ -1,6 +1,8 @@ package com.op.wms.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -113,6 +115,26 @@ public class BaseTeamT extends BaseEntity { @Excel(name = "班组类型") private String teamType; + private List rightData; + + public void setRightData(List rightData) { + this.rightData = rightData; + } + + public List getRightData() { + return rightData; + } + + private List selectedData; + + public void setSelectedData(List selectedData) { + this.selectedData = selectedData; + } + + public List getSelectedData() { + return selectedData; + } + public void setTeamType(String teamType) { this.teamType = teamType; } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamUser.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamUser.java new file mode 100644 index 00000000..e825fd89 --- /dev/null +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamUser.java @@ -0,0 +1,86 @@ +package com.op.wms.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; + +/** + * 班组人员对象 base_team_user + * + * @author Open Platform + * @date 2023-08-29 + */ +public class BaseTeamUser extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键 */ + private String id; + + /** 班组id */ + @Excel(name = "班组id") + private String teamId; + + /** 班组编码 */ + @Excel(name = "班组编码") + private String teamCode; + + /** 人员id */ + @Excel(name = "人员id") + private String userId; + + /** 人员名字 */ + @Excel(name = "人员名字") + private String userName; + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + public void setTeamId(String teamId) { + this.teamId = teamId; + } + + public String getTeamId() { + return teamId; + } + public void setTeamCode(String teamCode) { + this.teamCode = teamCode; + } + + public String getTeamCode() { + return teamCode; + } + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserId() { + return userId; + } + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserName() { + return userName; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("teamId", getTeamId()) + .append("teamCode", getTeamCode()) + .append("userId", getUserId()) + .append("userName", getUserName()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamTMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamTMapper.java index bb719c01..6c7129e6 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamTMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamTMapper.java @@ -2,7 +2,9 @@ package com.op.wms.mapper; import java.util.List; +import com.baomidou.dynamic.datasource.annotation.DS; import com.op.wms.domain.BaseTeamT; +import com.op.wms.domain.BaseTeamUser; /** * 班组Mapper接口 @@ -41,6 +43,7 @@ public interface BaseTeamTMapper { * @param baseTeamT 班组 * @return 结果 */ + @DS("#header.poolName") public int updateBaseTeamT(BaseTeamT baseTeamT); /** diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamUserMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamUserMapper.java new file mode 100644 index 00000000..998e2bc7 --- /dev/null +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamUserMapper.java @@ -0,0 +1,71 @@ +package com.op.wms.mapper; + +import java.util.List; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.wms.domain.BaseTeamUser; + +/** + * 班组人员Mapper接口 + * + * @author Open Platform + * @date 2023-08-29 + */ +public interface BaseTeamUserMapper { + /** + * 查询班组人员 + * + * @param id 班组人员主键 + * @return 班组人员 + */ + public BaseTeamUser selectBaseTeamUserById(String id); + + /** + * 查询班组人员列表 + * + * @param baseTeamUser 班组人员 + * @return 班组人员集合 + */ + public List selectBaseTeamUserList(BaseTeamUser baseTeamUser); + + /** + * 新增班组人员 + * + * @param baseTeamUser 班组人员 + * @return 结果 + */ + public int insertBaseTeamUser(BaseTeamUser baseTeamUser); + + /** + * 修改班组人员 + * + * @param baseTeamUser 班组人员 + * @return 结果 + */ + public int updateBaseTeamUser(BaseTeamUser baseTeamUser); + + /** + * 删除班组人员 + * + * @param id 班组人员主键 + * @return 结果 + */ + public int deleteBaseTeamUserById(String id); + + /** + * 批量删除班组人员 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBaseTeamUserByIds(String[] ids); + + //查询人员 + public List selectTeamMembers(BaseTeamUser baseTeamUser); + + //查询人员对应名字 + public List selectTeamMembersIds(BaseTeamUser baseTeamUser); + + //查询人员ID + public String selectId(BaseTeamUser baseTeamUser); +} diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamTService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamTService.java index 96fb0973..04d8a75d 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamTService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamTService.java @@ -2,6 +2,7 @@ package com.op.wms.service; import java.util.List; import com.op.wms.domain.BaseTeamT; +import com.op.wms.domain.BaseTeamUser; /** * 班组Service接口 diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamUserService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamUserService.java new file mode 100644 index 00000000..d3492baf --- /dev/null +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamUserService.java @@ -0,0 +1,62 @@ +package com.op.wms.service; + +import java.util.List; +import com.op.wms.domain.BaseTeamUser; + +/** + * 班组人员Service接口 + * + * @author Open Platform + * @date 2023-08-29 + */ +public interface IBaseTeamUserService { + /** + * 查询班组人员 + * + * @param id 班组人员主键 + * @return 班组人员 + */ + public BaseTeamUser selectBaseTeamUserById(String id); + + /** + * 查询班组人员列表 + * + * @param baseTeamUser 班组人员 + * @return 班组人员集合 + */ + public List selectBaseTeamUserList(BaseTeamUser baseTeamUser); + + /** + * 新增班组人员 + * + * @param baseTeamUser 班组人员 + * @return 结果 + */ + public int insertBaseTeamUser(BaseTeamUser baseTeamUser); + + /** + * 修改班组人员 + * + * @param baseTeamUser 班组人员 + * @return 结果 + */ + public int updateBaseTeamUser(BaseTeamUser baseTeamUser); + + /** + * 批量删除班组人员 + * + * @param ids 需要删除的班组人员主键集合 + * @return 结果 + */ + public int deleteBaseTeamUserByIds(String[] ids); + + /** + * 删除班组人员信息 + * + * @param id 班组人员主键 + * @return 结果 + */ + public int deleteBaseTeamUserById(String id); + + public List selectTeamMembers(BaseTeamUser baseTeamUser); +} diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamTServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamTServiceImpl.java index 064d665a..6e30f06b 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamTServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamTServiceImpl.java @@ -1,10 +1,14 @@ package com.op.wms.service.impl; +import java.util.ArrayList; import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.uuid.IdUtils; import com.op.common.security.utils.SecurityUtils; +import com.op.wms.domain.BaseTeamUser; +import com.op.wms.mapper.BaseTeamUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.wms.mapper.BaseTeamTMapper; @@ -22,6 +26,9 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService { @Autowired private BaseTeamTMapper baseTeamTMapper; + @Autowired + private BaseTeamUserMapper baseTeamUserMapper; + /** * 查询班组 * @@ -31,7 +38,12 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService { @Override @DS("#header.poolName") public BaseTeamT selectBaseTeamTByTeamId(String teamId) { - return baseTeamTMapper.selectBaseTeamTByTeamId(teamId); + BaseTeamUser baseTeamUser = new BaseTeamUser(); + baseTeamUser.setTeamId(teamId); + List baseTeamUser1 = baseTeamUserMapper.selectBaseTeamUserList(baseTeamUser); + BaseTeamT baseTeamT = baseTeamTMapper.selectBaseTeamTByTeamId(teamId); + baseTeamT.setSelectedData(baseTeamUser1); + return baseTeamT; } /** @@ -71,6 +83,30 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService { public int updateBaseTeamT(BaseTeamT baseTeamT) { baseTeamT.setLastUpdateDate(DateUtils.getNowDate()); baseTeamT.setLastUpdateBy(SecurityUtils.getUsername()); + for(int i = 0;i list = new ArrayList<>(); + list = baseTeamT.getRightData(); + String userId = list.get(i); + baseTeamUser.setUserId(userId); + BaseTeamUser baseTeamUser1 = new BaseTeamUser(); + List members = baseTeamUserMapper.selectTeamMembersIds(baseTeamUser1); + boolean bool = members.contains(userId); + if(bool == true){ + //倒查id + String id = baseTeamUserMapper.selectId(baseTeamUser); + baseTeamUser.setUpdateTime(DateUtils.getNowDate()); + baseTeamUser.setUpdateBy(SecurityUtils.getUsername()); + baseTeamUserMapper.updateBaseTeamUser(baseTeamUser); + }else{ + baseTeamUser.setCreateBy(SecurityUtils.getUsername()); + baseTeamUser.setCreateTime(DateUtils.getNowDate()); + baseTeamUser.setId(IdUtils.fastSimpleUUID()); + baseTeamUserMapper.insertBaseTeamUser(baseTeamUser); + } + } return baseTeamTMapper.updateBaseTeamT(baseTeamT); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamUserServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamUserServiceImpl.java new file mode 100644 index 00000000..1fc8455a --- /dev/null +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamUserServiceImpl.java @@ -0,0 +1,103 @@ +package com.op.wms.service.impl; + +import java.util.List; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.op.wms.mapper.BaseTeamUserMapper; +import com.op.wms.domain.BaseTeamUser; +import com.op.wms.service.IBaseTeamUserService; + +/** + * 班组人员Service业务层处理 + * + * @author Open Platform + * @date 2023-08-29 + */ +@Service +public class BaseTeamUserServiceImpl implements IBaseTeamUserService { + @Autowired + private BaseTeamUserMapper baseTeamUserMapper; + + /** + * 查询班组人员 + * + * @param id 班组人员主键 + * @return 班组人员 + */ + @Override + public BaseTeamUser selectBaseTeamUserById(String id) { + return baseTeamUserMapper.selectBaseTeamUserById(id); + } + + /** + * 查询班组人员列表 + * + * @param baseTeamUser 班组人员 + * @return 班组人员 + */ + @Override + public List selectBaseTeamUserList(BaseTeamUser baseTeamUser) { + return baseTeamUserMapper.selectBaseTeamUserList(baseTeamUser); + } + + /** + * 新增班组人员 + * + * @param baseTeamUser 班组人员 + * @return 结果 + */ + @Override + public int insertBaseTeamUser(BaseTeamUser baseTeamUser) { + baseTeamUser.setCreateTime(DateUtils.getNowDate()); + return baseTeamUserMapper.insertBaseTeamUser(baseTeamUser); + } + + /** + * 修改班组人员 + * + * @param baseTeamUser 班组人员 + * @return 结果 + */ + @Override + public int updateBaseTeamUser(BaseTeamUser baseTeamUser) { + baseTeamUser.setUpdateTime(DateUtils.getNowDate()); + return baseTeamUserMapper.updateBaseTeamUser(baseTeamUser); + } + + /** + * 批量删除班组人员 + * + * @param ids 需要删除的班组人员主键 + * @return 结果 + */ + @Override + public int deleteBaseTeamUserByIds(String[] ids) { + return baseTeamUserMapper.deleteBaseTeamUserByIds(ids); + } + + /** + * 删除班组人员信息 + * + * @param id 班组人员主键 + * @return 结果 + */ + @Override + public int deleteBaseTeamUserById(String id) { + return baseTeamUserMapper.deleteBaseTeamUserById(id); + } + + /** + * 查询班组人员列表 + * + * @param baseTeamUser 班组人员 + * @return 班组人员 + */ + @Override + @DS("#master") + public List selectTeamMembers(BaseTeamUser baseTeamUser){ + return baseTeamUserMapper.selectTeamMembers(baseTeamUser); + } +} diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamUserMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamUserMapper.xml new file mode 100644 index 00000000..5b793d04 --- /dev/null +++ b/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamUserMapper.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + select id, team_id, team_code, user_id, user_name, create_by, create_time, update_by, update_time from base_team_user + + + + + + + + insert into base_team_user + + id, + team_id, + team_code, + user_id, + user_name, + create_by, + create_time, + update_by, + update_time, + + + #{id}, + #{teamId}, + #{teamCode}, + #{userId}, + #{userName}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update base_team_user + + team_id = #{teamId}, + team_code = #{teamCode}, + user_id = #{userId}, + user_name = #{userName}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from base_team_user where id = #{id} + + + + delete from base_team_user where id in + + #{id} + + + + + + + + + + + + \ No newline at end of file