制单管理相关问题

zhc4dev
赵玉瑞 2 years ago
parent 87501ef21f
commit 72a9bc3b1d
  1. 2
      ant-design-vue-jeecg/src/mixins/JeecgListMixin.js
  2. 278
      ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue
  3. 97
      ant-design-vue-jeecg/src/views/maker/modules/ZyMakerFormDetail.vue
  4. 1
      jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsTypeController.java
  5. 238
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/controller/ZyMakerController.java
  6. 7
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java
  7. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/mapper/ZyMakerMapper.java
  8. 6
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java
  9. 92
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java

@ -322,7 +322,7 @@ export const JeecgListMixin = {
zyStyleFabricHandleAdd: function (id) {
this.$refs.modalForm.add(id);
this.$refs.modalForm.title = "新增";
console.log("js层id的传递"+id);
//console.log("js层id的传递"+id);
this.$refs.modalForm.disableSubmit = false;
},
styleModuleHandleAdd: function (id,typeId,styleNames) {

@ -11,25 +11,34 @@
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
<a-button @click="makerAdd" type="primary" icon="plus">制单</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('制单管理')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
@change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<j-super-query :fieldList="superFieldList" ref="superQueryModal"
@handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
<a-menu-item key="1" @click="batchDel">
<a-icon type="delete"/>
删除
</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
<a-button style="margin-left: 8px"> 批量操作
<a-icon type="down"/>
</a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
@ -52,7 +61,8 @@
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
<img v-else :src="getImgView(text)" height="25px" alt=""
style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
@ -68,27 +78,31 @@
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<!-- <a @click="handleEdit(record)">编辑</a>-->
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record.id)">详情</a>
</a-menu-item>
<a-menu-item>
<a @click="qrPrint(record)">二维码</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
<a @click="handleDetail(record.id)">详情</a>
<a-divider type="vertical"/>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
<!-- <a-divider type="vertical"/>-->
<!-- <a-dropdown>-->
<!-- <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>-->
<!-- <a-menu slot="overlay">-->
<!-- <a-menu-item>-->
<!-- <a @click="handleDetail(record.id)">详情</a>-->
<!-- </a-menu-item>-->
<!-- <a-menu-item>-->
<!-- <a @click="qrPrint(record)">二维码</a>-->
<!-- </a-menu-item>-->
<!-- <a-menu-item>-->
<!-- <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
<!-- <a>删除</a>-->
<!-- </a-popconfirm>-->
<!-- </a-menu-item>-->
<!-- </a-menu>-->
<!-- </a-dropdown>-->
</span>
</a-table>
</div>
<ZyMakerFormDetail ref="ZyMakerFormDetail"></ZyMakerFormDetail>
@ -99,106 +113,132 @@
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ZyMakerModal from './modules/ZyMakerModal'
import QRCode from "./modules/QRCode";
import ZyMakerFormDetail from './modules/ZyMakerFormDetail'
export default {
name: 'ZyMakerList',
mixins:[JeecgListMixin, mixinDevice],
components: {
QRCode,
ZyMakerModal,
ZyMakerFormDetail
},
data () {
return {
description: '制单管理管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'制单编号',
align:"center",
dataIndex: 'code'
},
{
title:'工单编号',
align:"center",
dataIndex: 'workerCode'
},
{
title:'模块名称',
align:"center",
dataIndex: 'modelName'
},
{
title: '创建时间',
align: "center",
dataIndex: 'createTime'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/maker/zyMaker/list",
delete: "/maker/zyMaker/delete",
deleteBatch: "/maker/zyMaker/deleteBatch",
exportXlsUrl: "/maker/zyMaker/exportXls",
importExcelUrl: "maker/zyMaker/importExcel",
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import ZyMakerModal from './modules/ZyMakerModal'
import QRCode from "./modules/QRCode";
import ZyMakerFormDetail from './modules/ZyMakerFormDetail'
import {getAction, postAction} from "@api/manage";
export default {
name: 'ZyMakerList',
mixins: [JeecgListMixin, mixinDevice],
components: {
QRCode,
ZyMakerModal,
ZyMakerFormDetail
},
data() {
return {
description: '制单管理管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
dictOptions:{},
superFieldList:[],
}
},
created() {
{
title: '制单编号',
align: "center",
dataIndex: 'code'
},
{
title: '工单编号',
align: "center",
dataIndex: 'workerCode'
},
{
title: '产品编号',
align: "center",
dataIndex: 'productCode'
},
{
title: '产品名称',
align: "center",
dataIndex: 'productName'
},
{
title: '模块名称',
align: "center",
dataIndex: 'modelName'
},
{
title: '创建时间',
align: "center",
dataIndex: 'createTime'
},
{
title: '操作',
dataIndex: 'action',
align: "center",
fixed: "right",
width: 147,
scopedSlots: {customRender: 'action'}
}
],
url: {
list: "/maker/zyMaker/list",
listMakerAdd: "/maker/zyMaker/listMakerAdd",
delete: "/maker/zyMaker/delete",
deleteBatch: "/maker/zyMaker/deleteBatch",
exportXlsUrl: "/maker/zyMaker/exportXls",
importExcelUrl: "maker/zyMaker/importExcel",
},
dictOptions: {},
superFieldList: [],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
makerAdd() {
//this.url.listMakerAdd = '/maker/zyMaker/listMakerAdd';
postAction(this.url.listMakerAdd, null).then((res) => {
if(res.success){
this.$message.success(res.message);
this.loadData();
}else{
this.$message.warning(res.message);
}
// this.$emit('valueChange',1)
// this.close()
})
},
methods: {
initDictConfig(){
},
qrPrint(record) {
this.$refs.qrForm.edit(record);
this.$refs.qrForm.title = "二维码";
this.$refs.qrForm.disableSubmit = true;
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'code',text:'制单编号',dictCode:''})
fieldList.push({type:'string',value:'workerCode',text:'工单编号',dictCode:''})
fieldList.push({type:'string',value:'modelName',text:'模块名称',dictCode:''})
this.superFieldList = fieldList
},
handleDetail(id){
this.$refs.ZyMakerFormDetail.showModal(id)
// this.$children[0].showModal(id)
}
initDictConfig() {
},
qrPrint(record) {
this.$refs.qrForm.edit(record);
this.$refs.qrForm.title = "二维码";
this.$refs.qrForm.disableSubmit = true;
},
getSuperFieldList() {
let fieldList = [];
fieldList.push({type: 'string', value: 'code', text: '制单编号', dictCode: ''})
fieldList.push({type: 'string', value: 'workerCode', text: '工单编号', dictCode: ''})
fieldList.push({type: 'string', value: 'modelName', text: '模块名称', dictCode: ''})
this.superFieldList = fieldList
},
handleDetail(id) {
this.$refs.ZyMakerFormDetail.showModal(id)
// this.$children[0].showModal(id)
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>

@ -11,17 +11,17 @@
>
<a-descriptions bordered size="small">
<a-descriptions-item label="制单编号" >
{{model.code}}
</a-descriptions-item>
<a-descriptions-item label="工单编号" >
{{model.workerCode}}
</a-descriptions-item>
<a-descriptions-item label="模块名称">
{{model.modelName}}
</a-descriptions-item>
</a-descriptions>
<a-descriptions bordered size="small">
<a-descriptions-item label="制单编号">
{{model.code}}
</a-descriptions-item>
<a-descriptions-item label="工单编号">
{{model.workerCode}}
</a-descriptions-item>
<a-descriptions-item label="模块名称">
{{model.modelName}}
</a-descriptions-item>
</a-descriptions>
</a-modal>
@ -29,44 +29,43 @@
</template>
<script>
export default {
name: 'ZyMakerFormDetail',
data () {
return {
visible: false,
confirmLoading: false,
model:{
},
}
export default {
name: 'ZyMakerFormDetail',
data() {
return {
visible: false,
confirmLoading: false,
model: {},
}
},
created() {
//model
// this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
showModal(id) {
// console.log(this.selectId)
this.visible = true;
this.$http.get('/maker/zyMaker/queryById?id=' + id).then(
res => {
this.model = res.result
console.log(this.data)
}
)
},
created () {
//model
// this.modelDefault = JSON.parse(JSON.stringify(this.model));
handleOk(e) {
this.ModalText = 'The modal will be closed after two seconds';
this.confirmLoading = true;
console.log(this.data)
setTimeout(() => {
this.visible = false;
this.confirmLoading = false;
}, 1);
},
methods: {
showModal(id) {
// console.log(this.selectId)
this.visible = true;
this.$http.get('/maker/zyMaker/queryById?id='+id).then(
res=>{
this.model = res.result
console.log(this.data)
}
)
},
handleOk(e) {
this.ModalText = 'The modal will be closed after two seconds';
this.confirmLoading = true;
console.log(this.data)
setTimeout(() => {
this.visible = false;
this.confirmLoading = false;
}, 1);
},
handleCancel(e) {
console.log('Clicked cancel button');
this.visible = false;
},
},
}
handleCancel(e) {
console.log('Clicked cancel button');
this.visible = false;
},
},
}
</script>

@ -237,6 +237,7 @@ public class ZyClothsTypeController extends JeecgController<ZyClothsType, IZyClo
return Result.error("只能选择一个企业");
} else {
//String enterpriseName = zyClothsTypeMapper.getEnterprisenameById(id);
//根据企业id 直接在数据库里面拿到企业缩写 然后处理一下空值问题
String enterpriseName = zyClothsTypeMapper.getEnterpriseNum(id);
//根据企业名称拿到企业编号 //two 是直接编号 然后做一个判断
return Result.OK(zyClothsTypeService.getEnterpriseNumsTwo(enterpriseName));

@ -9,6 +9,7 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
@ -36,133 +37,148 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
/**
* @Description: 制单管理
* @Author: jeecg-boot
* @Date: 2021-11-27
* @Date: 2021-11-27
* @Version: V1.0
*/
@Api(tags="制单管理")
@Api(tags = "制单管理")
@RestController
@RequestMapping("/maker/zyMaker")
@Slf4j
public class ZyMakerController extends JeecgController<ZyMaker, IZyMakerService> {
@Autowired
private IZyMakerService zyMakerService;
/**
* 分页列表查询
*
* @param zyMaker
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "制单管理-分页列表查询")
@ApiOperation(value="制单管理-分页列表查询", notes="制单管理-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(ZyMaker zyMaker,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ZyMaker> queryWrapper = QueryGenerator.initQueryWrapper(zyMaker, req.getParameterMap());
Page<ZyMaker> page = new Page<ZyMaker>(pageNo, pageSize);
IPage<ZyMaker> pageList = zyMakerService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param zyMaker
* @return
*/
@AutoLog(value = "制单管理-添加")
@ApiOperation(value="制单管理-添加", notes="制单管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ZyMaker zyMaker) {
zyMakerService.save(zyMaker);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param zyMaker
* @return
*/
@AutoLog(value = "制单管理-编辑")
@ApiOperation(value="制单管理-编辑", notes="制单管理-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ZyMaker zyMaker) {
zyMakerService.updateById(zyMaker);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "制单管理-通过id删除")
@ApiOperation(value="制单管理-通过id删除", notes="制单管理-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
zyMakerService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "制单管理-批量删除")
@ApiOperation(value="制单管理-批量删除", notes="制单管理-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.zyMakerService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "制单管理-通过id查询")
@ApiOperation(value="制单管理-通过id查询", notes="制单管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
ZyMaker zyMaker = zyMakerService.getById(id);
if(zyMaker==null) {
return Result.error("未找到对应数据");
}
return Result.OK(zyMaker);
}
@Autowired
private IZyMakerService zyMakerService;
/**
* 分页列表查询
*
* @param zyMaker
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "制单管理-分页列表查询")
@ApiOperation(value = "制单管理-分页列表查询", notes = "制单管理-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(ZyMaker zyMaker,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ZyMaker> queryWrapper = QueryGenerator.initQueryWrapper(zyMaker, req.getParameterMap());
Page<ZyMaker> page = new Page<ZyMaker>(pageNo, pageSize);
IPage<ZyMaker> pageList = zyMakerService.page(page, queryWrapper);
List<ZyMaker> zyMakerList = zyMakerService.ZyMakerVo(pageList.getRecords());
pageList.setRecords(zyMakerList);
return Result.OK(pageList);
}
/**
* 添加
*
* @param zyMaker
* @return
*/
@AutoLog(value = "制单管理-添加")
@ApiOperation(value = "制单管理-添加", notes = "制单管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ZyMaker zyMaker) {
zyMakerService.save(zyMaker);
return Result.OK("添加成功!");
}
/**
* 制单
*/
@AutoLog(value = "制单管理-制单")
@ApiOperation(value = "制单管理-制单", notes = "制单管理-制单")
@PostMapping(value = "/listMakerAdd")
public Result<?> listMakerAdd() {
//点击制单 点击后按产品模块分解成制单写入制单表
zyMakerService.listMakerAdd();
//zyMakerService.save(zyMaker);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param zyMaker
* @return
*/
@AutoLog(value = "制单管理-编辑")
@ApiOperation(value = "制单管理-编辑", notes = "制单管理-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ZyMaker zyMaker) {
zyMakerService.updateById(zyMaker);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "制单管理-通过id删除")
@ApiOperation(value = "制单管理-通过id删除", notes = "制单管理-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
zyMakerService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "制单管理-批量删除")
@ApiOperation(value = "制单管理-批量删除", notes = "制单管理-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.zyMakerService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "制单管理-通过id查询")
@ApiOperation(value = "制单管理-通过id查询", notes = "制单管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
ZyMaker zyMaker = zyMakerService.getById(id);
if (zyMaker == null) {
return Result.error("未找到对应数据");
}
return Result.OK(zyMaker);
}
/**
* 导出excel
*
* @param request
* @param zyMaker
*/
* 导出excel
*
* @param request
* @param zyMaker
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ZyMaker zyMaker) {
return super.exportXls(request, zyMaker, ZyMaker.class, "制单管理");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ZyMaker.class);

@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -66,6 +67,12 @@ public class ZyMaker implements Serializable {
@Excel(name = "工单编号", width = 15)
@ApiModelProperty(value = "工单编号")
private String workerCode;
/**产品编号*/
@TableField(exist = false)
private String productCode;
/**产品名称*/
@TableField(exist = false)
private String productName;
/**模块id*/
@Excel(name = "模块id", width = 15)
@ApiModelProperty(value = "模块id")

@ -3,8 +3,10 @@ package org.jeecg.modules.maker.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.maker.entity.ZyMaker;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.workproduct.entity.ZyProduct;
/**
* @Description: 制单管理
@ -14,4 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ZyMakerMapper extends BaseMapper<ZyMaker> {
@Select("select * from zy_product where work_order_id=#{workerCode}")
ZyProduct getProduct(String workerCode);
}

@ -3,6 +3,8 @@ package org.jeecg.modules.maker.service;
import org.jeecg.modules.maker.entity.ZyMaker;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: 制单管理
* @Author: jeecg-boot
@ -11,4 +13,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IZyMakerService extends IService<ZyMaker> {
//点击制单 点击后按产品模块分解成制单写入制单表
void listMakerAdd();
List<ZyMaker> ZyMakerVo(List<ZyMaker> records);
}

@ -1,19 +1,109 @@
package org.jeecg.modules.maker.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.modules.maker.entity.ZyMaker;
import org.jeecg.modules.maker.mapper.ZyMakerMapper;
import org.jeecg.modules.maker.service.IZyMakerService;
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.service.IZyProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @Description: 制单管理
* @Author: jeecg-boot
* @Date: 2021-11-27
* @Date: 2021-11-27
* @Version: V1.0
*/
@Service
public class ZyMakerServiceImpl extends ServiceImpl<ZyMakerMapper, ZyMaker> implements IZyMakerService {
@Autowired
private IWorkOrderService workOrderService;
@Autowired
private IZyProductService productService;
@Resource
private ZyMakerMapper zyMakerMapper;
////点击制单 点击后按产品模块分解成制单写入制单表
@Override
public void listMakerAdd() {
//先拿到所有产品 产品暂定为服装款式里面的数据
List<WorkOrder> workOrderList = workOrderService.list();
for (WorkOrder workOrder : workOrderList) {
ZyMaker maker = new ZyMaker();
//制单编号 工单编号(22)+顺序号(2)
maker.setCode(getMakerCode(workOrder.getProductCode()));
//工单编号
maker.setWorkerCode(workOrder.getProductCode());
this.save(maker);
}
}
@Override
public List<ZyMaker> ZyMakerVo(List<ZyMaker> records) {
if (ObjectUtils.isEmpty(records)) {
return null;
}
//根据工单编号找到产品编号 产品名称
for (ZyMaker maker : records) {
ZyProduct zyProductMapper = zyMakerMapper.getProduct(maker.getWorkerCode());
// LambdaQueryWrapper<ZyProduct> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(ZyProduct::getWorkOrderId, maker.getWorkerCode());
// ZyProduct zyProduct = productService.getOne(queryWrapper);
//产品编号
if (!ObjectUtils.isEmpty(zyProductMapper)){
if (StringUtils.hasText(zyProductMapper.getProductCode())) {
maker.setProductCode(zyProductMapper.getProductCode());
}
if (StringUtils.hasText(zyProductMapper.getProductName())) {
maker.setProductName(zyProductMapper.getProductName());
}
}
//产品名称
}
return records;
}
private String getMakerCode(String productCode) {
if (StringUtils.isEmpty(productCode)) {
return "null";
}
List<ZyMaker> zyMakerList = this.list();
List<String> collect = zyMakerList.stream().map(ZyMaker::getCode).collect(Collectors.toList());
List<Long> longList = new ArrayList<>();
for (String makerCode : collect) {
String newNums = makerCode.trim();
if (StringUtils.isEmpty(newNums)) continue;
if (newNums.length() <= 2) longList.add(Long.valueOf(newNums));
else {
//拿到后6位 substring(4) 截掉前4位
String substring = newNums.substring(newNums.length() - 2);
longList.add(Long.valueOf(substring));
}
}
long max = Collections.max(longList) + 1;
if (Long.toString(max).length() > 2) {
String toString = Long.toString(max);
return toString.substring(toString.length() - 2);
}
return String.format("%02d", max);
}
}

Loading…
Cancel
Save