| | |
| | | <script setup> |
| | | import { ref, nextTick } from 'vue'; |
| | | import { ref, nextTick, reactive, watch } from 'vue'; |
| | | import { get, post, postBlob, postForm } from '@/utils/request.js' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | import { |
| | | MinusCircleOutlined, |
| | | PlusOutlined, |
| | | } from "@ant-design/icons-vue"; |
| | | |
| | | const formTable = ref(null); |
| | | const submitButton = ref(null); |
| | |
| | | const open = ref(false); |
| | | const initFormData = {} |
| | | let formData = ref(initFormData); |
| | | |
| | | const dynamicValidateForm = reactive({ |
| | | detls: [], |
| | | }); |
| | | |
| | | const emit = defineEmits(['tableReload']) |
| | | |
| | |
| | | const onFinish = values => { |
| | | // console.log('Success:', values); |
| | | open.value = false; |
| | | |
| | | let detls = [] |
| | | dynamicValidateForm.detls.forEach((item) => { |
| | | detls.push(item.value) |
| | | }) |
| | | formData.value.detls = detls; |
| | | post(isSave.value ? '/api/shelvesRule/save' : '/api/shelvesRule/update', formData.value).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | |
| | | }) |
| | | } |
| | | |
| | | const removeDomain = item => { |
| | | const index = dynamicValidateForm.detls.indexOf(item); |
| | | if (index !== -1) { |
| | | dynamicValidateForm.detls.splice(index, 1); |
| | | } |
| | | }; |
| | | |
| | | const addDomain = () => { |
| | | dynamicValidateForm.detls.push({ |
| | | value: '', |
| | | }); |
| | | }; |
| | | |
| | | watch(open, (newVal, oldVal) => { |
| | | if (open.value) { |
| | | if (!isSave.value) { |
| | | let ruleDetls = formData.value.ruleDetl$ |
| | | let detls = [] |
| | | ruleDetls.forEach((item) => { |
| | | detls.push({ |
| | | value: item.detlType |
| | | }) |
| | | }) |
| | | |
| | | dynamicValidateForm.detls = detls; |
| | | } |
| | | }else { |
| | | dynamicValidateForm.detls = [] |
| | | } |
| | | }) |
| | | |
| | | defineExpose({ |
| | | open, |
| | |
| | | <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_shelves_rule.name', '规则名称')" name="name" |
| | | style="width: 250px;"> |
| | | <a-input v-model:value="formData.name" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.strategy_shelves_rule.rule_type', '规则类型')" name="ruleType" |
| | | style="width: 250px;"> |
| | | <a-select v-model:value="formData.ruleType" :options="[ |
| | |
| | | ]"> |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.strategy_shelves_rule.create_time', '添加时间')" name="createTime" |
| | | <!-- <a-form-item :label="formatMessage('db.strategy_shelves_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" /> |
| | |
| | | style="width: 100%" show-search :options="userQueryList" optionFilterProp="label" |
| | | optionLabelProp="label"> |
| | | </a-select> |
| | | </a-form-item> |
| | | </a-form-item> --> |
| | | <a-form-item :label="formatMessage('db.strategy_shelves_rule.memo', '备注')" name="memo" |
| | | style="width: 250px;"> |
| | | <a-input v-model:value="formData.memo" /> |
| | |
| | | style="visibility: hidden;">Submit</a-button> |
| | | </a-form-item> |
| | | </a-form> |
| | | |
| | | <a-form> |
| | | <a-form-item v-for="(domain, index) in dynamicValidateForm.detls" :key="domain.key" |
| | | :label="formatMessage('db.strategy_shelves_rule.memo', '规则明细')" :name="['domains', index, 'value']" |
| | | :labelCol="{ span: 4, offset: 1 }" style="width: 100%;"> |
| | | <div style="width: 400px;"> |
| | | <a-select v-model:value="domain.value" :options="[ |
| | | { label: '库存或任务中匹配相邻库位', value: 1 }, |
| | | { label: '推荐区域', value: 2 }, |
| | | { label: '完整巷道', value: 3 }, |
| | | ]" style="width: 300px;margin-right: 20px;"> |
| | | </a-select> |
| | | <MinusCircleOutlined v-if="dynamicValidateForm.detls.length > 1" |
| | | @click="removeDomain(domain)" /> |
| | | </div> |
| | | </a-form-item> |
| | | <a-form-item :labelCol="{ span: 4, offset: 1 }" style="width: 100%;"> |
| | | <div style="width: 200px;"> |
| | | <a-button type="dashed" style="width: 200px;" @click="addDomain"> |
| | | <PlusOutlined /> |
| | | {{ formatMessage('db.strategy_shelves_rule.addDetl', '添加明细') }} |
| | | </a-button> |
| | | </div> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | |
| | | } = useTableSearch(); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.rule_type', '规则类型'), |
| | | dataIndex: 'ruleType$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('ruleType$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.lane$', '巷道'), |
| | | dataIndex: 'lane$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('lane$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('status$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.create_by', '添加人员'), |
| | | dataIndex: 'createBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.update_by', '修改人员'), |
| | | dataIndex: 'updateBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('memo'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.name', '规则名称'), |
| | | dataIndex: 'name', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('name'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.rule_type', '规则类型'), |
| | | dataIndex: 'ruleType$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('ruleType$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.lane$', '巷道'), |
| | | dataIndex: 'lane$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('lane$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('status$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.create_by', '添加人员'), |
| | | dataIndex: 'createBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.update_by', '修改人员'), |
| | | dataIndex: 'updateBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.strategy_shelves_rule.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('memo'), |
| | | }, |
| | | |
| | | { |
| | | title: formatMessage('common.operation', '操作'), |
| | |
| | | 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.ShelvesRuleDetl; |
| | | import com.zy.asrs.wms.asrs.service.ShelvesRuleDetlService; |
| | | 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.utils.ExcelUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | @Autowired |
| | | private ShelvesRuleService shelvesRuleService; |
| | | @Autowired |
| | | private ShelvesRuleDetlService shelvesRuleDetlService; |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:shelvesRule:list')") |
| | | @PostMapping("/shelvesRule/page") |
| | |
| | | return R.error("缺少参数"); |
| | | } |
| | | ShelvesRule shelvesRule = new ShelvesRule(); |
| | | shelvesRule.setName(param.get("name").toString()); |
| | | shelvesRule.setRuleType(Integer.parseInt(param.get("ruleType").toString())); |
| | | shelvesRule.setLane(JSON.toJSONString(param.get("laneList"))); |
| | | if (!shelvesRuleService.save(shelvesRule)) { |
| | | return R.error("添加失败"); |
| | | throw new CoolException("添加失败"); |
| | | } |
| | | |
| | | List<Integer> detls = JSON.parseArray(JSON.toJSONString(param.get("detls")), Integer.class); |
| | | for (Integer detlType : detls) { |
| | | ShelvesRuleDetl shelvesRuleDetl = new ShelvesRuleDetl(); |
| | | shelvesRuleDetl.setRuleId(shelvesRule.getId()); |
| | | shelvesRuleDetl.setDetlType(detlType); |
| | | if (!shelvesRuleDetlService.save(shelvesRuleDetl)) { |
| | | throw new CoolException("添加规则明细失败"); |
| | | } |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | |
| | | @PreAuthorize("hasAuthority('asrs:shelvesRule:update')") |
| | | @OperationLog("修改上架规则") |
| | | @PostMapping("/shelvesRule/update") |
| | | @Transactional |
| | | public R update(@RequestBody HashMap<String, Object> param) { |
| | | if(!param.containsKey("ruleType") || !param.containsKey("laneList") || !param.containsKey("id")) { |
| | | return R.error("缺少参数"); |
| | |
| | | return R.error("上架规则不存在"); |
| | | } |
| | | |
| | | shelvesRule.setName(param.get("name").toString()); |
| | | shelvesRule.setRuleType(Integer.parseInt(param.get("ruleType").toString())); |
| | | shelvesRule.setLane(JSON.toJSONString(param.get("laneList"))); |
| | | shelvesRule.setStatus(Integer.parseInt(param.get("status").toString())); |
| | | if (!shelvesRuleService.updateById(shelvesRule)) { |
| | | return R.error("修改失败"); |
| | | throw new CoolException("修改失败"); |
| | | } |
| | | |
| | | shelvesRuleDetlService.remove(new LambdaQueryWrapper<ShelvesRuleDetl>().eq(ShelvesRuleDetl::getRuleId, shelvesRule.getId())); |
| | | List<Integer> detls = JSON.parseArray(JSON.toJSONString(param.get("detls")), Integer.class); |
| | | for (Integer detlType : detls) { |
| | | ShelvesRuleDetl shelvesRuleDetl = new ShelvesRuleDetl(); |
| | | shelvesRuleDetl.setRuleId(shelvesRule.getId()); |
| | | shelvesRuleDetl.setDetlType(detlType); |
| | | if (!shelvesRuleDetlService.save(shelvesRuleDetl)) { |
| | | throw new CoolException("添加规则明细失败"); |
| | | } |
| | | } |
| | | |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.wms.asrs.service.LanewayRuleService; |
| | | import com.zy.asrs.wms.asrs.service.ShelvesRuleDetlService; |
| | | import com.zy.asrs.wms.system.entity.Host; |
| | | import com.zy.asrs.wms.system.entity.User; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 规则名称 |
| | | */ |
| | | @ApiModelProperty(value= "规则名称") |
| | | private String name; |
| | | |
| | | /** |
| | | * 规则类型 0: 优先平层 1: 优先立体 |
| | | */ |
| | | @ApiModelProperty(value= "规则类型 0: 优先平层 1: 优先立体 ") |
| | |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | |
| | | return list; |
| | | } |
| | | |
| | | public List<ShelvesRuleDetl> getRuleDetl$() { |
| | | ShelvesRuleDetlService service = SpringUtils.getBean(ShelvesRuleDetlService.class); |
| | | return service.list(new LambdaQueryWrapper<ShelvesRuleDetl>().eq(ShelvesRuleDetl::getRuleId, id)); |
| | | } |
| | | |
| | | public String getRuleType$(){ |
| | | if (null == this.ruleType){ return null; } |
| | | switch (this.ruleType){ |