10 changed files with 783 additions and 16 deletions
@ -0,0 +1,26 @@ |
|||
package org.nl.wms.ext.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
/** |
|||
* <p> |
|||
* WMS调用ERP 服务类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-03 |
|||
*/ |
|||
public interface WmsToErpService { |
|||
|
|||
/** |
|||
* 出入库单据回传 |
|||
* @param whereJson { |
|||
* data: [] |
|||
* } |
|||
* @return JSONObject { |
|||
* status: 200 / !=200 |
|||
* message: 信息 |
|||
* } |
|||
*/ |
|||
JSONObject uploadErp(JSONObject whereJson); |
|||
} |
@ -0,0 +1,54 @@ |
|||
package org.nl.wms.ext.service.impl; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import cn.hutool.http.HttpRequest; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.config.SpringContextHolder; |
|||
import org.nl.system.service.param.impl.SysParamServiceImpl; |
|||
import org.nl.wms.ext.service.WmsToErpService; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* <p> |
|||
* WMS调用ERP 实现类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-03 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class WmsToErpServiceImpl implements WmsToErpService { |
|||
|
|||
@Override |
|||
public JSONObject uploadErp(JSONObject whereJson) { |
|||
log.info("uploadErp接口输入参数为:-------------------" + whereJson.toString()); |
|||
JSONObject result = new JSONObject(); |
|||
|
|||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("ERP_URL").getValue(); |
|||
String api = "CamstarApi/MomRollBakeInBound"; |
|||
url = url + api; |
|||
|
|||
try { |
|||
String resultMsg = HttpRequest.post(url) |
|||
.body(String.valueOf(whereJson)) |
|||
.execute().body(); |
|||
result = JSONObject.parseObject(resultMsg); |
|||
log.info("uploadErp接口输出参数为:-------------------" + result.toString()); |
|||
|
|||
|
|||
Integer status = result.getInteger("status"); |
|||
if (status != HttpStatus.OK.value()) { |
|||
throw new BadRequestException(result.getString("message")); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
throw new BadRequestException("ERP提示错误:" + e.getMessage()); |
|||
} |
|||
return result; |
|||
|
|||
} |
|||
} |
@ -0,0 +1,55 @@ |
|||
package org.nl.wms.warehouse_management.controller; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.wms.warehouse_management.service.ReturnService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* <p> |
|||
* 出入库回传 控制层 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-03 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/iosReturn") |
|||
@Slf4j |
|||
public class ReturnController { |
|||
|
|||
@Autowired |
|||
private ReturnService returnService; |
|||
|
|||
@GetMapping |
|||
@Log("查询出入库单") |
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(returnService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/upload") |
|||
@Log("回传") |
|||
public ResponseEntity<Object> upload(@RequestBody JSONObject whereJson) { |
|||
returnService.upload(whereJson); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/disupload") |
|||
@Log("不回传") |
|||
public ResponseEntity<Object> disupload(@RequestBody JSONObject whereJson) { |
|||
returnService.disupload(whereJson); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,45 @@ |
|||
package org.nl.wms.warehouse_management.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.wms.warehouse_management.service.dao.IOStorInv; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* <p> |
|||
* 出入库回传 服务类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-03 |
|||
*/ |
|||
public interface ReturnService extends IService<IOStorInv> { |
|||
|
|||
/** |
|||
* 分页查询 |
|||
* @param whereJson : {查询参数} |
|||
* @param page : 分页对象 |
|||
* @return 返回结果 |
|||
*/ |
|||
IPage<IOStorInv> queryAll(Map whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 回传 |
|||
* @param whereJson { |
|||
* rows: [] |
|||
* } |
|||
*/ |
|||
void upload(JSONObject whereJson); |
|||
|
|||
/** |
|||
* 不回传 |
|||
* @param whereJson { |
|||
* rows: [] |
|||
* } |
|||
*/ |
|||
void disupload(JSONObject whereJson); |
|||
} |
@ -0,0 +1,197 @@ |
|||
package org.nl.wms.warehouse_management.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.map.MapUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.wms.basedata_manage.enums.BaseDataEnum; |
|||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService; |
|||
import org.nl.wms.basedata_manage.service.IMdPbMeasureunitService; |
|||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase; |
|||
import org.nl.wms.basedata_manage.service.dao.MdPbMeasureunit; |
|||
import org.nl.wms.ext.service.WmsToErpService; |
|||
import org.nl.wms.warehouse_management.enums.IOSConstant; |
|||
import org.nl.wms.warehouse_management.enums.IOSEnum; |
|||
import org.nl.wms.warehouse_management.service.ReturnService; |
|||
import org.nl.wms.warehouse_management.service.dao.IOStorInv; |
|||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis; |
|||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper; |
|||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 出入库回传 实现类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-03 |
|||
*/ |
|||
@Service |
|||
public class RetrunServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> implements ReturnService { |
|||
|
|||
/** |
|||
* 出入库mapper服务 |
|||
*/ |
|||
@Autowired |
|||
private IOStorInvDisMapper ioStorInvDisMapper; |
|||
|
|||
/** |
|||
* 物料基础服务 |
|||
*/ |
|||
@Autowired |
|||
private IMdMeMaterialbaseService iMdMeMaterialbaseService; |
|||
|
|||
/** |
|||
* 计量单位服务 |
|||
*/ |
|||
@Autowired |
|||
private IMdPbMeasureunitService iMdPbMeasureunitService; |
|||
|
|||
/** |
|||
* WMS调用ERP服务类 |
|||
*/ |
|||
@Autowired |
|||
private WmsToErpService wmsToErpService; |
|||
|
|||
@Override |
|||
public IPage<IOStorInv> queryAll(Map whereJson, PageQuery page) { |
|||
String stor_id = MapUtil.getStr(whereJson, "stor_id"); |
|||
String io_type = MapUtil.getStr(whereJson, "io_type"); |
|||
String bill_type = MapUtil.getStr(whereJson, "bill_type"); |
|||
String bill_code = MapUtil.getStr(whereJson, "bill_code"); |
|||
String is_upload = MapUtil.getStr(whereJson, "is_upload"); |
|||
String begin_time = MapUtil.getStr(whereJson, "begin_time"); |
|||
String end_time = MapUtil.getStr(whereJson, "end_time"); |
|||
|
|||
LambdaQueryWrapper<IOStorInv> lambda = new QueryWrapper<IOStorInv>().lambda(); |
|||
lambda.eq(ObjectUtil.isNotEmpty(stor_id), IOStorInv::getStor_id, stor_id); |
|||
lambda.eq(ObjectUtil.isNotEmpty(io_type), IOStorInv::getIo_type, io_type); |
|||
lambda.eq(ObjectUtil.isNotEmpty(bill_type), IOStorInv::getBill_type, bill_type); |
|||
lambda.like(ObjectUtil.isNotEmpty(bill_code), IOStorInv::getBill_code, bill_code); |
|||
lambda.eq(ObjectUtil.isNotEmpty(is_upload), IOStorInv::getIs_upload, is_upload); |
|||
lambda.ge(ObjectUtil.isNotEmpty(begin_time), IOStorInv::getInput_time, begin_time); |
|||
lambda.lt(ObjectUtil.isNotEmpty(end_time), IOStorInv::getInput_time, end_time); |
|||
lambda.eq(IOStorInv::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否")); |
|||
lambda.eq(IOStorInv::getBill_status, IOSEnum.CHECK_MST_STATUS.code("完成")); |
|||
lambda.orderByDesc(IOStorInv::getInput_time); |
|||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), |
|||
lambda |
|||
); |
|||
} |
|||
|
|||
@Override |
|||
public void upload(JSONObject whereJson) { |
|||
List<JSONObject> rows = whereJson.getJSONArray("rows").toJavaList(JSONObject.class); |
|||
// 根据主表id查询所有分配明细
|
|||
List<IOStorInvDis> iosDisList = ioStorInvDisMapper.selectList( |
|||
new QueryWrapper<IOStorInvDis>().lambda() |
|||
.in(IOStorInvDis::getIostorinv_id, rows.stream() |
|||
.map(row -> row.getString("iostorinv_id")) |
|||
.collect(Collectors.toList()) |
|||
) |
|||
); |
|||
// 查询所有物料
|
|||
List<MdMeMaterialbase> materList = iMdMeMaterialbaseService.list( |
|||
new QueryWrapper<MdMeMaterialbase>().lambda() |
|||
.in(MdMeMaterialbase::getMaterial_id, iosDisList.stream() |
|||
.map(IOStorInvDis::getMaterial_id) |
|||
.distinct() |
|||
.collect(Collectors.toList()) |
|||
|
|||
) |
|||
); |
|||
// 查询所有计量单位
|
|||
List<MdPbMeasureunit> unitList = iMdPbMeasureunitService.list( |
|||
new QueryWrapper<MdPbMeasureunit>().lambda() |
|||
.in(MdPbMeasureunit::getMeasure_unit_id, iosDisList.stream() |
|||
.map(IOStorInvDis::getQty_unit_id) |
|||
.distinct() |
|||
.collect(Collectors.toList())) |
|||
); |
|||
|
|||
// 需回传数据集合
|
|||
List<JSONObject> paramList = new ArrayList<>(); |
|||
for(IOStorInvDis disDao : iosDisList) { |
|||
JSONObject param = new JSONObject(); |
|||
// 物料编码
|
|||
MdMeMaterialbase materDao = materList.stream() |
|||
.filter(row -> row.getMaterial_id().equals(disDao.getMaterial_id())) |
|||
.findFirst().orElse(null); |
|||
param.put("mater_code", materDao.getExt_id()); |
|||
// 批次
|
|||
param.put("batch_no", disDao.getPcsn()); |
|||
// 数量
|
|||
param.put("quantity", disDao.getReal_qty()); |
|||
// 计量单位
|
|||
MdPbMeasureunit unitDao = unitList.stream() |
|||
.filter(row -> row.getMeasure_unit_id().equals(disDao.getQty_unit_id())) |
|||
.findFirst().orElse(null); |
|||
param.put("unit_code", unitDao.getExt_id()); |
|||
// 仓库编码
|
|||
JSONObject jsonMst = rows.stream() |
|||
.filter(row -> row.getString("iostorinv_id").equals(disDao.getIostorinv_id())) |
|||
.findFirst().orElse(null); |
|||
param.put("stor_code", jsonMst.getString("stor_code")); |
|||
// 货位编码
|
|||
param.put("point_code", disDao.getStruct_code()); |
|||
// 载具编码
|
|||
param.put("pallet_code", disDao.getStoragevehicle_code()); |
|||
// 单据号
|
|||
param.put("inv_code", jsonMst.getString("bill_code")); |
|||
// 业务类型
|
|||
param.put("task_type", jsonMst.getString("bill_type")); |
|||
paramList.add(param); |
|||
} |
|||
JSONObject jsonParam = new JSONObject(); |
|||
jsonParam.put("data", paramList); |
|||
wmsToErpService.uploadErp(jsonParam); |
|||
|
|||
// 更新主表
|
|||
this.update( |
|||
new UpdateWrapper<IOStorInv>().lambda() |
|||
.in(IOStorInv::getIostorinv_id, rows.stream() |
|||
.map(row -> row.getString("iostorinv_id")) |
|||
.collect(Collectors.toList()) |
|||
) |
|||
.set(IOStorInv::getIs_upload, IOSConstant.IS_DELETE_YES) |
|||
.set(IOStorInv::getUpdate_optid, SecurityUtils.getCurrentUserId()) |
|||
.set(IOStorInv::getUpdate_optname, SecurityUtils.getCurrentNickName()) |
|||
.set(IOStorInv::getUpdate_time, DateUtil.now()) |
|||
); |
|||
|
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void disupload(JSONObject whereJson) { |
|||
List<JSONObject> rows = whereJson.getJSONArray("rows").toJavaList(JSONObject.class); |
|||
List<String> idList = rows.stream() |
|||
.map(row -> row.getString("iostorinv_id")) |
|||
.collect(Collectors.toList()); |
|||
// 更新
|
|||
this.update( |
|||
new UpdateWrapper<IOStorInv>().lambda() |
|||
.in(IOStorInv::getIo_type, idList) |
|||
.set(IOStorInv::getIs_upload, IOSConstant.IS_DELETE_YES) |
|||
.set(IOStorInv::getUpdate_optid, SecurityUtils.getCurrentUserId()) |
|||
.set(IOStorInv::getUpdate_optname, SecurityUtils.getCurrentNickName()) |
|||
.set(IOStorInv::getUpdate_time, DateUtil.now()) |
|||
); |
|||
} |
|||
} |
@ -0,0 +1,43 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/iosReturn', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/iosReturn/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/iosReturn', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function upload(data) { |
|||
return request({ |
|||
url: '/api/iosReturn/upload', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function disupload(data) { |
|||
return request({ |
|||
url: '/api/iosReturn/disupload', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export default { add, edit, del, upload, disupload } |
@ -0,0 +1,355 @@ |
|||
<template> |
|||
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container"> |
|||
<!--工具栏--> |
|||
<div class="head-container"> |
|||
<div v-if="crud.props.searchToggle"> |
|||
<!-- 搜索 --> |
|||
<el-form |
|||
:inline="true" |
|||
class="demo-form-inline" |
|||
label-position="right" |
|||
label-width="90px" |
|||
label-suffix=":" |
|||
> |
|||
<el-form-item label="所属仓库"> |
|||
<el-select |
|||
v-model="query.stor_id" |
|||
clearable |
|||
size="mini" |
|||
placeholder="全部" |
|||
class="filter-item" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option |
|||
v-for="item in storlist" |
|||
:key="item.stor_id" |
|||
:label="item.stor_name" |
|||
:value="item.stor_id" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="出入类型"> |
|||
<el-select |
|||
v-model="query.io_type" |
|||
size="mini" |
|||
placeholder="出入类型" |
|||
class="filter-item" |
|||
@change="ioTypeChange" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.io_type" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="业务类型"> |
|||
<el-select |
|||
v-model="query.bill_type" |
|||
clearable |
|||
filterable |
|||
size="mini" |
|||
placeholder="业务类型" |
|||
class="filter-item" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option |
|||
v-for="item in billtypelist" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="模糊查询"> |
|||
<el-input |
|||
v-model="query.bill_code" |
|||
size="mini" |
|||
clearable |
|||
placeholder="出入库单号" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="是否回传"> |
|||
<el-select |
|||
v-model="query.is_upload" |
|||
clearable |
|||
size="mini" |
|||
placeholder="是否回传" |
|||
class="filter-item" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.is_upload" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="单据日期"> |
|||
<el-date-picker |
|||
v-model="query.createTime" |
|||
type="daterange" |
|||
value-format="yyyy-MM-dd HH:mm:ss" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
:default-time="['00:00:00', '23:59:59']" |
|||
@input="onInput()" |
|||
@change="mytoQuery" |
|||
/> |
|||
</el-form-item> |
|||
<rrOperation /> |
|||
</el-form> |
|||
</div> |
|||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
|||
<crudOperation :permission="permission"> |
|||
<el-button |
|||
slot="right" |
|||
class="filter-item" |
|||
type="primary" |
|||
icon="el-icon-position" |
|||
size="mini" |
|||
@click="upload" |
|||
> |
|||
回传 |
|||
</el-button> |
|||
<el-button |
|||
slot="right" |
|||
class="filter-item" |
|||
type="warning" |
|||
icon="el-icon-position" |
|||
size="mini" |
|||
@click="disupload" |
|||
> |
|||
不回传 |
|||
</el-button> |
|||
</crudOperation> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
size="mini" |
|||
:data="crud.data" |
|||
style="width: 100%;" |
|||
:highlight-current-row="true" |
|||
@selection-change="crud.selectionChangeHandler" |
|||
> |
|||
<el-table-column type="selection" width="55" /> |
|||
<el-table-column prop="is_upload" label="是否回传" :formatter="formatIsUpload" :min-width="flexWidth('is_upload',crud.data,'是否回传')" /> |
|||
<el-table-column prop="bill_code" label="单据号" :min-width="flexWidth('bill_code',crud.data,'单据号')" /> |
|||
<el-table-column prop="stor_name" label="仓库" :min-width="flexWidth('stor_name',crud.data,'仓库')" /> |
|||
<el-table-column prop="bill_type" :formatter="bill_typeFormat" label="业务类型" :min-width="flexWidth('bill_type',crud.data,'业务类型')" /> |
|||
<el-table-column prop="biz_date" label="业务日期" :min-width="flexWidth('biz_date',crud.data,'业务日期')" /> |
|||
<el-table-column prop="total_qty" label="总重量" :min-width="100" :formatter="crud.formatNum3" /> |
|||
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" /> |
|||
<el-table-column :formatter="create_modeFormat" prop="create_mode" label="生成方式" :min-width="flexWidth('create_mode',crud.data,'生成方式')" /> |
|||
<el-table-column label="明细数" align="center" prop="detail_count" :min-width="flexWidth('detail_count',crud.data,'明细数')" /> |
|||
<el-table-column prop="input_optname" label="制单人" :min-width="flexWidth('input_optname',crud.data,'制单人')" /> |
|||
<el-table-column prop="input_time" label="制单时间" :min-width="flexWidth('input_time',crud.data,'制单时间')" /> |
|||
<el-table-column prop="confirm_optname" label="完成人" :min-width="flexWidth('confirm_optname',crud.data,'完成人')" /> |
|||
<el-table-column prop="confirm_time" label="完成时间" :min-width="flexWidth('confirm_time',crud.data,'完成时间')" /> |
|||
<el-table-column prop="update_optname" label="回传人" :min-width="flexWidth('update_optname',crud.data,'回传人')" /> |
|||
<el-table-column prop="update_time" label="回传时间" :min-width="flexWidth('update_time',crud.data,'回传时间')" /> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import inandoutreturn from '@/views/wms/st/inAndOutReturn/inandoutreturn' |
|||
import CRUD, { crud, header, presenter } from '@crud/crud' |
|||
import rrOperation from '@crud/RR.operation' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import pagination from '@crud/Pagination' |
|||
import crudUserStor from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr' |
|||
import Date from '@/utils/datetime' |
|||
|
|||
export default { |
|||
name: 'Return', |
|||
components: { crudOperation, rrOperation, pagination }, |
|||
cruds() { |
|||
return CRUD({ |
|||
title: '出入库单回传', idField: 'iostorinv_id', url: 'api/iosReturn', crudMethod: { ...inandoutreturn }, |
|||
optShow: { |
|||
add: false, |
|||
edit: false, |
|||
del: false, |
|||
reset: true, |
|||
download: false |
|||
}, |
|||
query: { io_type: '0', bill_status: '99' }, |
|||
queryOnPresenterCreated: false |
|||
}) |
|||
}, |
|||
mixins: [presenter(), header(), crud()], |
|||
// 数据字典 |
|||
dicts: ['ST_CREATE_MODE', 'io_type', 'is_upload', 'ST_INV_IN_TYPE', 'ST_INV_OUT_TYPE'], |
|||
data() { |
|||
return { |
|||
height: document.documentElement.clientHeight - 180 + 'px;', |
|||
permission: {}, |
|||
mstrow: {}, |
|||
fullscreenLoading: false, |
|||
storlist: [], |
|||
query_flag: true, |
|||
billtypelist: [], |
|||
showDtlLoading: false |
|||
} |
|||
}, |
|||
mounted: function() { |
|||
const that = this |
|||
window.onresize = function temp() { |
|||
that.height = document.documentElement.clientHeight - 180 + 'px;' |
|||
} |
|||
}, |
|||
created() { |
|||
crudUserStor.getStor().then(res => { |
|||
this.storlist = res |
|||
}) |
|||
// debugger |
|||
this.billtypelist = this.dict.ST_INV_OUT_TYPE |
|||
this.crud.query.createTime = [new Date().daysAgo(30), new Date()] |
|||
this.initQuery() |
|||
}, |
|||
methods: { |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
if (this.query_flag) { |
|||
this.crud.query.begin_time = (new Date().daysAgo(30)).strftime('%F', 'zh') |
|||
this.crud.query.end_time = (new Date()).strftime('%F', 'zh') |
|||
this.query_flag = false |
|||
} |
|||
}, |
|||
/* 搜索框出入类型 默认出库*/ |
|||
initQuery() { |
|||
this.query.io_type = '1' |
|||
this.query.is_upload = '0' |
|||
this.crud.toQuery() |
|||
}, |
|||
mytoQuery(array1) { |
|||
if (array1 === null) { |
|||
this.crud.query.begin_time = '' |
|||
this.crud.query.end_time = '' |
|||
} else { |
|||
this.crud.query.begin_time = array1[0] |
|||
this.crud.query.end_time = array1[1] |
|||
} |
|||
this.crud.toQuery() |
|||
}, |
|||
onInput() { |
|||
this.$forceUpdate() |
|||
}, |
|||
querytable() { |
|||
this.onSelectAll() |
|||
this.crud.toQuery() |
|||
}, |
|||
bill_typeFormat(row) { |
|||
if (this.query.io_type === '0') { |
|||
return this.dict.label.ST_INV_IN_TYPE[row.bill_type] |
|||
} |
|||
if (this.query.io_type === '1') { |
|||
return this.dict.label.ST_INV_OUT_TYPE[row.bill_type] |
|||
} |
|||
}, |
|||
ioTypeChange(value) { |
|||
if (value === '1') { |
|||
this.billtypelist = this.dict.ST_INV_OUT_TYPE |
|||
} else { |
|||
this.billtypelist = this.dict.ST_INV_IN_TYPE |
|||
} |
|||
this.crud.toQuery() |
|||
}, |
|||
create_modeFormat(row) { |
|||
return this.dict.label.ST_CREATE_MODE[row.create_mode] |
|||
}, |
|||
upload() { |
|||
const res = this.$refs.table.selection |
|||
if (!res || res.length < 1) { |
|||
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO) |
|||
return |
|||
} |
|||
const upload_flag = res.some(row => row.is_upload === '1') |
|||
if (upload_flag) { |
|||
this.$confirm('存在已经回传的单据, 是否继续回传?', '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
this.fullscreenLoading = true |
|||
const data = {} |
|||
data.rows = res |
|||
inandoutreturn.upload(data).then(res => { |
|||
this.fullscreenLoading = false |
|||
this.crud.notify('单据回传成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) |
|||
this.crud.toQuery() |
|||
}).catch(() => { |
|||
this.fullscreenLoading = false |
|||
}) |
|||
}).catch(() => { |
|||
this.$message({ |
|||
type: 'info', |
|||
message: '已取消回传' |
|||
}) |
|||
}) |
|||
} else { |
|||
this.fullscreenLoading = true |
|||
const data = {} |
|||
data.rows = res |
|||
inandoutreturn.upload(data).then(res => { |
|||
this.fullscreenLoading = false |
|||
this.crud.notify('单据回传成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) |
|||
this.crud.toQuery() |
|||
}).catch(() => { |
|||
this.fullscreenLoading = false |
|||
}) |
|||
} |
|||
}, |
|||
disupload() { |
|||
const res = this.$refs.table.selection |
|||
if (!res || res.length < 1) { |
|||
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO) |
|||
return |
|||
} |
|||
this.fullscreenLoading = true |
|||
const data = {} |
|||
data.rows = res |
|||
inandoutreturn.disupload(data).then(res => { |
|||
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) |
|||
}).finally(() => { |
|||
this.fullscreenLoading = false |
|||
this.crud.toQuery() |
|||
}) |
|||
}, |
|||
formatIsUpload(row) { |
|||
if (row.is_upload === '0') { |
|||
return '否' |
|||
} else if (row.is_upload === '1') { |
|||
return '是' |
|||
} |
|||
}, |
|||
formatUploadMes(row) { |
|||
if (row.upload_mes === '0') { |
|||
return '否' |
|||
} else if (row.upload_mes === '1') { |
|||
return '是' |
|||
} |
|||
}, |
|||
formatUploadSap(row) { |
|||
if (row.upload_sap === '0') { |
|||
return '否' |
|||
} else if (row.upload_sap === '1') { |
|||
return '是' |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
::v-deep .el-dialog__body { |
|||
padding-top: 10px; |
|||
} |
|||
</style> |
Loading…
Reference in new issue