diff --git a/ant-design-vue-jeecg/src/components/lang/en-US.js b/ant-design-vue-jeecg/src/components/lang/en-US.js index ba3061e..3bee0c6 100644 --- a/ant-design-vue-jeecg/src/components/lang/en-US.js +++ b/ant-design-vue-jeecg/src/components/lang/en-US.js @@ -66,6 +66,7 @@ export default { inputScanCodeText: 'Please input scan code text', status: 'Status', selectStatus: 'Please select status', + scanSuccessful: 'Scan successful', }, pallet: { id: 'Task ID', diff --git a/ant-design-vue-jeecg/src/components/lang/zh-CN.js b/ant-design-vue-jeecg/src/components/lang/zh-CN.js index 216883c..0b46f7b 100644 --- a/ant-design-vue-jeecg/src/components/lang/zh-CN.js +++ b/ant-design-vue-jeecg/src/components/lang/zh-CN.js @@ -66,6 +66,7 @@ export default { inputScanCodeText: '请输入扫码文本', status: '状态', selectStatus: '请选择扫码文本', + scanSuccessful: '扫描成功', }, pallet: { id: '任务 ID', diff --git a/ant-design-vue-jeecg/src/views/dashboard/Analysis.vue b/ant-design-vue-jeecg/src/views/dashboard/Analysis.vue index b03886e..1ec4bad 100644 --- a/ant-design-vue-jeecg/src/views/dashboard/Analysis.vue +++ b/ant-design-vue-jeecg/src/views/dashboard/Analysis.vue @@ -1,189 +1,170 @@ <template> - <div> - <a-row :gutter="24"> </a-row> - - <a-row :gutter="24"> - <a-col :span="12"> - <a-card :bordered="false" title="历史每日收发货量" :style="{ marginTop: '24px' }"> - <a-row> - <a-col :span="19"> - <div id="chart1" class="flot-chart1"> - 这里放图表 - </div> - </a-col> - </a-row> - </a-card> - </a-col> - <a-col :span="12"> - <a-card :bordered="false" title="库位利用率" :style="{ marginTop: '24px' }"> - <a-row> - <a-col :span="19"> - <div id="chart2" class="flot-chart1"> - 这里放图表 - </div> - </a-col> - </a-row> - </a-card> - </a-col> - </a-row> - - <a-row :gutter="24"> - <a-col :span="12"> - <a-card :bordered="false" title="在线库存状态" :style="{ marginTop: '24px' }"> - <a-row> - <a-col :span="19"> - <div id="chart3" class="flot-chart1"> - 这里放图表 - </div> - </a-col> - </a-row> - </a-card> - </a-col> - <a-col :span="12"> - <a-card :bordered="false" title="库存概况" :style="{ marginTop: '24px' }"> - <a-row> - <a-col :span="19"> - <div id="chart4" class="flot-chart1"> - 这里放图表 - </div> - </a-col> - </a-row> - </a-card> - </a-col> - </a-row> - </div> + <a-card :bordered="false"> + <!-- 查询区域 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="add"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item :label="$t('scanin.scanCodeText')"> + <a-input :placeholder="$t('scanin.inputScanCodeText')" v-model="queryParam.context" ref="input" @blur="focus"></a-input> + </a-form-item> + </a-col> + </a-row> + </a-form> + </div> + <!-- 查询区域-END --> + + <!-- table区域-begin --> + <div> + <a-table + ref="table" + size="middle" + :scroll="{ x: false }" + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="false" + class="j-table-force-nowrap" + @change="handleTableChange" + ></a-table> + </div> + </a-card> </template> -<script language="javascript" type="text/javascript"> -import {} from '@/api/api' +<script> +import '@/assets/less/TableExpand.less' +import { mixinDevice } from '@/utils/mixin' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import { httpGroupRequest } from '@/api/GroupRequest.js' +import { getAction, postAction } from '@/api/manage' export default { - name: 'Echartdemo', + name: 'ScaninRecordList', + mixins: [JeecgListMixin, mixinDevice], + props: ['groupId'], + components: {}, data() { return { - msg: 'EChart demo', - s1: '0', - s2: '0', - s3: '0', - s4: '0', - s5: '0', - s6: '0' + description: '上线扫码管理页面', + dataSource: [], + isorter: { + column: 'createTime', + order: 'desc' + }, + // 表头 + columns: [ + { + title: 'ID', + align: 'center', + dataIndex: 'id' + }, + { + title: this.$t('scanin.scanCodeText'), + align: 'center', + dataIndex: 'context' + }, + { + title: this.$t('scanin.status'), + align: 'center', + dataIndex: 'status' + }, + { + title: this.$t('system.remark'), + align: 'center', + dataIndex: 'remark' + }, + { + title: this.$t('system.createTime'), + align: 'center', + dataIndex: 'createTime' + }, + { + title: this.$t('system.updateTime'), + align: 'center', + dataIndex: 'updateTime' + } + ], + url: { + list: '/scan/scaninRecord/list', + add: '/scan/scaninRecord/add' + }, + dictOptions: {}, + superFieldList: [] } }, mounted() { - this.drawLine() + // 每隔3秒定时刷新 + this.timer = setInterval(() => { + this.loadPeriodData() + }, 30000) + }, + created() { + this.$nextTick(() => this.$refs.input.focus()) + this.getSuperFieldList() + }, + computed: { + importExcelUrl: function() { + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}` + } }, methods: { - drawLine() { - let chart1 = this.$echarts.init(document.getElementById('chart1')) - let chart2 = this.$echarts.init(document.getElementById('chart2')) - let chart3 = this.$echarts.init(document.getElementById('chart3')) - let chart4 = this.$echarts.init(document.getElementById('chart4')) - - // deliveringAmount().then(res => { - // if (res.success) { - // chart1.setOption(JSON.parse(res.message)) - // } - // }) - // inventoryUtilization().then(res => { - // if (res.success) { - // chart2.setOption(JSON.parse(res.message)) - // } - // }) - // inventoryStatus().then(res => { - // if (res.success) { - // chart3.setOption(JSON.parse(res.message)) - // } - // }) - // inventoryOverview().then(res => { - // if (res.success) { - // chart4.setOption(JSON.parse(res.message)) - // } - // }) - // getCommonData().then(res => { - // if (res.success) { - // this.s1 = res.result.bllCount - // this.s2 = res.result.receiptTotal - // this.s3 = res.result.shipmentTotal - // this.s4 = res.result.inventoryTotal - // this.s5 = res.result.materialCount - // this.s6 = res.result.taskUncompletedTotal - // } - // }) + focus() { + this.$nextTick(() => this.$refs.input.focus()) + }, + add() { + let params = Object.assign({}, this.queryParam, this.isorter) + let url = `${this.url.add}` + //缓存key + let groupIdKey + if (this.groupId) { + groupIdKey = this.groupId + url + } + httpGroupRequest(() => postAction(url, params), groupIdKey).then(res => { + if (res.success) { + if (res.message != '') { + this.$notification.success({ + message: this.$t('system.systemMessage'), + description: this.queryParam.context + ' ' + this.$t('scanin.scanSuccessful') + }) + this.loadPeriodData() + } + } else { + this.$notification.error({ + message: this.$t('system.systemMessage'), + description: res.message + }) + } + this.searchReset() + }) + }, + initDictConfig() {}, + getSuperFieldList() { + let fieldList = [] + fieldList.push({ type: 'string', value: 'context', text: 'context', dictCode: '' }) + fieldList.push({ type: 'string', value: 'status', text: 'status', dictCode: '' }) + this.superFieldList = fieldList + }, + async loadPeriodData() { + let params = Object.assign({}, null, this.isorter) + let url = `${this.url.list}` + //缓存key + let groupIdKey + if (this.groupId) { + groupIdKey = this.groupId + url + } + httpGroupRequest(() => getAction(url, params), groupIdKey).then(res => { + let data = res.result + console.info(data.records) + if (data.length > 0) { + this.dataSource = data + } else { + this.dataSource = [] + } + }) } } } </script> - <style scoped> -@media (min-width: 768px) { - .col-sm-2 { - float: left; - } - - .col-sm-2 { - width: 16.66666667%; - } -} - -.panel-heading h1, -.panel-heading h2 { - margin-bottom: 5px; -} - -.ibox-content h1, -.ibox-content h2, -.ibox-content h3, -.ibox-content h4, -.ibox-content h5, -.ibox-title h1, -.ibox-title h2, -.ibox-title h3, -.ibox-title h4, -.ibox-title h5 { - margin-top: 5px; -} - -h1 { - font-size: 30px; - color: #fff; -} - -.total_box { - text-align: center; - color: #fff; - padding: 8px 0 10px 0; -} - -.total_box:hover { - opacity: 0.8; -} - -.ys01 { - background: #1ab394; -} - -.ys02 { - background: #23c6c8; -} - -.ys03 { - background: #1c84c6; -} - -.ys04 { - background: #8d95c5; -} - -.ys05 { - background: #e59aa6; -} - -.ys06 { - background: #f8ac59; -} - -.flot-chart1 { - height: 290px; -} +@import '~@assets/less/common.less'; </style> \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/scanin/ScaninRecordList.vue b/ant-design-vue-jeecg/src/views/scanin/ScaninRecordList.vue index 3f93be1..e75fe3b 100644 --- a/ant-design-vue-jeecg/src/views/scanin/ScaninRecordList.vue +++ b/ant-design-vue-jeecg/src/views/scanin/ScaninRecordList.vue @@ -6,7 +6,7 @@ <a-row :gutter="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item :label="$t('scanin.scanCodeText')"> - <a-input :placeholder="$t('scanin.inputScanCodeText')" v-model="queryParam.context"></a-input> + <j-input :placeholder="$t('scanin.inputScanCodeText')" v-model="queryParam.context"></j-input> </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> @@ -31,18 +31,12 @@ </div> <!-- 查询区域-END --> - <!-- 操作按钮区域 --> - <div class="table-operator"> - <a-button @click="handleAdd" type="primary" icon="plus">{{ $t('button.new') }}</a-button> - </div> - <!-- table区域-begin --> <div> <a-table ref="table" size="middle" - :scroll="{ x: true }" - bordered + :scroll="{ x: false }" rowKey="id" :columns="columns" :dataSource="dataSource" @@ -117,7 +111,7 @@ export default { } ], url: { - list: '/scan/scaninRecord/list', + list: '/scan/scaninRecord/pagelist', delete: '/scan/scaninRecord/delete', deleteBatch: '/scan/scaninRecord/deleteBatch', exportXlsUrl: '/scan/scaninRecord/exportXls', diff --git a/ant-design-vue-jeecg/src/views/scanin/modules/ScaninRecordForm.vue b/ant-design-vue-jeecg/src/views/scanin/modules/ScaninRecordForm.vue index 70dad3c..e1b0932 100644 --- a/ant-design-vue-jeecg/src/views/scanin/modules/ScaninRecordForm.vue +++ b/ant-design-vue-jeecg/src/views/scanin/modules/ScaninRecordForm.vue @@ -13,6 +13,11 @@ <a-input v-model="model.context" :placeholder="$t('scanin.inputScanCodeText')"></a-input> </a-form-model-item> </a-col> + <a-col :span="24"> + <a-form-model-item :label="$t('scanin.status')" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status" > + <j-dict-select-tag type="list" v-model="model.status" dictCode="scan_record_status" :placeholder="$t('scanin.selectStatus')" /> + </a-form-model-item> + </a-col> </a-row> </a-form-model> </j-form-container> diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java index a08a3fc..5fa58b5 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java @@ -144,7 +144,7 @@ public class LoginController { String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt()); String syspassword = sysUser.getPassword(); if (!syspassword.equals(userpassword)) { - result.error500("Invalid username or password"); + result.error500("The password is incorrect"); return result; } // 激活信息认证 diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java index 49bf95c..e46a459 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java @@ -394,8 +394,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl Result<JSONObject> result = new Result<JSONObject>(); // 情况1:根据用户信息查询,该用户不存在 if (sysUser == null) { - result.error500("该用户不存在,请注册"); - baseCommonService.addLog("用户登录失败,用户不存在!", CommonConstant.LOG_TYPE_1, null); + result.error500("User account does not exist"); + baseCommonService.addLog("User account does not exist", CommonConstant.LOG_TYPE_1, null); return result; } // 情况2:根据用户信息查询,该用户已注销 diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/job/ScaninRecordParseTask.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/job/ScaninRecordParseTask.java index 643891c..eed9565 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/job/ScaninRecordParseTask.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/job/ScaninRecordParseTask.java @@ -84,6 +84,7 @@ public class ScaninRecordParseTask implements Job { String[] contexts = scaninRecord.getContext().split(SCAN_CONTEXTS_REGEX); try { PalletTaskDto palletTaskDto = new PalletTaskDto(); + palletTaskDto.setScaninRecordId(scaninRecord.getId()); palletTaskDto.setContainerCode(contexts[0]); if (SCAN_CONTEXTS_LENGTH.equals(contexts.length)) { palletTaskDto.setBatch(contexts[1]); @@ -91,9 +92,6 @@ public class ScaninRecordParseTask implements Job { palletTaskDto.setWarehouseCode(leCangWarehouseCode); palletTaskDto.setStationCode(stationCode); palletTaskService.generatePalletTaskInfo(palletTaskDto); - scaninRecordUpdateWrapper.eq(ScaninRecord::getId, scaninRecord.getId()).eq(ScaninRecord::getStatus, QuantityConstant.SCAN_RECORD_STATUS_UNMATCH) - .set(ScaninRecord::getStatus, QuantityConstant.SCAN_RECORD_STATUS_MATCHED); - scaninRecordService.update(new ScaninRecord(), scaninRecordUpdateWrapper); } catch (Exception e) { log.error("生成托盘任务失败,scaninContext:{},等待下一次重试", e); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/scan/controller/ScaninRecordController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/scan/controller/ScaninRecordController.java index 78e8314..ca61758 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/scan/controller/ScaninRecordController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/scan/controller/ScaninRecordController.java @@ -1,9 +1,11 @@ package org.jeecg.modules.wcs.scan.controller; import java.util.Arrays; +import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.transaction.Transactional; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; @@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; +import com.aliyuncs.utils.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -55,7 +58,7 @@ public class ScaninRecordController extends JeecgController<ScaninRecord, IScani */ // @AutoLog(value = "scaninRecord-分页列表查询") @ApiOperation(value = "scaninRecord-分页列表查询", notes = "scaninRecord-分页列表查询") - @GetMapping(value = "/list") + @GetMapping(value = "/pagelist") public Result<IPage<ScaninRecord>> queryPageList(ScaninRecord scaninRecord, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { QueryWrapper<ScaninRecord> queryWrapper = QueryGenerator.initQueryWrapper(scaninRecord, req.getParameterMap()); @@ -64,6 +67,14 @@ public class ScaninRecordController extends JeecgController<ScaninRecord, IScani return Result.OK(pageList); } + @GetMapping(value = "/list") + public Result<List<ScaninRecord>> list(HttpServletRequest req) { + QueryWrapper<ScaninRecord> queryWrapper = QueryGenerator.initQueryWrapper(new ScaninRecord(), req.getParameterMap()); + queryWrapper.last("limit 30"); + List<ScaninRecord> list = scaninRecordService.list(queryWrapper); + return Result.OK(list); + } + /** * 添加 * @param scaninRecord @@ -73,9 +84,12 @@ public class ScaninRecordController extends JeecgController<ScaninRecord, IScani @ApiOperation(value = "scaninRecord-添加", notes = "scaninRecord-添加") @PostMapping(value = "/add") public Result<String> add(@RequestBody ScaninRecord scaninRecord) { - scaninRecord.setStatus(QuantityConstant.SCAN_RECORD_STATUS_UNMATCH); - scaninRecordService.save(scaninRecord); - return Result.OK("添加成功!"); + if (scaninRecord != null && !StringUtils.isEmpty(scaninRecord.getContext())) { + scaninRecord.setStatus(QuantityConstant.SCAN_RECORD_STATUS_UNMATCH); + scaninRecordService.save(scaninRecord); + return Result.OK("添加成功!"); + } + return Result.OK(); } /** diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/task/dto/PalletTaskDto.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/task/dto/PalletTaskDto.java index 48274ff..d569797 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/task/dto/PalletTaskDto.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/task/dto/PalletTaskDto.java @@ -11,6 +11,8 @@ public class PalletTaskDto implements Serializable { private static final long serialVersionUID = 6796757353133379454L; + private Integer scaninRecordId; + @NotNull(message = "warehouseCode is empty") private String warehouseCode; diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/task/service/impl/PalletTaskServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/task/service/impl/PalletTaskServiceImpl.java index 62c0ad9..cf5d55a 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/task/service/impl/PalletTaskServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wcs/task/service/impl/PalletTaskServiceImpl.java @@ -31,6 +31,8 @@ import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** @@ -43,6 +45,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; public class PalletTaskServiceImpl extends ServiceImpl<PalletTaskMapper, PalletTask> implements IPalletTaskService { @Autowired + private IScaninRecordService scaninRecordService; + + @Autowired private PalletTaskMapper palletTaskMapper; @Autowired @@ -125,5 +130,12 @@ public class PalletTaskServiceImpl extends ServiceImpl<PalletTaskMapper, PalletT palletBillList.add(palletBill); } palletBillService.saveBatch(palletBillList); + LambdaUpdateWrapper<ScaninRecord> scaninRecordUpdateWrapper = Wrappers.lambdaUpdate(); + scaninRecordUpdateWrapper.eq(ScaninRecord::getId, palletTaskDto.getScaninRecordId()).eq(ScaninRecord::getStatus, QuantityConstant.SCAN_RECORD_STATUS_UNMATCH) + .set(ScaninRecord::getStatus, QuantityConstant.SCAN_RECORD_STATUS_MATCHED); + Boolean isUpdate = scaninRecordService.update(new ScaninRecord(), scaninRecordUpdateWrapper); + if (isUpdate == false) { + throw new JeecgBootException("更新扫码记录状态异常"); + } } }