增加单据异常查询

This commit is contained in:
杰 朱
2021-06-10 14:25:20 +08:00
parent 59ce2b9df6
commit 58f5877073
10 changed files with 375 additions and 11 deletions

View File

@@ -78,6 +78,7 @@
<Compile Include="Request\MomRequest.cs" />
<Compile Include="Request\PurchasesumRequest.cs" />
<Compile Include="Request\PoOrderRequest.cs" />
<Compile Include="Request\VouchererrorRequest.cs" />
<Compile Include="Request\SnOrderRequest.cs" />
<Compile Include="Request\SaleOrderRequest.cs" />
<Compile Include="Request\Stock.cs" />

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class VouchererrorRequest
{
public IEnumerable<string> Ccode { get; set; }
public IEnumerable<string> error { get; set; }
}
}

View File

@@ -83,6 +83,54 @@ namespace NX.ERP.U8.Finance
}
}
public IEnumerable<object> Voucherror(NX.ERP.Model.Request.VouchererrorRequest info)
{
string sql = $@"
select *from (
select c.MoCode,b.SortSeq,b.InvCode,d.cInvName,a.InvCode as InvCode1, t.cInvName as cInvName1,t.cInvStd,a.Qty , a.IssQty ,'超领' as error from mom_moallocate a WITH (NOLOCK)
left join mom_orderdetail b WITH (NOLOCK) on a.MoDId= b.MoDId
left join mom_order c WITH (NOLOCK) on b.MoId= c.MoId
left join Inventory d WITH (NOLOCK) on b.InvCode= d.cInvCode
left join Inventory t WITH (NOLOCK) on a.InvCode= t.cInvCode
where a.Qty < a.IssQty
union all
select c.MoCode,b.SortSeq,b.InvCode,d.cInvName,a.InvCode as InvCode1, t.cInvName as cInvName1,t.cInvStd,a.Qty , a.IssQty ,'缺领' as error from mom_moallocate a WITH (NOLOCK)
left join mom_orderdetail b WITH (NOLOCK) on a.MoDId= b.MoDId
left join mom_order c WITH (NOLOCK) on b.MoId= c.MoId
left join Inventory d WITH (NOLOCK) on b.InvCode= d.cInvCode
left join Inventory t WITH (NOLOCK) on a.InvCode= t.cInvCode
where a.IssQty < a.Qty*(b.QualifiedInQty/b.qty)
) mm
";
List<string> where = new List<string>();
if (info.Ccode != null)
{
where.Add(" mm.MoCode in @Ccode");
}
if (info.error != null)
{
where.Add(" mm.error in @error");
}
var aa = string.Join(" and ", where.ToArray());
if (!string.IsNullOrEmpty(aa))
{
sql += " where " + aa;
}
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
{
return conn.Query<object>(sql, new { info.Ccode, info.error });
}
}
}
}

View File

@@ -37,25 +37,24 @@ SELECT cinvcode,
),1 ,1, '') cPosName
FROM InvPositionSum b
GROUP BY cinvcode
select a.id AS ArrivalId,a.cCode as ArrivalCode,a.cpersoncode,a.cpersonname,A.cbustype AS busType,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode,a.dDate as ArrivalDate,A.cVenCode AS SupplierCode,
select a.id AS ArrivalId,a.cCode as ArrivalCode,a.cpersoncode,a.cpersonname,A.cbustype AS busType,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode, CONVERT(varchar(100), a.dDate, 23) as ArrivalDate,A.cVenCode AS SupplierCode,
B.Autoid as id,b.ID as ArrivalID,
b.cInvCode AS MaterialCode,
b.cInvCode AS MaterialCode,cinvname ,cinvstd,
b.cBatch AS BatchNo,
b.fvalidinquan as RealQuantity,
b.ccomunitcode AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.icost as cost,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum,b.isum as sum,
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate,
Pos.cPosName
FROM pu_ArrBody b , pu_ArrHead a
, (select cinvcode as cinvcode1,iId from inventory) inventory
, PO_Podetails C WITH (NOLOCK) ,
tempdb..tablearrive20210603 Pos -- on isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') and isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'')
FROM pu_ArrBody b left join tempdb..tablearrive20210603 Pos on isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'') , pu_ArrHead a
, (select cinvcode as cinvcode1,iId from inventory WITH (NOLOCK) ) inventory
, PO_Podetails C WITH (NOLOCK)
Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') -- and ( isnull (b.cInvCode,'')=isnull(Pos.cInvCode,''))
And (1=1) and isnull(b.cbcloser,N'')=N'' And isnull(a.cverifier,'')<>'' and a.id=b.id and b.cinvcode=inventory.cinvcode1 and B.iPOsID = C.ID
And a.iBillType =N'0' and isnull(b.bGsp,N'')=N'0' and (isnull(b.iQuantity,0)-isnull(b.fRefuseQuantity,0)>isnull(b.fValidInQuan,0) or (b.igrouptype=2
and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1
";
List<string> where = new List<string>();

View File

@@ -20,6 +20,14 @@ namespace NX.ERP.WebAPi.Controllers
}
[HttpPost]
[Route("api/Finance/Voucherror")]
public IEnumerable<object> Voucherror(NX.ERP.Model.Request.VouchererrorRequest info)
{
var FinanceQuery = new NX.ERP.U8.Finance.FinanceQuery();
return FinanceQuery.Voucherror(info);
}
}

View File

@@ -6,8 +6,8 @@
<configuration>
<appSettings>
<add key="server" value="10.0.0.12" />
<add key="AccId" value="u8-2@003" />
<add key="UserId" value="wx995" />
<add key="AccId" value="u8-2@001" />
<add key="UserId" value="wx996" />
<add key="Password" value="1" />
<add key="EaiPort" value="80" />
<add key="EaiPath" value="U8EAI/import.asp" />

View File

@@ -25,6 +25,7 @@
</template>
<MenuGroup title="单据">
<MenuItem to="/inventoryrrival" name="4-2">到货单</MenuItem>
<MenuItem to="/inventoryerror" name="4-3">异常单据查询</MenuItem>
</MenuGroup>
</Submenu>

View File

@@ -10,3 +10,8 @@ export const Userrole = (info) => {
}
export const Voucherror = (info) => {
return axios.post('/api/Finance/Voucherror', info)
}

View File

@@ -0,0 +1,283 @@
<template>
<div>
<h4>异常单据查询</h4>
<div>
<Row :gutter="16">
<Col span="4">
<label>生产订单号</label>
<Input autosize type="textarea" v-model="filter.mo_codes" />
</Col>
<Col span="3">
<label>异常类型:</label>
<div>
<Select v-model="filter.by_finish" multiple>
<Option
v-for="item in stateList"
:value="item.value"
:key="item.value"
>{{ item.label }}</Option
>
</Select>
</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>
<div>
<Row :gutter="16">
<Col span="4">
<label></label>
</Col>
<Col span="12">
<label>超领:已领大于应领; 缺领:已领小于(应领*(入库量/生产量))</label>
</Col>
</Row>
</div>
<div id="tb">
<Table
style="margin-top: 20px"
:loading="loading"
size="small"
border
:columns="columns"
:data="pagedData"
>
</Table>
</div>
<Page
style="margin-top: 20px"
:current="pageNo"
:page-size="pageSize"
:total="total"
:page-size-opts="PageSizeOpts"
@on-change="handlePagechange"
@on-page-size-change="handlePageSize"
show-elevator
show-sizer
show-total
size="small"
/>
</div>
</template>
<script>
import { Voucherror } from "@/api/Finance";
//import vUpLoad from "@/bill/PrintView";
import { pageingData, export_col_to_excel, sortByKey } from "@/libs/tools";
export default {
//components:{vUpLoad},
data() {
return {
loading: false,
PageSizeOpts: [10, 15, 20, 30],
pageNo: 1,
modal1: false,
printing: false,
strfilter: "",
multiple: false,
pageSize: 15,
datas: [],
ccode: "",
stateList: [
{
value: "超领",
label: "超领",
},
{
value: "缺领",
label: "缺领",
},
],
filter: {
inv_codes: "",
by_finish: ["超领", "缺领"],
inv_std: "",
mo_codes: "",
},
columns: [
{
title: "生产订单号",
align: "center",
key: "MoCode",
},
{
title: "行号",
align: "center",
key: "SortSeq",
width: 80,
},
{
title: "产品编号",
align: "center",
key: "InvCode",
width: 120,
},
{
title: "产品名称",
align: "center",
key: "cInvName",
},
{
title: "子件编号",
align: "center",
key: "InvCode1",
width: 120,
},
{
title: "子件名称",
align: "center",
key: "cInvName1",
},
{
title: "规格型号",
align: "center",
key: "cInvStd",
},
{
title: "应领数量",
align: "center",
key: "Qty",
},
{
title: "已领数量",
align: "center",
key: "IssQty",
},
{
title: "异常情况",
align: "center",
key: "error",
render: (h, params) => {
if (params.row.error === "超领") {
return h(
"span",
{ style: { color: "#ff6600" } },
params.row.error
);
} else {
return h(
"span",
{ style: { color: "#2db7f5" } },
params.row.error
);
}
},
},
],
};
},
computed: {
total() {
return this.datas.length;
},
pagedData() {
return pageingData(this.datas, this.pageSize, this.pageNo);
},
},
mounted() {
this.loadData();
},
methods: {
handelExport() {
export_col_to_excel(this.columns, this.datas);
},
handleClick() {
this.loadData();
},
async loadData() {
try {
let _filert = {
ccode:
this.filter.mo_codes !== ""
? this.filter.mo_codes.split(/[,\s\n,]/)
: null,
error: this.filter.by_finish,
};
this.loading = true;
let resp = await Voucherror(_filert);
this.pageNo = 1;
this.datas = sortByKey(resp.data.data, "MoCode");
// this.datas = resp.data.data;
} catch (error) {
} finally {
this.loading = false;
}
},
handlePagechange(page) {
this.pageNo = page;
},
handlePageSize(pageSize) {
this.pageSize = pageSize;
},
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style >
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
.ivu-table .demo-table-info-row td {
background-color: #2db7f5;
color: #fff;
}
.ivu-table .demo-table-error-row td {
background-color: #ff6600;
color: #fff;
}
.ivu-table td.demo-table-info-old {
color: #2db7f5;
}
.ivu-table td.demo-table-info-new {
color: #ff6600;
font-size: 12px;
}
.ivu-table td.demo-table-info-nom {
font-size: 11px;
}
.ivu-table td.demo-table-info-ex {
color: #187;
font-weight: 600;
}
body {
padding: 10px 1;
}
</style>

View File

@@ -9,6 +9,7 @@ import inventorypo from '@/views/inventory-po.vue'
import inventorypoc from '@/views/inventory-poc.vue'
import Purchasesum from '@/views/Purchasesum.vue'
import inventoryrrival from '@/bill/inventory-arrival.vue'
import inventoryerror from '@/bill/inventory-error.vue'
export default [
{
@@ -27,4 +28,5 @@ export default [
{ path: '/inventorypoc', component: inventorypoc },
{ path: '/Purchasesum', component: Purchasesum },
{ path: '/inventoryrrival', component: inventoryrrival },
{ path: '/inventoryerror', component: inventoryerror },
]