修改接口参数

This commit is contained in:
gongxh
2021-05-04 14:43:24 +08:00
parent ddb7455154
commit 99515f25dd
5 changed files with 155 additions and 116 deletions

View File

@@ -64,6 +64,7 @@
<Compile Include="BaseModel.cs" /> <Compile Include="BaseModel.cs" />
<Compile Include="Request\BinChange.cs" /> <Compile Include="Request\BinChange.cs" />
<Compile Include="Request\Inventoryall.cs" /> <Compile Include="Request\Inventoryall.cs" />
<Compile Include="Request\SaleOrderRequest.cs" />
<Compile Include="Response\Pmc\PmcInventoryallRes.cs" /> <Compile Include="Response\Pmc\PmcInventoryallRes.cs" />
<Compile Include="Response\Store\Stock.cs" /> <Compile Include="Response\Store\Stock.cs" />
<Compile Include="TimestampConverter.cs" /> <Compile Include="TimestampConverter.cs" />

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class SaleOrderRequest
{
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; }
}
}

View File

@@ -97,7 +97,7 @@ namespace NX.ERP.U8.Pmc
where.Add(" c.cinvcode in @cinvcode"); where.Add(" c.cinvcode in @cinvcode");
} }
@@ -341,7 +341,7 @@ namespace NX.ERP.U8.Pmc
} }
public IEnumerable<object> Inventorysocode(NX.ERP.Model.Request.Inventoryall info1) public IEnumerable<object> Inventorysocode(NX.ERP.Model.Request.SaleOrderRequest info1)
{ {
string sql = $@" string sql = $@"
select j.cSTName,b.cSOCode,b.dDate,a.iRowNo,f.cCusAbbName,a.cInvCode,a.cInvName,g.cInvStd,a.iQuantity, h.dDate as fhdDate ,isnull(c.fqty,0)fqty,isnull(d.cqty,0)cqty select j.cSTName,b.cSOCode,b.dDate,a.iRowNo,f.cCusAbbName,a.cInvCode,a.cInvName,g.cInvStd,a.iQuantity, h.dDate as fhdDate ,isnull(c.fqty,0)fqty,isnull(d.cqty,0)cqty
@@ -380,11 +380,23 @@ namespace NX.ERP.U8.Pmc
{ {
where.Add(" g.cInvStd like @cInvStd "); where.Add(" g.cInvStd like @cInvStd ");
} }
if (!string.IsNullOrEmpty(info1.SoCode)) if (info1.SoCodes != null)
{ {
where.Add(" b.cSOCode like @cSOCode "); where.Add(" b.cSOCode in @cSOCode ");
} }
if (info1.BeginDate != null && info1.EndDate != null)
{
where.Add(" b.dDate between @beginDate and @endDate ");
}
if (!info1.byFinish)
{
where.Add(" h.dDate is null ");
}
var aa = string.Join(" and ", where.ToArray()); var aa = string.Join(" and ", where.ToArray());
if (!string.IsNullOrEmpty(aa)) if (!string.IsNullOrEmpty(aa))
@@ -394,7 +406,7 @@ namespace NX.ERP.U8.Pmc
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection) using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
{ {
return conn.Query<object>(sql, new { cinvcode = info1.InvCodes, cInvStd = $"%{info1.InvStd}%", cSOCode = $"%{info1.SoCode}%" }); return conn.Query<object>(sql, new { cinvcode = info1.InvCodes, cInvStd = $"%{info1.InvStd}%", cSOCode = info1.SoCodes, info1.BeginDate, info1.EndDate });
} }
} }

View File

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

View File

@@ -3,7 +3,12 @@
<h4>销售订单表</h4> <h4>销售订单表</h4>
<div> <div>
<Row :gutter="16"> <Row :gutter="16">
<Col span="8"> <Col span="4">
<label>销售订单编号</label>
<Input v-model="filter.so_code" />
</Col>
<Col span="4">
<label>物料编号</label> <label>物料编号</label>
<Input autosize type="textarea" v-model="filter.inv_codes" /> <Input autosize type="textarea" v-model="filter.inv_codes" />
</Col> </Col>
@@ -11,33 +16,27 @@
<label>规格</label> <label>规格</label>
<Input v-model="filter.inv_std" /> <Input v-model="filter.inv_std" />
</Col> </Col>
<Col span="4">
<label>销售订单表</label> <Col span="3">
<Input v-model="filter.so_code" /> <label>期间</label>
<div>
<DatePicker v-model="filter.dates" type="daterange"></DatePicker>
</div>
</Col>
<Col span="3">
<label>状态</label>
<div>
<Checkbox v-model="filter.by_finish">包含已经交货</Checkbox>
</div>
</Col> </Col>
<Col span="4"> <Col span="4">
<Button <Button size="large" type="primary" icon="ios-search" @click="handleClick">查询</Button>
size="large" <Button size="large" type="success" @click="handelExport">导出</Button>
type="primary"
icon="ios-search"
@click="handleClick"
>查询</Button
>
<Button size="large" type="success" @click="handelExport"
>导出</Button
>
</Col> </Col>
</Row> </Row>
</div> </div>
<Table <Table style="margin-top: 20px" size="small" border :columns="columns" :data="pagedData"> </Table>
style="margin-top: 20px"
size="small"
border
:columns="columns"
:data="pagedData"
>
</Table>
<Page <Page
style="margin-top: 20px" style="margin-top: 20px"
@@ -56,157 +55,159 @@
</template> </template>
<script> <script>
import { getInventorysocode } from "@/api/pmc"; import { getInventorysocode } from '@/api/pmc'
import { import { pageingData, export_col_to_excel, dateFormatFull, dateFormat, sortByKey } from '@/libs/tools'
pageingData,
export_col_to_excel,
dateFormatFull,
dateFormat,
sortByKey,
} from "@/libs/tools";
export default { export default {
data() { data() {
return { return {
PageSizeOpts: [10, 15, 20, 30], PageSizeOpts: [10, 15, 20, 30],
pageNo: 1, pageNo: 1,
strfilter: "", strfilter: '',
multiple: false, multiple: false,
pageSize: 15, pageSize: 15,
datas: [], datas: [],
filter: { filter: {
inv_codes: "", inv_codes: '',
inv_std: "", inv_std: '',
so_code: "", so_code: '',
dates: [],
by_finish: false
}, },
columns: [ columns: [
{ {
title: "销售类型", title: '销售类型',
align: "center", align: 'center',
key: "cSTName", key: 'cSTName',
width: "120", width: '120'
}, },
{ {
title: "销售编号", title: '销售编号',
align: "center", align: 'center',
key: "cSOCode", key: 'cSOCode',
width: "150", width: '150'
}, },
{ {
title: "订单日期", title: '订单日期',
align: "center", align: 'center',
key: "dDate", key: 'dDate',
render: (h, params) => { render: (h, params) => {
return <div> {dateFormat(params.row.dDate)} </div>; return <div> {dateFormat(params.row.dDate)} </div>
}, }
}, },
{ {
title: "行号", title: '行号',
align: "center", align: 'center',
key: "iRowNo", key: 'iRowNo',
width: "80", width: '80'
}, },
{ {
title: "客户名称", title: '客户名称',
align: "center", align: 'center',
key: "cCusAbbName", key: 'cCusAbbName'
}, },
{ {
title: "产品编码", title: '产品编码',
align: "center", align: 'center',
key: "cInvCode", key: 'cInvCode',
className: "demo-table-info-new", className: 'demo-table-info-new'
}, },
{ {
title: "产品名称", title: '产品名称',
align: "center", align: 'center',
key: "cInvName", key: 'cInvName'
}, },
{ {
title: "规格型号", title: '规格型号',
align: "center", align: 'center',
key: "cInvStd", key: 'cInvStd',
width: "220", width: '220'
}, },
{ {
title: "订单数", title: '订单数',
align: "center", align: 'center',
key: "iQuantity", key: 'iQuantity'
}, },
{ {
title: "发货时间", title: '发货时间',
align: "center", align: 'center',
key: "fhdDate", key: 'fhdDate',
render: (h, params) => { render: (h, params) => {
return <div> {dateFormat(params.row.fhdDate)} </div>; return <div> {dateFormat(params.row.fhdDate)} </div>
}, }
}, },
{ {
title: "发货数量", title: '发货数量',
align: "center", align: 'center',
key: "fqty", key: 'fqty'
}, },
{ {
title: "出库数量", title: '出库数量',
align: "center", align: 'center',
key: "cqty", key: 'cqty'
}, },
{ {
title: "现存量", title: '现存量',
align: "center", align: 'center',
key: "qty", key: 'qty'
}, },
{ {
title: "在制量", title: '在制量',
align: "center", align: 'center',
key: "momqty", key: 'momqty'
}, }
], ]
}; }
}, },
computed: { computed: {
total() { total() {
return this.datas.length; return this.datas.length
}, },
pagedData() { pagedData() {
return pageingData(this.datas, this.pageSize, this.pageNo); return pageingData(this.datas, this.pageSize, this.pageNo)
}, }
}, },
mounted() { mounted() {
this.loadData(); this.loadData()
}, },
methods: { methods: {
handelExport() { handelExport() {
export_col_to_excel(this.columns, this.datas); export_col_to_excel(this.columns, this.datas)
}, },
handleClick() { handleClick() {
this.loadData(); this.loadData()
}, },
async loadData() { async loadData() {
let _beginDate = null
let _endDate = null
if (this.filter.dates.length == 2 && this.filter.dates[0] !== '' && this.filter.dates[0] !== '') {
_beginDate = this.filter.dates[0]
_endDate = this.filter.dates[1]
}
let _filert = { let _filert = {
inv_codes: inv_codes: this.filter.inv_codes !== '' ? this.filter.inv_codes.split(/[,\s\n,]/) : null,
this.filter.inv_codes !== ""
? this.filter.inv_codes.split(/[,\s\n,]/)
: null,
inv_std: this.filter.inv_std, inv_std: this.filter.inv_std,
so_code: this.filter.so_code, so_codes: this.filter.so_code !== '' ? this.filter.so_code.split(/[,\s\n,]/) : null,
}; begin_date: _beginDate,
let resp = await getInventorysocode(_filert); end_date: _endDate,
this.pageNo = 1; by_finish: this.filter.by_finish
this.datas =resp.data.data; }
this.datas = sortByKey(resp.data.data, "cSOCode"); let resp = await getInventorysocode(_filert)
this.pageNo = 1
this.datas = resp.data.data
this.datas = sortByKey(resp.data.data, 'cSOCode')
}, },
handlePagechange(page) { handlePagechange(page) {
this.pageNo = page; this.pageNo = page
}, },
handlePageSize(pageSize) { handlePageSize(pageSize) {
this.pageSize = pageSize; this.pageSize = pageSize
}, }
}, }
}; }
</script> </script>