New file |
| | |
| | | <script setup> |
| | | import { ref, nextTick } from 'vue'; |
| | | import { get, post, postBlob, postForm } from '@/utils/request.js' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const formTable = ref(null); |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | | const initFormData = {} |
| | | let formData = ref(initFormData); |
| | | |
| | | const emit = defineEmits(['tableReload']) |
| | | |
| | | const handleOk = (e) => { |
| | | nextTick(() => { |
| | | setTimeout(() => { |
| | | submitButton.value.$el.click(); |
| | | }, 100); |
| | | }); |
| | | }; |
| | | |
| | | const onFinish = values => { |
| | | // console.log('Success:', values); |
| | | open.value = false; |
| | | post(isSave.value ? '/api/waitPakinRule/save' : '/api/waitPakinRule/update', formData.value).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(isSave.value ? formatMessage('page.add.success', '新增成功') : formatMessage('page.update.success', '更新成功')); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | nextTick(() => { |
| | | formTable.value.resetFields() |
| | | }) |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | | console.log('Failed:', errorInfo); |
| | | }; |
| | | |
| | | const userQueryList = ref(null); |
| | | userQuery(); |
| | | function userQuery() { |
| | | postForm('/api/user/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | userQueryList.value = result.data; |
| | | }) |
| | | } |
| | | |
| | | |
| | | defineExpose({ |
| | | open, |
| | | formData, |
| | | initFormData, |
| | | isSave, |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '组托规则-edit' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <a-modal v-model:open="open" |
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk" |
| | | style="width: 600px;"> |
| | | <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <a-form-item |
| | | :label="formatMessage('db.strategy_wait_pakin_rule.pallet_order', '托盘订单') " |
| | | name="palletOrder" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.palletOrder" |
| | | :options="[ |
| | | { label: '单订单', value: 0 }, |
| | | { label: '多订单', value: 1 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.strategy_wait_pakin_rule.pallet_mixed', '是否混载') " |
| | | name="palletMixed" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.palletMixed" |
| | | :options="[ |
| | | { label: '否', value: 0 }, |
| | | { label: '是', value: 1 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.strategy_wait_pakin_rule.status', '状态') " |
| | | name="status" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.status" |
| | | :options="[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.strategy_wait_pakin_rule.create_time', '添加时间') " |
| | | name="createTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.createTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.strategy_wait_pakin_rule.create_by', '添加人员') " |
| | | name="createBy" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.createBy" |
| | | :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="userQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.strategy_wait_pakin_rule.update_time', '修改时间') " |
| | | name="updateTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.updateTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.strategy_wait_pakin_rule.update_by', '修改人员') " |
| | | name="updateBy" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.updateBy" |
| | | :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="userQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.strategy_wait_pakin_rule.memo', '备注') " |
| | | name="memo" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.memo" |
| | | /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item> |
| | | <a-button type="primary" html-type="submit" ref="submitButton" |
| | | style="visibility: hidden;">Submit</a-button> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
New file |
| | |
| | | <script setup> |
| | | import { getCurrentInstance, ref, computed, reactive } from 'vue'; |
| | | import { useRouter } from "vue-router"; |
| | | import { get, post, postBlob } from '@/utils/request.js' |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | import { logout } from '@/config.js'; |
| | | import EditView from './edit.vue' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const TABLE_KEY = 'table-waitPakinRule'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | | const searchInput = ref("") |
| | | const editChild = ref(null) |
| | | |
| | | let tableData = ref([]); |
| | | getPage(); |
| | | |
| | | const { |
| | | getColumnSearchProps, |
| | | handleResizeColumn, |
| | | } = useTableSearch(); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: formatMessage('db.strategy_wait_pakin_rule.pallet_order', '托盘订单'), |
| | | dataIndex: 'palletOrder$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('palletOrder$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_wait_pakin_rule.pallet_mixed', '是否混载'), |
| | | dataIndex: 'palletMixed$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('palletMixed$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_wait_pakin_rule.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('status$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_wait_pakin_rule.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_wait_pakin_rule.create_by', '添加人员'), |
| | | dataIndex: 'createBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_wait_pakin_rule.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_wait_pakin_rule.update_by', '修改人员'), |
| | | dataIndex: 'updateBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_wait_pakin_rule.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('memo'), |
| | | }, |
| | | |
| | | { |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | fixed: 'right', |
| | | }, |
| | | ]; |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | }); |
| | | const hasSelected = computed(() => state.selectedRowKeys.length > 0); |
| | | const start = () => { |
| | | state.loading = true; |
| | | // ajax request after empty completing |
| | | setTimeout(() => { |
| | | state.loading = false; |
| | | state.selectedRowKeys = []; |
| | | }, 1000); |
| | | }; |
| | | const onSelectChange = selectedRowKeys => { |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | state.selectedRowKeys = selectedRowKeys; |
| | | }; |
| | | |
| | | function getPage() { |
| | | post('/api/waitPakinRule/page', { |
| | | current: currentPage, |
| | | pageSize: pageSize, |
| | | condition: searchInput.value |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data; |
| | | tableData.value = data; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleEdit = (item) => { |
| | | editChild.value.open = true; |
| | | editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item)); |
| | | editChild.value.isSave = item == null; |
| | | } |
| | | |
| | | const handleDel = (rows) => { |
| | | Modal.confirm({ |
| | | title: formatMessage('page.delete', '删除'), |
| | | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/waitPakinRule/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | const handleExport = async (intl) => { |
| | | postBlob('/api/waitPakinRule/export', {}).then(result => { |
| | | const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | return true; |
| | | }) |
| | | }; |
| | | |
| | | const onSearch = () => { |
| | | // console.log('search'); |
| | | getPage() |
| | | } |
| | | |
| | | const onPageChange = (page, size) => { |
| | | currentPage = page; |
| | | pageSize = size; |
| | | getPage(); |
| | | } |
| | | |
| | | function handleTableReload(value) { |
| | | getPage() |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '组托规则' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <EditView ref="editChild" @tableReload="handleTableReload" /> |
| | | <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-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button> |
| | | <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button> |
| | | </div> |
| | | </div> |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" |
| | | :pagination="{ total: tableData.total, onChange: onPageChange }" |
| | | :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns" @resizeColumn="handleResizeColumn"> |
| | | <template #bodyCell="{ column, text, record }"> |
| | | <template v-if="column.dataIndex === 'oper'"> |
| | | <div style="display: flex;justify-content: space-evenly;"> |
| | | <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '编辑') }}</a-button> |
| | | <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除') |
| | | }}</a-button> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.entity.enums.OrderSettleType; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | |
| | | |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private LocService locService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakin:list')") |
| | | @PostMapping("/waitPakin/page") |
| | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakin:save')") |
| | | @OperationLog("添加组托通知档") |
| | | @PostMapping("/waitPakin/save") |
| | | @Transactional |
| | | public R save(@RequestBody WaitPakin waitPakin) { |
| | | if (waitPakin.getAnfme() <= 0) { |
| | | return R.error("组托数量错误"); |
| | | } |
| | | |
| | | List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, waitPakin.getBarcode())); |
| | | if (!locList.isEmpty()) { |
| | | return R.error("托盘已在库"); |
| | | } |
| | | |
| | | List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, waitPakin.getBarcode())); |
| | | if (!taskList.isEmpty()) { |
| | | return R.error("托盘正在入库中"); |
| | | } |
| | | |
| | | //查询是否存在相同明细和托盘码的组托通知档 |
| | | WaitPakin waitPakin1 = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, waitPakin.getBarcode()).eq(WaitPakin::getDetlId, waitPakin.getDetlId())); |
| | | if (waitPakin1 == null) { |
| | | //不存在组托通知档,创建 |
| | | if (!waitPakinService.save(waitPakin)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | }else { |
| | | //存在组托通知档,更新 |
| | | waitPakin1.setAnfme(waitPakin1.getAnfme() + waitPakin.getAnfme()); |
| | | waitPakin1.setUpdateTime(new Date()); |
| | | if (!waitPakinService.updateById(waitPakin1)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | } |
| | | |
| | | OrderDetl orderDetl = orderDetlService.getById(waitPakin.getDetlId()); |
| | | if (orderDetl == null) { |
| | | throw new CoolException("订单明细不存在"); |
| | | } |
| | | |
| | | //获取订单 |
| | | Order order = orderService.getById(orderDetl.getOrderId()); |
| | | if(order == null){ |
| | | throw new CoolException("订单不存在"); |
| | | } |
| | | |
| | | //更新订单状态 |
| | | if (order.getOrderSettle().equals(OrderSettleType.INIT.val())) { |
| | | order.setOrderSettle(OrderSettleType.WAIT.val()); |
| | | order.setUpdateTime(new Date()); |
| | | if (!orderService.updateById(order)) { |
| | | throw new CoolException("订单数据更新失败"); |
| | | } |
| | | try { |
| | | waitPakinService.comb(waitPakin); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.error(e.getMessage()); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.asrs.entity.WaitPakinRule; |
| | | import com.zy.asrs.wms.asrs.service.WaitPakinRuleService; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | | import com.zy.asrs.wms.utils.ExcelUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class WaitPakinRuleController extends BaseController { |
| | | |
| | | @Autowired |
| | | private WaitPakinRuleService waitPakinRuleService; |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinRule:list')") |
| | | @PostMapping("/waitPakinRule/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<WaitPakinRule, BaseParam> pageParam = new PageParam<>(baseParam, WaitPakinRule.class); |
| | | return R.ok().add(waitPakinRuleService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinRule:list')") |
| | | @PostMapping("/waitPakinRule/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(waitPakinRuleService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinRule:list')") |
| | | @GetMapping("/waitPakinRule/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(waitPakinRuleService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinRule:save')") |
| | | @OperationLog("添加组托规则") |
| | | @PostMapping("/waitPakinRule/save") |
| | | public R save(@RequestBody WaitPakinRule waitPakinRule) { |
| | | if (!waitPakinRuleService.save(waitPakinRule)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinRule:update')") |
| | | @OperationLog("修改组托规则") |
| | | @PostMapping("/waitPakinRule/update") |
| | | public R update(@RequestBody WaitPakinRule waitPakinRule) { |
| | | if (!waitPakinRuleService.updateById(waitPakinRule)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinRule:remove')") |
| | | @OperationLog("删除组托规则") |
| | | @PostMapping("/waitPakinRule/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!waitPakinRuleService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinRule:list')") |
| | | @PostMapping("/waitPakinRule/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<WaitPakinRule> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(WaitPakinRule::getId, condition); |
| | | } |
| | | waitPakinRuleService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:waitPakinRule:list')") |
| | | @PostMapping("/waitPakinRule/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(waitPakinRuleService.list(), WaitPakinRule.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.wms.system.entity.Host; |
| | | import com.zy.asrs.wms.system.entity.User; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.wms.system.service.UserService; |
| | | import com.zy.asrs.wms.system.service.HostService; |
| | | import com.zy.asrs.common.utils.Synchro; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("strategy_wait_pakin_rule") |
| | | public class WaitPakinRule implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 托盘订单 0: 单订单 1: 多订单 |
| | | */ |
| | | @ApiModelProperty(value= "托盘订单 0: 单订单 1: 多订单 ") |
| | | private Integer palletOrder; |
| | | |
| | | /** |
| | | * 是否混载 0: 否 1: 是 |
| | | */ |
| | | @ApiModelProperty(value= "是否混载 0: 否 1: 是 ") |
| | | private Integer palletMixed; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | public WaitPakinRule() {} |
| | | |
| | | public WaitPakinRule(Integer palletOrder,Integer palletMixed,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | | this.palletOrder = palletOrder; |
| | | this.palletMixed = palletMixed; |
| | | this.hostId = hostId; |
| | | this.status = status; |
| | | this.deleted = deleted; |
| | | this.createTime = createTime; |
| | | this.createBy = createBy; |
| | | this.updateTime = updateTime; |
| | | this.updateBy = updateBy; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // WaitPakinRule waitPakinRule = new WaitPakinRule( |
| | | // null, // 托盘订单 |
| | | // null, // 是否混载 |
| | | // null, // 所属机构 |
| | | // null, // 状态 |
| | | // null, // 是否删除 |
| | | // null, // 添加时间 |
| | | // null, // 添加人员 |
| | | // null, // 修改时间 |
| | | // null, // 修改人员 |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getPalletOrder$(){ |
| | | if (null == this.palletOrder){ return null; } |
| | | switch (this.palletOrder){ |
| | | case 0: |
| | | return "单订单"; |
| | | case 1: |
| | | return "多订单"; |
| | | default: |
| | | return String.valueOf(this.palletOrder); |
| | | } |
| | | } |
| | | |
| | | public String getPalletMixed$(){ |
| | | if (null == this.palletMixed){ return null; } |
| | | switch (this.palletMixed){ |
| | | case 0: |
| | | return "否"; |
| | | case 1: |
| | | return "是"; |
| | | default: |
| | | return String.valueOf(this.palletMixed); |
| | | } |
| | | } |
| | | |
| | | public String getHostId$(){ |
| | | HostService service = SpringUtils.getBean(HostService.class); |
| | | Host host = service.getById(this.hostId); |
| | | if (!Cools.isEmpty(host)){ |
| | | return String.valueOf(host.getName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "禁用"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getDeleted$(){ |
| | | if (null == this.deleted){ return null; } |
| | | switch (this.deleted){ |
| | | case 1: |
| | | return "是"; |
| | | case 0: |
| | | return "否"; |
| | | default: |
| | | return String.valueOf(this.deleted); |
| | | } |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | public void sync(Object source) { |
| | | Synchro.Copy(source, this); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.mapper; |
| | | |
| | | import com.zy.asrs.wms.asrs.entity.WaitPakinRule; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface WaitPakinRuleMapper extends BaseMapper<WaitPakinRule> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wms.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.wms.asrs.entity.WaitPakinRule; |
| | | |
| | | public interface WaitPakinRuleService extends IService<WaitPakinRule> { |
| | | |
| | | boolean rule(WaitPakin waitPakin); |
| | | |
| | | } |
| | |
| | | |
| | | List<WaitPakin> getByOrderDetlId(Long orderDetlId); |
| | | |
| | | //组托 |
| | | boolean comb(WaitPakin waitPakin); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.wms.asrs.mapper.WaitPakinRuleMapper; |
| | | import com.zy.asrs.wms.asrs.entity.WaitPakinRule; |
| | | import com.zy.asrs.wms.asrs.service.WaitPakinRuleService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.wms.asrs.service.WaitPakinService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service("waitPakinRuleService") |
| | | public class WaitPakinRuleServiceImpl extends ServiceImpl<WaitPakinRuleMapper, WaitPakinRule> implements WaitPakinRuleService { |
| | | |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | |
| | | @Override |
| | | public boolean rule(WaitPakin waitPakin) { |
| | | List<WaitPakinRule> list = this.list(new LambdaQueryWrapper<WaitPakinRule>().eq(WaitPakinRule::getStatus, 1).orderByDesc(WaitPakinRule::getId)); |
| | | if (list.isEmpty()) { |
| | | return true;//无规则,直接放行 |
| | | } |
| | | |
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, waitPakin.getBarcode())); |
| | | if(waitPakins.isEmpty()) { |
| | | return true;//无托盘,放行 |
| | | } |
| | | |
| | | WaitPakinRule waitPakinRule = list.get(0); |
| | | //判断是否混载 |
| | | if (waitPakinRule.getPalletMixed() == 1) { |
| | | //混载 |
| | | //判断是否允许多订单 |
| | | if (waitPakinRule.getPalletOrder() == 0) { |
| | | //单订单 |
| | | for (WaitPakin pakin : waitPakins) { |
| | | if (!pakin.getOrderId().equals(waitPakin.getOrderId())) { |
| | | throw new CoolException("托盘不允许多订单"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | //单放 |
| | | //判断组托通知档是否已经存在托盘 |
| | | if(!waitPakins.isEmpty()) { |
| | | throw new CoolException("托盘已组托"); |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.wms.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.entity.enums.OrderSettleType; |
| | | import com.zy.asrs.wms.asrs.mapper.WaitPakinMapper; |
| | | import com.zy.asrs.wms.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.wms.asrs.service.WaitPakinService; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service("waitPakinService") |
| | | public class WaitPakinServiceImpl extends ServiceImpl<WaitPakinMapper, WaitPakin> implements WaitPakinService { |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private LocService locService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private WaitPakinRuleService waitPakinRuleService; |
| | | |
| | | @Override |
| | | public List<WaitPakin> getByOrderDetlId(Long orderDetlId) { |
| | | return this.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getDetlId, orderDetlId)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public boolean comb(WaitPakin waitPakin) { |
| | | //组托规则校验 |
| | | waitPakinRuleService.rule(waitPakin); |
| | | |
| | | if (waitPakin.getAnfme() <= 0) { |
| | | throw new CoolException("组托数量错误"); |
| | | } |
| | | |
| | | List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, waitPakin.getBarcode())); |
| | | if (!locList.isEmpty()) { |
| | | throw new CoolException("托盘已在库"); |
| | | } |
| | | |
| | | List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, waitPakin.getBarcode())); |
| | | if (!taskList.isEmpty()) { |
| | | throw new CoolException("托盘正在入库中"); |
| | | } |
| | | |
| | | //查询是否存在相同明细和托盘码的组托通知档 |
| | | WaitPakin waitPakin1 = this.getOne(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, waitPakin.getBarcode()).eq(WaitPakin::getDetlId, waitPakin.getDetlId())); |
| | | if (waitPakin1 == null) { |
| | | //不存在组托通知档,创建 |
| | | if (!this.save(waitPakin)) { |
| | | throw new CoolException("添加失败"); |
| | | } |
| | | }else { |
| | | //存在组托通知档,更新 |
| | | waitPakin1.setAnfme(waitPakin1.getAnfme() + waitPakin.getAnfme()); |
| | | waitPakin1.setUpdateTime(new Date()); |
| | | if (!this.updateById(waitPakin1)) { |
| | | throw new CoolException("添加失败"); |
| | | } |
| | | } |
| | | |
| | | OrderDetl orderDetl = orderDetlService.getById(waitPakin.getDetlId()); |
| | | if (orderDetl == null) { |
| | | throw new CoolException("订单明细不存在"); |
| | | } |
| | | |
| | | //获取订单 |
| | | Order order = orderService.getById(orderDetl.getOrderId()); |
| | | if(order == null){ |
| | | throw new CoolException("订单不存在"); |
| | | } |
| | | |
| | | //更新订单状态 |
| | | if (order.getOrderSettle().equals(OrderSettleType.INIT.val())) { |
| | | order.setOrderSettle(OrderSettleType.WAIT.val()); |
| | | order.setUpdateTime(new Date()); |
| | | if (!orderService.updateById(order)) { |
| | | throw new CoolException("订单数据更新失败"); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="strategy_order_no_rule"; |
| | | generator.tableName="单号规则"; |
| | | generator.table="strategy_wait_pakin_rule"; |
| | | generator.tableName="组托规则"; |
| | | generator.rootPackagePath="com.zy.asrs.wms"; |
| | | generator.packagePath="com.zy.asrs.wms.asrs"; |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.wms.asrs.mapper.WaitPakinRuleMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | -- save waitPakinRule record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '组托规则管理', '0', '/asrs/waitPakinRule', '/asrs/waitPakinRule', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询组托规则', '', '1', 'asrs:waitPakinRule:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加组托规则', '', '1', 'asrs:waitPakinRule:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改组托规则', '', '1', 'asrs:waitPakinRule:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除组托规则', '', '1', 'asrs:waitPakinRule:remove', '3', '1', '1'); |
| | | |