This commit is contained in:
杰 朱
2021-10-20 17:28:09 +08:00
parent 2dffca5f8d
commit 9f2c936f8f
7 changed files with 528 additions and 58 deletions

View File

@@ -79,6 +79,7 @@
<Compile Include="Request\ProductOrderReportSn.cs" />
<Compile Include="Request\PurchasesumRequest.cs" />
<Compile Include="Request\PoOrderRequest.cs" />
<Compile Include="Request\SaleinvRequest.cs" />
<Compile Include="Request\VouchererrorRequest.cs" />
<Compile Include="Request\SnOrderRequest.cs" />
<Compile Include="Request\SaleOrderRequest.cs" />

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class SaleinvRequest
{
public string cCusAbbName { get; set; }
public string dDate { get; set; }
public string cSOCode { get; set; }
public string cInvCode { get; set; }
public string cInvName { get; set; }
public string cInvStd { get; set; }
public string wfiQuantity { get; set; }
public string kcyl { get; set; }
public string dPreDate { get; set; }
public string cMemo { get; set; }
public string datewaring { get; set; }
public string jandate { get; set; }
public string kcyl2 { get; set; }
public IEnumerable<string> SoCodes { get; set; }
public string InvStd { get; set; }
public IEnumerable<string> InvCodes { get; set; }
public DateTime? BeginDate { get; set; }
public DateTime? EndDate { get; set; }
public bool byFinish { get; set; }
public IEnumerable<string> flag { get; set; }
}
}

View File

@@ -852,13 +852,14 @@ select *from tempdb..tablepzck20210526
}
public IEnumerable<object> InventorySale(NX.ERP.Model.Request.SaleOrderRequest info1)
public IEnumerable<object> InventorySale(NX.ERP.Model.Request.SaleinvRequest info1)
{
string sql = $@"
select *from (
select f.cCusAbbName,CONVERT(varchar(100),b.dDate, 23) as dDate ,b.cSOCode,a.cInvCode,a.cInvName,g.cInvStd, a.iQuantity - isnull(d.cqty,0) as wfiQuantity
,
isnull(cs.qty,0) as xcl
isnull(cs.qty,0) as xcl,
b.cVerifier
,
isnull(
(SELECT isnull(SUM(iquantity),0) qty
@@ -892,7 +893,7 @@ select *from tempdb..tablepzck20210526
GROUP BY cInvCode) cs ON a.cInvCode = cs.cInvCode
left join Customer f WITH (nolock) on b.cCusCode=f.cCusCode
left join Inventory g WITH (nolock) on g.cInvCode=a.cInvCode
left join Inventory g WITH (nolock) on g.cInvCode=a.cInvCode ) mm
@@ -901,26 +902,112 @@ select *from tempdb..tablepzck20210526
List<string> where = new List<string>();
where.Add(" a.iQuantity - isnull(d.cqty,0) >0 and b.cVerifier is not null ");
// where.Add(" a.iQuantity - isnull(d.cqty,0) >0 and b.cVerifier is not null ");
where.Add(" mm.wfiQuantity >0 and mm.cVerifier is not null ");
if (!string.IsNullOrEmpty(info1.cCusAbbName))
{
where.Add(" mm.cCusAbbName like @cCusAbbName ");
}
if (!string.IsNullOrEmpty(info1.dDate))
{
where.Add(" mm.dDate = @dDate ");
}
if (!string.IsNullOrEmpty(info1.cSOCode))
{
where.Add(" mm.cSOCode = @cSOCode ");
}
if (!string.IsNullOrEmpty(info1.cInvCode))
{
where.Add(" mm.cInvCode like @cInvCode ");
}
if (!string.IsNullOrEmpty(info1.cInvName))
{
where.Add(" mm.cInvName like @cInvName ");
}
if (!string.IsNullOrEmpty(info1.cInvStd))
{
where.Add(" mm.cInvStd like @cInvStd ");
}
if (!string.IsNullOrEmpty(info1.cMemo))
{
where.Add(" mm.cMemo like @cMemo ");
}
if (!string.IsNullOrEmpty(info1.dPreDate))
{
where.Add(" mm.dPreDate = @dPreDate ");
}
if (!string.IsNullOrEmpty(info1.wfiQuantity))
{
where.Add(" mm.wfiQuantity = @wfiQuantity ");
}
if (!string.IsNullOrEmpty(info1.kcyl))
{
where.Add(" mm.kcyl = @kcyl ");
}
if (!string.IsNullOrEmpty(info1.jandate))
{
where.Add(" mm.jandate = @jandate ");
}
if (!string.IsNullOrEmpty(info1.kcyl2))
{
if (info1.kcyl2 == "1")
{
where.Add(" mm.kcyl <= 0 ");
}
else if (info1.kcyl2 == "2")
{
where.Add(" mm.kcyl > 0 ");
}
}
if (!string.IsNullOrEmpty(info1.datewaring))
{
if (info1.datewaring == "1")
{
where.Add(" (mm.jandate > -15 AND mm.jandate < 0) ");
}
else if (info1.datewaring == "2")
{
where.Add("(mm.jandate <= -15) ");
}
else if (info1.datewaring == "3")
{
where.Add("(mm.jandate >= 0) ");
}
}
/*
if (info1.InvCodes != null)
{
where.Add(" a.cinvcode in @cinvcode");
where.Add(" mm.cinvcode in @cinvcode");
}
if (!string.IsNullOrEmpty(info1.InvStd))
{
where.Add(" g.cInvStd like @cInvStd ");
where.Add(" mm.cInvStd like @cInvStd ");
}
if (info1.SoCodes != null)
{
where.Add(" b.cSOCode in @cSOCode ");
where.Add(" mm.cSOCode in @SoCodes ");
}
if (info1.BeginDate != null && info1.EndDate != null)
{
where.Add(" b.dDate between @beginDate and @endDate ");
}
*/
if (info1.flag != null && info1.flag.ToList().Count>0)
{
@@ -931,15 +1018,15 @@ select *from tempdb..tablepzck20210526
{
if (item == "1")
{
str.Add(" (DATEDIFF(day,a.dPreDate,GETDATE()) > -15 AND DATEDIFF(day,a.dPreDate,GETDATE()) < 0) ");
str.Add(" (mm.jandate > -15 AND mm.jandate < 0) ");
}
else if (item == "2")
{
str.Add(" (DATEDIFF(day,a.dPreDate,GETDATE()) <= -15) ");
str.Add(" (mm.jandate <= -15) ");
}
else
{
str.Add(" (DATEDIFF(day, a.dPreDate, GETDATE()) >= 0) ");
str.Add(" (mm.jandate >= 0) ");
}
}
@@ -962,7 +1049,7 @@ select *from tempdb..tablepzck20210526
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
{
return conn.Query<object>(sql, new { cinvcode = info1.InvCodes, cInvStd = $"%{info1.InvStd}%", cSOCode = info1.SoCodes, info1.BeginDate, info1.EndDate });
return conn.Query<object>(sql, new { cCusAbbName = $"%{info1.cCusAbbName}%", dDate = info1.dDate, dPreDate = info1.dPreDate, cSOCode = info1.cSOCode, cInvCode = $"%{info1.cInvCode}%" , cInvName = $"%{info1.cInvName}%" , cInvStd = $"%{info1.cInvStd}%" , cMemo = $"%{info1.cMemo}%", SoCodes = info1.SoCodes, info1.jandate, info1.wfiQuantity, info1.kcyl, });
}
}

View File

@@ -47,7 +47,7 @@ namespace NX.ERP.WebAPi.Controllers
[HttpPost]
[Route("api/Pmc/InventorySale")]
public IEnumerable<object> InventorySale(NX.ERP.Model.Request.SaleOrderRequest info1)
public IEnumerable<object> InventorySale(NX.ERP.Model.Request.SaleinvRequest info1)
{
var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery();
return PmcQuery.InventorySale(info1);

View File

@@ -12,13 +12,14 @@
<MenuItem to="/InventoryMonth" name="3-4">材料出库数据与品种</MenuItem>
<MenuItem to="/InventorySo" name="3-5">销售订单表</MenuItem> -->
<MenuItem to="/inventorysale" name="3-5">销售未发明细表</MenuItem>
<MenuItem to="/inventory-SNDetail" name="3-6">序列号查询</MenuItem>
<!-- <MenuItem to="/inventory-SNDetail" name="3-6">序列号查询</MenuItem>
<MenuItem to="/inventorybu" name="3-7">补料量查询</MenuItem>
<!-- <MenuItem to="/inventorypo" name="3-8">采购订单列表(PMC)</MenuItem> -->
<MenuItem to="/inventorypo" name="3-8">采购订单列表(PMC)</MenuItem>
<MenuItem to="/inventorypoc" name="3-9">采购跟进表(采购部)</MenuItem>
<MenuItem to="/Purchasesum" name="3-99">采购查询汇总</MenuItem>
<MenuItem to="/Purchasesum" name="3-99">采购查询汇总</MenuItem>-->
</MenuGroup>
</Submenu>
<!--
<Submenu name="4">
<template slot="title">
<Icon type="ios-stats" />
@@ -32,6 +33,7 @@
<MenuItem to="/inventoryQmerror" name="4-5">不良品处理问题单据</MenuItem>
</MenuGroup>
</Submenu>
-->
</Menu>
<div class="contain">
<router-view></router-view>

View File

@@ -0,0 +1,165 @@
<template>
<div>
<Table
border
:data="filters"
:columns="tableColumnsFilters"
>
</Table>
<Table
:show-header=false
border
:data="data"
:columns="columns"
>
</Table>
</div>
</template>
<script>
export default {
name: "FilterTable",
props: {
columns: Array, //列描述数据对象
data: Array //表格数据
},
data() {
return {
filters: [{
title: ''
}],
tableColumnsFilters: [],
search: {},//过滤条件保存的对象,就是保存Input框和Select中值
}
},
created() {
for (let index in this.columns) {
let filter = {};
/**
* 因为是采用的两个表的形式,过滤表中显示查询的Input,Select条件输组件,表头显示的是数据表的表头,渲染的数据是传入的columns中的filter字段
* 数据表隐藏表头,只显示数据,渲染的数据是传入的columns中的key值
*/
//将传入的列描述数据对象(columns) 的title和width 复制给 过滤表的列描述数据对象(tableColumnsFilters)
this.$set(filter, 'title', this.columns[index].title);
if (this.columns[index].width) {
this.$set(filter, 'width', this.columns[index].width);
}
let render = (h) => {};
/**
* 需要有搜索的列, 只要在 列描述数据对象columns中配置 filter属性就行如下:
{
title: '名字',
key: '_id',
filter: {
type: 'Input'
}
},
{
title: '交易金额 (元)',
key: 'money',
filter: {
type: 'Select',
option:status //选项
}
},
*/
//如果存在 过滤选项
if (this.columns[index].filter) {
//过滤为 下拉选择框
if (this.columns[index].filter.type && this.columns[index].filter.type === 'Select') {
render = (h) => {
return h(this.columns[index].filter.type, {
props: {
value: 0,//Select选项列表一般 0 为全部
transfer: true,
},
on: {
'on-change': (val) => {
if (val === 0) {
//当选项是全部的时候删除 search中该字段的过滤条件
this.$delete(this.search, this.columns[index].key);
this.load();
return;
}
//添加字段过滤条件
this.$set(this.search, this.columns[index].key, val);
this.load();
}
}
}, this.createOptionsRender(index, h));
}
} else {
//如果是输入框
render = (h) => {
//获取输入框的值,为了减少数据库的压力,我这里是
//通过回车和点击搜索按钮才进行数据过滤查询,如果
//要输入框变化就进行过滤,把 this.load()放到
//input事件方法就行了
let inputValue = {};
return h(this.columns[index].filter.type, {
props: {
placeholder: '输入' + this.columns[index].title,
icon: 'ios-search-strong'
},
on: {
input: val => {
inputValue = val;
if (!inputValue) {
this.validInputValue(index, inputValue);
}
},
//input框后面的搜索按钮的点击事件
'on-click': () => {
this.validInputValue(index, inputValue);
},
'on-enter': () => {
this.validInputValue(index, inputValue);
}
}
})
};
}
}
this.$set(filter, 'render', render);
this.tableColumnsFilters.push(filter);
}
},
methods: {
createOptionsRender(index, h) {
//选项渲染
let optionRender = [];
if (this.columns[index].filter.option) {
let option = this.columns[index].filter.option;
for (let i in option) {
optionRender.push(h('Option', {
props: {
value: option[i].value
}
}, option[i].name))
}
}
return optionRender;
},
//重新加载数据
load() {
//会执行一个load的事件
this.$emit('on-search',this.search);
},
//验证输入框的值
validInputValue(index, inputValue) {
if (!inputValue) {
this.$delete(this.search, this.columns[index].key);
this.load();
return;
}
this.$set(this.search, this.columns[index].key, inputValue);
this.load();
}
}
}
</script>
<style scoped>
</style>

View File

@@ -1,8 +1,9 @@
<template>
<div>
<h4>销售订单表</h4>
<h2>销售未发货明细表</h2>
<div>
<Row :gutter="16">
<!--
<Col span="4">
<label>销售订单编号</label>
<Input v-model="filter.so_code" />
@@ -12,12 +13,8 @@
<label>物料编号</label>
<Input autosize type="textarea" v-model="filter.inv_codes" />
</Col>
<Col span="4">
<label>规格</label>
<Input v-model="filter.inv_std" />
</Col>
<Col span="4">
<Col span="4">
<label>时间预警</label>
<div>
<Select v-model="filter.flag" multiple>
@@ -29,14 +26,30 @@
</Select>
</div>
</Col>
-->
<Col span="4">
<Button size="large" type="primary" icon="ios-search" @click="handleClick">查询</Button>
<div class="search_div">
<i-input
@on-change="pageNo=1"
clearable
placeholder="输入关键词筛选,多个用空格分隔"
v-model="strfilter"
>
<Icon slot="suffix" type="ios-search" />
</i-input>
</div>
</Col>
<Col span="4">
<!--<Button size="large" type="primary" icon="ios-search" @click="handleClick">查询</Button>-->
<Button size="large" type="success" @click="handelExport">导出</Button>
</Col>
</Row>
</div>
<Table style="margin-top: 20px" size="small" border :columns="columns" :data="pagedData"></Table>
<!--<Table style="margin-top: 20px" size="small" border :columns="columns" :data="pagedData"></Table>-->
<filter-table @on-search="onSearch" :data="pagedData" :columns="columns"></filter-table>
<Page
style="margin-top: 20px"
@@ -56,6 +69,7 @@
<script>
import { getInventorySale } from "@/api/pmc";
import FilterTable from "./FilterTable";
import {
pageingData,
export_col_to_excel,
@@ -63,7 +77,36 @@ import {
dateFormat,
sortByKey
} from "@/libs/tools";
const isqj = {
1: {
value: 1,
name: "是",
color: "red"
},
2: {
value: 2,
name: "否",
color: "green"
}
};
const stateListq = {
0: {
value: "1",
name: "15天内发货"
},
1: {
value: "2",
name: "15天以上发货"
},
2: {
value: "3",
name: "超期"
}
};
export default {
components: { FilterTable },
data() {
return {
PageSizeOpts: [10, 15, 20, 30],
@@ -103,7 +146,10 @@ export default {
{
title: "客户",
align: "center",
key: "cCusAbbName"
key: "cCusAbbName",
filter: {
type: "Input"
}
},
{
title: "订单日期",
@@ -111,82 +157,161 @@ export default {
key: "dDate",
render: (h, params) => {
return <div> {dateFormat(params.row.dDate)} </div>;
},
filter: {
type: "Input"
}
},
{
title: "销售单号",
align: "center",
key: "cSOCode",
width: "150"
width: "150",
filter: {
type: "Input"
}
},
{
title: "产品编码",
align: "center",
key: "cInvCode",
className: "demo-table-info-new"
className: "demo-table-info-new",
filter: {
type: "Input"
}
},
{
title: "产品名称",
align: "center",
key: "cInvName"
key: "cInvName",
filter: {
type: "Input"
}
},
{
title: "规格型号",
align: "center",
key: "cInvStd",
width: "220"
width: "220",
filter: {
type: "Input"
}
},
{
title: "未发数量",
align: "center",
key: "wfiQuantity"
key: "wfiQuantity",
filter: {
type: "Input"
}
},
{
title: "库存余量",
align: "center",
key: "kcyl"
key: "kcyl",
filter: {
type: "Input"
}
},
{
title: "预计发货日期",
align: "center",
key: "dPreDate"
key: "dPreDate",
filter: {
type: "Input"
}
},
{
title: "技术要求",
align: "center",
key: "cMemo",
width: "300"
width: "300",
filter: {
type: "Input"
}
},
{
title: "时间预警",
align: "center",
key: "datewaring",
filter: {
type: "Select",
option: stateListq
}
},
{
title: "超期天数",
align: "center",
key: "jandate"
key: "jandate",
filter: {
type: "Input"
}
},
{
title: "是否欠机",
align: "center",
key: "kcyl",
key: "kcyl2",
render: (h, params) => {
return <div> {this.Formatkcyl(params.row.kcyl)} </div>;
},
filter: {
type: "Select",
option: isqj
}
}
]
};
},
computed: {
filertData() {
let data = this.datas;
if (this.strfilter && this.strfilter !== "") {
let filterKey = this.strfilter
.toLowerCase()
.trim()
.split(/\s+/);
if (filterKey.length > 0) {
data = data.filter(item => {
return Object.keys(item).some(key => {
return filterKey.some(filter => {
return (
String(item[key])
.toLowerCase()
.indexOf(filter) > -1
);
});
});
});
}
}
return data;
},
usePage() {
if (this.page) {
return this.page;
} else {
return this.filertData.length > 15;
}
},
total() {
return this.filertData.length;
},
pagedData() {
if (this.usePage) {
return pageingData(this.filertData, this.pageSize, this.pageNo);
} else {
return this.filertData;
}
} /*
total() {
return this.datas.length;
},
pagedData() {
return pageingData(this.datas, this.pageSize, this.pageNo);
}
*/
},
mounted() {
@@ -236,26 +361,67 @@ export default {
this.pageNo = 1;
this.datas = resp.data.data;
this.datas = sortByKey(resp.data.data, "dDate");
this.datas.forEach((item) => {
if(item.datewaring==="15天内发货")
{
item.cellClassName= {
datewaring: 'demo-table-info-cell-address'
}
this.datas.forEach(item => {
if (item.datewaring === "15天内发货") {
item.cellClassName = {
datewaring: "demo-table-info-cell-address"
};
} else if (item.datewaring === "超期") {
item.cellClassName = {
datewaring: "demo-table-info-cell-age"
};
} else {
item.cellClassName = {
datewaring: "demo-table-info-cell-name"
};
}
else if (item.datewaring==="超期")
{
item.cellClassName= {
datewaring: 'demo-table-info-cell-age'
}
});
},
async onSearch(search) {
//模拟数据库查询数据
//这个search应该是传到后台,然后台来根据条件查询数据库
//alert("查询条件:" + JSON.stringify(search, null, 4));
//console.log(JSON.stringify(search, null, 4));
console.log(search);
let _filert = {
c_cus_abb_name: search.cCusAbbName,
d_date: search.dDate,
c_so_code: search.cSOCode,
c_inv_code: search.cInvCode,
c_inv_name: search.cInvName,
c_inv_std: search.cInvStd,
wfi_quantity: search.wfiQuantity,
kcyl: search.kcyl,
d_pre_date: search.dPreDate,
datewaring: search.datewaring,
c_memo: search.cMemo,
jandate: search.jandate,
kcyl2: search.kcyl2,
};
let resp = await getInventorySale(_filert);
this.pageNo = 1;
this.datas = resp.data.data;
this.datas = sortByKey(resp.data.data, "dDate");
this.datas.forEach(item => {
if (item.datewaring === "15天内发货") {
item.cellClassName = {
datewaring: "demo-table-info-cell-address"
};
} else if (item.datewaring === "超期") {
item.cellClassName = {
datewaring: "demo-table-info-cell-age"
};
} else {
item.cellClassName = {
datewaring: "demo-table-info-cell-name"
};
}
else{
item.cellClassName= {
datewaring: 'demo-table-info-cell-name'
}
}
})
});
},
handlePagechange(page) {