生产计划-重构

zhc4dev
zhc077 2 years ago
parent 08c69bdb0e
commit 16e889e753
  1. 324
      ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue
  2. 6
      ant-design-vue-jeecg/src/views/productplan/ZyProductPlanList.vue
  3. 9
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyPlanProcessController.java
  4. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyPlanProcessService.java
  5. 91
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java

@ -0,0 +1,324 @@
<template>
<a-card :bordered="false">
<template>
<div>
<el-descriptions border :column='4'>
<el-descriptions-item label="工单编号 ">{{planInfo.productName}}</el-descriptions-item>
<el-descriptions-item label="生产企业">{{ planInfo.productOrg }}</el-descriptions-item>
<!-- <el-descriptions-item label="企业负责人 ">admin</el-descriptions-item>-->
<el-descriptions-item label="车间 ">{{ planInfo.workshop }}</el-descriptions-item>
<!-- <el-descriptions-item label="车间负责人 ">admin</el-descriptions-item>-->
<el-descriptions-item label="班组">{{ planInfo.team }}</el-descriptions-item>
<el-descriptions-item label="班组长">{{ planInfo.teamLade }}</el-descriptions-item>
<el-descriptions-item label="产品类型">10</el-descriptions-item>
<el-descriptions-item label="产品编号">{{ planInfo.productNo }}</el-descriptions-item>
<el-descriptions-item label="产品名称">{{ planInfo.productName}}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{ planInfo.workTime }}</el-descriptions-item>
<el-descriptions-item label="生产时长">{{ planInfo.duration }}</el-descriptions-item>
<el-descriptions-item label="生产状态">{{ planInfo.status }}</el-descriptions-item>
<el-descriptions-item label="加急">{{ planInfo.speedUp }}</el-descriptions-item>
<el-descriptions-item label="销售企业">{{ planInfo.salesEnterprise }}</el-descriptions-item>
<el-descriptions-item label="订货期">{{ planInfo.orderTime }}</el-descriptions-item>
<!-- <el-descriptions-item label="制定人">100</el-descriptions-item>-->
<!-- <el-descriptions-item label="制定时间">100</el-descriptions-item>-->
<el-descriptions-item label="审核人">{{ planInfo.auditBy }}</el-descriptions-item>
<el-descriptions-item label="审核时间">{{ planInfo.auditTimr }}</el-descriptions-item>
</el-descriptions>
</div>
</template>
<!-- table区域-begin -->
<div>
<j-vxe-table
ref="xTable"
toolbar
:toolbarConfig="toolbarConfig"
row-number
row-selection
keep-source
:rowSelection="clickTrue"
:clickSelectRow="clickTrue"
:loading="loading"
:columns="columns"
@selectRowChange="handleSelectRowChange"
:dataSource="dataSource"
@valueChange="handleValueChange"
@save="handleTableSave"
>
<template v-slot:toolbarSuffix>
<a-button type="primary" icon="download" @click="handleExportXls('计划工序')">导出</a-button>
<a-button type="primary" icon="rollback" @click="fanHui()">返回</a-button>
</template>
</j-vxe-table>
</div>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {getAction, postAction} from "@api/manage";
import {filterObj, pushIfNotExist, randomNumber, randomUUID} from "@/utils/util";
import {JVXETypes} from '@/components/jeecg/JVxeTable'
import Area from "@comp/_util/Area";
export default {
name: 'ZyPlanProcessDataList',
mixins: [JeecgListMixin, mixinDevice],
data() {
return {
toolbarConfig: {
// add remove clearSelection
btn: ['save',]
},
description: '生产计划工序管理页面',
loading: false,
dataSource: [],
// columns,
columns: [
{key: 'workOrderId', title: '工单编号', width: '200px'},
// {key: 'productName', title: '', width: '120px'},
{key: 'departName', title: '车间名称', width: '120px'},
{key: 'processName', title: '工序名称', width: '120px'},
{
title: '工位ID',
key: 'stationId',
type: JVXETypes.hidden,
// width: '200px',
// options: [],
// placeholder: '${title}',
}, {
title: '工位名称',
key: 'stationName',
type: JVXETypes.select,
width: '200px',
options: [],
placeholder: '请选择${title}',
},
{
title: 'stationIds',
key: 'stationIds',
type: JVXETypes.hidden,
},
{
title: '设备列表',
key: 'machineNames',
type: JVXETypes.selectMultiple,
width: '200px',
options: [],
placeholder: '请选择${title}',
},
{
title: 'toodsIds',
key: 'toolsIds',
type: JVXETypes.hidden,
},
{
title: '工具列表',
key: 'toolsIdNames',
type: JVXETypes.selectMultiple,
width: '200px',
options: [],
placeholder: '请选择${title}',
},
{key: 'proProcess', type: JVXETypes.hidden, title: '前导工序ID', width: '120px'},
{
title: '前导工序',
key: 'proProcessName',
type: JVXETypes.popup,
width: '180px',
popupCode: 'zy_process',
field: 'id,process_code,process_name,process_describe',
// orgFields: 'id,process_code,process_name,process_describe',
// destFields: 'proProcessName,process_code,process_name,process_describe',
orgFields: 'process_name,id',
destFields: 'proProcessName,proProcess',
},
{key: 'postProcess', type: JVXETypes.hidden, title: '后导工序ID', width: '120px'},
{
title: '后导工序',
key: 'postProcessName',
type: JVXETypes.popup,
width: '180px',
popupCode: 'zy_process',
field: 'id,process_code,process_name,process_describe',
// orgFields: 'id,process_code,process_name,process_describe',
// destFields: 'proProcessName,process_code,process_name,process_describe',
orgFields: 'process_name,id',
destFields: 'postProcessName,postProcess',
},
{key: 'inputProduct', title: '输入产品', width: '150', type: JVXETypes.input},
{key: 'semiProduct', title: '成品/半成品', width: '150', type: JVXETypes.input},
],
url: {
list: "/org.jeecg.modules.productplan/zyPlanProcess/getProcessDatalist",
getPlanInfo: "/org.jeecg.modules.productplan/zyPlanProcess/getPlanInfo",
stationToolslist: "/stationTool/list2",
stationMachinelist: "/stationMachine/list2",
addProcessBatch: "/org.jeecg.modules.productplan/zyPlanProcess/addProcessBatch",
},
loadRouteType: false,
planId: "",
dictOptions: {},
planInfo: {},
superFieldList: [],
stationId: [],
stationList: [],
toolsList: [],
machineList: [],
clickTrue: true,
}
},
created() {
this.loadParameter();
this.getPlanInfo(this.planId);
},
methods: {
getPlanInfo(planId) {
// debugger;
getAction(this.url.getPlanInfo, {"planId": planId}).then((res) => {
if (res.success) {
this.planInfo = res.result.records || res.result;
console.log("getPlanInfo------------:" + JSON.stringify(this.planInfo));
} else {
// this.stationIdCode = "station,station_name,id,depart_id in (select workshop_id from zy_product_plan where id='" + this.planId + "')";
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
//
handleTableSave({$table, target}) {
console.log("生产计划工序保存开始-----------------")
//
$table.validate().then((errMap) => {
//
if (!errMap) {
//
let tableData = target.getTableData()
console.log('当前保存的数据是:', tableData)
//
this.loading = true
postAction(this.url.addProcessBatch, tableData).then(res => {
if (res.success) {
this.$message.success(`保存成功!`)
} else {
this.$message.warn(`保存失败:` + res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
fanHui() {
this.$router.push({
path: '/productplan/ZyPlanProcessList',
});
},
//
loadParameter() {
// debugger;
if (this.loadRouteType === false) {
this.planId = this.$route.query.planId;
// this.biaoTi = this.$route.query.styleNames+"";
console.log("*******传递的planId:" + this.planId)
this.loadRouteType = true;
}
},
loadData(arg) {
console.log("the loadData---------开始");
// var that = this;
if (!this.url.list) {
this.$message.error("请设置url.list属性!")
return
}
// 1
// this.loadParameter();
var params = this.getQueryParams();//
this.loading = true;
console.log("----------------the params:", params);
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.dataSource = res.result.records || res.result;
// this.stationId = this.dataSource[0].stationId;
this.stationList = this.dataSource[0].stationList;
} else {
// this.stationIdCode = "station,station_name,id,depart_id in (select workshop_id from zy_product_plan where id='" + this.planId + "')";
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
getQueryParams() {
//
let sqp = {}
if (this.superQueryParams) {
sqp['superQueryParams'] = encodeURI(this.superQueryParams)
sqp['superQueryMatchType'] = this.superQueryMatchType
}
var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters);
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
param.planId = this.planId;
return filterObj(param);
},
//
handleSelectRowChange(event) {
console.log("handleSelectRowChange")
console.log("handleSelectRowChange-event:", event)
const {type, row, column, value, target, $table} = event
console.log(JSON.stringify(this.stationIdList));
// target.$refs.vxe.columns[6].dictCode = this.stationIdCode;
target.$refs.vxe.columns[6].options = this.stationList;
},
/** 当选项被改变时,联动其他组件 */
handleValueChange(event) {
const {type, row, column, value, target} = event
console.log("event", event)
console.log("row", row)
// if (type === JVXETypes.select) {
//
if (column.key === 'stationId') {
// options
console.log('this stationid(row.id):', row.stationId)
//
target.setValues([{
rowKey: row.id,
values: {machineIds: '', toolsIds: ''}
}])
target.$refs.vxe.columns[7].options = []
target.$refs.vxe.columns[8].options = []
getAction(this.url.stationMachinelist, {"stationId": row.stationId}).then((res) => {
if (res.success) {
this.machineList = res.result.records || res.result;
console.log("machineList", JSON.stringify(this.machineList))
target.$refs.vxe.columns[7].options = this.machineList;
} else {
this.$message.warning(res.message)
}
});
getAction(this.url.stationToolslist, {"stationId": row.stationId}).then((res) => {
if (res.success) {
this.toolsList = res.result.records || res.result;
console.log("toolsList", JSON.stringify(this.toolsList))
target.$refs.vxe.columns[8].options = this.toolsList;
} else {
this.$message.warning(res.message)
}
});
}
}
},
};
</script>

@ -146,6 +146,7 @@ import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import ZyProductPlanModal from './modules/ZyProductPlanModal' import ZyProductPlanModal from './modules/ZyProductPlanModal'
import {getAction, putAction, httpAction, postAction} from "@api/manage"; import {getAction, putAction, httpAction, postAction} from "@api/manage";
import {filterObj} from "@/utils/util"; import {filterObj} from "@/utils/util";
import Area from "@comp/_util/Area";
export default { export default {
name: 'ZyProductPlanList', name: 'ZyProductPlanList',
@ -281,11 +282,12 @@ export default {
// }, // },
}, },
methods: { methods: {
jumpPage1(record) { jumpPage1(record) {
this.$router.push({ this.$router.push({
path: '/team/StationMachineList', path: '/productplan/ProductplanManage',
query: { // query: { //
'plan': record.id, 'planId': record.id,
// 'stationName': record.stationName, // 'stationName': record.stationName,
// 'stationNum': record.stationNum, // 'stationNum': record.stationNum,
// 'departName': record.departName, // 'departName': record.departName,

@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description: 生产计划工序 * @Description: 生产计划工序
@ -122,6 +123,14 @@ public class ZyPlanProcessController extends JeecgController<ZyPlanProcess, IZyP
return Result.OK(processDatalist); return Result.OK(processDatalist);
} }
@ApiOperation(value = "生产计划工序-查询产品工序&计划", notes = "生产计划工序-查询产品工序&计划")
@GetMapping(value = "/getPlanInfo")
public Result<?> getPlanInfo(ZyPlanProcess zyPlanProcess,
HttpServletRequest req) {
Map<String, Object> map = zyPlanProcessService.getPlanInfo(zyPlanProcess);
return Result.OK(map);
}
@ApiOperation(value = "计划班组管理-查询产品工序&班组", notes = "计划班组管理-查询产品工序&班组") @ApiOperation(value = "计划班组管理-查询产品工序&班组", notes = "计划班组管理-查询产品工序&班组")
@GetMapping(value = "/getTeamDatalist") @GetMapping(value = "/getTeamDatalist")
public Result<?> getTeamDatalist(ZyPlanProcess zyPlanProcess, public Result<?> getTeamDatalist(ZyPlanProcess zyPlanProcess,

@ -6,6 +6,7 @@ import org.jeecg.modules.productplan.entity.ZyPlanProcess;
import org.jeecg.modules.productplan.entity.vo.ProcessDataVo; import org.jeecg.modules.productplan.entity.vo.ProcessDataVo;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description: 生产计划工序 * @Description: 生产计划工序
@ -16,6 +17,7 @@ import java.util.List;
public interface IZyPlanProcessService extends IService<ZyPlanProcess> { public interface IZyPlanProcessService extends IService<ZyPlanProcess> {
List<ZyPlanProcess> getProcessDatalist(ZyPlanProcess zyPlanProcess); List<ZyPlanProcess> getProcessDatalist(ZyPlanProcess zyPlanProcess);
Map<String,Object> getPlanInfo(ZyPlanProcess zyPlanProcess);
List<ProcessDataVo> getTeamDatalist(ZyPlanProcess zyPlanProcess); List<ProcessDataVo> getTeamDatalist(ZyPlanProcess zyPlanProcess);
} }

@ -6,10 +6,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.modules.demo.base.service.IZyProcessService; import org.jeecg.modules.demo.base.service.IZyProcessService;
import org.jeecg.modules.demo.ordergoods.entity.OrderGoods;
import org.jeecg.modules.demo.ordergoods.service.IOrderGoodsService;
import org.jeecg.modules.demo.zyorders.entity.ZyOrders;
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService;
import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess; import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess;
import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService; import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService;
import org.jeecg.modules.productplan.entity.ZyPlanProcess; import org.jeecg.modules.productplan.entity.ZyPlanProcess;
import org.jeecg.modules.productplan.entity.ZyProductPlan; import org.jeecg.modules.productplan.entity.ZyProductPlan;
import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo;
import org.jeecg.modules.productplan.entity.vo.ProcessDataVo; import org.jeecg.modules.productplan.entity.vo.ProcessDataVo;
import org.jeecg.modules.productplan.mapper.ZyPlanProcessMapper; import org.jeecg.modules.productplan.mapper.ZyPlanProcessMapper;
import org.jeecg.modules.productplan.service.IZyPlanProcessService; import org.jeecg.modules.productplan.service.IZyPlanProcessService;
@ -18,6 +23,7 @@ import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService; import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserService; 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.GroupxMember;
import org.jeecg.modules.team.entity.Station; import org.jeecg.modules.team.entity.Station;
import org.jeecg.modules.team.service.IGroupxMemberService; import org.jeecg.modules.team.service.IGroupxMemberService;
@ -25,17 +31,20 @@ import org.jeecg.modules.team.service.IGroupxService;
import org.jeecg.modules.team.service.IStationService; import org.jeecg.modules.team.service.IStationService;
import org.jeecg.modules.team.vo.GroupxMemeberVo; import org.jeecg.modules.team.vo.GroupxMemeberVo;
import org.jeecg.modules.team.vo.StationVo; import org.jeecg.modules.team.vo.StationVo;
import org.jeecg.modules.workorder.entity.WorkOrder;
import org.jeecg.modules.workorder.service.IWorkOrderService;
import org.jeecg.modules.workproduct.entity.ZyProduct; import org.jeecg.modules.workproduct.entity.ZyProduct;
import org.jeecg.modules.workproduct.service.IZyProductService; import org.jeecg.modules.workproduct.service.IZyProductService;
import org.springframework.beans.BeanUtils; import org.jeecg.modules.zyclothsstyle.entity.ZyClothsStyle;
import org.jeecg.modules.zyclothsstyle.service.IZyClothsStyleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.ArrayList; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Map;
/** /**
@ -56,9 +65,24 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
private IStationService iStationService; private IStationService iStationService;
@Autowired @Autowired
private ISysDepartService iSysDepartService; private IZyOrdersService iZyOrdersService;
// 工单信息
@Autowired
private IWorkOrderService iWorkOrderService;
//商品订单信息
@Autowired
private IOrderGoodsService iOrderGoodsService;
@Autowired @Autowired
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@Autowired
private IZyClothsStyleService iZyClothsStyleService;
@Autowired
private ISysDepartService iSysDepartService;
@Autowired @Autowired
private IZyProcessService iZyProcessService; private IZyProcessService iZyProcessService;
@Autowired @Autowired
@ -106,7 +130,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
} }
if (!ObjectUtils.isEmpty(planProcessList)) { if (!ObjectUtils.isEmpty(planProcessList)) {
// SysDepart depart = iSysDepartService.getById(departId); SysDepart depart = iSysDepartService.getById(departId);
List<Station> stationList = iStationService.list(new LambdaQueryWrapper<Station>().eq(Station::getDepartId, departId)); List<Station> stationList = iStationService.list(new LambdaQueryWrapper<Station>().eq(Station::getDepartId, departId));
List<StationVo> stationVoList = new LinkedList<>(); List<StationVo> stationVoList = new LinkedList<>();
if (!ObjectUtils.isEmpty(stationList)) { if (!ObjectUtils.isEmpty(stationList)) {
@ -131,13 +155,68 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
// vo.setDepartName(depart.getDepartName()); // vo.setDepartName(depart.getDepartName());
// vo.setStationList(stationVoList); // vo.setStationList(stationVoList);
// vo.setStationId(stationVoList); // vo.setStationId(stationVoList);
e.setStationIdList(stationVoList); // e.setStationIdList(stationVoList);
// result.add(vo); // result.add(vo);
}); });
} }
return planProcessList; return planProcessList;
} }
@Override
public Map<String, Object> getPlanInfo(ZyPlanProcess planProcess) {
//生产计划id
String planId = planProcess.getPlanId();
ZyProductPlan zyProductPlan = iZyProductPlanService.getById(planId);
if (ObjectUtils.isEmpty(zyProductPlan)) {
throw new JeecgBootException("生产计划不存在!");
}
//工单id
String workOrderId = zyProductPlan.getProductCode();
String departId = zyProductPlan.getWorkshopId();
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, workOrderId));
if (ObjectUtils.isEmpty(zyProduct)) {
throw new JeecgBootException("产品不存在!");
}
// 工单信息
WorkOrder workOrder = iWorkOrderService.getOne(new LambdaQueryWrapper<WorkOrder>().eq(WorkOrder::getProductCode, zyProductPlan.getProductCode()));
if (ObjectUtils.isEmpty(workOrder))
throw new JeecgBootException(zyProductPlan.getProductCode() + "工单信息不存在");
String ordersId = workOrder.getOrdersId();
//订单信息
OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrdersId, ordersId));
if (ObjectUtils.isEmpty(orderGoods)) throw new JeecgBootException(ordersId + "订单商品信息不存在");
ZyOrders zyOrders = iZyOrdersService.getOne(new LambdaQueryWrapper<ZyOrders>().eq(ZyOrders::getId, ordersId));
if (ObjectUtils.isEmpty(zyOrders)) throw new JeecgBootException(ordersId + "订单信息不存在");
// ZyClothsStyle zyClothsStyle = iZyClothsStyleService.getById(orderGoods.getStyleId());
Map<String, Object> result = new HashMap<>();
result.put("productName", zyProduct.getProductName());
result.put("productOrg", zyProductPlan.getProductOrg());
result.put("productName", zyProductPlan.getProductName());
result.put("productNo", zyProductPlan.getProductNo());
SysDepart depart = iSysDepartService.getById(departId);
Groupx groupx = iGroupxService.getById(zyProductPlan.getTeamId());
result.put("Workshop", depart.getDepartName());
result.put("team", groupx.getGroupName());
result.put("teamLade", groupx.getEnterprisesManager());
result.put("productType", groupx.getEnterprisesManager());
result.put("workTime", zyProductPlan.getWorkTime());
result.put("duration", zyProductPlan.getDuration());
result.put("speedUp", zyProductPlan.getSpeedUp());
result.put("orderTime", zyOrders.getOrderTime());
SysDepart depart1 = iSysDepartService.getById(zyOrders.getSalesEnterpriseId());
//销售门店
result.put("salesEnterprise", depart1.getDepartName());
result.put("auditBy", zyProductPlan.getAuditBy());
result.put("auditTimr", zyProductPlan.getAuditTimr());
return result;
}
@Override @Override
public List<ProcessDataVo> getTeamDatalist(ZyPlanProcess zyPlanProcess) { public List<ProcessDataVo> getTeamDatalist(ZyPlanProcess zyPlanProcess) {
//生产计划id //生产计划id

Loading…
Cancel
Save