借料入库-调整弹窗字段是否可编辑

This commit is contained in:
mzr 2025-09-05 18:24:14 +08:00
parent 88372b072f
commit 6c7652d70c
10 changed files with 237 additions and 28 deletions

View File

@ -0,0 +1,100 @@
import {ajax, base, toast} from 'nc-lightapp-front';
import {AREA, DIALOGCODE, FIELD, URL} from '../../constance';
import {getLangByResId} from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import {showWarningInfo} from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
import PickmBorrowDlg from "../../pickmborrow/list";
let {NCModal, NCButton, NCTooltip, NCHotKeys} = base;
const TABLE_HEAD = 'borrow_list';
export default function borrowBtnClick(props, record) {
let _this = this;
this.props = {};
let setProps = (val) => {
this.props = val;
}
let bids = [];
let hid;
let rows = props.cardTable.getCheckedRows(AREA.bodyTable);
// 如果没有选中行,则提示并返回,不进行任何操作
if (!rows) {
return;
}
if (rows.length <= 0) {
hid = 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;
bids.push(cpickm_bid);
});
}
let appcode = props.getAppCode();
let param = {
cpickmid: hid,
cpickmbids: bids,
pageid: DIALOGCODE.BORROWDLG,
appcode: appcode
}
ajax({
url: URL.pickmItemsQuery,
data: param,
success: res => {
if (res.success && res.data) {
let showData = res.data.data;
props.modal.show('BorrowDlg', {
size: 'max',
title: '借料入库明细',
content: <PickmBorrowDlg showdata={showData}
setProps={setProps}/>,
userControl: true,
// leftBtnName: '',
// rightBtnName: getLangByResId(this, '5008Pickm-000013'),/* 国际化处理: 取消*/
beSureBtnClick: oKBtnClicks.bind(this, props, true),
cancelBtnClick: () => {
props.modal.close('BorrowDlg');
}
});
}
}
});
}
function oKBtnClicks(props) {
let rowids = [];
let hids = [];
let hid;
let rows = props.table.getCheckedRows(AREA.borrowMaterialDialog);
hid = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value;
hids.push(hid);
// 如果没有选中行,则提示并返回,不进行任何操作
if (!rows || rows.length <= 0) {
showWarningInfo('请选择行');
return;
}
for (let i = 0; i < rows.length; i++) {
rowids.push(rows[i].data.values.cpickm_bid.value);
}
let data = {
cpickmids: hids,
cpickmbids: rowids
}
console.log('data = ', data);
ajax({
url: URL.pickmItemsQuery,
data: data,
success: res => {
if (res.success && res.data) {
if (res.success) {
toast({color: 'success', title: "推送成功"});
this.props.modal.close(AREA.borrowMaterialDialog);
}
}
},
error: (error) => {
toast({
color: 'warning',
content: error.message
});
}
});
}

View File

@ -272,6 +272,7 @@ class PickmCard extends Component {
{createModal('TakeOverDlg', {zIndex: "300"})}
{createModal('SetBackDeliverDlg', {zIndex: "280"})}
{createModal('ReplaceDlg', {zIndex: "300"})}
{createModal('BorrowDlg', {zIndex: "300"})}
{createModal(AREA.borrowMaterialDialog, {
title: '借料入库明细',
@ -284,7 +285,7 @@ class PickmCard extends Component {
let rowids = [];
let hids = [];
let hid;
let rows = this.props.table.getCheckedRows(AREA.borrowMaterialDialog);
let rows = this.props.table.getCheckedRows(AREA.borrowMaterialDialog);
hid = this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value;
hids.push(hid);
// 如果没有选中行,则提示并返回,不进行任何操作
@ -292,7 +293,7 @@ class PickmCard extends Component {
showWarningInfo('请选择行');
return;
}
for (let i = 0; i < rows.length; i++){
for (let i = 0; i < rows.length; i++) {
rowids.push(rows[i].data.values.cpickm_bid.value);
}
let data = {

View File

@ -42,6 +42,7 @@ 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";
import borrowBtnClick from "../btnClicks/borrowBtnClick";
export default async function clickBtn(props, id, text, record, index) {
let _this = this;
@ -818,33 +819,11 @@ export default async function clickBtn(props, id, text, record, index) {
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;
// }
billstatus = props.form.getFormItemsValue(AREA.formArea, 'fbillstatus');
//审批态
if (billstatus && billstatus.value && billstatus.value == 1) {
detailqueryBtnClick.call(this, this.props, record);
// detailqueryBtnClick.call(this, this.props, record);
borrowBtnClick.call(this, this.props, record);
} else {
toast({color: 'warning', title: "只有审批后单据才能生产其他入库单"});
}

View File

@ -10,7 +10,8 @@ const AREA = {
cardHeadBtnArea: 'card_head', //卡片表头按钮区域
cardBodyBtnArea: 'card_body', //卡片表体按钮区域
cardBodyInnerBtnArea: 'card_body_inner', //卡片表体操作按钮区域
borrowMaterialDialog: 'NCTable_83c3abf9' //借料弹窗
borrowMaterialDialog: 'NCTable_83c3abf9', //借料弹窗
borrowList: 'borrow_list' //借料弹窗
};
const MANUFACTURE = 'fa';//製造場景
@ -23,7 +24,8 @@ const DIALOGCODE = {
BACKDELIVERDLG: '50080102_backdeliver',
SETBACKDELIVERDLG: '50080102_backdeliverwithset',
TAKEOVERDLG: '50080102_takeover',
REPLACEDLG: '50080102_replace'
REPLACEDLG: '50080102_replace',
BORROWDLG: '50080102_borrow'
}
const LIST_BTN = {

View File

@ -0,0 +1,4 @@
export default async function headAfterEvent(props, moduleId, key, value, changedrows, i) {
let headData = props.editTable.getAllData('replace_head', true);
this.props.setHeadDatas(headData);
}

View File

@ -0,0 +1,15 @@
export default function headBeforeEvent(props, moduleId, item, index, value, record) {
let key = item.attrcode;
let editFields = ['freplacetype'];
if (!editFields.includes(key)) {
return false;
}
else if (key == 'freplacetype') {
//以替代的备料计划表体不能修改替代类型
let replaceInfo = props.editTable.getValByKeyAndIndex(moduleId, index, 'freplaceinfo').value;
if (replaceInfo == 2) {
return false;
}
} return true;
}

View File

@ -0,0 +1,3 @@
import headBeforeEvent from './headBeforeEvent';
import headAfterEvent from './headAfterEvent';
export { headBeforeEvent,headAfterEvent };

View File

@ -0,0 +1,60 @@
import React, {Component} from 'react';
import {base, createPage, high} from 'nc-lightapp-front';
import {initTemplate} from './init';
import {initLang} from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import {headAfterEvent} from './events';
import {DIALOGCODE} from "../../constance";
const {Refer} = high;
const {NCModal} = base;
const TABLE_HEAD = 'borrow_list';
class PickmBorrowDlg extends Component {
constructor(props) {
super(props);
props.use.editTable(TABLE_HEAD);
this.state = {
totalRepNum: {}
};
initLang(this, ['5008Pickm'], 'mmpac', initTemplate.bind(this, this.props));
}
componentDidMount() {
this.initData();
}
//请求列表数据
initData = () => {
let showdata = this.props.showdata;
this.props.editTable.setTableData(TABLE_HEAD, showdata.borrow_list);
this.props.setProps(this.props);
};
render() {
let {editTable} = this.props;
let {createEditTable} = editTable;
return <div class="flex-container" style={{height: '100%'}}>
<div className='flex-container'>
{createEditTable(TABLE_HEAD, {
showIndex: true,
// height: 100,
// onRowClick: this.onRowClick.bind(this),
// onRowDoubleClick: this.onRowDoubleClick.bind(this),
// onBeforeEvent: headBeforeEvent.bind(this),
onAfterEvent: headAfterEvent.bind(this),
isAddRow: false,
showCheck: false
})}
</div>
</div>;
}
}
PickmBorrowDlg = createPage({
billinfo: {
billtype: 'grid',
pagecode: DIALOGCODE.BORROWDLG
}//,
})(PickmBorrowDlg);
export default PickmBorrowDlg;

View File

@ -0,0 +1,2 @@
import initTemplate from './initTemplate';
export { initTemplate };

View File

@ -0,0 +1,43 @@
import { DIALOGCODE } from '../../../constance';
import { getLangByResId } from '../../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
const TABLE_HEAD = 'borrow_list';
export default function (props) {
let appcode = props.getAppCode();
if (props.getAppCode().startsWith('5009')) {
appcode = '50090102';
}
else if (props.getAppCode().startsWith('5008')) {
appcode = '50080102';
}
//请求模板数据
props.createUIDom(
{
appcode: appcode,
pagecode: DIALOGCODE.BORROWDLG
},
(templedata) => {
if (templedata.template) {
let meta = templedata.template;
// modifierMeta.call(this, this.props, meta);
props.meta.setMeta(meta);
props.editTable.setStatus(TABLE_HEAD, 'edit');
// props.editTable.setStatus(TABLE_BODY, 'edit');
}
});
}
function modifierMeta(props, meta) {
meta[TABLE_HEAD].items.map((item) => {
if (item.attrcode == 'freplacetype') {
item.options = [{
display: getLangByResId(this, '5008Pickm-000096')/* 国际化处理: "全部替代"*/,
value: "1"
}, {
display: getLangByResId(this, '5008Pickm-000097')/* 国际化处理: ""部分替代"*/,
value: "2"
}
];
}
});
return meta;
}