| | |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | import ShowOrderDetlComponent from '@/components/orderDetl/show.vue'; |
| | | import { |
| | | DownOutlined, |
| | | } from "@ant-design/icons-vue"; |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | |
| | | getPage() |
| | | } |
| | | |
| | | const handleSyncOrderClick = (e) => { |
| | | if (e.key == 'import') { |
| | | importTemplate() |
| | | } else if (e.key == 'export') { |
| | | exportTemplate() |
| | | } |
| | | } |
| | | |
| | | const importTemplate = () => { |
| | | //导入模板 |
| | | } |
| | | |
| | | const exportTemplate = () => { |
| | | //模板导出 |
| | | postBlob('/api/order/exportTemplate', {}).then(result => { |
| | | const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | return true; |
| | | }) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | |
| | | |
| | | <template> |
| | | <div> |
| | | <EditView ref="editChild" @tableReload="handleTableReload" :ioModel="ioModel == 'in' ? 1 : ioModel == 'out' ? 2 : null" /> |
| | | <EditView ref="editChild" @tableReload="handleTableReload" |
| | | :ioModel="ioModel == 'in' ? 1 : ioModel == 'out' ? 2 : null" /> |
| | | <div class="table-header"> |
| | | <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')" |
| | | style="width: 200px;" @search="onSearch" /> |
| | | <div class="table-header-right"> |
| | | <a-dropdown> |
| | | <template #overlay> |
| | | <a-menu @click="handleSyncOrderClick"> |
| | | <a-menu-item key="import"> |
| | | <UserOutlined /> |
| | | {{ formatMessage('page.order.import', '单据导入') }} |
| | | </a-menu-item> |
| | | <a-menu-item key="export"> |
| | | <UserOutlined /> |
| | | {{ formatMessage('page.order.export.template', '导出模板') }} |
| | | </a-menu-item> |
| | | </a-menu> |
| | | </template> |
| | | <a-button> |
| | | {{ formatMessage('page.order.sync', '单据同步') }} |
| | | <DownOutlined /> |
| | | </a-button> |
| | | </a-dropdown> |
| | | <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button> |
| | | <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button> |
| | | </div> |
| | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @PostMapping("/locDetl/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(locDetlService.list(), LocDetl.class), response); |
| | | List<LocDetl> locDetls = locDetlService.parseLocDetl(locDetlService.list()); |
| | | List<MatField> locFields = matFieldService.getLocFields(); |
| | | ExcelUtil.build(ExcelUtil.create(locDetls, LocDetl.class, locFields), response); |
| | | } |
| | | |
| | | private void setLocDetlField(HashMap<String, Object> param, LocDetl locDetl) { |
| | |
| | | @PreAuthorize("hasAuthority('asrs:mat:list')") |
| | | @PostMapping("/mat/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(matService.list(), Mat.class), response); |
| | | List<Mat> list = matService.parseMat(matService.list()); |
| | | List<MatField> matFields = matFieldService.getMatFields(); |
| | | ExcelUtil.build(ExcelUtil.create(list, Mat.class, matFields), response); |
| | | } |
| | | |
| | | private void setMatField(HashMap<String, Object> param, Mat mat) { |
| | |
| | | ExcelUtil.build(ExcelUtil.create(list, Order.class), response); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:order:list')") |
| | | @PostMapping("/order/exportTemplate") |
| | | public void exportTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ArrayList<Order> list = new ArrayList<>(); |
| | | ExcelUtil.build(ExcelUtil.create(list, Order.class), response); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wms.asrs.entity.MatField; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface MatFieldService extends IService<MatField> { |
| | | |
| | | void createView(); |
| | | |
| | | List<MatField> getMatFields(); |
| | | |
| | | List<MatField> getLocFields(); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wms.asrs.entity.Mat; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface MatService extends IService<Mat> { |
| | | |
| | | List<Mat> parseMat(List<Mat> list); |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.wms.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.wms.asrs.entity.LocDetlField; |
| | | import com.zy.asrs.wms.asrs.mapper.MatFieldMapper; |
| | | import com.zy.asrs.wms.asrs.entity.MatField; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Service("matFieldService") |
| | |
| | | this.baseMapper.createLocDetlView(); |
| | | } |
| | | |
| | | @Override |
| | | public List<MatField> getMatFields() { |
| | | return this.list(new LambdaQueryWrapper<MatField>().eq(MatField::getFieldType, 0)); |
| | | } |
| | | |
| | | @Override |
| | | public List<MatField> getLocFields() { |
| | | return this.list(new LambdaQueryWrapper<MatField>().eq(MatField::getFieldType, 1)); |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.wms.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.wms.asrs.entity.MatFieldValue; |
| | | import com.zy.asrs.wms.asrs.mapper.MatMapper; |
| | | import com.zy.asrs.wms.asrs.entity.Mat; |
| | | import com.zy.asrs.wms.asrs.service.MatFieldValueService; |
| | | import com.zy.asrs.wms.asrs.service.MatService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Service("matService") |
| | | public class MatServiceImpl extends ServiceImpl<MatMapper, Mat> implements MatService { |
| | | |
| | | @Autowired |
| | | private MatFieldValueService matFieldValueService; |
| | | |
| | | @Override |
| | | public List<Mat> parseMat(List<Mat> list) { |
| | | for (Mat mat : list) { |
| | | List<MatFieldValue> matFieldValueList = matFieldValueService.list(new LambdaQueryWrapper<MatFieldValue>() |
| | | .eq(MatFieldValue::getMatId, mat.getId())); |
| | | mat.syncField(matFieldValueList); |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.wms.utils; |
| | | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.wms.asrs.entity.MatField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by vincent on 2/17/2024 |
| | |
| | | } |
| | | |
| | | public static <T> Workbook create(List<T> list, Class<T> clz) { |
| | | return create(list, clz, null); |
| | | } |
| | | |
| | | public static <T> Workbook create(List<T> list, Class<T> clz, List<MatField> dynamicFields) { |
| | | HSSFWorkbook workbook = new HSSFWorkbook(); |
| | | Sheet sheet = workbook.createSheet(clz.getSimpleName()); |
| | | |
| | |
| | | } |
| | | header.createCell(headerIdx).setCellValue(memo); |
| | | headerIdx++; |
| | | } |
| | | |
| | | //动态字段 |
| | | if(dynamicFields != null){ |
| | | for (MatField field : dynamicFields) { |
| | | header.createCell(headerIdx).setCellValue(field.getDescribe()); |
| | | headerIdx++; |
| | | } |
| | | } |
| | | |
| | | int rowIndex = 1; |
| | |
| | | } |
| | | cellIndex++; |
| | | } |
| | | |
| | | //动态字段 |
| | | if(dynamicFields != null){ |
| | | for (Field field : fields) { |
| | | if (field.getName().equals("dynamicFields")) { |
| | | try { |
| | | Map<String, Object> map = (Map<String, Object>) field.get(t); |
| | | for (MatField matField : dynamicFields) { |
| | | Object value = map.get(matField.getName()); |
| | | if(value != null){ |
| | | row.createCell(cellIndex).setCellValue(value.toString()); |
| | | cellIndex++; |
| | | } |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | for (int i = 0; i <= fields.length; i++) { |