借料入库前端调整

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

View File

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

View File

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