借料入库前端调整

This commit is contained in:
mzr 2025-07-24 11:00:55 +08:00
parent 498fa57aff
commit dc4af22787
5 changed files with 1199 additions and 1135 deletions

View File

@ -1,15 +1,13 @@
import { ajax, toast } from 'nc-lightapp-front';
import { AREA, URL, DIALOGCODE, FIELD } from '../../constance';
import { initLang, getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import {ajax, toast} from 'nc-lightapp-front';
import {AREA, URL, DIALOGCODE, FIELD} from '../../constance';
import {initLang, getLangByResId} from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import PickmCLQueryDlg from '../../pickmclquery/list';
import { showErrorInfo } from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
import {showErrorInfo} from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
export default function detailqueryBtnClick(props, record) {
let _this = this;
let bids = [];
let hid;
if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) {
bids.push(record.values.cpickm_bid.value);
} else {
let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable);
// 如果没有选中行,则提示并返回,不进行任何操作
if (!rows) {
@ -17,18 +15,17 @@ export default function detailqueryBtnClick(props, record) {
}
if (rows.length <= 0) {
hid = this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value;
}
else {
} else {
rows.map((item) => {
let cpickm_bid = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'cpickm_bid').value;
bids.push(cpickm_bid);
});
}
doQuery.call(this, props, hid, bids, rows);
}
}
doQuery.call(this, props, hid, bids);
}
function doQuery(props, hid, bids) {
function doQuery(props, hid, bids, rows) {
let appcode = props.getAppCode();
ajax({
@ -40,9 +37,49 @@ function doQuery(props, hid, bids) {
appcode: appcode
},
success: res => {
props.table.setAllTableData('NCTable_83c3abf9', res.data.clquery);
// props.table.setAllTableData('NCTable_83c3abf9', res.data.clquery,true, true, false);
props.modal.show('NCTable_83c3abf9');
let bids = res.data.data;
// console.log('bids = ', bids);
let rows1 = [];
rows.map((item) => {
let values = item.data.values;
// 借料数量 = 计划出库数量-累计出库数量-累计发货数量-累计委外数量所有数值用getNumber处理null转0
values.borrowedQty = {
value: getNumber(values.nplanoutastnum) - getNumber(values.naccoutastnum) -
getNumber(values.nshouldastnum) - getNumber(values.npscastnum)
};
let rowItem = {
isOptimized: false,
status: '0',
values: values
};
// 确保 bids 是数组类型
if (!Array.isArray(bids)) {
bids = [bids];
}
// 筛选出未生成的行
// console.log('values.cpickm_bid = ', values.cpickm_bid.value);
// console.log('values.indexOf = ', bids.indexOf(values.cpickm_bid.value));
if (values.cpickm_bid && values.cpickm_bid.value && (bids.indexOf(values.cpickm_bid.value) > -1)) {
rows1.push(rowItem);
}
});
let data = {
areacode: 'clquery',
rows: rows1
};
// console.log('rows = ', rows);
// console.log('data = ', data);
props.table.setAllTableData(AREA.borrowMaterialDialog, data);
props.modal.show(AREA.borrowMaterialDialog);
}
});
}
// 本地安全数值转换方法null/undefined/空对象转0
function getNumber(data) {
if (data && data.value != null) {
return +data.value;
} else {
return 0;
}
}

View File

@ -1,28 +1,31 @@
import React, { Component } from 'react';
import { createPage, ajax, base, high, toast } from 'nc-lightapp-front';
import React, {Component} from 'react';
import {createPage, ajax, base, high, toast} from 'nc-lightapp-front';
import ApproveDetail from 'uap/common/components/ApproveDetail';
import NCUploader from 'uap/common/components/NCUploader';
import ApprovalTrans from 'uap/common/components/approvalTrans';
const { BillTrack } = high;
import { initTemplate } from './init';
import { pageInfoClick, pageInfoClickPage, getParentURlParme } from './btnClicks';
const {BillTrack} = high;
import {initTemplate} from './init';
import {pageInfoClick, pageInfoClickPage, getParentURlParme} from './btnClicks';
import newLineDefaultUtil from './utils/newLineDefaultUtil';
import { checkDeleteRows } from './utils/rowDeleteUtil';
import { btnClickController, buttonController } from './viewController/index';
import { FIELD, BTNID, URL, PAGECARDCODE, UISTATE, AREA, CARD_BTN, PickmCache, FbillStatus } from '../constance';
import { headAfterEvent, bodyAfterEvent } from './afterEvents';
import { batchEvent } from './batchEvents';
import { headBeforeEvent, bodyBeforeEvent } from './beforeEvents';
import {checkDeleteRows} from './utils/rowDeleteUtil';
import {btnClickController, buttonController} from './viewController/index';
import {FIELD, BTNID, URL, PAGECARDCODE, UISTATE, AREA, CARD_BTN, PickmCache, FbillStatus} from '../constance';
import {headAfterEvent, bodyAfterEvent} from './afterEvents';
import {batchEvent} from './batchEvents';
import {headBeforeEvent, bodyBeforeEvent} from './beforeEvents';
import saveCommitBtnClick from './btnClicks/saveCommitBtnClick';
import commitBtnClick from './btnClicks/commitBtnClick'; //提交
const { NCFormControl, NCAffix, NCDiv, NCIcon, NCUpload, NCBackBtn } = base;
import { RownoUtils } from '../../../../mmpub/mmpub/pub/tool/cardTableTools';
import { initLang, getLangByResId } from '../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import { BillReserve } from 'ic/ic/components/billReserve'; //预留
const {NCFormControl, NCAffix, NCDiv, NCIcon, NCUpload, NCBackBtn} = base;
import {RownoUtils} from '../../../../mmpub/mmpub/pub/tool/cardTableTools';
import {initLang, getLangByResId} from '../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import {BillReserve} from 'ic/ic/components/billReserve'; //预留
import ReserveQuery from 'ic/ic/components/reserveQuery'; //预留查询
import inputChange from '../../../../mmpub/mmpub/pub/tool/rownoInputUtil';
import {showWarningInfo} from "../../../../mmpub/mmpub/pub/tool/messageUtil";
let param = getParentURlParme('pageMsgType');
class PickmCard extends Component {
constructor(props) {
super(props);
@ -43,7 +46,7 @@ class PickmCard extends Component {
lineShowType: [], //通过数组的方式控制 列按钮显示 1-收起 0-展开
target: null, //附件管理弹出框目标位置
showUploader: false, //是否显示附件管理弹出框
tableData: { rows: [] },
tableData: {rows: []},
refreshFlag: 0,
editable: false, //页面是否可以编辑
status: UISTATE.browse, // 页面标志,默认浏览态
@ -61,6 +64,7 @@ class PickmCard extends Component {
//initTemplate.call(this, this.props);
initLang(this, ['5008Pickm', '5008Pub'], 'mmpac', initTemplate.bind(this, this.props));
}
// 渲染页面前,执行
componentWillMount() {
// 关闭浏览器
@ -73,6 +77,7 @@ class PickmCard extends Component {
}
};
}
componentDidMount() {
//设置状态
this.props.BillHeadInfo.setBillHeadInfoVisible({
@ -82,6 +87,7 @@ class PickmCard extends Component {
});
//pageInfoClick.bind(this)();
}
closeApprove = () => {
this.setState({
show: false
@ -125,7 +131,7 @@ class PickmCard extends Component {
} else {
commitBtnClick.call(this, this.props, value);
}
this.setState({ compositedisplay: false, saveAndCommit: false });
this.setState({compositedisplay: false, saveAndCommit: false});
};
change = (data) => {
@ -133,21 +139,19 @@ class PickmCard extends Component {
};
render() {
const { createBillHeadInfo } = this.props.BillHeadInfo;
let { table, cardTable, form, button, modal, cardPagination, socket } = this.props;
const {createBillHeadInfo} = this.props.BillHeadInfo;
let {table, cardTable, form, button, modal, cardPagination, socket} = this.props;
let buttons = this.props.button.getButtons();
let multiLang = this.props.MutiInit.getIntl(this.moduleId);
let { createForm } = form;
let { createCardTable } = cardTable;
let { createModal } = modal;
let { createSimpleTable } = table;
const { createCardPagination } = cardPagination;
let { showUploader, target } = this.state;
let {createForm} = form;
let {createCardTable} = cardTable;
let {createModal} = modal;
let {createSimpleTable} = table;
const {createCardPagination} = cardPagination;
let {showUploader, target} = this.state;
// this.props.use.form('NCTable_83c3abf9')
//         this.props.form.setFormStatus('NCTable_83c3abf9', 'edit')
return (
<div className='nc-bill-card' id='mm-mmpac-pickm-card' >
<div className='nc-bill-card' id='mm-mmpac-pickm-card'>
{socket.connectMesg({
headBtnAreaCode: AREA.cardHeadBtnArea, // 表头按钮区域ID
formAreaCode: AREA.formArea, // 表头Form区域ID
@ -181,7 +185,7 @@ class PickmCard extends Component {
<BillTrack
show={this.state.showTrack}
close={() => {
this.setState({ showTrack: false });
this.setState({showTrack: false});
}}
pk={this.state.cpickmid}
type={FIELD.billtype}
@ -250,32 +254,32 @@ class PickmCard extends Component {
display={this.state.compositedisplay}
getResult={this.getAssginUsedr.bind(this)}
cancel={() => {
this.setState({ compositedisplay: false });
this.setState({compositedisplay: false});
}}
/>}
</div>
<div>{showUploader && <NCUploader billId={this.state.cpickmid} onHide={this.onHideUploader} />}</div>
<div>{showUploader && <NCUploader billId={this.state.cpickmid} onHide={this.onHideUploader}/>}</div>
{createModal('orgChange')}
{createModal('ResumeMessageDlg', {
className: 'iframe-modal',
size: 'xlg'
})}
{createModal('delModal')}
{createModal('MessageDlg', { zIndex: "280" })}
{createModal('MessageDlg', {zIndex: "280"})}
{createModal('SetDeliverDlg')}
{createModal('BackDeliverDlg', { zIndex: "280" })}
{createModal('BackSerialnoDlg', { zIndex: "300" })}
{createModal('TakeOverDlg', { zIndex: "300" })}
{createModal('SetBackDeliverDlg', { zIndex: "280" })}
{createModal('ReplaceDlg', { zIndex: "300" })}
{createModal('BackDeliverDlg', {zIndex: "280"})}
{createModal('BackSerialnoDlg', {zIndex: "300"})}
{createModal('TakeOverDlg', {zIndex: "300"})}
{createModal('SetBackDeliverDlg', {zIndex: "280"})}
{createModal('ReplaceDlg', {zIndex: "300"})}
{createModal('NCTable_83c3abf9', {
title: '备料明细',
{createModal(AREA.borrowMaterialDialog, {
title: '借料入库明细',
content: (
<div class="flex-container" style={{ height: '100%' }}>
{createSimpleTable("NCTable_83c3abf9", { showIndex: true })}</div>
<div class="flex-container" style={{height: '100%'}}>
{createSimpleTable(AREA.borrowMaterialDialog, {showIndex: true})}</div>
),
size: '500',
size: 'xlg',
beSureBtnClick: () => {
let rowids = [];
let hids = [];
@ -285,32 +289,32 @@ class PickmCard extends Component {
hids.push(hid);
// 如果没有选中行,则提示并返回,不进行任何操作
if (!rows || rows.length <= 0) {
hids.push(this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value);
showWarningInfo('请选择行');
return;
}
else {
rows.map((item) => {
let cpickm_bid = this.props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'cpickm_bid').value;
let cpickm_bid = this.props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, FIELD.bid).value;
rowids.push(cpickm_bid);
});
}
let data = {
cpickmids: hids,
cpickmbids: rowids
}
console.log('data = ', data);
ajax({
url: URL.convertOtherIn,
data: data,
success: (res) => {
if (res.success) {
toast({ color: 'success', title: "推送成功" });
this.props.modal.close('NCTable_83c3abf9');
toast({color: 'success', title: "推送成功"});
this.props.modal.close(AREA.borrowMaterialDialog);
}
}
});
},
cancelBtnClick: () => {
this.props.modal.close('NCTable_83c3abf9')
this.props.modal.close(AREA.borrowMaterialDialog)
},
userControl: true
})}
@ -332,11 +336,11 @@ class PickmCard extends Component {
data={this.reserveData}
billType={'55A3'}
onClose={() => {
this.setState({ showReserve: false });
this.setState({showReserve: false});
}}
onSave={() => {
this.setState(
{ showReserve: false },
{showReserve: false},
//调用刷新
btnClickController.bind(this, this.props, 'Refresh')
);
@ -347,6 +351,7 @@ class PickmCard extends Component {
);
}
}
PickmCard = createPage({
billinfo: {
billtype: 'card',

View File

@ -1,24 +1,47 @@
import {
backBtnClick, addBtnClick, delBtnClick, editBtnClick, cancelBtnClick, saveBtnClick, saveCommitBtnClick, copyBtnClick,
commitBtnClick, unCommitBtnClick, printBtnClick, outputBtnClick, subItemsBtnClick, finishBtnClick, unfinishBtnClick,
clqueryBtnClick, replaceBtnClick, pageInfoClick, reserveBtnClick, reserveQueryBtnClick, detailqueryBtnClick
backBtnClick,
addBtnClick,
delBtnClick,
editBtnClick,
cancelBtnClick,
saveBtnClick,
saveCommitBtnClick,
copyBtnClick,
commitBtnClick,
unCommitBtnClick,
printBtnClick,
outputBtnClick,
subItemsBtnClick,
finishBtnClick,
unfinishBtnClick,
clqueryBtnClick,
replaceBtnClick,
pageInfoClick,
reserveBtnClick,
reserveQueryBtnClick,
detailqueryBtnClick
} from '../btnClicks';//
import newLineDefaultUtil from '../utils/newLineDefaultUtil';
import { CARD_BTN, AREA, URL, PAGECARDCODE, FIELD, UISTATE, DIALOGCODE, PickmCache, appcode } from '../../constance';
import { RownoUtils } from '../../../../../mmpub/mmpub/pub/tool/cardTableTools';
import { rowCopyPasteUtils } from '../utils/rowCopyPasteUtils';
import { checkDeleteRows } from '../utils/rowDeleteUtil';
import { buttonController } from './index';
import { ajax, cacheTools } from 'nc-lightapp-front';
import { setBtnShow } from '../btnClicks/pageInfoClick';
import { pickmSetDeliver } from '../../../pub/pickmdeliverwithset';
import { updateCacheData } from '../../../../../mmpub/mmpub/pub/cache/cacheDataManager';
import { showSuccessInfo, showErrorInfo, showWarningInfo, showWarningDialog } from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { pickmBackDeliver } from '../../../pub/pickmbackdeliver';
import { pickmTakeOver } from '../../../pub/pickmtakeover';
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import { pickmBackDeliverWithSet } from '../../../pub/pickmbackdeliverwithset';
import {CARD_BTN, AREA, URL, PAGECARDCODE, FIELD, UISTATE, DIALOGCODE, PickmCache, appcode} from '../../constance';
import {RownoUtils} from '../../../../../mmpub/mmpub/pub/tool/cardTableTools';
import {rowCopyPasteUtils} from '../utils/rowCopyPasteUtils';
import {checkDeleteRows} from '../utils/rowDeleteUtil';
import {buttonController} from './index';
import {ajax, cacheTools} from 'nc-lightapp-front';
import {setBtnShow} from '../btnClicks/pageInfoClick';
import {pickmSetDeliver} from '../../../pub/pickmdeliverwithset';
import {updateCacheData} from '../../../../../mmpub/mmpub/pub/cache/cacheDataManager';
import {
showSuccessInfo,
showErrorInfo,
showWarningInfo,
showWarningDialog
} from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
import {pickmBackDeliver} from '../../../pub/pickmbackdeliver';
import {pickmTakeOver} from '../../../pub/pickmtakeover';
import {getLangByResId} from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import {pickmBackDeliverWithSet} from '../../../pub/pickmbackdeliverwithset';
import {toast} from "../../../../../gl/public/components/utils";
export default async function clickBtn(props, id, text, record, index) {
let _this = this;
@ -75,7 +98,7 @@ export default async function clickBtn(props, id, text, record, index) {
let visibleRows = props.cardTable.getVisibleRows(AREA.bodyTable);
let addIndex = visibleRows.length - 1;
RownoUtils.setRowNo(props, AREA.bodyTable, FIELD.vrowno);
newLineDefaultUtil.setDefault.call(this,props, AREA.bodyTable, addIndex);
newLineDefaultUtil.setDefault.call(this, props, AREA.bodyTable, addIndex);
break;
// 删除行 record有值走行删除逻辑没有值走批量处理逻辑
case CARD_BTN.DeleteLine:
@ -83,7 +106,7 @@ export default async function clickBtn(props, id, text, record, index) {
let isDelete = false;
let delRows = [];
let rowIds = [];
let delIds=[];
let delIds = [];
let mainids = [];
if (record) {
delRows.push(record);
@ -130,15 +153,14 @@ export default async function clickBtn(props, id, text, record, index) {
bodyData.map((item, i) => {
if (rowIds.indexOf(i) < 0) {
if(item.status!=3){
if (item.status != 3) {
if (item.values.cpickm_bid && item.values.cpickm_bid.value && mainids.indexOf(item.values.cpickm_bid.value) > -1) {
mainAndRepItem.push(item);
}
//主料组非关键料
else if (item.values.cgroupkeyrowid && item.values.cgroupkeyrowid.value && mainids.indexOf(item.values.cgroupkeyrowid.value) > -1) {
mainAndRepItem.push(item);
}
else if ((!item.values.cgroupkeyrowid||!item.values.cgroupkeyrowid.value)&&item.values.creplacesrcid && item.values.creplacesrcid.value && mainids.indexOf(item.values.creplacesrcid.value) > -1) {
} else if ((!item.values.cgroupkeyrowid || !item.values.cgroupkeyrowid.value) && item.values.creplacesrcid && item.values.creplacesrcid.value && mainids.indexOf(item.values.creplacesrcid.value) > -1) {
mainAndRepItem.push(item);
}
//替代料非关键料一起删掉
@ -189,7 +211,7 @@ export default async function clickBtn(props, id, text, record, index) {
for (let i = 0; i < len; i++) {
cpcikmbid = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, i, 'cpickm_bid');
if (cpcikmbid && cpcikmbid.value && res.data[cpcikmbid.value]) {
let obj = { index: i, data: res.data[cpcikmbid.value] };
let obj = {index: i, data: res.data[cpcikmbid.value]};
updateArray.push(obj);
}
}
@ -281,12 +303,12 @@ export default async function clickBtn(props, id, text, record, index) {
case CARD_BTN.InsertLine: //插入行
props.cardTable.addRow(AREA.bodyTable, index);
RownoUtils.setRowNo(props, AREA.bodyTable, FIELD.vrowno);
newLineDefaultUtil.setDefault.call(this,props, AREA.bodyTable, index);
newLineDefaultUtil.setDefault.call(this, props, AREA.bodyTable, index);
break;
//重排行号
case CARD_BTN.Resetno:
let bodyRows = props.cardTable.getVisibleRows(AREA.bodyTable);
if(bodyRows.length<1){
if (bodyRows.length < 1) {
showWarningInfo(null, getLangByResId(this, '5008Pickm-000100'));
return;
}
@ -353,7 +375,7 @@ export default async function clickBtn(props, id, text, record, index) {
//单据追溯
case CARD_BTN.LinkQuery:
let pk = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value;
this.setState({ cpickmid: pk, showTrack: true })
this.setState({cpickmid: pk, showTrack: true})
break;
//附件管理
case CARD_BTN.FileManage:
@ -419,8 +441,7 @@ export default async function clickBtn(props, id, text, record, index) {
// 如果没有选中行,则提示并返回,不进行任何操作
if (!rows || rows.length <= 0) {
hids.push(this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value);
}
else {
} else {
rows.map((item) => {
let cpickm_bid = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'cpickm_bid').value;
rowids.push(cpickm_bid);
@ -474,8 +495,7 @@ export default async function clickBtn(props, id, text, record, index) {
// 如果没有选中行,则提示并返回,不进行任何操作
if (!rows || rows.length <= 0) {
hids.push(this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value);
}
else {
} else {
rows.map((item) => {
let cpickm_bid = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'cpickm_bid').value;
rowids.push(cpickm_bid);
@ -496,7 +516,7 @@ export default async function clickBtn(props, id, text, record, index) {
let deliverParam = {
cpickmbids: res.data.pks,
deliverType: 1,//1,领料2成套领料3补成套领料
pageCode:res.data.deliverPagecode
pageCode: res.data.deliverPagecode
};
cacheTools.set('pickmDeliverParam', deliverParam);
props.openTo(null, {
@ -521,8 +541,7 @@ export default async function clickBtn(props, id, text, record, index) {
// 如果没有选中行,则提示并返回,不进行任何操作
if (!rows || rows.length <= 0) {
hids.push(this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value);
}
else {
} else {
rows.map((item) => {
let cpickm_bid = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'cpickm_bid').value;
rowids.push(cpickm_bid);
@ -564,8 +583,7 @@ export default async function clickBtn(props, id, text, record, index) {
// 如果没有选中行,则提示并返回,不进行任何操作
if (!rows || rows.length <= 0) {
hid = this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value;
}
else {
} else {
rows.map((item) => {
let cpickm_bid = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'cpickm_bid').value;
bids.push(cpickm_bid);
@ -578,9 +596,9 @@ export default async function clickBtn(props, id, text, record, index) {
cpickmbids: bids,
appcode: props.getAppCode()
}
pickmBackDeliver.call(this, this.props, data, true, PAGECARDCODE, true,null,(result)=>{
pickmBackDeliver.call(this, this.props, data, true, PAGECARDCODE, true, null, (result) => {
if (result.head) {
this.props.form.setAllFormValue({ [AREA.formArea]: result.head[AREA.formArea] });
this.props.form.setAllFormValue({[AREA.formArea]: result.head[AREA.formArea]});
this.setState({
lineShowType: [],
vbillcode: result.head[AREA.formArea].rows[0].values.vbillcode.value,
@ -612,9 +630,9 @@ export default async function clickBtn(props, id, text, record, index) {
cpickmids: [cpickmid],
appcode: props.getAppCode()
}
pickmBackDeliverWithSet.call(this, this.props, data, true, PAGECARDCODE, true,(res)=>{
pickmBackDeliverWithSet.call(this, this.props, data, true, PAGECARDCODE, true, (res) => {
if (res.data.head) {
this.props.form.setAllFormValue({ [AREA.formArea]: res.data.head[AREA.formArea] });
this.props.form.setAllFormValue({[AREA.formArea]: res.data.head[AREA.formArea]});
this.setState({
lineShowType: [],
vbillcode: res.data.head[AREA.formArea].rows[0].values.vbillcode.value,
@ -650,8 +668,7 @@ export default async function clickBtn(props, id, text, record, index) {
showWarningInfo(getLangByResId(this, '5008Pickm-000060')/* 国际化处理: 请选择需要接收的备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/
);
return;
}
else if (rows.length > 1) {
} else if (rows.length > 1) {
showWarningInfo(getLangByResId(this, '5008Pickm-000061')/* 国际化处理: 请选择一行备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/
);
return;
@ -663,7 +680,7 @@ export default async function clickBtn(props, id, text, record, index) {
isUnTakeOver: false,
pageid: DIALOGCODE.TAKEOVERDLG
}
pickmTakeOver.call(this, this.props, data, PAGECARDCODE,(res)=>{
pickmTakeOver.call(this, this.props, data, PAGECARDCODE, (res) => {
if (data === undefined) {
//订单编号
this.setState({
@ -674,7 +691,7 @@ export default async function clickBtn(props, id, text, record, index) {
}
//渲染数据,
if (res.data.head) {
this.props.form.setAllFormValue({ [AREA.formArea]: res.data.head[AREA.formArea] });
this.props.form.setAllFormValue({[AREA.formArea]: res.data.head[AREA.formArea]});
this.setState({
lineShowType: [],
vbillcode: res.data.head[AREA.formArea].rows[0].values.vbillcode.value,
@ -710,8 +727,7 @@ export default async function clickBtn(props, id, text, record, index) {
showWarningInfo(getLangByResId(this, '5008Pickm-000062')/* 国际化处理: 请选择需要取消接收的备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/
);
return;
}
else if (rows.length > 1) {
} else if (rows.length > 1) {
showWarningInfo(getLangByResId(this, '5008Pickm-000061')/* 国际化处理: 请选择一行备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/
);
return;
@ -723,7 +739,7 @@ export default async function clickBtn(props, id, text, record, index) {
isUnTakeOver: true,
pageid: DIALOGCODE.TAKEOVERDLG
}
pickmTakeOver.call(this, this.props, data, PAGECARDCODE,(res)=>{
pickmTakeOver.call(this, this.props, data, PAGECARDCODE, (res) => {
if (data === undefined) {
//订单编号
this.setState({
@ -734,7 +750,7 @@ export default async function clickBtn(props, id, text, record, index) {
}
//渲染数据,
if (res.data.head) {
this.props.form.setAllFormValue({ [AREA.formArea]: res.data.head[AREA.formArea] });
this.props.form.setAllFormValue({[AREA.formArea]: res.data.head[AREA.formArea]});
this.setState({
lineShowType: [],
vbillcode: res.data.head[AREA.formArea].rows[0].values.vbillcode.value,
@ -773,8 +789,7 @@ export default async function clickBtn(props, id, text, record, index) {
rows.push(item.data);
}
});
}
else {
} else {
showWarningInfo(getLangByResId(this, '5008Pickm-000092')/* 国际化处理: 请选择需要替代的备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/
);
}
@ -796,54 +811,50 @@ export default async function clickBtn(props, id, text, record, index) {
let pickmReservQuery = reserveQueryBtnClick.bind(this);
return pickmReservQuery(props);
case CARD_BTN.toOtherWarehouse://其他入库
case "toOtherWarehouse":
billstatus = props.form.getFormItemsValue(AREA.formArea, 'fbillstatus');
//审批态,行号不能修改
if (billstatus && billstatus.value && billstatus.value == 1) {
detailqueryBtnClick.call(this, this.props, record);
}else{
toast({ color: 'warning', title: "只有审批后单据才能生产其他入库单" });
let selectRows = props.cardTable.getCheckedRows(AREA.bodyTable);
// 如果没有选中行,则提示并返回,不进行任何操作
if (!selectRows || selectRows.length <= 0) {
/* 国际化处理: 请选择需要处理的数据!*/
showWarningInfo(getLangByResId(this, '5008Pickm-000061'));
return;
}
// rowids = [];
// hids = [];
// if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) {
// rowids.push(record.values.cpickm_bid.value);
// hid = record.values.cpickmid.value;
// } else {
// let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable);
// hid = this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value;
// // 如果没有选中行,则提示并返回,不进行任何操作
// if (!rows || rows.length <= 0) {
// hids.push(this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value);
// }
// else {
// rows.map((item) => {
// let cpickm_bid = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'cpickm_bid').value;
// rowids.push(cpickm_bid);
// });
// console.log('selectRows = ', selectRows);
// 判断选中行的借料数量是否>0,如果存在<=0的行则提示并返回
let hasInvalidRow = false;
let warningMessage = getLangByResId(this, '5008Pickm-000106'); /* 国际化处理: 借料数量必须大于0*/
for (const item of selectRows) {
let values = item.data.values;
// 借料数量 = 计划出库数量-累计出库数量-累计发货数量-累计委外数量
let borrowedQty = getNumber(values.nplanoutastnum) - getNumber(values.naccoutastnum) -
getNumber(values.nshouldastnum) - getNumber(values.npscastnum);
if (borrowedQty <= 0) {
hasInvalidRow = true;
// 获取行号用于提示信息
let vrowno = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'vrowno');
warningMessage = warningMessage + ' 行号:' + `[${vrowno.value}]`;
break;
}
}
if (hasInvalidRow) {
showErrorInfo('错误', warningMessage);
return;
}
billstatus = props.form.getFormItemsValue(AREA.formArea, 'fbillstatus');
//审批态
if (billstatus && billstatus.value && billstatus.value == 1) {
detailqueryBtnClick.call(this, this.props, record);
} else {
toast({color: 'warning', title: "只有审批后单据才能生产其他入库单"});
}
// }
// }
// data = {
// cpickmids: hids,
// cpickmbids: rowids
// }
// ajax({
// url: URL.convertOtherIn,
// data: data,
// success: (res) => {
// if (res.success) {
// toast({ color: 'success', title: "推送成功" });
// }
// }
// });
break;
default:
break;
}
}
function cancelCommon(props) {
rowCopyPasteUtils.cancel.call(
this,
@ -853,3 +864,12 @@ function cancelCommon(props) {
CARD_BTN.cardBodyCopy
);
}
// 本地安全数值转换方法null/undefined/空对象转0
function getNumber(data) {
if (data && data.value != null) {
return +data.value;
} else {
return 0;
}
}

View File

@ -9,7 +9,8 @@ const AREA = {
listInnerBtnArea: 'list_inner', //列表操作列按钮区域
cardHeadBtnArea: 'card_head', //卡片表头按钮区域
cardBodyBtnArea: 'card_body', //卡片表体按钮区域
cardBodyInnerBtnArea: 'card_body_inner' //卡片表体操作按钮区域
cardBodyInnerBtnArea: 'card_body_inner', //卡片表体操作按钮区域
borrowMaterialDialog: 'NCTable_83c3abf9' //借料弹窗
};
const MANUFACTURE = 'fa';//製造場景

View File

@ -104,5 +104,6 @@
"5008Pickm-000102": "确定",
"5008Pickm-000103": "自动匹配",
"5008Pickm-000104": "自动匹配成功",
"5008Pickm-000105": "是替代料的非关键料行,不可删除"
"5008Pickm-000105": "是替代料的非关键料行,不可删除",
"5008Pickm-000106": "借料数量必须大于0请检查对应行数据"
}