增加 子件领料报表

This commit is contained in:
杰 朱
2021-09-01 15:31:16 +08:00
parent 83eda2dd4b
commit 4e9d70775d
8 changed files with 672 additions and 2 deletions

View File

@@ -48,7 +48,9 @@ namespace NX.ERP.Model
public double wll { get; set; }
public double shwl { get; set; }
public double sdwl { get; set; }
public string cPosName { get; set; }
/// <summary>
///

View File

@@ -312,5 +312,117 @@ namespace NX.ERP.U8.Mom
return this.GetList("b.moid >= @id", new { Id });
}
public IEnumerable<NX.ERP.Model.PmcInventorymomRes> Pick(NX.ERP.Model.Request.MomOrderRequest info)
{
string sql = $@"
select *from (
SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,md.Remark,CONVERT(varchar(100), mor.DueDate, 23) as DueDate ,DATEDIFF(day,GETDATE(),mor.DueDate) AS jandete , md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty,(md.Qty-md.QualifiedInQty) as wwc, ma.InvCode invcode1,
c.cInvName cinvname1, c.cInvStd cinvstd1,LL.cComUnitName as cComUnitName1, CASE
WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 and c.bself = 1 THEN '外购,委外,自制'
WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 and c.bself <>1 THEN '外购,委外'
WHEN c.bPurchase = 1 AND c.bProxyForeign <> 1 and c.bself <> 1 THEN '外购'
WHEN c.bPurchase = 1 AND c.bProxyForeign <> 1 and c.bself = 1 THEN '外购,自制'
WHEN c.bPurchase <> 1 AND c.bProxyForeign <> 1 and c.bself = 1 THEN '自制'
WHEN c.bPurchase <> 1 AND c.bProxyForeign = 1 and c.bself = 1 THEN '委外,自制'
WHEN c.bPurchase <> 1 AND c.bProxyForeign = 1 and c.bself <> 1 THEN '委外'
ELSE '其它'
END AS std, ma.Qty qty1, ma.IssQty issqty,(ma.Qty-ma.IssQty) as wll, motype.description,
CASE WHEN md.Status = 2 THEN '锁定' WHEN md.Status = 4 THEN '关闭' WHEN md.Status = 3 THEN '审核' ELSE '新建' END AS st, md.Status,ISNULL(ds.qty, 0) dqty,post.cPosName
FROM mom_order m WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON m.MoId = md.MoId INNER JOIN
mom_morder mor WITH (NOLOCK) ON md.MoDId = mor.MoDId INNER JOIN
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
left JOIN
mom_motype motype WITH (NOLOCK) ON motype.MoTypeId = md.MoTypeId
LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM InvPositionSum WITH (NOLOCK) where cPosCode not in ('00701','00801','09001') and cWhCode not in (4,5)
GROUP BY cInvCode) ds ON ma.InvCode = ds.cInvCode
LEFT JOIN (
SELECT
cinvcode,
STUFF(
(
SELECT
',' + cPosName
FROM
(
SELECT
b.cPosName,
a.cInvCode,
a.iQuantity
FROM
InvPositionSum a WITH ( NOLOCK ),
POSITION b WITH ( NOLOCK )
WHERE
a.iQuantity <> 0
AND a.cPosCode= b.cPosCode
) a
WHERE
b.cinvcode = a.cinvcode
ORDER BY
a.iQuantity DESC FOR XML PATH ( '' )
),
1,
1,
''
) cPosName
FROM
InvPositionSum b WITH (NOLOCK) where b.cPosCode not in ('00701','00801','09001') and b.cWhCode not in (4,5)
GROUP BY
cinvcode
) AS post ON ma.InvCode = post.cinvcode
INNER JOIN
Inventory p WITH (NOLOCK) ON md.InvCode = p.cInvCode INNER JOIN
Inventory c WITH (NOLOCK) ON ma.InvCode = c.cInvCode LEFT JOIN
ComputationUnit kk WITH (nolock) on p.cComUnitCode=kk.cComunitCode
left join ComputationUnit LL WITH (nolock) on c.cComUnitCode=LL.cComunitCode
) mmm
";
List<string> where = new List<string>();
///处理-
if (info.moCodes != null && info.moCodes.Count > 0)
{
where.Add(" mmm.mocode in @moCodes");
}
if (info.InvCodes != null)
{
where.Add(" mmm.InvCode in @invcode");
}
if (info.InvCodes1 != null)
{
where.Add(" mmm.invcode1 in @invcode1");
}
if (info.byFinish != null)
{
where.Add(" mmm.Status in @byFinish");
}
if (!info.byiss)
{
where.Add(" isnull(mmm.qty1,0)- isnull(mmm.issqty,0)> 0");
}
else { where.Add(" mmm.issqty > 0"); }
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<NX.ERP.Model.PmcInventorymomRes>(sql, new { moCodes = info.moCodes, invcode = info.InvCodes, invcode1 = info.InvCodes1, info.byFinish });
}
}
}
}

View File

@@ -62,5 +62,12 @@ namespace NX.ERP.WebAPi.Controllers.MOM
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
return customerDAL.QueryDetails(momOrder);
}
[Route("api/ProductOrder/Pick")]
[HttpPost]
public IEnumerable<NX.ERP.Model.PmcInventorymomRes> Pick(Model.Request.MomOrderRequest momOrder)
{
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
return customerDAL.Pick(momOrder);
}
}
}

View File

@@ -27,6 +27,7 @@
<MenuItem to="/inventoryrrival" name="4-2">到货单</MenuItem>
<MenuItem to="/inventoryerror" name="4-3">异常单据查询</MenuItem>
<MenuItem to="/inventoryMaterialAppVouch" name="4-4">领料单查询</MenuItem>
<MenuItem to="/inventorypick" name="4-5">生产领料需求查询</MenuItem>
</MenuGroup>
</Submenu>
</Menu>

View File

@@ -17,4 +17,7 @@ export const getInventorybu=(info)=>{
export const getInventorypo=(info)=>{
return axios.post('/api/Pmc/InventoryPocode',info)
}
export const getPick=(info)=>{
return axios.post('/api/ProductOrder/Pick',info)
}

View File

@@ -11,6 +11,7 @@ import Purchasesum from '@/views/Purchasesum.vue'
import inventoryrrival from '@/bill/inventory-arrival.vue'
import inventoryerror from '@/bill/inventory-error.vue'
import inventoryMaterialAppVouch from '@/views/inventory-materialAppVouch.vue'
import inventorypick from '@/views/inventory-pick.vue'
export default [
{
@@ -31,4 +32,5 @@ export default [
{ path: '/inventoryrrival', component: inventoryrrival },
{ path: '/inventoryerror', component: inventoryerror },
{ path: '/inventoryMaterialAppVouch', component: inventoryMaterialAppVouch },
{ path: '/inventorypick', component: inventorypick },
]

View File

@@ -0,0 +1,542 @@
<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="4">
<label>产品编码</label>
<Input autosize type="textarea" v-model="filter.inv_codes" />
</Col>
<Col span="4">
<label>子件编码</label>
<Input autosize type="textarea" v-model="filter.inv_codes1" />
</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="15">
<label>提示:点击蓝色单号,打印整单子件需求,点击产品号打印部装需求</label>
</Col>
</Row>
</div>
<Table
style="margin-top: 20px"
size="small"
:loading="loading"
border
:columns="columns"
:data="pagedData"
></Table>
<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"
/>
<Modal width="1366" v-model="modal1" title="单据详情" @on-cancel="cancel">
<Button size="large" type="primary" @click="print">打印</Button>
<div id="tb2">
<div>
<Row :gutter="16">
<Col span="7">
<label></label>
</Col>
<Col span="6">
<h1>生产子件需求</h1>
</Col>
</Row>
</div>
<div>
<Row :gutter="16">
<Col span="8">{{"单据号:"+this.ccode}}</Col>
<Col span="6">
{{"产品编码:"+this.inv_code}}
</Col>
<Col span="4">
{{"产品名称:"+this.c_inv_name}}
</Col>
</Row>
</div>
<Table
style="margin-top: 20px"
height="700"
size="small"
border
:columns="columns2"
:data="datas2"
></Table>
</div>
</Modal>
</div>
</template>
<script>
import { getPick } from "@/api/pmc";
import {
pageingData,
export_col_to_excel,
sortByKey,
numberFormat
} from "@/libs/tools";
export default {
data() {
return {
loading: false,
PageSizeOpts: [10, 15, 20, 30],
pageNo: 1,
modal1: false,
strfilter: "",
ccode: "",
inv_code: "",
c_inv_name: "",
multiple: false,
pageSize: 15,
datas: [],
datas2: [],
ranges: [
{
type: "price",
ccode: "",
inv_code: ""
// low: "", //区间的最小值
// height: "", //区间的最大值
}
],
stateList: [
{
value: "2",
label: "锁定"
},
{
value: "3",
label: "审核"
},
{
value: "4",
label: "关闭"
}
],
filter: {
inv_codes: "",
inv_codes1: "",
mo_codes: "",
by_finish: ["3"],
byiss: false
},
columns2: [
{
title: "子件编码",
align: "center",
width: 100,
key: "invcode1",
className: "demo-table-info-old"
},
{
title: "子件名称",
align: "center",
width: 110,
key: "cinvname1",
className: "demo-table-info-old"
},
{
title: "子件规格",
width: 175,
align: "center",
key: "cinvstd1"
},
{
title: "子件单位",
width: 100,
align: "center",
key: "c_com_unit_name1"
},
{
title: "应领量",
align: "center",
key: "qty1",
width: 110
},
{
title: "已领",
align: "center",
key: "issqty",
width: 110
},
{
title: "未领",
align: "center",
key: "wll",
width: 110
},
{
title: "现存无废品",
align: "center",
key: "dqty",
width: 100
},
{
title: "现存库位",
key: "c_pos_name",
width: 160,
align: "left"
}
],
columns: [
// {
// title: "生产订单号",
// align: "center",
// key: "mocode",
// width: 135,
// className: "demo-table-info-new"
// },
{
title: "生产订单号",
align: "center",
key: "mocode",
width: 135,
className: "demo-table-info-new",
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small"
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.mocode //添加title属性
},
on: {
click: () => {
this.handleShow(params.row.mocode, ""); //点击事件
}
}
},
params.row.mocode
)
]);
}
},
{
title: "子件编码",
align: "center",
width: 100,
key: "invcode1",
},
{
title: "子件名称",
align: "center",
width: 110,
key: "cinvname1",
},
{
title: "子件规格",
width: 175,
align: "center",
key: "cinvstd1"
},
{
title: "子件单位",
width: 100,
align: "center",
key: "c_com_unit_name1"
},
{
title: "应领量",
align: "center",
key: "qty1",
width: 110
},
{
title: "已领",
align: "center",
key: "issqty",
width: 110
},
{
title: "未领",
align: "center",
key: "wll",
width: 110
},
{
title: "现存无废品",
align: "center",
key: "dqty",
width: 100
},
{
title: "现存库位",
key: "c_pos_name",
width: 160,
align: "left"
},
{
title: "生产行号",
align: "center",
key: "sort_seq",
width: 95
},
{
title: "类别",
align: "center",
key: "description",
width: 95
},
// {
// title: "产品编码",
// align: "center",
// key: "inv_code",
// width: 100,
// className: "demo-table-info-new"
// },
{
title: "产品编码",
align: "center",
key: "inv_code",
width: 135,
className: "demo-table-info-old",
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small"
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.inv_code //添加title属性
},
on: {
click: () => {
this.handleShow(params.row.mocode, params.row.inv_code); //点击事件
}
}
},
params.row.inv_code
)
]);
}
},
{
title: "产品名称",
align: "center",
key: "c_inv_name",
width: 100,
className: "demo-table-info-new"
},
{
title: "产品规格",
align: "center",
key: "c_inv_std",
width: 120
},
{
title: "单位",
align: "center",
key: "c_com_unit_name",
width: 60
},
{
title: "投产量",
align: "center",
key: "qty",
width: 60
}
]
};
},
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 = {
inv_codes:
this.filter.inv_codes !== ""
? this.filter.inv_codes.split(/[,\s\n,]/)
: null,
inv_codes1:
this.filter.inv_codes1 !== ""
? this.filter.inv_codes1.split(/[,\s\n,]/)
: null,
mo_codes:
this.filter.mo_codes !== ""
? this.filter.mo_codes.split(/[,\s\n,]/)
: null,
by_finish: this.filter.by_finish,
byiss: this.filter.byiss
};
this.loading = true;
let resp = await getPick(_filert);
this.pageNo = 1;
this.datas = resp.data.data;
} catch (error) {
} finally {
this.loading = false;
}
},
print() {
this.dom = document.getElementById("tb2");
console.log(this.dom);
this.$print(this.dom);
},
cancel() {
this.datas2 = [];
this.modal1 = false;
},
inventory(ranges) {
const skus = new Array();
//筛选条件
if (this.ranges[0].inv_code != "") {
this.datas.map((Item, index) => {
if (
Item.mocode == this.ranges[0].ccode &&
Item.inv_code == this.ranges[0].inv_code
) {
skus.push({
...Item
});
}
});
} else {
this.datas.map((Item, index) => {
if (Item.mocode == this.ranges[0].ccode) {
skus.push({
...Item
});
}
});
}
return skus;
},
async handleShow(h, y) {
this.ranges[0].ccode = h;
this.ranges[0].inv_code = y;
this.datas2 = this.inventory(this.ranges);
this.ccode = h;
this.inv_code=this.datas2[0].inv_code;
this.c_inv_name=this.datas2[0].c_inv_name;
this.modal1 = true;
},
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;
}
.ivu-table td.demo-table-info-ex {
color: #187;
font-weight: 600;
}
body {
padding: 10px 1;
}
</style>

View File

@@ -58,7 +58,8 @@ module.exports = {
disableHostCheck: true,
proxy: {
'/api': {
target: 'http://10.0.0.250:8081', // 接口域名
// target: 'http://10.0.0.250:8081', // 接口域名
target: 'http://localhost:61448', // 接口域名
changeOrigin: true, // 是否跨域
pathRewrite: {}
},