借料入库前端调整
This commit is contained in:
parent
498fa57aff
commit
dc4af22787
|
@ -3,13 +3,11 @@ 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';
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ 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';
|
||||
|
@ -21,8 +22,10 @@ import { initLang, getLangByResId } from '../../../../mmpub/mmpub/pub/tool/multi
|
|||
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);
|
||||
|
@ -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
|
||||
|
@ -144,8 +150,6 @@ class PickmCard extends Component {
|
|||
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'>
|
||||
{socket.connectMesg({
|
||||
|
@ -269,13 +273,13 @@ class PickmCard extends Component {
|
|||
{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>
|
||||
{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');
|
||||
this.props.modal.close(AREA.borrowMaterialDialog);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
cancelBtnClick: () => {
|
||||
this.props.modal.close('NCTable_83c3abf9')
|
||||
this.props.modal.close(AREA.borrowMaterialDialog)
|
||||
},
|
||||
userControl: true
|
||||
})}
|
||||
|
@ -347,6 +351,7 @@ class PickmCard extends Component {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
PickmCard = createPage({
|
||||
billinfo: {
|
||||
billtype: 'card',
|
||||
|
|
|
@ -1,8 +1,25 @@
|
|||
|
||||
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';
|
||||
|
@ -14,11 +31,17 @@ 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 {
|
||||
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;
|
||||
|
@ -137,8 +160,7 @@ export default async function clickBtn(props, id, text, record, index) {
|
|||
//主料组非关键料
|
||||
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);
|
||||
}
|
||||
//替代料非关键料一起删掉
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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://其他入库
|
||||
let selectRows = props.cardTable.getCheckedRows(AREA.bodyTable);
|
||||
// 如果没有选中行,则提示并返回,不进行任何操作
|
||||
if (!selectRows || selectRows.length <= 0) {
|
||||
/* 国际化处理: 请选择需要处理的数据!*/
|
||||
showWarningInfo(getLangByResId(this, '5008Pickm-000061'));
|
||||
return;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
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: "只有审批后单据才能生产其他入库单"});
|
||||
}
|
||||
|
||||
// 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);
|
||||
// });
|
||||
|
||||
// }
|
||||
// }
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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';//製造場景
|
||||
|
||||
|
|
|
@ -104,5 +104,6 @@
|
|||
"5008Pickm-000102": "确定",
|
||||
"5008Pickm-000103": "自动匹配",
|
||||
"5008Pickm-000104": "自动匹配成功",
|
||||
"5008Pickm-000105": "是替代料的非关键料行,不可删除"
|
||||
"5008Pickm-000105": "是替代料的非关键料行,不可删除",
|
||||
"5008Pickm-000106": "借料数量必须大于0,请检查对应行数据"
|
||||
}
|
Loading…
Reference in New Issue