From 9d92b39ff2928181978adc0864288073da65f4c8 Mon Sep 17 00:00:00 2001
From: zhc077 <565291854>
Date: Mon, 30 Jan 2023 11:24:57 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=B7=A5=E5=BA=8F=E7=AE=A1?=
=?UTF-8?q?=E7=90=86-=E7=94=9F=E6=88=90=E7=89=A9=E6=96=99=E5=8D=95?=
=?UTF-8?q?=E3=80=81=E8=87=AA=E5=8A=A8=E6=8E=92=E4=BD=8D=201.30?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../views/productplan/ProductplanManage.vue | 58 +++++-
.../productplan/modules/ZyProductPlanForm.vue | 2 +-
.../controller/ZyPlanProcessController.java | 70 ++++---
.../productplan/entity/ZyPlanProcess.java | 1 +
.../ZyPlanProcessAccessoriesMapper.java | 2 +
.../mapper/ZyPlanProcessFabricMapper.java | 2 +
.../service/IZyPlanProcessService.java | 5 +
.../impl/ZyPlanProcessServiceImpl.java | 177 ++++++++++++++----
.../controller/StationMachineController.java | 5 +-
.../team/service/IStationMachineService.java | 3 +-
.../team/service/IStationToolService.java | 3 +
.../impl/StationMachineServiceImpl.java | 28 ++-
.../service/impl/StationToolServiceImpl.java | 26 ++-
13 files changed, 297 insertions(+), 85 deletions(-)
diff --git a/ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue b/ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue
index 34c84d1d..3e66ef30 100644
--- a/ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue
+++ b/ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue
@@ -48,10 +48,13 @@
>
读取工序
- 自动排位
-
-
-
+ 自动排位
+ 生成物料单
+
+ 查看物料单(计划面料&计划辅料)
+
+ 发送到仓库
+
导出
返回
@@ -200,6 +203,8 @@ export default {
list: "/org.jeecg.modules.productplan/zyPlanProcess/getProcessDatalist",
getPlanInfo: "/org.jeecg.modules.productplan/zyPlanProcess/getPlanInfo",
syncProductProcess: "/org.jeecg.modules.productplan/zyPlanProcess/syncProductProcess",
+ autoFilling: "/org.jeecg.modules.productplan/zyPlanProcess/autoFilling",
+ createMaterialBill: "/org.jeecg.modules.productplan/zyPlanProcess/createMaterialBill",
stationToolslist: "/stationTool/list2",
stationMachinelist: "/stationMachine/list2",
addProcessBatch: "/org.jeecg.modules.productplan/zyPlanProcess/addProcessBatch",
@@ -293,9 +298,6 @@ export default {
path: '/productplan/ZyProductPlanList',
});
},
- autoFilling() {
- alert("请稍等,正在开发中。。。")
- },
//读取工序
syncProductProcess() {
@@ -312,6 +314,48 @@ export default {
})
},
+ //自动排位
+ /**
+ * 根据工序id,查询工序设备表zy_process_machine,用工序设备表数据与工位设备进行匹配(工位设备包含工序设备即是匹配成功,则自动填充工位、设备字段数据,匹配不上则不自动填充,由用户自己录入)
+ */
+ autoFilling() {
+ this.loading = true;
+ getAction(this.url.autoFilling, {"planId": this.planId}).then((res) => {
+ if (res.success) {
+ this.$message.success("操作成功");
+ this.loadData();
+ } else {
+ this.$message.warning(res.message)
+ }
+ }).finally(() => {
+ this.loading = false
+ })
+ },
+
+ //生成物料单
+ /**
+ * 根据该生产计划的工序面料、工序辅料按类统计各种面料、辅料的用量汇总到计划面料、计划辅料表
+ */
+ createMaterialBill() {
+ this.loading = true;
+ getAction(this.url.createMaterialBill, {"planId": this.planId}).then((res) => {
+ if (res.success) {
+ this.$message.success("操作成功");
+ this.loadData();
+ } else {
+ this.$message.warning(res.message)
+ }
+ }).finally(() => {
+ this.loading = false
+ })
+ },
+
+ //查看物料单
+ viewMaterialBill(props) {
+ // alert("deatil row id:"+props.row.id);
+ this.$refs.zyPlanProcessDataDetail.showModal(props.row.id)
+ },
+
//加载传递参数
loadParameter() {
// debugger;
diff --git a/ant-design-vue-jeecg/src/views/productplan/modules/ZyProductPlanForm.vue b/ant-design-vue-jeecg/src/views/productplan/modules/ZyProductPlanForm.vue
index 418bcb36..2d78b0f3 100644
--- a/ant-design-vue-jeecg/src/views/productplan/modules/ZyProductPlanForm.vue
+++ b/ant-design-vue-jeecg/src/views/productplan/modules/ZyProductPlanForm.vue
@@ -126,7 +126,7 @@ export default {
workTime: '',
status: 0,
auditTimr: '',
- speedUp: 0,
+ speedUp: 1,
auditBy: 'admin',
},
labelCol: {
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java
index ff0c3aa8..967857d4 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java
@@ -80,41 +80,6 @@ public class ZyPlanProcessController extends JeecgController queryPageList2(ZyPlanProcess zyPlanProcess,
-// @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-// @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-// HttpServletRequest req) {
-// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyPlanProcess, req.getParameterMap());
-// Page page = new Page(pageNo, pageSize);
-// IPage pageList = zyPlanProcessService.page(page, queryWrapper);
-// if (!ObjectUtils.isEmpty(pageList)) {
-// String processIdList = "";
-// String stationIdList = "";
-// String machineIdList = "";
-// String toolsIdList = "";
-// String userIdList = "";
-// List records = pageList.getRecords();
-// for (ZyPlanProcess e : records) {
-// processIdList += e.getProcessId();
-// stationIdList += e.getStationId();
-// machineIdList += e.getMachineIds();
-// toolsIdList += e.getToolsIds();
-// userIdList += e.getUserIds();
-// }
-// for (ZyPlanProcess e : records) {
-// e.setProcessId(processIdList);
-// e.setStationId(stationIdList);
-// e.setMachineIds(machineIdList);
-// e.setToolsIds(toolsIdList);
-// e.setUserIds(userIdList);
-// }
-// }
-// return Result.OK(pageList);
-// }
-
@ApiOperation(value = "生产计划工序-查询产品工序&计划", notes = "生产计划工序-查询产品工序&计划")
@GetMapping(value = "/getProcessDatalist")
public Result> getProcessDatalist(ZyPlanProcess zyPlanProcess,
@@ -124,7 +89,6 @@ public class ZyPlanProcessController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper(zyPlanProcess, req.getParameterMap());
// Page page = new Page(pageNo, pageSize);
List processDatalist = zyPlanProcessService.getProcessDatalist(zyPlanProcess);
-
return Result.OK(processDatalist);
}
@@ -144,6 +108,36 @@ public class ZyPlanProcessController extends JeecgController autoFilling(ZyPlanProcess zyPlanProcess,
+ HttpServletRequest req) {
+ zyPlanProcessService.autoFilling(zyPlanProcess);
+ return Result.OK();
+ }
+
+ /**
+ *
+ * @param zyPlanProcess
+ * @param req
+ * @return
+ */
+ @ApiOperation(value = "生成物料单", notes = "生成物料单")
+ @GetMapping(value = "/createMaterialBill")
+ public Result> createMaterialBill(ZyPlanProcess zyPlanProcess,
+ HttpServletRequest req) {
+ zyPlanProcessService.createMaterialBill(zyPlanProcess);
+ return Result.OK();
+ }
+
@ApiOperation(value = "计划班组管理-查询产品工序&班组", notes = "计划班组管理-查询产品工序&班组")
@GetMapping(value = "/getTeamDatalist")
public Result> getTeamDatalist(ZyPlanProcess zyPlanProcess,
@@ -196,10 +190,10 @@ public class ZyPlanProcessController extends JeecgController {
}
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/mapper/ZyPlanProcessFabricMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/mapper/ZyPlanProcessFabricMapper.java
index 1b11be2b..b42e529d 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/mapper/ZyPlanProcessFabricMapper.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/mapper/ZyPlanProcessFabricMapper.java
@@ -2,6 +2,7 @@ package org.jeecg.modules.productplan.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.productplan.entity.ZyPlanProcessFabric;
/**
@@ -10,6 +11,7 @@ import org.jeecg.modules.productplan.entity.ZyPlanProcessFabric;
* @Date: 2023-01-09
* @Version: V1.0
*/
+@Mapper
public interface ZyPlanProcessFabricMapper extends BaseMapper {
}
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java
index bc7b7814..80aea3a9 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java
@@ -22,4 +22,9 @@ public interface IZyPlanProcessService extends IService {
Map getPlanInfo(ZyPlanProcess zyPlanProcess);
List getTeamDatalist(ZyPlanProcess zyPlanProcess);
+
+ void autoFilling(ZyPlanProcess zyPlanProcess);
+
+ void createMaterialBill(ZyPlanProcess zyPlanProcess);
+
}
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java
index b9fd87ad..1500aefe 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java
@@ -1,7 +1,9 @@
package org.jeecg.modules.productplan.service.impl;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.exception.JeecgBootException;
@@ -15,28 +17,21 @@ import org.jeecg.modules.demo.ordergoods.entity.OrderGoods;
import org.jeecg.modules.demo.ordergoods.service.IOrderGoodsService;
import org.jeecg.modules.demo.pro.entity.ZyProcessAccessories;
import org.jeecg.modules.demo.pro.entity.ZyProcessFabric;
+import org.jeecg.modules.demo.pro.entity.ZyProcessMachine;
import org.jeecg.modules.demo.pro.service.IZyProcessAccessoriesService;
import org.jeecg.modules.demo.pro.service.IZyProcessFabricService;
+import org.jeecg.modules.demo.pro.service.IZyProcessMachineService;
import org.jeecg.modules.demo.zyorders.entity.ZyOrders;
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService;
-import org.jeecg.modules.product.pdaccessories.entity.ProductAccessories;
-import org.jeecg.modules.product.pdaccessories.service.IProductAccessoriesService;
-import org.jeecg.modules.product.pdfabric.entity.ProductFabric;
-import org.jeecg.modules.product.pdfabric.service.IProductFabricService;
import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess;
import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService;
-import org.jeecg.modules.productplan.entity.ZyPlanProcess;
-import org.jeecg.modules.productplan.entity.ZyPlanProcessAccessories;
-import org.jeecg.modules.productplan.entity.ZyPlanProcessFabric;
-import org.jeecg.modules.productplan.entity.ZyProductPlan;
-import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo;
+import org.jeecg.modules.productplan.entity.*;
import org.jeecg.modules.productplan.entity.vo.ProcessDataVo;
import org.jeecg.modules.productplan.enums.ProductPlanStatusEnum;
+import org.jeecg.modules.productplan.mapper.ZyPlanProcessAccessoriesMapper;
+import org.jeecg.modules.productplan.mapper.ZyPlanProcessFabricMapper;
import org.jeecg.modules.productplan.mapper.ZyPlanProcessMapper;
-import org.jeecg.modules.productplan.service.IZyPlanProcessAccessoriesService;
-import org.jeecg.modules.productplan.service.IZyPlanProcessFabricService;
-import org.jeecg.modules.productplan.service.IZyPlanProcessService;
-import org.jeecg.modules.productplan.service.IZyProductPlanService;
+import org.jeecg.modules.productplan.service.*;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService;
@@ -44,8 +39,10 @@ import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.team.entity.Groupx;
import org.jeecg.modules.team.entity.GroupxMember;
import org.jeecg.modules.team.entity.Station;
+import org.jeecg.modules.team.entity.StationMachine;
import org.jeecg.modules.team.service.IGroupxMemberService;
import org.jeecg.modules.team.service.IGroupxService;
+import org.jeecg.modules.team.service.IStationMachineService;
import org.jeecg.modules.team.service.IStationService;
import org.jeecg.modules.team.vo.GroupxMemeberVo;
import org.jeecg.modules.team.vo.StationVo;
@@ -60,6 +57,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
+import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@@ -115,6 +113,12 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl getProcessDatalist(ZyPlanProcess zyPlanProcess) {
//生产计划id
String planId = zyPlanProcess.getPlanId();
@@ -145,7 +161,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl planProcessList = this.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, planId));
+ List planProcessList = this.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, planId).orderByAsc(ZyPlanProcess::getStationNum));
if (!ObjectUtils.isEmpty(planProcessList)) {
List stationList = iStationService.list(new LambdaQueryWrapper().eq(Station::getDepartId, departId));
List stationVoList = new LinkedList<>();
@@ -159,7 +175,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl().eq(Groupx::getDepartId, departId).eq(Groupx::getId,zyProductPlan.getTeamId()));
+ Groupx groupx = iGroupxService.getOne(new LambdaQueryWrapper().eq(Groupx::getDepartId, departId).eq(Groupx::getId, zyProductPlan.getTeamId()));
List groupMembers = iGroupxMemberService.list(new LambdaQueryWrapper().eq(GroupxMember::getGroupxId, groupx.getId()));
List groupxMemeberVoList = new LinkedList<>();
@@ -184,6 +200,96 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl planProcessList = this.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId()));
+ //是否有计划工序
+ if (ObjectUtils.isEmpty(planProcessList)) return;
+
+ //生产计划车间工位列表
+ List stationList = iStationService.list(new LambdaQueryWrapper().eq(Station::getDepartId, zyProductPlan.getWorkshopId()));
+
+ /**
+ * 遍历计划工序:
+ * 用工序设备表数据与工位设备进行匹配
+ * 依次用该生产计划的车间工位设备循环与工序设备比对【(工位设备包含工序设备即是匹配成功,则自动填充工位、设备字段数据,匹配不上则不自动填充,由用户自己录入)】
+ * 根据工序,查询工序设备表zy_process_machine,
+ */
+ Optional.ofNullable(planProcessList).orElse(new ArrayList<>()).forEach(e -> {
+ List machineList = iZyProcessMachineService.list(new LambdaQueryWrapper().eq(ZyProcessMachine::getProcessId, e.getProcessId()));
+ this.diffMachine(e, stationList, machineList);
+ });
+ }
+
+ @Override
+ public void createMaterialBill(ZyPlanProcess zyPlanProcess) {
+ ZyProductPlan zyProductPlan = iZyProductPlanService.getById(zyPlanProcess.getPlanId());
+ if (ObjectUtils.isEmpty(zyProductPlan)) {
+ throw new JeecgBootException("生产计划不存在!");
+ }
+ List planProcessList = this.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId()));
+ if(ObjectUtils.isEmpty(planProcessList)) return;
+
+ this.delBillData(zyPlanProcess);
+ List idList = planProcessList.stream().map(ZyPlanProcess::getId).collect(Collectors.toList());
+ QueryWrapper qw = new QueryWrapper();
+ qw.select("fabric_id", "sum(amount) as count");
+ qw.in("plan_process_id", idList);
+ qw.groupBy("fabric_id");
+ List