add:同步eas平库库存功能;
opt:出入库单据模块
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.nl.wms.basedata_manage.controller;
|
package org.nl.wms.basedata_manage.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.common.base.ResponseData;
|
import org.nl.common.base.ResponseData;
|
||||||
@@ -8,8 +9,10 @@ import org.nl.common.domain.query.PageQuery;
|
|||||||
import org.nl.common.logging.annotation.Log;
|
import org.nl.common.logging.annotation.Log;
|
||||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -40,4 +43,11 @@ public class StructIvtController {
|
|||||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||||
return ResponseData.build(iMdPbStoragevehicleextService.queryAll(whereJson, page), HttpStatus.OK);
|
return ResponseData.build(iMdPbStoragevehicleextService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@PostMapping("/syncStock")
|
||||||
|
@Log("库存同步")
|
||||||
|
public ResponseEntity<Object> syncStock(@RequestBody JSONObject param) {
|
||||||
|
String warehouseno = param.getString("warehouseno");
|
||||||
|
return ResponseData.build(iMdPbStoragevehicleextService.syncStock(warehouseno), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,4 +36,6 @@ public interface IMdPbStoragevehicleextService extends IService<MdPbStoragevehic
|
|||||||
*/
|
*/
|
||||||
List<MdPbStoragevehicleextDto> queryAll(Map whereJson);
|
List<MdPbStoragevehicleextDto> queryAll(Map whereJson);
|
||||||
|
|
||||||
|
JSONObject syncStock(String warehouseno);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,4 +86,6 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<MdPbStoragevehicleextDto> queryAvailableInv(@Param("params") Map whereJson);
|
List<MdPbStoragevehicleextDto> queryAvailableInv(@Param("params") Map whereJson);
|
||||||
|
|
||||||
|
List<JSONObject> querySyncByStorCode(@Param("stor_code") String storCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,4 +332,24 @@
|
|||||||
</where>
|
</where>
|
||||||
ORDER BY ext.create_time Desc
|
ORDER BY ext.create_time Desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="querySyncByStorCode" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
ext.group_id,
|
||||||
|
ext.storagevehicle_code,
|
||||||
|
ext.material_code,
|
||||||
|
ext.pcsn,
|
||||||
|
ext.qty,
|
||||||
|
ext.qty_unit_id,
|
||||||
|
ext.qty_unit_name,
|
||||||
|
ext.status,
|
||||||
|
attr.struct_id,
|
||||||
|
attr.struct_code,
|
||||||
|
attr.sect_code
|
||||||
|
FROM
|
||||||
|
md_pb_groupplate ext
|
||||||
|
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
|
||||||
|
WHERE
|
||||||
|
attr.sect_code = #{stor_code}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -1,18 +1,34 @@
|
|||||||
package org.nl.wms.basedata_manage.service.impl;
|
package org.nl.wms.basedata_manage.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
|
import org.nl.common.utils.IdUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||||
|
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||||
|
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||||
|
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||||
|
import org.nl.wms.ext_manage.api.EasApi;
|
||||||
|
import org.nl.wms.ext_manage.api.request.QueryEasStockRequest;
|
||||||
|
import org.nl.wms.ext_manage.api.response.QueryEasStockResponse;
|
||||||
|
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||||
|
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||||
|
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.math.BigDecimal;
|
||||||
import java.util.Map;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -25,7 +41,14 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class MdPbStoragevehicleextServiceImpl extends ServiceImpl<MdPbStoragevehicleextMapper, MdPbStoragevehicleext> implements IMdPbStoragevehicleextService {
|
public class MdPbStoragevehicleextServiceImpl extends ServiceImpl<MdPbStoragevehicleextMapper, MdPbStoragevehicleext> implements IMdPbStoragevehicleextService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EasApi easApi;
|
||||||
|
@Autowired
|
||||||
|
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||||
|
@Autowired
|
||||||
|
private IStructattrService iStructattrService;
|
||||||
|
@Autowired
|
||||||
|
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<JSONObject> queryAll(Map whereJson, PageQuery page) {
|
public IPage<JSONObject> queryAll(Map whereJson, PageQuery page) {
|
||||||
@@ -38,5 +61,84 @@ public class MdPbStoragevehicleextServiceImpl extends ServiceImpl<MdPbStorageveh
|
|||||||
return this.baseMapper.queryAll(whereJson);
|
return this.baseMapper.queryAll(whereJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public JSONObject syncStock(String warehouseno) {
|
||||||
|
Structattr struct = iStructattrService.getOne(
|
||||||
|
new LambdaQueryWrapper<Structattr>()
|
||||||
|
.eq(Structattr::getSect_code, warehouseno)
|
||||||
|
.last("LIMIT 1"));
|
||||||
|
QueryEasStockRequest easRequest = new QueryEasStockRequest();
|
||||||
|
easRequest.setOrgno("01.09.14");
|
||||||
|
easRequest.setWarehouseno(warehouseno);
|
||||||
|
List<QueryEasStockResponse> easStocks = easApi.queryStock(easRequest);
|
||||||
|
|
||||||
|
List<JSONObject> localStocks = this.baseMapper.querySyncByStorCode(warehouseno);
|
||||||
|
|
||||||
|
Map<String, JSONObject> localMap = new HashMap<>();
|
||||||
|
for (JSONObject local : localStocks) {
|
||||||
|
String key = local.getString("material_code") + "_" + local.getString("pcsn");
|
||||||
|
localMap.put(key, local);
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> easKeys = new HashSet<>();
|
||||||
|
int updateCount = 0, addCount = 0, deleteCount = 0;
|
||||||
|
|
||||||
|
for (QueryEasStockResponse eas : easStocks) {
|
||||||
|
String key = eas.getMaterialno() + "_" + eas.getLotnumber();
|
||||||
|
easKeys.add(key);
|
||||||
|
|
||||||
|
if (localMap.containsKey(key)) {
|
||||||
|
JSONObject local = localMap.get(key);
|
||||||
|
GroupPlate plate = new GroupPlate();
|
||||||
|
plate.setGroup_id(local.getString("group_id"));
|
||||||
|
plate.setQty(new BigDecimal(eas.getQty()));
|
||||||
|
iMdPbGroupplateService.updateById(plate);
|
||||||
|
updateCount++;
|
||||||
|
} else {
|
||||||
|
GroupPlate plate = new GroupPlate();
|
||||||
|
plate.setGroup_id(IdUtil.getStringId());
|
||||||
|
plate.setStoragevehicle_code(struct.getStoragevehicle_code());
|
||||||
|
plate.setMaterial_code(eas.getMaterialno());
|
||||||
|
plate.setPcsn(Optional.ofNullable(eas.getLotnumber()).filter(s -> !s.isEmpty()).orElse("1"));
|
||||||
|
plate.setQty(new BigDecimal(eas.getQty()));
|
||||||
|
plate.setQty_unit_name(eas.getUnitname());
|
||||||
|
plate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("入库"));
|
||||||
|
plate.setCreate_time(DateUtil.now());
|
||||||
|
plate.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
plate.setCreate_name(SecurityUtils.getCurrentUsername());
|
||||||
|
|
||||||
|
MdMeMaterialbase material = iMdMeMaterialbaseService.getOne(
|
||||||
|
new LambdaQueryWrapper<MdMeMaterialbase>()
|
||||||
|
.eq(MdMeMaterialbase::getMaterial_code, eas.getMaterialno()));
|
||||||
|
if (material != null) {
|
||||||
|
plate.setQty_unit_id(material.getQty_unit_id());
|
||||||
|
if (plate.getQty_unit_name() == null) {
|
||||||
|
plate.setQty_unit_name(material.getQty_unit_name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iMdPbGroupplateService.save(plate);
|
||||||
|
|
||||||
|
addCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (JSONObject local : localStocks) {
|
||||||
|
String key = local.getString("material_code") + "_" + local.getString("pcsn");
|
||||||
|
if (!easKeys.contains(key)) {
|
||||||
|
iMdPbGroupplateService.removeById(local.getString("group_id"));
|
||||||
|
deleteCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("updateCount", updateCount);
|
||||||
|
result.put("addCount", addCount);
|
||||||
|
result.put("deleteCount", deleteCount);
|
||||||
|
result.put("easTotal", easStocks.size());
|
||||||
|
result.put("localTotal", localStocks.size());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ public class ErpUtil {
|
|||||||
Object result = call.invoke(new Object[]{json});
|
Object result = call.invoke(new Object[]{json});
|
||||||
JSONObject resultJson = JSON.parseObject(result.toString());
|
JSONObject resultJson = JSON.parseObject(result.toString());
|
||||||
if (resultJson.getBoolean("status") == false){
|
if (resultJson.getBoolean("status") == false){
|
||||||
throw new BadRequestException("回传失败:" + resultJson.getString("message"));
|
throw new BadRequestException("EAS接口请求失败失败:" + resultJson.getString("message"));
|
||||||
}
|
}
|
||||||
log.error("Eas回传接口请求成功!");
|
log.error("Eas接口请求成功!");
|
||||||
log.error("Eas回传接口invoke调用结果:" + result);
|
log.error("Eas接口invoke调用结果:" + result);
|
||||||
return resultJson;
|
return resultJson;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BadRequestException("erp审核接口请求失败:" + e.getMessage());
|
throw new BadRequestException("erp审核接口请求失败:" + e.getMessage());
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
"normalize.css": "7.0.0",
|
"normalize.css": "7.0.0",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"path-to-regexp": "2.4.0",
|
"path-to-regexp": "2.4.0",
|
||||||
|
"qrcode": "^1.5.4",
|
||||||
"qrcodejs2": "0.0.2",
|
"qrcodejs2": "0.0.2",
|
||||||
"qs": "^6.9.1",
|
"qs": "^6.9.1",
|
||||||
"screenfull": "4.2.0",
|
"screenfull": "4.2.0",
|
||||||
|
|||||||
@@ -47,14 +47,14 @@
|
|||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
<crudOperation :permission="permission">
|
<crudOperation :permission="permission">
|
||||||
<el-button
|
<el-button
|
||||||
slot="right"
|
slot="right"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="success"
|
type="success"
|
||||||
icon="el-icon-printer"
|
icon="el-icon-printer"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handlePrint"
|
@click="handlePrint"
|
||||||
>
|
>
|
||||||
打印
|
打印
|
||||||
</el-button>
|
</el-button>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
@@ -157,6 +157,19 @@ slot="right"
|
|||||||
<el-button :loading="crud.cu === 2" type="primary" @click="print">打印</el-button>
|
<el-button :loading="crud.cu === 2" type="primary" @click="print">打印</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
title="打印预览"
|
||||||
|
:visible.sync="printPreviewVisible"
|
||||||
|
width="650px"
|
||||||
|
@close="closePrintPreview"
|
||||||
|
>
|
||||||
|
<iframe ref="printIframe" src="about:blank" style="width: 100%; height: 500px; border: 1px solid #ddd;" />
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="info" @click="printPreviewVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="doPrint">打印</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:before-close="crud.cancelCU"
|
:before-close="crud.cancelCU"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
@@ -279,6 +292,7 @@ import udOperation from '@crud/UD.operation'
|
|||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
|
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
|
||||||
import MaterDtl from '@/views/wms/basedata/material/MaterialDialog'
|
import MaterDtl from '@/views/wms/basedata/material/MaterialDialog'
|
||||||
|
import QRCode from 'qrcode'
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
vehicle_code: null,
|
vehicle_code: null,
|
||||||
@@ -333,6 +347,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
printVisible: false,
|
printVisible: false,
|
||||||
|
printPreviewVisible: false,
|
||||||
updateForm: {},
|
updateForm: {},
|
||||||
printForm: {
|
printForm: {
|
||||||
pageh: '40mm',
|
pageh: '40mm',
|
||||||
@@ -444,19 +459,60 @@ export default {
|
|||||||
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const codes = _selectData.map(item => item.storagevehicle_code).join('\n')
|
this.printPreviewVisible = true
|
||||||
const ids = _selectData.map(item => item.storagevehicle_id)
|
this.$nextTick(() => {
|
||||||
this.$confirm(`确认打印以下载具编码?\n${codes}`, '打印确认', {
|
this.renderPrintContent(_selectData)
|
||||||
confirmButtonText: '确认',
|
})
|
||||||
cancelButtonText: '取消',
|
},
|
||||||
type: 'warning'
|
async renderPrintContent(selectData) {
|
||||||
}).then(() => {
|
const iframe = this.$refs.printIframe
|
||||||
crudStoragevehicleinfo.printLabel(ids).then(res=>{
|
if (!iframe) return
|
||||||
this.crud.notify('打印成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
const doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document)
|
||||||
})
|
if (!doc) {
|
||||||
|
setTimeout(() => this.renderPrintContent(selectData), 100)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let html = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>'
|
||||||
|
html += '*{margin:0;padding:0;box-sizing:border-box}'
|
||||||
|
html += 'body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:10px}'
|
||||||
|
html += '.label{page-break-after:always;padding:10px;text-align:center}'
|
||||||
|
html += '.label:last-child{page-break-after:auto}'
|
||||||
|
html += 'h3{text-align:center;font-size:16px;margin-bottom:8px}'
|
||||||
|
html += 'table{width:100%;border-collapse:collapse;margin:0 auto;max-width:400px}'
|
||||||
|
html += 'td{padding:6px 10px;border:2px solid #333;font-size:13px}'
|
||||||
|
html += '.lbl{width:30%;text-align:right;background:#f9f9f9}'
|
||||||
|
html += '.val{width:40%;text-align:left}'
|
||||||
|
html += '.qr{width:30%;text-align:center;vertical-align:middle}'
|
||||||
|
html += '@media print{@page{size:auto;margin:5mm}}'
|
||||||
|
html += '</style></head><body>'
|
||||||
|
|
||||||
this.crud.toQuery()
|
for (const item of selectData) {
|
||||||
}).catch(() => {})
|
const code = item.storagevehicle_code || ''
|
||||||
|
const imgSrc = await QRCode.toDataURL(code, {
|
||||||
|
width: 100
|
||||||
|
})
|
||||||
|
const type = this.formattType(item) || ''
|
||||||
|
html += '<div class="label">'
|
||||||
|
html += '<h3>上海诺力</h3>'
|
||||||
|
html += '<table>'
|
||||||
|
html += '<tr><td class="lbl">载具条码</td><td class="val">' + code + '</td><td class="qr" rowspan="3"><img src="' + imgSrc + '" width="100" height="100" /></td></tr>'
|
||||||
|
html += '<tr><td class="lbl">载具类型</td><td class="val">' + type + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">归属厂区</td><td class="val">诺力五期</td></tr>'
|
||||||
|
html += '</table></div>'
|
||||||
|
}
|
||||||
|
html += '</body></html>'
|
||||||
|
doc.open()
|
||||||
|
doc.write(html)
|
||||||
|
doc.close()
|
||||||
|
},
|
||||||
|
doPrint() {
|
||||||
|
const iframe = this.$refs.printIframe
|
||||||
|
if (!iframe) return
|
||||||
|
iframe.contentWindow.focus()
|
||||||
|
iframe.contentWindow.print()
|
||||||
|
},
|
||||||
|
closePrintPreview() {
|
||||||
|
this.printPreviewVisible = false
|
||||||
},
|
},
|
||||||
printClose() {
|
printClose() {
|
||||||
this.printVisible = false
|
this.printVisible = false
|
||||||
|
|||||||
377
nladmin-ui/src/views/wms/pm_manage/allocationIn/index.vue
Normal file
377
nladmin-ui/src/views/wms/pm_manage/allocationIn/index.vue
Normal file
@@ -0,0 +1,377 @@
|
|||||||
|
<template>
|
||||||
|
<div 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="80px" label-suffix=":">
|
||||||
|
<el-form-item label="模糊查询">
|
||||||
|
<el-input
|
||||||
|
v-model="query.blurry"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="单据号/订单号/供应商"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单据编号">
|
||||||
|
<el-input
|
||||||
|
v-model="query.bill_id"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="单据编号"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="订单号">
|
||||||
|
<el-input
|
||||||
|
v-model="query.order_no"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="订单号"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="供应商">
|
||||||
|
<el-input
|
||||||
|
v-model="query.supplier_name"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="供应商名称"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单据状态">
|
||||||
|
<el-select
|
||||||
|
v-model="query.bill_status"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="全部"
|
||||||
|
class="filter-item"
|
||||||
|
@change="crud.toQuery"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in billStatusOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createTime">
|
||||||
|
<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']"
|
||||||
|
@change="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<rrOperation />
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<crudOperation :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-s-promotion"
|
||||||
|
size="mini"
|
||||||
|
:disabled="audit_flag"
|
||||||
|
@click="issueReturnBill"
|
||||||
|
>下发回传单
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-printer"
|
||||||
|
size="mini"
|
||||||
|
:disabled="audit_flag"
|
||||||
|
@click="printBill"
|
||||||
|
>打印
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
size="mini"
|
||||||
|
:data="crud.data"
|
||||||
|
highlight-current-row
|
||||||
|
style="width: 100%;"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
@select="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column
|
||||||
|
v-permission="['admin','purchasemst:del','purchasemst:edit']"
|
||||||
|
label="操作"
|
||||||
|
width="115"
|
||||||
|
align="center"
|
||||||
|
fixed="right"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
:disabled-edit="canUd(scope.row)"
|
||||||
|
:disabled-dle="canUd(scope.row)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column show-overflow-tooltip prop="bill_id" width="160" label="单据编号">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bill_id }}</el-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column show-overflow-tooltip prop="order_no" width="150" label="订单号" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="order_type" width="100" label="订单类型" />
|
||||||
|
<el-table-column :formatter="billStatusFormat" prop="bill_status" width="100" label="单据状态" />
|
||||||
|
<el-table-column label="明细数" align="center" prop="dtl_count" width="80" />
|
||||||
|
<el-table-column label="单据总数" align="center" prop="total_qty" width="80" />
|
||||||
|
<el-table-column label="入库数量" align="center" prop="instock_qty" width="80" />
|
||||||
|
<el-table-column label="转发中鼎" align="center" prop="forwardZD" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<p v-if="scope.row.forwardZD == '0'">-</p>
|
||||||
|
<template v-else-if="scope.row.forwardZD == '1'">
|
||||||
|
<el-popconfirm
|
||||||
|
confirm-button-text="是"
|
||||||
|
cancel-button-text="否"
|
||||||
|
icon="el-icon-info"
|
||||||
|
icon-color="red"
|
||||||
|
title="是否重新转发中鼎?"
|
||||||
|
@confirm="toForwardZD(scope.row)"
|
||||||
|
>
|
||||||
|
<a slot="reference" style="color: red;text-decoration: underline">失败</a>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
<p v-else>成功</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column show-overflow-tooltip prop="supplier_code" width="120" label="供应商编码" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="supplier_name" width="150" label="供应商名称" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="creator" width="100" label="创建人" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="create_time" width="150" label="创建时间">
|
||||||
|
<template slot-scope="scope">{{ formatDate(scope.row.create_time) }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column show-overflow-tooltip prop="modify_date" width="150" label="修改时间">
|
||||||
|
<template slot-scope="scope">{{ formatDate(scope.row.modify_date) }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
<AddDialog @AddChanged="querytable" />
|
||||||
|
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable" />
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
title="打印预览"
|
||||||
|
:visible.sync="printPreviewVisible"
|
||||||
|
width="700px"
|
||||||
|
@close="closePrintPreview"
|
||||||
|
>
|
||||||
|
<iframe ref="printIframe" src="about:blank" style="width: 100%; height: 500px; border: 1px solid #ddd;" />
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="info" @click="printPreviewVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="doPrint">打印</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudPurchase from '@/views/wms/pm_manage/allocationIn/purchase'
|
||||||
|
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
|
||||||
|
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
|
||||||
|
import QRCode from 'qrcode'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AllocationIn',
|
||||||
|
components: { AddDialog, ViewDialog, crudOperation, rrOperation, udOperation, pagination },
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '调拨入库单',
|
||||||
|
optShow: { add: true, reset: true },
|
||||||
|
idField: 'id',
|
||||||
|
url: '/api/purchasemst/107',
|
||||||
|
crudMethod: { ...crudPurchase },
|
||||||
|
queryOnPresenterCreated: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
mixins: [presenter(), header(), crud()],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
permission: {
|
||||||
|
add: ['admin', 'purchasemst:add'],
|
||||||
|
edit: ['admin', 'purchasemst:edit'],
|
||||||
|
del: ['admin', 'purchasemst:del']
|
||||||
|
},
|
||||||
|
viewShow: false,
|
||||||
|
mstrow: {},
|
||||||
|
currentRow: null,
|
||||||
|
audit_flag: true,
|
||||||
|
printPreviewVisible: false,
|
||||||
|
billStatusOptions: [{ value: '0', label: '已创建' }, { value: '1', label: '执行中' }, { value: '2', label: '已完成' }]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
canUd(row) {
|
||||||
|
return row.bill_status !== '0'
|
||||||
|
},
|
||||||
|
billStatusFormat(row) {
|
||||||
|
return ({ '0': '已创建', '1': '执行中', '2': '已完成' })[row.bill_status] || row.bill_status
|
||||||
|
},
|
||||||
|
formatDate(val) {
|
||||||
|
if (!val) return ''
|
||||||
|
if (typeof val === 'string') return val
|
||||||
|
const d = new Date(val)
|
||||||
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')} ${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}:${String(d.getSeconds()).padStart(2, '0')}`
|
||||||
|
},
|
||||||
|
toForwardZD(row) {
|
||||||
|
crudPurchase.pushZD({
|
||||||
|
billid: row.bill_id,
|
||||||
|
orderNo: row.order_no,
|
||||||
|
orderType: row.order_type,
|
||||||
|
red: row.red,
|
||||||
|
status: row.status
|
||||||
|
})
|
||||||
|
}, toView(index, row) {
|
||||||
|
this.mstrow = row
|
||||||
|
this.viewShow = true
|
||||||
|
},
|
||||||
|
handleSelectionChange(val, row) {
|
||||||
|
this.audit_flag = val.length == 0
|
||||||
|
},
|
||||||
|
handleCurrentChange(currentRow) {
|
||||||
|
this.currentRow = currentRow || {}
|
||||||
|
this.audit_flag = this.crud.selections.length === 0
|
||||||
|
},
|
||||||
|
querytable() {
|
||||||
|
this.crud.toQuery()
|
||||||
|
},
|
||||||
|
issueReturnBill() {
|
||||||
|
const selections = this.crud.selections
|
||||||
|
if (!selections || selections.length === 0) {
|
||||||
|
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const ids = selections.map(s => s.id)
|
||||||
|
const billIds = selections.map(s => s.bill_id).join('、')
|
||||||
|
this.$confirm('确认下发以下单据的回传单?\n' + billIds, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
crudPurchase.issueReturnBill(ids).then(() => {
|
||||||
|
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.crud.toQuery()
|
||||||
|
}).catch(() => {
|
||||||
|
this.crud.notify('下发失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
printBill() {
|
||||||
|
const selections = this.crud.selections
|
||||||
|
if (!selections || selections.length === 0) {
|
||||||
|
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const billIds = selections.map(s => s.order_no).join('、')
|
||||||
|
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.fetchDetailsAndPrint(selections)
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
fetchDetailsAndPrint(selections) {
|
||||||
|
const promises = selections.map(bill => {
|
||||||
|
return crudPurchase.get(bill.id).then(res => {
|
||||||
|
const dtlList = (res && res.data && res.data.tableData) || []
|
||||||
|
return dtlList.map(dtl => ({
|
||||||
|
...dtl,
|
||||||
|
order_no: bill.order_no,
|
||||||
|
bill_id: bill.bill_id
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
Promise.all(promises).then(results => {
|
||||||
|
const allDtls = results.reduce((acc, cur) => acc.concat(cur), [])
|
||||||
|
if (allDtls.length === 0) {
|
||||||
|
this.crud.notify('未查询到明细数据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.printPreviewVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.renderPrintContent(allDtls)
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.crud.notify('查询明细失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async renderPrintContent(dtlList) {
|
||||||
|
const iframe = this.$refs.printIframe
|
||||||
|
if (!iframe) return
|
||||||
|
const doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document)
|
||||||
|
if (!doc) {
|
||||||
|
setTimeout(() => this.renderPrintContent(dtlList), 100)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let html = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>'
|
||||||
|
html += '*{margin:0;padding:0;box-sizing:border-box}'
|
||||||
|
html += 'body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:10px}'
|
||||||
|
html += '.label{page-break-after:always;padding:10px;text-align:center}'
|
||||||
|
html += '.label:last-child{page-break-after:auto}'
|
||||||
|
html += 'h3{text-align:center;font-size:13px;margin-bottom:3px}'
|
||||||
|
html += 'table{width:100%;border-collapse:collapse;margin:0 auto;max-width:450px}'
|
||||||
|
html += 'td{padding:3px 5px;border:2px solid #333;font-size:13px}'
|
||||||
|
html += '.lbl{width:25%;text-align:right;background:#f9f9f9}'
|
||||||
|
html += '.val{width:45%;text-align:left}'
|
||||||
|
html += '.qr{width:30%;text-align:center;vertical-align:middle}'
|
||||||
|
html += '@media print{@page{size:auto;margin:5mm}}'
|
||||||
|
html += '</style></head><body>'
|
||||||
|
for (const dtl of dtlList) {
|
||||||
|
const orderNo = dtl.order_no || ''
|
||||||
|
const itemNo = dtl.item_no || ''
|
||||||
|
const skuCode = dtl.sku_code || ''
|
||||||
|
const skuName = dtl.sku_name || ''
|
||||||
|
const qty = dtl.qty || ''
|
||||||
|
const qrText = orderNo + '#' + itemNo + '#' + skuCode + '#' + skuName + '##' + qty + '#'
|
||||||
|
const imgSrc = await QRCode.toDataURL(qrText, {
|
||||||
|
width: 200
|
||||||
|
})
|
||||||
|
html += '<div class="label">'
|
||||||
|
html += '<h3>上海诺力</h3>'
|
||||||
|
html += '<table>'
|
||||||
|
html += '<tr><td class="lbl">订单号</td><td class="val">' + orderNo + '</td><td class="qr" rowspan="5"><img src="' + imgSrc + '" width="100" height="100" /></td></tr>'
|
||||||
|
html += '<tr><td class="lbl">行号</td><td class="val">' + itemNo + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">物料编码</td><td class="val">' + skuCode + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">物料名称</td><td class="val">' + skuName + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">数量</td><td class="val">' + qty + '</td></tr>'
|
||||||
|
html += '</table></div>'
|
||||||
|
}
|
||||||
|
html += '</body></html>'
|
||||||
|
doc.open()
|
||||||
|
doc.write(html)
|
||||||
|
doc.close()
|
||||||
|
},
|
||||||
|
doPrint() {
|
||||||
|
const iframe = this.$refs.printIframe
|
||||||
|
if (!iframe) return
|
||||||
|
iframe.contentWindow.focus()
|
||||||
|
iframe.contentWindow.print()
|
||||||
|
},
|
||||||
|
closePrintPreview() {
|
||||||
|
this.printPreviewVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
::v-deep .el-dialog__body {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -55,4 +55,4 @@ export function pushZD(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, get, issueReturnBill, print,pushZD }
|
export default { add, edit, del, get, issueReturnBill, print, pushZD }
|
||||||
@@ -76,14 +76,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import crudPurchase from '@/views/wms/st/allocationOut/purchase'
|
import crudPurchase from '@/views/wms/pm_manage/allocationOut/purchase'
|
||||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
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 udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import AddDialog from '@/views/wms/st/purchase/AddDialog'
|
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
|
||||||
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
|
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AllocationOut',
|
name: 'AllocationOut',
|
||||||
@@ -55,4 +55,4 @@ export function pushZD(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, get, issueReturnBill, print,pushZD }
|
export default { add, edit, del, get, issueReturnBill, print, pushZD }
|
||||||
@@ -28,8 +28,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<crudOperation :permission="permission">
|
<crudOperation :permission="permission">
|
||||||
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini" :disabled="audit_flag" @click="issueReturnBill">下发回传单</el-button>
|
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini" :disabled="audit_flag" @click="issueReturnBill">下发回传单</el-button>
|
||||||
<el-button slot="right" class="filter-item" type="primary" icon="el-icon-printer" size="mini"
|
<el-button
|
||||||
:disabled="audit_flag" @click="printBill">打印
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-printer"
|
||||||
|
size="mini"
|
||||||
|
:disabled="audit_flag"
|
||||||
|
@click="printBill"
|
||||||
|
>打印
|
||||||
</el-button>
|
</el-button>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<el-table ref="table" v-loading="crud.loading" size="mini" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange" @select="handleSelectionChange">
|
<el-table ref="table" v-loading="crud.loading" size="mini" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange" @select="handleSelectionChange">
|
||||||
@@ -75,18 +82,32 @@
|
|||||||
</div>
|
</div>
|
||||||
<AddDialog @AddChanged="querytable" />
|
<AddDialog @AddChanged="querytable" />
|
||||||
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable" />
|
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable" />
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
title="打印预览"
|
||||||
|
:visible.sync="printPreviewVisible"
|
||||||
|
width="700px"
|
||||||
|
@close="closePrintPreview"
|
||||||
|
>
|
||||||
|
<iframe ref="printIframe" src="about:blank" style="width: 100%; height: 500px; border: 1px solid #ddd;" />
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="info" @click="printPreviewVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="doPrint">打印</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import crudPurchase from '@/views/wms/st/otherIn/purchase'
|
import crudPurchase from '@/views/wms/pm_manage/otherIn/purchase'
|
||||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
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 udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import AddDialog from '@/views/wms/st/purchase/AddDialog'
|
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
|
||||||
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
|
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
|
||||||
|
import QRCode from 'qrcode'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OtherIn',
|
name: 'OtherIn',
|
||||||
@@ -113,6 +134,7 @@ export default {
|
|||||||
mstrow: {},
|
mstrow: {},
|
||||||
currentRow: null,
|
currentRow: null,
|
||||||
audit_flag: true,
|
audit_flag: true,
|
||||||
|
printPreviewVisible: false,
|
||||||
billStatusOptions: [
|
billStatusOptions: [
|
||||||
{ value: '0', label: '已创建' },
|
{ value: '0', label: '已创建' },
|
||||||
{ value: '1', label: '执行中' },
|
{ value: '1', label: '执行中' },
|
||||||
@@ -203,19 +225,94 @@ export default {
|
|||||||
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const ids = selections.map(s => s.id)
|
|
||||||
const billIds = selections.map(s => s.order_no).join('、')
|
const billIds = selections.map(s => s.order_no).join('、')
|
||||||
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
|
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
crudPurchase.print(ids).then(() => {
|
this.fetchDetailsAndPrint(selections)
|
||||||
this.crud.notify('打印指令已发送', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
||||||
}).catch(() => {
|
|
||||||
this.crud.notify('打印失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
|
||||||
})
|
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
fetchDetailsAndPrint(selections) {
|
||||||
|
const promises = selections.map(bill => {
|
||||||
|
return crudPurchase.get(bill.id).then(res => {
|
||||||
|
const dtlList = (res && res.data && res.data.tableData) || []
|
||||||
|
return dtlList.map(dtl => ({
|
||||||
|
...dtl,
|
||||||
|
order_no: bill.order_no,
|
||||||
|
bill_id: bill.bill_id
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
Promise.all(promises).then(results => {
|
||||||
|
const allDtls = results.reduce((acc, cur) => acc.concat(cur), [])
|
||||||
|
if (allDtls.length === 0) {
|
||||||
|
this.crud.notify('未查询到明细数据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.printPreviewVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.renderPrintContent(allDtls)
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.crud.notify('查询明细失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async renderPrintContent(dtlList) {
|
||||||
|
const iframe = this.$refs.printIframe
|
||||||
|
if (!iframe) return
|
||||||
|
const doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document)
|
||||||
|
if (!doc) {
|
||||||
|
setTimeout(() => this.renderPrintContent(dtlList), 100)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let html = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>'
|
||||||
|
html += '*{margin:0;padding:0;box-sizing:border-box}'
|
||||||
|
html += 'body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:10px}'
|
||||||
|
html += '.label{page-break-after:always;padding:10px;text-align:center}'
|
||||||
|
html += '.label:last-child{page-break-after:auto}'
|
||||||
|
html += 'h3{text-align:center;font-size:13px;margin-bottom:3px}'
|
||||||
|
html += 'table{width:100%;border-collapse:collapse;margin:0 auto;max-width:450px}'
|
||||||
|
html += 'td{padding:3px 5px;border:2px solid #333;font-size:13px}'
|
||||||
|
html += '.lbl{width:25%;text-align:right;background:#f9f9f9}'
|
||||||
|
html += '.val{width:45%;text-align:left}'
|
||||||
|
html += '.qr{width:30%;text-align:center;vertical-align:middle}'
|
||||||
|
html += '@media print{@page{size:auto;margin:5mm}}'
|
||||||
|
html += '</style></head><body>'
|
||||||
|
for (const dtl of dtlList) {
|
||||||
|
const orderNo = dtl.order_no || ''
|
||||||
|
const itemNo = dtl.item_no || ''
|
||||||
|
const skuCode = dtl.sku_code || ''
|
||||||
|
const skuName = dtl.sku_name || ''
|
||||||
|
const qty = dtl.qty || ''
|
||||||
|
const qrText = orderNo + '#' + itemNo + '#' + skuCode + '#' + skuName + '##' + qty + '#'
|
||||||
|
const imgSrc = await QRCode.toDataURL(qrText, {
|
||||||
|
width: 200
|
||||||
|
})
|
||||||
|
html += '<div class="label">'
|
||||||
|
html += '<h3>上海诺力</h3>'
|
||||||
|
html += '<table>'
|
||||||
|
html += '<tr><td class="lbl">订单号</td><td class="val">' + orderNo + '</td><td class="qr" rowspan="5"><img src="' + imgSrc + '" width="100" height="100" /></td></tr>'
|
||||||
|
html += '<tr><td class="lbl">行号</td><td class="val">' + itemNo + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">物料编码</td><td class="val">' + skuCode + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">物料名称</td><td class="val">' + skuName + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">数量</td><td class="val">' + qty + '</td></tr>'
|
||||||
|
html += '</table></div>'
|
||||||
|
}
|
||||||
|
html += '</body></html>'
|
||||||
|
doc.open()
|
||||||
|
doc.write(html)
|
||||||
|
doc.close()
|
||||||
|
},
|
||||||
|
doPrint() {
|
||||||
|
const iframe = this.$refs.printIframe
|
||||||
|
if (!iframe) return
|
||||||
|
iframe.contentWindow.focus()
|
||||||
|
iframe.contentWindow.print()
|
||||||
|
},
|
||||||
|
closePrintPreview() {
|
||||||
|
this.printPreviewVisible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,4 +54,4 @@ export function pushZD(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, get, issueReturnBill, print,pushZD }
|
export default { add, edit, del, get, issueReturnBill, print, pushZD }
|
||||||
@@ -76,14 +76,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import crudPurchase from '@/views/wms/st/otherOut/purchase'
|
import crudPurchase from '@/views/wms/pm_manage/otherOut/purchase'
|
||||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
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 udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import AddDialog from '@/views/wms/st/purchase/AddDialog'
|
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
|
||||||
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
|
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OtherOut',
|
name: 'OtherOut',
|
||||||
@@ -54,4 +54,4 @@ export function pushZD(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, get, issueReturnBill, print,pushZD }
|
export default { add, edit, del, get, issueReturnBill, print, pushZD }
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import CRUD, { crud, form } from '@crud/crud'
|
import CRUD, { crud, form } from '@crud/crud'
|
||||||
import crudPurchase from '@/views/wms/st/purchase/purchase'
|
import crudPurchase from '@/views/wms/pm_manage/purchase/purchase'
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
id: '',
|
id: '',
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
append-to-body
|
append-to-body
|
||||||
title="采购入库单详情"
|
title="单据详情"
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
destroy-on-close
|
destroy-on-close
|
||||||
fullscreen
|
fullscreen
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { crud } from '@crud/crud'
|
import { crud } from '@crud/crud'
|
||||||
import crudPurchase from '@/views/wms/st/purchase/purchase'
|
import crudPurchase from '@/views/wms/pm_manage/purchase/purchase'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ViewDialog',
|
name: 'ViewDialog',
|
||||||
@@ -97,18 +97,32 @@
|
|||||||
</div>
|
</div>
|
||||||
<AddDialog @AddChanged="querytable" />
|
<AddDialog @AddChanged="querytable" />
|
||||||
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable" />
|
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable" />
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
title="打印预览"
|
||||||
|
:visible.sync="printPreviewVisible"
|
||||||
|
width="700px"
|
||||||
|
@close="closePrintPreview"
|
||||||
|
>
|
||||||
|
<iframe ref="printIframe" src="about:blank" style="width: 100%; height: 500px; border: 1px solid #ddd;" />
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="info" @click="printPreviewVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="doPrint">打印</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import crudPurchase from '@/views/wms/st/purchase/purchase'
|
import crudPurchase from '@/views/wms/pm_manage/purchase/purchase'
|
||||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
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 udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import AddDialog from '@/views/wms/st/purchase/AddDialog'
|
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
|
||||||
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
|
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
|
||||||
|
import QRCode from 'qrcode'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Purchase',
|
name: 'Purchase',
|
||||||
@@ -135,6 +149,7 @@ export default {
|
|||||||
mstrow: {},
|
mstrow: {},
|
||||||
currentRow: null,
|
currentRow: null,
|
||||||
audit_flag: true,
|
audit_flag: true,
|
||||||
|
printPreviewVisible: false,
|
||||||
billStatusOptions: [
|
billStatusOptions: [
|
||||||
{ value: '0', label: '已创建' },
|
{ value: '0', label: '已创建' },
|
||||||
{ value: '1', label: '执行中' },
|
{ value: '1', label: '执行中' },
|
||||||
@@ -173,7 +188,7 @@ export default {
|
|||||||
orderType: row.order_type,
|
orderType: row.order_type,
|
||||||
red: row.red,
|
red: row.red,
|
||||||
status: row.status
|
status: row.status
|
||||||
}).then(res=>{
|
}).then(res => {
|
||||||
this.crud.notify(res.respMsg)
|
this.crud.notify(res.respMsg)
|
||||||
this.crud.init()
|
this.crud.init()
|
||||||
})
|
})
|
||||||
@@ -231,19 +246,94 @@ export default {
|
|||||||
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const ids = selections.map(s => s.id)
|
|
||||||
const billIds = selections.map(s => s.order_no).join('、')
|
const billIds = selections.map(s => s.order_no).join('、')
|
||||||
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
|
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
crudPurchase.print(ids).then(() => {
|
this.fetchDetailsAndPrint(selections)
|
||||||
this.crud.notify('打印指令已发送', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
||||||
}).catch(() => {
|
|
||||||
this.crud.notify('打印失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
|
||||||
})
|
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
fetchDetailsAndPrint(selections) {
|
||||||
|
const promises = selections.map(bill => {
|
||||||
|
return crudPurchase.get(bill.id).then(res => {
|
||||||
|
const dtlList = (res && res.data && res.data.tableData) || []
|
||||||
|
return dtlList.map(dtl => ({
|
||||||
|
...dtl,
|
||||||
|
order_no: bill.order_no,
|
||||||
|
bill_id: bill.bill_id
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
Promise.all(promises).then(results => {
|
||||||
|
const allDtls = results.reduce((acc, cur) => acc.concat(cur), [])
|
||||||
|
if (allDtls.length === 0) {
|
||||||
|
this.crud.notify('未查询到明细数据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.printPreviewVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.renderPrintContent(allDtls)
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.crud.notify('查询明细失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async renderPrintContent(dtlList) {
|
||||||
|
const iframe = this.$refs.printIframe
|
||||||
|
if (!iframe) return
|
||||||
|
const doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document)
|
||||||
|
if (!doc) {
|
||||||
|
setTimeout(() => this.renderPrintContent(dtlList), 100)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let html = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>'
|
||||||
|
html += '*{margin:0;padding:0;box-sizing:border-box}'
|
||||||
|
html += 'body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:10px}'
|
||||||
|
html += '.label{page-break-after:always;padding:10px;text-align:center}'
|
||||||
|
html += '.label:last-child{page-break-after:auto}'
|
||||||
|
html += 'h3{text-align:center;font-size:13px;margin-bottom:3px}'
|
||||||
|
html += 'table{width:100%;border-collapse:collapse;margin:0 auto;max-width:450px}'
|
||||||
|
html += 'td{padding:3px 5px;border:2px solid #333;font-size:13px}'
|
||||||
|
html += '.lbl{width:25%;text-align:right;background:#f9f9f9}'
|
||||||
|
html += '.val{width:45%;text-align:left}'
|
||||||
|
html += '.qr{width:30%;text-align:center;vertical-align:middle}'
|
||||||
|
html += '@media print{@page{size:auto;margin:5mm}}'
|
||||||
|
html += '</style></head><body>'
|
||||||
|
for (const dtl of dtlList) {
|
||||||
|
const orderNo = dtl.order_no || ''
|
||||||
|
const itemNo = dtl.item_no || ''
|
||||||
|
const skuCode = dtl.sku_code || ''
|
||||||
|
const skuName = dtl.sku_name || ''
|
||||||
|
const qty = dtl.qty || ''
|
||||||
|
const qrText = orderNo + '#' + itemNo + '#' + skuCode + '#' + skuName + '##' + qty + '#'
|
||||||
|
const imgSrc = await QRCode.toDataURL(qrText, {
|
||||||
|
width: 200
|
||||||
|
})
|
||||||
|
html += '<div class="label">'
|
||||||
|
html += '<h3>上海诺力</h3>'
|
||||||
|
html += '<table>'
|
||||||
|
html += '<tr><td class="lbl">订单号</td><td class="val">' + orderNo + '</td><td class="qr" rowspan="5"><img src="' + imgSrc + '" width="100" height="100" /></td></tr>'
|
||||||
|
html += '<tr><td class="lbl">行号</td><td class="val">' + itemNo + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">物料编码</td><td class="val">' + skuCode + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">物料名称</td><td class="val">' + skuName + '</td></tr>'
|
||||||
|
html += '<tr><td class="lbl">数量</td><td class="val">' + qty + '</td></tr>'
|
||||||
|
html += '</table></div>'
|
||||||
|
}
|
||||||
|
html += '</body></html>'
|
||||||
|
doc.open()
|
||||||
|
doc.write(html)
|
||||||
|
doc.close()
|
||||||
|
},
|
||||||
|
doPrint() {
|
||||||
|
const iframe = this.$refs.printIframe
|
||||||
|
if (!iframe) return
|
||||||
|
iframe.contentWindow.focus()
|
||||||
|
iframe.contentWindow.print()
|
||||||
|
},
|
||||||
|
closePrintPreview() {
|
||||||
|
this.printPreviewVisible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,4 +55,4 @@ export function pushZD(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, get, issueReturnBill, print,pushZD }
|
export default { add, edit, del, get, issueReturnBill, print, pushZD }
|
||||||
@@ -1,219 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div 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="80px" label-suffix=":">
|
|
||||||
<el-form-item label="模糊查询">
|
|
||||||
<el-input v-model="query.blurry" size="mini" clearable placeholder="单据号/订单号/供应商"
|
|
||||||
@keyup.enter.native="crud.toQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="单据编号">
|
|
||||||
<el-input v-model="query.bill_id" size="mini" clearable placeholder="单据编号"
|
|
||||||
@keyup.enter.native="crud.toQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="订单号">
|
|
||||||
<el-input v-model="query.order_no" size="mini" clearable placeholder="订单号"
|
|
||||||
@keyup.enter.native="crud.toQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="供应商">
|
|
||||||
<el-input v-model="query.supplier_name" size="mini" clearable placeholder="供应商名称"
|
|
||||||
@keyup.enter.native="crud.toQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="单据状态">
|
|
||||||
<el-select v-model="query.bill_status" clearable size="mini" placeholder="全部" class="filter-item"
|
|
||||||
@change="crud.toQuery">
|
|
||||||
<el-option v-for="item in billStatusOptions" :key="item.value" :label="item.label" :value="item.value"/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="创建时间" prop="createTime">
|
|
||||||
<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']" @change="crud.toQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
<rrOperation/>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
<crudOperation :permission="permission">
|
|
||||||
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini"
|
|
||||||
:disabled="audit_flag" @click="issueReturnBill">下发回传单
|
|
||||||
</el-button>
|
|
||||||
<el-button slot="right" class="filter-item" type="primary" icon="el-icon-printer" size="mini"
|
|
||||||
:disabled="audit_flag" @click="printBill">打印
|
|
||||||
</el-button>
|
|
||||||
</crudOperation>
|
|
||||||
<el-table ref="table" v-loading="crud.loading" size="mini" :data="crud.data" highlight-current-row
|
|
||||||
style="width: 100%;" @selection-change="crud.selectionChangeHandler"
|
|
||||||
@current-change="handleCurrentChange" @select="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55"/>
|
|
||||||
<el-table-column v-permission="['admin','purchasemst:del','purchasemst:edit']" label="操作" width="115"
|
|
||||||
align="center" fixed="right">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<udOperation :data="scope.row" :permission="permission" :disabled-edit="canUd(scope.row)"
|
|
||||||
:disabled-dle="canUd(scope.row)"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column show-overflow-tooltip prop="bill_id" width="160" label="单据编号">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bill_id }}</el-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column show-overflow-tooltip prop="order_no" width="150" label="订单号"/>
|
|
||||||
<el-table-column show-overflow-tooltip prop="order_type" width="100" label="订单类型"/>
|
|
||||||
<el-table-column :formatter="billStatusFormat" prop="bill_status" width="100" label="单据状态"/>
|
|
||||||
<el-table-column label="明细数" align="center" prop="dtl_count" width="80"/>
|
|
||||||
<el-table-column label="单据总数" align="center" prop="total_qty" width="80"/>
|
|
||||||
<el-table-column label="入库数量" align="center" prop="instock_qty" width="80"/>
|
|
||||||
<el-table-column label="转发中鼎" align="center" prop="forwardZD" width="80">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<p v-if="scope.row.forwardZD == '0'">-</p>
|
|
||||||
<template v-else-if="scope.row.forwardZD == '1'">
|
|
||||||
<el-popconfirm confirm-button-text="是" cancel-button-text="否" icon="el-icon-info" icon-color="red"
|
|
||||||
title="是否重新转发中鼎?" @confirm="toForwardZD(scope.row)">
|
|
||||||
<a slot="reference" style="color: red;text-decoration: underline">失败</a>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
<p v-else>成功</p>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column show-overflow-tooltip prop="supplier_code" width="120" label="供应商编码"/>
|
|
||||||
<el-table-column show-overflow-tooltip prop="supplier_name" width="150" label="供应商名称"/>
|
|
||||||
<el-table-column show-overflow-tooltip prop="creator" width="100" label="创建人"/>
|
|
||||||
<el-table-column show-overflow-tooltip prop="create_time" width="150" label="创建时间">
|
|
||||||
<template slot-scope="scope">{{ formatDate(scope.row.create_time) }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column show-overflow-tooltip prop="modify_date" width="150" label="修改时间">
|
|
||||||
<template slot-scope="scope">{{ formatDate(scope.row.modify_date) }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<pagination/>
|
|
||||||
</div>
|
|
||||||
<AddDialog @AddChanged="querytable"/>
|
|
||||||
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable"/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import crudPurchase from '@/views/wms/st/allocationIn/purchase'
|
|
||||||
import CRUD, {crud, header, presenter} from '@crud/crud'
|
|
||||||
import rrOperation from '@crud/RR.operation'
|
|
||||||
import crudOperation from '@crud/CRUD.operation'
|
|
||||||
import udOperation from '@crud/UD.operation'
|
|
||||||
import pagination from '@crud/Pagination'
|
|
||||||
import AddDialog from '@/views/wms/st/purchase/AddDialog'
|
|
||||||
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'AllocationIn',
|
|
||||||
components: {AddDialog, ViewDialog, crudOperation, rrOperation, udOperation, pagination},
|
|
||||||
cruds() {
|
|
||||||
return CRUD({
|
|
||||||
title: '调拨入库单',
|
|
||||||
optShow: {add: true, reset: true},
|
|
||||||
idField: 'id',
|
|
||||||
url: '/api/purchasemst/107',
|
|
||||||
crudMethod: {...crudPurchase},
|
|
||||||
queryOnPresenterCreated: true
|
|
||||||
})
|
|
||||||
},
|
|
||||||
mixins: [presenter(), header(), crud()],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
permission: {
|
|
||||||
add: ['admin', 'purchasemst:add'],
|
|
||||||
edit: ['admin', 'purchasemst:edit'],
|
|
||||||
del: ['admin', 'purchasemst:del']
|
|
||||||
},
|
|
||||||
viewShow: false,
|
|
||||||
mstrow: {},
|
|
||||||
currentRow: null,
|
|
||||||
audit_flag: true,
|
|
||||||
billStatusOptions: [{value: '0', label: '已创建'}, {value: '1', label: '执行中'}, {value: '2', label: '已完成'}]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
canUd(row) {
|
|
||||||
return row.bill_status !== '0'
|
|
||||||
},
|
|
||||||
billStatusFormat(row) {
|
|
||||||
return ({'0': '已创建', '1': '执行中', '2': '已完成'})[row.bill_status] || row.bill_status
|
|
||||||
},
|
|
||||||
formatDate(val) {
|
|
||||||
if (!val) return '';
|
|
||||||
if (typeof val === 'string') return val;
|
|
||||||
const d = new Date(val);
|
|
||||||
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')} ${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}:${String(d.getSeconds()).padStart(2, '0')}`
|
|
||||||
},
|
|
||||||
toForwardZD(row) {
|
|
||||||
crudPurchase.pushZD({
|
|
||||||
billid: row.bill_id,
|
|
||||||
orderNo: row.order_no,
|
|
||||||
orderType: row.order_type,
|
|
||||||
red: row.red,
|
|
||||||
status: row.status
|
|
||||||
})
|
|
||||||
}, toView(index, row) {
|
|
||||||
this.mstrow = row;
|
|
||||||
this.viewShow = true
|
|
||||||
},
|
|
||||||
handleSelectionChange(val, row) {
|
|
||||||
this.audit_flag = val.length == 0
|
|
||||||
},
|
|
||||||
handleCurrentChange(currentRow) {
|
|
||||||
this.currentRow = currentRow || {};
|
|
||||||
this.audit_flag = this.crud.selections.length === 0
|
|
||||||
},
|
|
||||||
querytable() {
|
|
||||||
this.crud.toQuery()
|
|
||||||
},
|
|
||||||
issueReturnBill() {
|
|
||||||
const selections = this.crud.selections;
|
|
||||||
if (!selections || selections.length === 0) {
|
|
||||||
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const ids = selections.map(s => s.id);
|
|
||||||
const billIds = selections.map(s => s.bill_id).join('、')
|
|
||||||
this.$confirm('确认下发以下单据的回传单?\n' + billIds, '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
crudPurchase.issueReturnBill(ids).then(() => {
|
|
||||||
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS);
|
|
||||||
this.crud.toQuery()
|
|
||||||
}).catch(() => {
|
|
||||||
this.crud.notify('下发失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
|
||||||
})
|
|
||||||
}).catch(() => {
|
|
||||||
})
|
|
||||||
},
|
|
||||||
printBill() {
|
|
||||||
const selections = this.crud.selections;
|
|
||||||
if (!selections || selections.length === 0) {
|
|
||||||
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const ids = selections.map(s => s.id);
|
|
||||||
const billIds = selections.map(s => s.order_no).join('、')
|
|
||||||
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
crudPurchase.print(ids).then(() => {
|
|
||||||
this.crud.notify('打印指令已发送', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
||||||
}).catch(() => {
|
|
||||||
this.crud.notify('打印失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
|
||||||
})
|
|
||||||
}).catch(() => {
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
||||||
::v-deep .el-dialog__body {
|
|
||||||
padding-top: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -57,17 +57,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
<crudOperation :permission="permission">
|
<crudOperation :permission="permission">
|
||||||
<!-- <el-button
|
<el-button
|
||||||
slot="right"
|
slot="right"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="success"
|
type="warning"
|
||||||
icon="el-icon-check"
|
icon="el-icon-refresh"
|
||||||
size="mini"
|
size="mini"
|
||||||
:loading="showDtlLoading"
|
:loading="syncLoading"
|
||||||
@click="downdtl"
|
@click="openSyncDialog"
|
||||||
>
|
>
|
||||||
导出Excel
|
库存同步
|
||||||
</el-button>-->
|
</el-button>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<!--表格渲染-->
|
<!--表格渲染-->
|
||||||
<el-table
|
<el-table
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
<el-table-column prop="pcsn" label="批次号" :min-width="flexWidth('pcsn',crud.data,'批次号')" />
|
<el-table-column prop="pcsn" label="批次号" :min-width="flexWidth('pcsn',crud.data,'批次号')" />
|
||||||
<el-table-column prop="storagevehicle_code" label="载具号" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" />
|
<el-table-column prop="storagevehicle_code" label="载具号" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" />
|
||||||
<el-table-column prop="qty" label="总数" :formatter="crud.formatNum3" :min-width="100" />
|
<el-table-column prop="qty" label="总数" :formatter="crud.formatNum3" :min-width="100" />
|
||||||
<el-table-column label="可用数" :min-width="100" >
|
<el-table-column label="可用数" :min-width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.qty - scope.row.frozen_qty }}</span>
|
<span>{{ scope.row.qty - scope.row.frozen_qty }}</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -100,6 +100,27 @@
|
|||||||
<!--分页组件-->
|
<!--分页组件-->
|
||||||
<pagination />
|
<pagination />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="库存同步"
|
||||||
|
:visible.sync="syncDialogVisible"
|
||||||
|
width="400px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form label-width="80px" label-suffix=":">
|
||||||
|
<el-form-item label="仓库编码">
|
||||||
|
<el-input
|
||||||
|
v-model="syncWarehouseCode"
|
||||||
|
placeholder="请输入仓库编码"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="syncDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="syncLoading" @click="doSyncStock">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -112,6 +133,7 @@ import pagination from '@crud/Pagination'
|
|||||||
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
|
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
|
||||||
import { download } from '@/api/data'
|
import { download } from '@/api/data'
|
||||||
import { downloadFile } from '@/utils'
|
import { downloadFile } from '@/utils'
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Structivt',
|
name: 'Structivt',
|
||||||
@@ -135,7 +157,10 @@ export default {
|
|||||||
return {
|
return {
|
||||||
sects: [],
|
sects: [],
|
||||||
permission: {},
|
permission: {},
|
||||||
rules: {}
|
rules: {},
|
||||||
|
syncDialogVisible: false,
|
||||||
|
syncWarehouseCode: '',
|
||||||
|
syncLoading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -179,6 +204,33 @@ export default {
|
|||||||
this.showDtlLoading = false
|
this.showDtlLoading = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
openSyncDialog() {
|
||||||
|
this.syncWarehouseCode = ''
|
||||||
|
this.syncDialogVisible = true
|
||||||
|
},
|
||||||
|
doSyncStock() {
|
||||||
|
if (!this.syncWarehouseCode) {
|
||||||
|
this.$message.warning('请输入仓库编码')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.syncLoading = true
|
||||||
|
request({
|
||||||
|
url: 'api/structivt/syncStock',
|
||||||
|
method: 'post',
|
||||||
|
data: { warehouseno: this.syncWarehouseCode }
|
||||||
|
}).then(res => {
|
||||||
|
const data = res.data || res
|
||||||
|
this.$message.success(
|
||||||
|
`同步完成!EAS总数:${data.easTotal}, 本地总数:${data.localTotal}, 更新:${data.updateCount}, 新增:${data.addCount}, 删除:${data.deleteCount}`
|
||||||
|
)
|
||||||
|
this.syncDialogVisible = false
|
||||||
|
this.crud.refresh()
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message.error('同步失败')
|
||||||
|
}).finally(() => {
|
||||||
|
this.syncLoading = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user