备料计划拉单

This commit is contained in:
xyz 2024-12-24 11:12:12 +08:00
parent f4f7f20aa9
commit 2d94f23384
10 changed files with 507 additions and 0 deletions

View File

@ -0,0 +1,20 @@
/*0cVfNoRJi5y0e3eZOgvmeA3dpfaWw7lcNNZVA2faZ5E=*/
/*
* @Author: xyz
* @PageInfo: 出库申请-列表拉单备料计划申请单
* @Date: 2024-12-13 17:33:02
* @Last Modified by: xyz
* @Last Modified time: 2024-12-13 17:33:02
*/
import { URL } from '../../constance';
import { DATASOURCE } from '../../transfer/const';
import { clearTransferCache } from '../../../../../scmpub/scmpub/pub/cache/cacheDataManager';
export default function clickAddBtn(props) {
clearTransferCache(props, DATASOURCE.refBljhDataSource);
props.pushTo(URL.gotoTransfer2, {
type: 'refBljh',
usecache: 'N' //跳转到转单查询区不使用缓存
});
}
/*0cVfNoRJi5y0e3eZOgvmeA3dpfaWw7lcNNZVA2faZ5E=*/

View File

@ -0,0 +1,35 @@
/*VRi3nyqaeOPenSkOLNstN7oYvnR1zilVv1ZhUjsAi0A=*/
/*
* @Author: raoczh
* @PageInfo: 出库申请-拉单查询区编辑后
* @Date: 2018-04-12 14:19:27
* @Last Modified by: lizhbo
* @Last Modified time: 2019-05-20 14:15:02
*/
import { PAGEAREA } from '../const';
/**
* 表头编辑后事件
* @param {*} key 操作的字段
* @param {*} val 编辑后操作字段的值主键
*/
export default function(key, val) {
// 库存组织编辑后事件
if (key == 'pk_org') {
let meta = this.props.meta.getMeta();
meta[PAGEAREA.searchBljh].items.map((item) => {
if (item.attrcode == 'pk_org') {
return;
}
if (val && (val.length == 1 || val.refpk)) {
item.isShowUnit = false;
} else {
item.isShowUnit = true;
}
});
this.props.meta.setMeta(meta);
}
}
/*VRi3nyqaeOPenSkOLNstN7oYvnR1zilVv1ZhUjsAi0A=*/

View File

@ -0,0 +1,6 @@
/*2gXQ0nN3+Et9xmw6gOyzbHfStbROxMgHTt7COgBVOUw=*/
import serachBljh_btnClick from './serachBljh_btnClick';
import refresh_BtnClick from './refresh_BtnClick';
export { serachBljh_btnClick, refresh_BtnClick };
/*2gXQ0nN3+Et9xmw6gOyzbHfStbROxMgHTt7COgBVOUw=*/

View File

@ -0,0 +1,17 @@
/*iGEr7jsLTpd/n+WcDubKzVIc2lxE8JPGzC/a/V9XNZQ=*/
/*
* @Author: raoczh
* @PageInfo: 出库申请-拉单刷新
* @Date: 2018-10-25 18:26:30
* @Last Modified by: lizhbo
* @Last Modified time: 2019-05-20 14:15:27
*/
import serachBljh_btnClick from './serachBljh_btnClick';
import { getDefData } from '../../../../../scmpub/scmpub/pub/cache/cacheDataManager';
import { DATASOURCE, PAGEAREA } from '../const';
export default function buttonClick() {
serachBljh_btnClick.call(this, getDefData(DATASOURCE.refBljhDataSource, PAGEAREA.searchBljh), true);
}
/*iGEr7jsLTpd/n+WcDubKzVIc2lxE8JPGzC/a/V9XNZQ=*/

View File

@ -0,0 +1,96 @@
/*BzB1e9CQ4aOBBkI1TxLpHbDzR4lToqaNhV7dCMXXqXQ=*/
/*
* @Author: raoczh
* @PageInfo: 出库申请-拉单查询按钮处理方法
* @Date: 2018-06-11 19:35:00
* @Last Modified by: lizhbo
* @Last Modified time: 2019-05-20 14:16:05
*/
import { PAGECODE, PAGEAREA, PK, URL, DATASOURCE } from '../const';
import { ajax } from 'nc-lightapp-front';
import transtypeUtils from '../../../../../scmpub/scmpub/pub/tool/transtypeUtils';
import { setDefData } from '../../../../../scmpub/scmpub/pub/cache/cacheDataManager';
import { getLangByResId } from '../../../../../scmpub/scmpub/pub/tool/multiLangUtil';
import { showSuccessInfo, showWarningInfo } from '../../../../../scmpub/scmpub/pub/tool/messageUtil';
export default function clickSerachBtn(cacheSearchData, isRefresh) {
let queryInfo = {};
if (!isRefresh) {
let searchVal = this.props.search.getAllSearchData(PAGEAREA.searchBljh);
if (!searchVal) {
return;
}
queryInfo = this.props.search.getQueryInfo(PAGEAREA.searchBljh, false);
queryInfo.querycondition = searchVal ? searchVal : null;
//缓存查询条件
setDefData(DATASOURCE.refBljhDataSource, PAGEAREA.searchBljh, queryInfo);
} else {
//刷新
if (!cacheSearchData) {
showWarningInfo(null, getLangByResId(this, '4008PUB-000204')); /* 国际化处理: 请先查询数据!*/
return;
}
queryInfo = cacheSearchData;
}
let transtypecode = transtypeUtils.getTranstypeCode.call(this);
queryInfo.userdefObj = { transtype: transtypecode };
let data = {
templetid: this.state.templateid,
queryInfo: queryInfo,
pageCode: PAGECODE.pagecodeBljh //页面编码
};
ajax({
url: URL.searchBljh,
data: data,
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
props.dealFormulamsg(
res.formulamsg //参数一:返回的公式对象
);
}
let { success, data } = res;
if (success) {
if (isRefresh) {
showSuccessInfo(getLangByResId(this, '4008PUB-000193')); /* 国际化处理: 刷新成功!*/
}
if (data && data.length > 0) {
data.map((item) => {
//增加计算可出库主数量
item.body[PAGEAREA.bodyBljh].rows.map((body) => {
let record = body.values;
let showNum = 0;
let nnum = record.nnum; //总数量
let ntotaloutnum = record.naccuoutnum; //累计出库数量
if (nnum && nnum.value != 0 && ntotaloutnum) {
showNum =
parseFloat(nnum.value) - (ntotaloutnum.value ? parseFloat(ntotaloutnum.value) : 0);
}
body.values.outNum = { value: showNum, scale: record.nnum.scale };
});
});
if (!isRefresh) {
showSuccessInfo(
null,
getLangByResId(this, '4008PUB-000195', { i: res.data.length })
); /* 国际化处理: 无符合条件数据*/
}
} else {
data = [];
if (!isRefresh) {
showWarningInfo(null, getLangByResId(this, '4008PUB-000202')); /* 国际化处理: 未查询出符合条件的数据!*/
}
}
this.props.transferTable.setTransferTableValue(
PAGEAREA.headBljh,
PAGEAREA.bodyBljh,
data,
PK.headBljh,
PK.bodyBljh
);
}
}
});
}
/*BzB1e9CQ4aOBBkI1TxLpHbDzR4lToqaNhV7dCMXXqXQ=*/

View File

@ -0,0 +1,41 @@
/*2gXQ0nN3+Et9xmw6gOyzbHfStbROxMgHTt7COgBVOUw=*/
/*
* @Author: raoczh
* @PageInfo: 出库申请-拉单常量
* @Date: 2018-12-10 12:11:37
* @Last Modified by: raoczh
* @Last Modified time: 2018-12-10 12:11:37
*/
const PAGECODE = {
pagecodeBljh: '50080102_Bljhto4455'
};
const APPCODE = {
// appcodeBljh: '50080102'
appcodeBljh: '400802800'
};
const PAGEAREA = {
headBljh: 'headBljh',
searchBljh: 'searchBljh',
bodyBljh: 'bodyBljh',
tileBljh: 'tileBljh'
};
const DATASOURCE = {
refBljhDataSource: 'refBljhDataSource'
};
//备料计划申请
const fileds_orgfilter_Bljh = [
'pk_storereq_b.pk_material',
'pk_storereq_b.pk_srcmaterial',
'pk_storereq_b.cvendorid' //供应商
];
const PK = {
headBljh: 'pk_storereq',
bodyBljh: 'pk_storereq_b'
};
const URL = {
searchBljh: '/nccloud/ic/sapplybill/queryBljh.do'
};
export { PAGECODE, APPCODE, PAGEAREA, PK, URL, DATASOURCE, fileds_orgfilter_Bljh };
/*2gXQ0nN3+Et9xmw6gOyzbHfStbROxMgHTt7COgBVOUw=*/

View File

@ -0,0 +1,5 @@
/*2gXQ0nN3+Et9xmw6gOyzbHfStbROxMgHTt7COgBVOUw=*/
import initBljhTemplate from './initBljhTemplate';
export { initBljhTemplate };
/*2gXQ0nN3+Et9xmw6gOyzbHfStbROxMgHTt7COgBVOUw=*/

View File

@ -0,0 +1,83 @@
/*YB5Bv4kuIZ2NvMyM/lDZplAuW/CCSA4NO+54vWpXrh8=*/
/*
* @Author: zhangjyp
* @PageInfo: 出库申请-拉单初始化模板
* @Date: 2018-04-19 10:32:11
* @Last Modified by: raoczh
* @Last Modified time: 2019-08-29 15:08:26
*/
import { PAGECODE, PAGEAREA, APPCODE, fileds_orgfilter_Bljh } from '../const';
import { transferSkipToSrcBillUtil } from '../../../../../scmpub/scmpub/pub/tool/transferSkipToSrcBillUtil';
export default function(props) {
let _this = this;
props.createUIDom(
{
pagecode: PAGECODE.pagecodeBljh, //卡片页面编码
appcode: APPCODE.appcodeBljh
},
callbackFun
);
function callbackFun(data) {
if (data) {
if (data.template) {
let meta = data.template;
meta = modify.call(_this, props, meta);
props.meta.addMeta(meta);
_this.setState({ templateid: meta.pageid });
}
if (data.button) {
let button = data.button;
props.button.setButtons(button);
}
}
}
}
function modify(props, meta) {
// 拉单界面增加单据号增加超链接
meta[PAGEAREA.headBljh].items.map((item, index) => {
transferSkipToSrcBillUtil.call(this, props, item, {
billtype: 'Bljh',
billcodefield: 'vbillcode',
pkfield: 'pk_storereq'
});
});
meta[PAGEAREA.searchBljh].items.map((item, index) => {
item.isShowUnit = true;
if (fileds_orgfilter_Bljh.includes(item.attrcode)) {
item.queryCondition = () => {
let pk_org = props.search.getSearchValByField(PAGEAREA.searchBljh, 'pk_org');
return {
pk_org:
pk_org && pk_org.value
? pk_org.value.firstvalue.includes(',') ? null : pk_org.value.firstvalue
: null
};
};
} else if (item.attrcode == 'pk_org') {
item.isShowUnit = false;
item.queryCondition = () => {
return { GridRefActionExt: 'nccloud.web.scmpub.ref.AppPermissionOrgRefFilter' };
};
} else if (item.attrcode == 'ctrantypeid') {
item.queryCondition = () => {
return { parentbilltype: 'Bljh' };
};
} else {
item.queryCondition = () => {
let pk_org = props.search.getSearchValByField(PAGEAREA.searchBljh, 'pk_org');
return {
pk_org:
pk_org && pk_org.value
? pk_org.value.firstvalue.includes(',') ? null : pk_org.value.firstvalue
: null //组织过滤
};
};
}
});
return meta;
}
/*YB5Bv4kuIZ2NvMyM/lDZplAuW/CCSA4NO+54vWpXrh8=*/

View File

@ -0,0 +1,194 @@
/*qglWYo2THvIGavZX5nSbwZ5iMJbqsiHVu5zwiu1zN1U=*/
/*
* @Author: xyz
* @PageInfo: 出库申请单拉单-备料计划申请
* @Date: 2024-12-14 14:38:19
* @Last Modified by: lizhbo
* @Last Modified time: 2020-03-28 13:18:38
*/
import React, { Component } from 'react';
import { base, createPage } from 'nc-lightapp-front';
import { PAGEAREA, DATASOURCE } from '../transfer2/const';
import { URL } from '../constance';
import searchAfterEvent from '../transfer2/afterEvent/searchAfterEvent';
import getNumber from './utils/getNumber';
import { initBljhTemplate } from '../transfer2/init';
import { serachBljh_btnClick, refresh_BtnClick } from '../transfer2/btnClicks';
import { initLang, getLangByResId } from '../../../../scmpub/scmpub/pub/tool/multiLangUtil';
class TransferTable extends Component {
constructor(props) {
super(props);
this.formId = PAGEAREA.headBljh;
this.tableId = PAGEAREA.bodyBljh;
this.serachId = PAGEAREA.searchBljh;
this.state = {
ntotalnum: 0
};
initLang(this, ['4008sapplybill', '4008pub'], 'ic', initBljhTemplate.bind(this, this.props));
}
componentDidMount() {
this.props.transferTable.setTransferTableValue(
this.formId,
this.tableId,
[],
PAGEAREA.headBljh,
PAGEAREA.bodyBljh
);
}
// 计算合计
calTotal = (flag, record, bodys, numkey) => {
let ntotalnum = this.state.ntotalnum;
if (record.length > 1 && flag) {
ntotalnum = 0;
}
if (flag == true) {
if (bodys && bodys.length > 0) {
for (let line of bodys) {
ntotalnum += getNumber(line[numkey]);
}
} else {
ntotalnum += getNumber(record[numkey]);
}
} else {
if (bodys && bodys.length > 0) {
for (let line of bodys) {
ntotalnum -= getNumber(line[numkey]);
}
} else {
ntotalnum -= getNumber(record[numkey]);
}
}
this.setState({
ntotalnum: ntotalnum
});
};
backClick = (props) => {
props.pushTo(URL.gotoList, { status: 'browse' });
};
// 主组织编辑后事件
renderCompleteEvent = () => {
// 给通过交易类型发布的节点,查询区的交易类型字段赋默认值
let pk_org = this.props.search.getSearchValByField(PAGEAREA.searchBljh, 'pk_org');
if (pk_org && pk_org.value && pk_org.value.firstvalue) {
let value = pk_org.value.firstvalue;
let arr = value.split(',');
arr = arr.map((item) => {
return { refpk: item };
});
searchAfterEvent.call(this, 'pk_org', arr);
}
};
// react界面渲染函数
render() {
const { transferTable, button, search } = this.props;
const { NCCreateSearch } = search;
const { createButtonApp } = button;
const { createTransferTable } = transferTable;
const { NCBackBtn, NCToggleViewBtn, NCDiv } = base;
const { createBillHeadInfo } = this.props.BillHeadInfo;
let title = getLangByResId(this, '4008SAPPLYBILL-000046');
let isShowSel = transferTable.getSelectedListDisplay(PAGEAREA.headBljh);
let totalstr = `${getLangByResId(this, '4008SAPPLYBILL-000045')}`; /* 国际化处理: 本次申请主数量*/
return (
<div id="transferList" className="nc-bill-list">
{!isShowSel ? (
<div>
<NCDiv areaCode={NCDiv.config.HEADER} className="nc-bill-header-area">
<div className="header-title-search-area">
{createBillHeadInfo({
title: title,
backBtnClick: this.backClick.bind(this, this.props)
})}
</div>
<div className="header-button-area">
{createButtonApp({
area: 'transfer_head',
buttonLimit: 8,
onButtonClick: refresh_BtnClick.bind(this),
popContainer: document.querySelector('.header-button-area')
})}
<NCToggleViewBtn
expand={false}
onClick={() => {
let meta = this.props.meta.getMeta();
if (!meta[PAGEAREA.tileBljh]) {
initBljhTemplate(this.props, PAGEAREA.tileBljh); //加载主子拉平模板
}
this.props.transferTable.changeViewType();
}}
/>
</div>
</NCDiv>
<div className="nc-bill-search-area">
{NCCreateSearch(
this.serachId,
{
clickSearchBtn: serachBljh_btnClick.bind(this, null, false),
onAfterEvent: searchAfterEvent.bind(this),
renderCompleteEvent: this.renderCompleteEvent,
statusChangeEvent: this.renderCompleteEvent,
useCache: this.props.getUrlParam('usecache') != 'N'
}
//模块id
)}
</div>
</div>
) : (
''
)}
<div className="nc-bill-transferTable-area">
{createTransferTable({
totalKey: ['outNum'],
totalTitle: [totalstr],
dataSource: DATASOURCE.refBljhDataSource,
headTableId: this.formId, //表格组件id
bodyTableId: this.tableId, //子表模板id
fullTableId: PAGEAREA.tileBljh,
//点击加号展开,设置表格数据
transferBtnText: getLangByResId(this, '4008SAPPLYBILL-000044'), //转单按钮显示文字/* 国际化处理: 生成出库申请*/
containerSelector: '#transferList',
// selectArea: () => {
// //已选列表个性化区域
// return <span>{totalstr}</span>;
// },
// onClearAll: () => {
// this.setState({
// ntotalnum: 0
// });
// },
// onCheckedChange: (flag, record, index, bodys) => {
// // 计算下方合计
// this.calTotal(flag, record, bodys, 'outNum');
// },
// onSelectedItemRemove: (record, bodys) => {
// // 计算下方合计
// this.calTotal(false, record, bodys, 'outNum');
// },
onTransferBtnClick: (ids) => {
this.props.pushTo(URL.gotoCard, { status: 'edit', type: 'refBljh' });
},
onChangeViewClick: () => {
//点击切换视图钩子函数
let meta = this.props.meta.getMeta();
if (!meta[PAGEAREA.tileBljh]) {
initBljhTemplate(this.props, PAGEAREA.tileBljh); //加载主子拉平模板
}
this.props.transferTable.changeViewType(PAGEAREA.headBljh);
}
})}
</div>
</div>
);
}
}
TransferTable = createPage({})(TransferTable);
export default TransferTable;
/*qglWYo2THvIGavZX5nSbwZ5iMJbqsiHVu5zwiu1zN1U=*/

View File

@ -0,0 +1,10 @@
/*vKU0t1Ld65IZrR7OBpmi2oaXGi1yMR//5sfMivrM8G8=*/
export default function(data) {
if (data) {
return +data.value;
} else {
return 0;
}
}
/*vKU0t1Ld65IZrR7OBpmi2oaXGi1yMR//5sfMivrM8G8=*/