add:增加回传管理页面,先生成回传单再回传(允许手动修改回传数据)
This commit is contained in:
@@ -1,55 +0,0 @@
|
|||||||
package org.nl.wms.warehouse_manage.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_manage.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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package org.nl.wms.warehouse_manage.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_manage.inAndOut.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);
|
|
||||||
}
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
package org.nl.wms.warehouse_manage.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_manage.service.WmsToErpService;
|
|
||||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
|
||||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
|
||||||
import org.nl.wms.warehouse_manage.service.ReturnService;
|
|
||||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
|
|
||||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
|
||||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
|
|
||||||
import org.nl.wms.warehouse_manage.inAndOut.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.getMaterial_code());
|
|
||||||
// 批次
|
|
||||||
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.getUnit_code());
|
|
||||||
// 仓库编码
|
|
||||||
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("source_id"));
|
|
||||||
// 业务类型
|
|
||||||
param.put("task_type", jsonMst.getString("source_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::getIostorinv_id, 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,66 @@
|
|||||||
|
package org.nl.wms.warehouse_manage.stockReturn.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_manage.stockReturn.service.dao.PmStockReturn;
|
||||||
|
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ERP回传管理 控制层
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/stockReturn")
|
||||||
|
@Slf4j
|
||||||
|
public class
|
||||||
|
PmStockReturnController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPmStockReturnService pmStockReturnService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询ERP回传管理")
|
||||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(pmStockReturnService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增ERP回传管理")
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody PmStockReturn stockReturn) {
|
||||||
|
pmStockReturnService.save(stockReturn);
|
||||||
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改ERP回传管理")
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody PmStockReturn stockReturn) {
|
||||||
|
pmStockReturnService.update(stockReturn);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@Log("删除ERP回传管理")
|
||||||
|
public ResponseEntity<Object> delete(@RequestBody Set<Integer> ids) {
|
||||||
|
pmStockReturnService.delete(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/upload")
|
||||||
|
@Log("ERP回传")
|
||||||
|
public ResponseEntity<Object> upload(@RequestBody JSONObject whereJson) {
|
||||||
|
pmStockReturnService.upload(whereJson);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package org.nl.wms.warehouse_manage.stockReturn.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_manage.stockReturn.service.dao.PmStockReturn;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ERP回传管理 服务类
|
||||||
|
*/
|
||||||
|
public interface IPmStockReturnService extends IService<PmStockReturn> {
|
||||||
|
|
||||||
|
IPage<PmStockReturn> queryAll(Map whereJson, PageQuery page);
|
||||||
|
|
||||||
|
void update(PmStockReturn stockReturn);
|
||||||
|
|
||||||
|
void delete(Set<Integer> ids);
|
||||||
|
|
||||||
|
void upload(JSONObject whereJson);
|
||||||
|
|
||||||
|
void uploadRows(List<PmStockReturn> rows);
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package org.nl.wms.warehouse_manage.stockReturn.service.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ERP回传管理
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("pm_stock_return")
|
||||||
|
public class PmStockReturn implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@TableField("request_Id")
|
||||||
|
private String request_Id;
|
||||||
|
|
||||||
|
private String request_type;
|
||||||
|
|
||||||
|
private String error_msg;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private String create_time;
|
||||||
|
|
||||||
|
private String process_time;
|
||||||
|
|
||||||
|
private String request_data;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package org.nl.wms.warehouse_manage.stockReturn.service.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回传状态枚举
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum StockReturnStatusEnum {
|
||||||
|
TODO("0","待回传"),
|
||||||
|
SUCESS("1","回传成功"),
|
||||||
|
FAIL("2","回传失败"),
|
||||||
|
;
|
||||||
|
|
||||||
|
StockReturnStatusEnum(String code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String desc;
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package org.nl.wms.warehouse_manage.stockReturn.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
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.exception.BadRequestException;
|
||||||
|
import org.nl.wms.ext_manage.service.WmsToErpService;
|
||||||
|
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
|
||||||
|
import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
|
||||||
|
import org.nl.wms.warehouse_manage.stockReturn.service.enums.StockReturnStatusEnum;
|
||||||
|
import org.nl.wms.warehouse_manage.stockReturn.service.mapper.PmStockReturnMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ERP回传管理 服务实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PmStockReturnServiceImpl extends ServiceImpl<PmStockReturnMapper, PmStockReturn> implements IPmStockReturnService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WmsToErpService wmsToErpService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<PmStockReturn> queryAll(Map whereJson, PageQuery page) {
|
||||||
|
QueryWrapper<PmStockReturn> wrapper = new QueryWrapper<>();
|
||||||
|
Object requestId = whereJson.get("request_Id");
|
||||||
|
if (requestId == null) {
|
||||||
|
requestId = whereJson.get("request_id");
|
||||||
|
}
|
||||||
|
if (StringUtils.hasText(requestId == null ? null : String.valueOf(requestId))) {
|
||||||
|
wrapper.lambda().like(PmStockReturn::getRequest_Id, requestId);
|
||||||
|
}
|
||||||
|
Object requestType = whereJson.get("request_type");
|
||||||
|
if (StringUtils.hasText(requestType == null ? null : String.valueOf(requestType))) {
|
||||||
|
wrapper.lambda().eq(PmStockReturn::getRequest_type, requestType);
|
||||||
|
}
|
||||||
|
Object status = whereJson.get("status");
|
||||||
|
if (StringUtils.hasText(status == null ? null : String.valueOf(status))) {
|
||||||
|
wrapper.lambda().eq(PmStockReturn::getStatus, status);
|
||||||
|
}
|
||||||
|
Object beginTime = whereJson.get("begin_time");
|
||||||
|
if (StringUtils.hasText(beginTime == null ? null : String.valueOf(beginTime))) {
|
||||||
|
wrapper.lambda().ge(PmStockReturn::getCreate_time, formatQueryTime(beginTime, "00:00:00"));
|
||||||
|
}
|
||||||
|
Object endTime = whereJson.get("end_time");
|
||||||
|
if (StringUtils.hasText(endTime == null ? null : String.valueOf(endTime))) {
|
||||||
|
wrapper.lambda().le(PmStockReturn::getCreate_time, formatQueryTime(endTime, "23:59:59"));
|
||||||
|
}
|
||||||
|
wrapper.lambda().orderByDesc(PmStockReturn::getId);
|
||||||
|
return this.page(new Page<>(page.getPage() + 1, page.getSize()), wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(PmStockReturn stockReturn) {
|
||||||
|
validateRequestData(stockReturn.getRequest_data());
|
||||||
|
this.updateById(stockReturn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(Set<Integer> ids) {
|
||||||
|
this.removeByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void upload(JSONObject whereJson) {
|
||||||
|
List<PmStockReturn> rows = whereJson.getJSONArray("rows").toJavaList(PmStockReturn.class);
|
||||||
|
uploadRows(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void uploadRows(List<PmStockReturn> rows) {
|
||||||
|
if (rows == null || rows.isEmpty()) {
|
||||||
|
throw new BadRequestException("请选择需要回传的记录");
|
||||||
|
}
|
||||||
|
for (PmStockReturn row : rows) {
|
||||||
|
PmStockReturn stockReturn = this.getById(row.getId());
|
||||||
|
if (stockReturn == null) {
|
||||||
|
throw new BadRequestException("回传记录不存在:" + row.getId());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
JSONObject requestData = parseRequestData(stockReturn.getRequest_data());
|
||||||
|
wmsToErpService.uploadErp(requestData);
|
||||||
|
stockReturn.setStatus(StockReturnStatusEnum.SUCESS.getCode());
|
||||||
|
stockReturn.setError_msg(null);
|
||||||
|
stockReturn.setProcess_time(DateUtil.now());
|
||||||
|
this.updateById(stockReturn);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String errorMsg = e.getMessage();
|
||||||
|
if (errorMsg != null && errorMsg.length() > 255) {
|
||||||
|
errorMsg = errorMsg.substring(0, 255);
|
||||||
|
}
|
||||||
|
stockReturn.setStatus(StockReturnStatusEnum.FAIL.getCode());
|
||||||
|
stockReturn.setError_msg(errorMsg);
|
||||||
|
stockReturn.setProcess_time(null);
|
||||||
|
this.updateById(stockReturn);
|
||||||
|
throw new BadRequestException(errorMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRequestData(String requestData) {
|
||||||
|
parseRequestData(requestData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatQueryTime(Object time, String defaultTime) {
|
||||||
|
String value = String.valueOf(time);
|
||||||
|
if (value.contains("T")) {
|
||||||
|
return DateUtil.format(DateUtil.parse(value), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
if (value.length() == 10) {
|
||||||
|
return value + " " + defaultTime;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JSONObject parseRequestData(String requestData) {
|
||||||
|
if (!StringUtils.hasText(requestData)) {
|
||||||
|
throw new BadRequestException("回传JSON数据不能为空");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return JSON.parseObject(requestData);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BadRequestException("回传JSON数据格式错误:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.nl.wms.warehouse_manage.stockReturn.service.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ERP回传管理 Mapper
|
||||||
|
*/
|
||||||
|
public interface PmStockReturnMapper extends BaseMapper<PmStockReturn> {
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import request from '@/utils/request'
|
|||||||
|
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/iosReturn',
|
url: 'api/stockReturn',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
@@ -10,7 +10,7 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(ids) {
|
export function del(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/iosReturn/',
|
url: 'api/stockReturn',
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
@@ -18,7 +18,7 @@ export function del(ids) {
|
|||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/iosReturn',
|
url: 'api/stockReturn',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
@@ -26,18 +26,10 @@ export function edit(data) {
|
|||||||
|
|
||||||
export function upload(data) {
|
export function upload(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/iosReturn/upload',
|
url: '/api/stockReturn/upload',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function disupload(data) {
|
export default { add, edit, del, upload }
|
||||||
return request({
|
|
||||||
url: '/api/iosReturn/disupload',
|
|
||||||
method: 'post',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default { add, edit, del, upload, disupload }
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container">
|
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container">
|
||||||
<!--工具栏-->
|
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<div v-if="crud.props.searchToggle">
|
<div v-if="crud.props.searchToggle">
|
||||||
<!-- 搜索 -->
|
|
||||||
<el-form
|
<el-form
|
||||||
:inline="true"
|
:inline="true"
|
||||||
class="demo-form-inline"
|
class="demo-form-inline"
|
||||||
@@ -11,9 +9,27 @@
|
|||||||
label-width="90px"
|
label-width="90px"
|
||||||
label-suffix=":"
|
label-suffix=":"
|
||||||
>
|
>
|
||||||
<el-form-item label="所属仓库">
|
<el-form-item label="单据号">
|
||||||
|
<el-input
|
||||||
|
v-model="query.request_Id"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="回传业务单据号"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="回传类型">
|
||||||
|
<el-input
|
||||||
|
v-model="query.request_type"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="入库回传/出库回传/调拨"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="query.stor_id"
|
v-model="query.status"
|
||||||
clearable
|
clearable
|
||||||
size="mini"
|
size="mini"
|
||||||
placeholder="全部"
|
placeholder="全部"
|
||||||
@@ -21,75 +37,14 @@
|
|||||||
@change="crud.toQuery"
|
@change="crud.toQuery"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in storlist"
|
v-for="item in statusOptions"
|
||||||
: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"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
<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
|
<el-date-picker
|
||||||
v-model="query.createTime"
|
v-model="query.createTime"
|
||||||
type="daterange"
|
type="daterange"
|
||||||
@@ -97,14 +52,13 @@
|
|||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
:default-time="['00:00:00', '23:59:59']"
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
@input="onInput()"
|
@input="onInput"
|
||||||
@change="mytoQuery"
|
@change="mytoQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<rrOperation />
|
<rrOperation />
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
|
||||||
<crudOperation :permission="permission">
|
<crudOperation :permission="permission">
|
||||||
<el-button
|
<el-button
|
||||||
slot="right"
|
slot="right"
|
||||||
@@ -116,18 +70,7 @@
|
|||||||
>
|
>
|
||||||
回传
|
回传
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
|
||||||
slot="right"
|
|
||||||
class="filter-item"
|
|
||||||
type="warning"
|
|
||||||
icon="el-icon-position"
|
|
||||||
size="mini"
|
|
||||||
@click="disupload"
|
|
||||||
>
|
|
||||||
不回传
|
|
||||||
</el-button>
|
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<!--表格渲染-->
|
|
||||||
<el-table
|
<el-table
|
||||||
ref="table"
|
ref="table"
|
||||||
v-loading="crud.loading"
|
v-loading="crud.loading"
|
||||||
@@ -138,25 +81,45 @@
|
|||||||
@selection-change="crud.selectionChangeHandler"
|
@selection-change="crud.selectionChangeHandler"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<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="request_Id" label="回传业务单据号" min-width="170" />
|
||||||
<el-table-column prop="bill_code" label="单据号" :min-width="flexWidth('bill_code',crud.data,'单据号')" />
|
<el-table-column prop="request_type" label="回传类型" min-width="120" />
|
||||||
<el-table-column prop="stor_name" label="仓库" :min-width="flexWidth('stor_name',crud.data,'仓库')" />
|
<el-table-column prop="status" label="状态" min-width="90" :formatter="formatStatus" />
|
||||||
<el-table-column prop="bill_type" :formatter="bill_typeFormat" label="业务类型" :min-width="flexWidth('bill_type',crud.data,'业务类型')" />
|
<el-table-column prop="error_msg" label="ERP处理失败记录" min-width="220" show-overflow-tooltip />
|
||||||
<el-table-column prop="biz_date" label="业务日期" :min-width="flexWidth('biz_date',crud.data,'业务日期')" />
|
<el-table-column prop="create_time" label="单据创建时间" min-width="160" />
|
||||||
<el-table-column prop="total_qty" label="总重量" :min-width="100" :formatter="crud.formatNum3" />
|
<el-table-column prop="process_time" label="成功时间" min-width="160" />
|
||||||
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
|
<el-table-column label="回传JSON数据" min-width="120" align="center">
|
||||||
<el-table-column :formatter="create_modeFormat" prop="create_mode" label="生成方式" :min-width="flexWidth('create_mode',crud.data,'生成方式')" />
|
<template slot-scope="scope">
|
||||||
<el-table-column label="明细数" align="center" prop="detail_count" :min-width="flexWidth('detail_count',crud.data,'明细数')" />
|
<el-button type="text" size="mini" @click="openJsonDialog(scope.row, false)">查看</el-button>
|
||||||
<el-table-column prop="input_optname" label="制单人" :min-width="flexWidth('input_optname',crud.data,'制单人')" />
|
</template>
|
||||||
<el-table-column prop="input_time" label="制单时间" :min-width="flexWidth('input_time',crud.data,'制单时间')" />
|
</el-table-column>
|
||||||
<el-table-column prop="confirm_optname" label="完成人" :min-width="flexWidth('confirm_optname',crud.data,'完成人')" />
|
<el-table-column label="操作" width="120" fixed="right" align="center">
|
||||||
<el-table-column prop="confirm_time" label="完成时间" :min-width="flexWidth('confirm_time',crud.data,'完成时间')" />
|
<template slot-scope="scope">
|
||||||
<el-table-column prop="update_optname" label="回传人" :min-width="flexWidth('update_optname',crud.data,'回传人')" />
|
<el-button type="text" size="mini" @click="openJsonDialog(scope.row, true)">编辑JSON</el-button>
|
||||||
<el-table-column prop="update_time" label="回传时间" :min-width="flexWidth('update_time',crud.data,'回传时间')" />
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!--分页组件-->
|
|
||||||
<pagination />
|
<pagination />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
:title="jsonDialog.edit ? '编辑回传JSON数据' : '查看回传JSON数据'"
|
||||||
|
:visible.sync="jsonDialog.visible"
|
||||||
|
width="760px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="jsonDialog.content"
|
||||||
|
type="textarea"
|
||||||
|
:rows="18"
|
||||||
|
:readonly="!jsonDialog.edit"
|
||||||
|
spellcheck="false"
|
||||||
|
/>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button size="mini" @click="jsonDialog.visible = false">关闭</el-button>
|
||||||
|
<el-button v-if="jsonDialog.edit" size="mini" type="info" @click="formatJsonContent">格式化</el-button>
|
||||||
|
<el-button v-if="jsonDialog.edit" size="mini" type="primary" @click="saveJsonContent">保存</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -166,7 +129,6 @@ import CRUD, { crud, header, presenter } from '@crud/crud'
|
|||||||
import rrOperation from '@crud/RR.operation'
|
import rrOperation from '@crud/RR.operation'
|
||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import crudUserStor from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
|
||||||
import Date from '@/utils/datetime'
|
import Date from '@/utils/datetime'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -174,7 +136,7 @@ export default {
|
|||||||
components: { crudOperation, rrOperation, pagination },
|
components: { crudOperation, rrOperation, pagination },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({
|
return CRUD({
|
||||||
title: '出入库单回传', idField: 'iostorinv_id', url: 'api/iosReturn', crudMethod: { ...inandoutreturn },
|
title: 'ERP回传管理', idField: 'id', url: 'api/stockReturn', crudMethod: { ...inandoutreturn },
|
||||||
optShow: {
|
optShow: {
|
||||||
add: false,
|
add: false,
|
||||||
edit: false,
|
edit: false,
|
||||||
@@ -182,52 +144,42 @@ export default {
|
|||||||
reset: true,
|
reset: true,
|
||||||
download: false
|
download: false
|
||||||
},
|
},
|
||||||
query: { io_type: '0', bill_status: '99' },
|
|
||||||
queryOnPresenterCreated: false
|
queryOnPresenterCreated: false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), crud()],
|
mixins: [presenter(), header(), crud()],
|
||||||
// 数据字典
|
|
||||||
dicts: ['ST_CREATE_MODE', 'io_type', 'is_upload', 'ST_INV_IN_TYPE', 'ST_INV_OUT_TYPE'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
height: document.documentElement.clientHeight - 180 + 'px;',
|
|
||||||
permission: {},
|
permission: {},
|
||||||
mstrow: {},
|
|
||||||
fullscreenLoading: false,
|
fullscreenLoading: false,
|
||||||
storlist: [],
|
|
||||||
query_flag: true,
|
query_flag: true,
|
||||||
billtypelist: [],
|
statusOptions: [
|
||||||
showDtlLoading: false
|
{ value: '0', label: '待回传' },
|
||||||
}
|
{ value: '1', label: '成功' },
|
||||||
},
|
{ value: '2', label: '失败' }
|
||||||
mounted: function() {
|
],
|
||||||
const that = this
|
jsonDialog: {
|
||||||
window.onresize = function temp() {
|
visible: false,
|
||||||
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
edit: false,
|
||||||
|
row: null,
|
||||||
|
content: ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
crudUserStor.getStor().then(res => {
|
this.crud.query.createTime = [this.formatDateTime(new Date().daysAgo(30), '00:00:00'), this.formatDateTime(new Date(), '23:59:59')]
|
||||||
this.storlist = res
|
|
||||||
})
|
|
||||||
// debugger
|
|
||||||
this.billtypelist = this.dict.ST_INV_OUT_TYPE
|
|
||||||
this.crud.query.createTime = [new Date().daysAgo(30), new Date()]
|
|
||||||
this.initQuery()
|
this.initQuery()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
[CRUD.HOOK.beforeRefresh]() {
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
if (this.query_flag) {
|
if (this.query_flag) {
|
||||||
this.crud.query.begin_time = (new Date().daysAgo(30)).strftime('%F', 'zh')
|
this.crud.query.begin_time = this.formatDateTime(new Date().daysAgo(30), '00:00:00')
|
||||||
this.crud.query.end_time = (new Date()).strftime('%F', 'zh')
|
this.crud.query.end_time = this.formatDateTime(new Date(), '23:59:59')
|
||||||
this.query_flag = false
|
this.query_flag = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 搜索框出入类型 默认出库*/
|
|
||||||
initQuery() {
|
initQuery() {
|
||||||
this.query.io_type = '1'
|
this.query.status = '0'
|
||||||
this.query.is_upload = '0'
|
|
||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
},
|
},
|
||||||
mytoQuery(array1) {
|
mytoQuery(array1) {
|
||||||
@@ -235,115 +187,99 @@ export default {
|
|||||||
this.crud.query.begin_time = ''
|
this.crud.query.begin_time = ''
|
||||||
this.crud.query.end_time = ''
|
this.crud.query.end_time = ''
|
||||||
} else {
|
} else {
|
||||||
this.crud.query.begin_time = array1[0]
|
this.crud.query.begin_time = this.formatDateTime(array1[0], '00:00:00')
|
||||||
this.crud.query.end_time = array1[1]
|
this.crud.query.end_time = this.formatDateTime(array1[1], '23:59:59')
|
||||||
}
|
}
|
||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
},
|
},
|
||||||
|
formatDateTime(value, defaultTime) {
|
||||||
|
if (!value) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
if (value instanceof Date) {
|
||||||
|
return value.strftime('%F %T', 'zh')
|
||||||
|
}
|
||||||
|
const str = String(value)
|
||||||
|
if (str.includes('T')) {
|
||||||
|
return new Date(str).strftime('%F %T', 'zh')
|
||||||
|
}
|
||||||
|
if (str.length === 10) {
|
||||||
|
return str + ' ' + defaultTime
|
||||||
|
}
|
||||||
|
return str
|
||||||
|
},
|
||||||
onInput() {
|
onInput() {
|
||||||
this.$forceUpdate()
|
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() {
|
upload() {
|
||||||
const res = this.$refs.table.selection
|
const rows = this.$refs.table.selection
|
||||||
if (!res || res.length < 1) {
|
if (!rows || rows.length < 1) {
|
||||||
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const upload_flag = res.some(row => row.is_upload === '1')
|
const successFlag = rows.some(row => row.status === '1')
|
||||||
if (upload_flag) {
|
const doUpload = () => {
|
||||||
this.$confirm('存在已经回传的单据, 是否继续回传?', '提示', {
|
this.fullscreenLoading = true
|
||||||
|
inandoutreturn.upload({ rows }).then(() => {
|
||||||
|
this.crud.notify('单据回传成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.crud.toQuery()
|
||||||
|
}).finally(() => {
|
||||||
|
this.fullscreenLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (successFlag) {
|
||||||
|
this.$confirm('存在已经回传成功的单据, 是否继续回传?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(doUpload).catch(() => {
|
||||||
this.fullscreenLoading = true
|
this.$message({ type: 'info', message: '已取消回传' })
|
||||||
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
|
return
|
||||||
}
|
}
|
||||||
this.fullscreenLoading = true
|
doUpload()
|
||||||
const data = {}
|
},
|
||||||
data.rows = res
|
openJsonDialog(row, edit) {
|
||||||
inandoutreturn.disupload(data).then(res => {
|
this.jsonDialog.row = row
|
||||||
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
this.jsonDialog.edit = edit
|
||||||
}).finally(() => {
|
this.jsonDialog.content = this.formatJson(row.request_data)
|
||||||
this.fullscreenLoading = false
|
this.jsonDialog.visible = true
|
||||||
|
},
|
||||||
|
saveJsonContent() {
|
||||||
|
let content = this.jsonDialog.content
|
||||||
|
try {
|
||||||
|
content = JSON.stringify(JSON.parse(content), null, 2)
|
||||||
|
} catch (e) {
|
||||||
|
this.crud.notify('JSON格式错误:' + e.message, CRUD.NOTIFICATION_TYPE.ERROR)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const data = { ...this.jsonDialog.row, request_data: content }
|
||||||
|
inandoutreturn.edit(data).then(() => {
|
||||||
|
this.crud.notify('保存成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.jsonDialog.visible = false
|
||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
formatIsUpload(row) {
|
formatJsonContent() {
|
||||||
if (row.is_upload === '0') {
|
try {
|
||||||
return '否'
|
this.jsonDialog.content = JSON.stringify(JSON.parse(this.jsonDialog.content), null, 2)
|
||||||
} else if (row.is_upload === '1') {
|
} catch (e) {
|
||||||
return '是'
|
this.crud.notify('JSON格式错误:' + e.message, CRUD.NOTIFICATION_TYPE.ERROR)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
formatUploadMes(row) {
|
formatJson(value) {
|
||||||
if (row.upload_mes === '0') {
|
if (!value) {
|
||||||
return '否'
|
return ''
|
||||||
} else if (row.upload_mes === '1') {
|
}
|
||||||
return '是'
|
try {
|
||||||
|
return JSON.stringify(JSON.parse(value), null, 2)
|
||||||
|
} catch (e) {
|
||||||
|
return value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
formatUploadSap(row) {
|
formatStatus(row) {
|
||||||
if (row.upload_sap === '0') {
|
const item = this.statusOptions.find(option => option.value === row.status)
|
||||||
return '否'
|
return item ? item.label : row.status
|
||||||
} else if (row.upload_sap === '1') {
|
|
||||||
return '是'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user