diff --git a/src/mmpac/mmpac/pickm/card/btnClicks/detailqueryBtnClick.js b/src/mmpac/mmpac/pickm/card/btnClicks/detailqueryBtnClick.js index f96519f..b747463 100644 --- a/src/mmpac/mmpac/pickm/card/btnClicks/detailqueryBtnClick.js +++ b/src/mmpac/mmpac/pickm/card/btnClicks/detailqueryBtnClick.js @@ -1,36 +1,33 @@ -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) { - 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 rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); + // 如果没有选中行,则提示并返回,不进行任何操作 + if (!rows) { + return; } - doQuery.call(this, props, hid, bids); + 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); + }); + } + doQuery.call(this, props, hid, bids, rows); + } -function doQuery(props, hid, bids) { + +function doQuery(props, hid, bids, rows) { let appcode = props.getAppCode(); - + ajax({ url: '/nccloud/mmpac/pickm/pickmItemsQuery.do', data: { @@ -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; + } +} diff --git a/src/mmpac/mmpac/pickm/card/index.js b/src/mmpac/mmpac/pickm/card/index.js index 2f59c02..3b300e2 100644 --- a/src/mmpac/mmpac/pickm/card/index.js +++ b/src/mmpac/mmpac/pickm/card/index.js @@ -1,359 +1,364 @@ -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); - props.use.form(AREA.formArea); - props.use.cardTable(AREA.bodyTable); - //this.meta; - this.billcode = ''; - this.MM_PICKM_TYPE = 'N'; //判断是否是从新增小应用过来的 - this.state = { - copy_billId: '', - hideAdd: false, - hideDel: false, - copyRowDatas: null, //复制行数据 - showTrack: false, //单据追溯 - show: false, //审批详情 - vtrantypecode: null, - cpickmid: '', - lineShowType: [], //通过数组的方式控制 列按钮显示 1-收起 0-展开 - target: null, //附件管理弹出框目标位置 - showUploader: false, //是否显示附件管理弹出框 - tableData: { rows: [] }, - refreshFlag: 0, - editable: false, //页面是否可以编辑 - status: UISTATE.browse, // 页面标志,默认浏览态 - compositedisplay: false, - compositedata: null, - saveAndCommit: false, //是否保存提交 - isUpdateForYL: null, - skipCodes: null, - isWW: false, - showReserve: false, //是否显示预留弹框 - showReserveQuery: false, //是否显示预留查询 - }; - this.reserveData = {}; //预留需要的数据 - this.reserveQueryPks = {}; //预留查询需要的数据 - //initTemplate.call(this, this.props); - initLang(this, ['5008Pickm', '5008Pub'], 'mmpac', initTemplate.bind(this, this.props)); - } - // 渲染页面前,执行 - componentWillMount() { - // 关闭浏览器 - window.onbeforeunload = () => { - let status = this.props.cardTable.getStatus(AREA.bodyTable); - //if (!status) status == 'browse'; - status = status == 'browse' ? 'browse' : 'edit'; - if (status == 'edit') { - return getLangByResId(this, '5008Pickm-000052');/* 国际化处理: 当前单据未保存,您确认离开此页面?*//*getLangByResId(this, '4008GENERALIN-000006'); 国际化处理: 当前单据未保存,您确认离开此页面?*/ - } - }; - } - componentDidMount() { - //设置状态 - this.props.BillHeadInfo.setBillHeadInfoVisible({ - showBackBtn: false, //控制显示返回按钮: true为显示,false为隐藏 ---非必传 - showBillCode: false, //控制显示单据号:true为显示,false为隐藏 ---非必传 - billCode: this.state.vbillcode //修改单据号---非必传 - }); - //pageInfoClick.bind(this)(); - } - closeApprove = () => { - this.setState({ - show: false - }); - }; - // 附件管理关闭 - onHideUploader = () => { - this.setState({ - showUploader: false - }); - }; - //切换页面状态 - toggleShow = () => { - let status = this.props.getUrlParam('status'); - if (!status) { - status = 'add'; - } - buttonController.setUIState.call(this, this.props, status); - buttonController.setBackButtonVisiable.call(this, this.props, param); - buttonController.setCardButtonVisiable.call(this, this.props, status, param); - }; - //获取列表肩部信息 - getTableHead = (buttons) => { - return ( -
- {this.props.button.createButtonApp({ - area: AREA.cardBodyBtnArea, - //ignoreHotkeyCode: this.getCardDisableHotKeyBtn, - onButtonClick: btnClickController.bind(this) - })} -
- ); - }; - getCardDisableHotKeyBtn = () => { - return ['DeleteLine']; /** 目前是仅有删除行 */ - }; - getAssginUsedr = (value) => { - //重新执行提交操作重新执行提交操作 - if (this.state.saveAndCommit == true) { - saveCommitBtnClick.call(this, this.props, this.state.skipCodes, this.state.isUpdateForYL, value); - } else { - commitBtnClick.call(this, this.props, value); - } - this.setState({ compositedisplay: false, saveAndCommit: false }); - }; + constructor(props) { + super(props); + props.use.form(AREA.formArea); + props.use.cardTable(AREA.bodyTable); + //this.meta; + this.billcode = ''; + this.MM_PICKM_TYPE = 'N'; //判断是否是从新增小应用过来的 + this.state = { + copy_billId: '', + hideAdd: false, + hideDel: false, + copyRowDatas: null, //复制行数据 + showTrack: false, //单据追溯 + show: false, //审批详情 + vtrantypecode: null, + cpickmid: '', + lineShowType: [], //通过数组的方式控制 列按钮显示 1-收起 0-展开 + target: null, //附件管理弹出框目标位置 + showUploader: false, //是否显示附件管理弹出框 + tableData: {rows: []}, + refreshFlag: 0, + editable: false, //页面是否可以编辑 + status: UISTATE.browse, // 页面标志,默认浏览态 + compositedisplay: false, + compositedata: null, + saveAndCommit: false, //是否保存提交 + isUpdateForYL: null, + skipCodes: null, + isWW: false, + showReserve: false, //是否显示预留弹框 + showReserveQuery: false, //是否显示预留查询 + }; + this.reserveData = {}; //预留需要的数据 + this.reserveQueryPks = {}; //预留查询需要的数据 + //initTemplate.call(this, this.props); + initLang(this, ['5008Pickm', '5008Pub'], 'mmpac', initTemplate.bind(this, this.props)); + } - change = (data) => { - console.log(data); - }; + // 渲染页面前,执行 + componentWillMount() { + // 关闭浏览器 + window.onbeforeunload = () => { + let status = this.props.cardTable.getStatus(AREA.bodyTable); + //if (!status) status == 'browse'; + status = status == 'browse' ? 'browse' : 'edit'; + if (status == 'edit') { + return getLangByResId(this, '5008Pickm-000052');/* 国际化处理: 当前单据未保存,您确认离开此页面?*//*getLangByResId(this, '4008GENERALIN-000006'); 国际化处理: 当前单据未保存,您确认离开此页面?*/ + } + }; + } - render() { - 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; + componentDidMount() { + //设置状态 + this.props.BillHeadInfo.setBillHeadInfoVisible({ + showBackBtn: false, //控制显示返回按钮: true为显示,false为隐藏 ---非必传 + showBillCode: false, //控制显示单据号:true为显示,false为隐藏 ---非必传 + billCode: this.state.vbillcode //修改单据号---非必传 + }); + //pageInfoClick.bind(this)(); + } - // this.props.use.form('NCTable_83c3abf9') - //         this.props.form.setFormStatus('NCTable_83c3abf9', 'edit') - return ( -
- {socket.connectMesg({ - headBtnAreaCode: AREA.cardHeadBtnArea, // 表头按钮区域ID - formAreaCode: AREA.formArea, // 表头Form区域ID - billtype: FIELD.billtype, - billpkname: FIELD.hid, - dataSource: PickmCache.PickmCacheKey - })} -
- - -
+ closeApprove = () => { + this.setState({ + show: false + }); + }; + // 附件管理关闭 + onHideUploader = () => { + this.setState({ + showUploader: false + }); + }; + //切换页面状态 + toggleShow = () => { + let status = this.props.getUrlParam('status'); + if (!status) { + status = 'add'; + } + buttonController.setUIState.call(this, this.props, status); + buttonController.setBackButtonVisiable.call(this, this.props, param); + buttonController.setCardButtonVisiable.call(this, this.props, status, param); + }; + //获取列表肩部信息 + getTableHead = (buttons) => { + return ( +
+ {this.props.button.createButtonApp({ + area: AREA.cardBodyBtnArea, + //ignoreHotkeyCode: this.getCardDisableHotKeyBtn, + onButtonClick: btnClickController.bind(this) + })} +
+ ); + }; + getCardDisableHotKeyBtn = () => { + return ['DeleteLine']; /** 目前是仅有删除行 */ + }; + getAssginUsedr = (value) => { + //重新执行提交操作重新执行提交操作 + if (this.state.saveAndCommit == true) { + saveCommitBtnClick.call(this, this.props, this.state.skipCodes, this.state.isUpdateForYL, value); + } else { + commitBtnClick.call(this, this.props, value); + } + this.setState({compositedisplay: false, saveAndCommit: false}); + }; + + change = (data) => { + console.log(data); + }; + + render() { + 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; + + return ( +
+ {socket.connectMesg({ + headBtnAreaCode: AREA.cardHeadBtnArea, // 表头按钮区域ID + formAreaCode: AREA.formArea, // 表头Form区域ID + billtype: FIELD.billtype, + billpkname: FIELD.hid, + dataSource: PickmCache.PickmCacheKey + })} +
+ + +
{createBillHeadInfo({ - title: this.props.getSearchParam('n'),//getLangByResId(this, '5008Pickm-000053'),/* 国际化处理: 备料计划*/ - backBtnClick: () => { - //返回按钮的点击事件 - btnClickController.bind(this, this.props, CARD_BTN.Back)(); - } - })} + title: this.props.getSearchParam('n'),//getLangByResId(this, '5008Pickm-000053'),/* 国际化处理: 备料计划*/ + backBtnClick: () => { + //返回按钮的点击事件 + btnClickController.bind(this, this.props, CARD_BTN.Back)(); + } + })} -
-
- {/*sagas*/} - {this.props.button.createErrorFlag({ - headBtnAreaCode: AREA.cardHeadBtnArea - })} - {this.props.button.createButtonApp({ - area: AREA.cardHeadBtnArea, - onButtonClick: btnClickController.bind(this) - })} - { - this.setState({ showTrack: false }); - }} - pk={this.state.cpickmid} - type={FIELD.billtype} - /> -
- {this.state.status == UISTATE.browse ? ( -
- {createCardPagination({ - handlePageInfoChange: pageInfoClickPage.bind(this), - dataSource: PickmCache.PickmCacheKey - })} -
- ) : ( - '' - )} -
-
-
- {createForm(AREA.formArea, { - onBeforeEvent: headBeforeEvent.bind(this), - onAfterEvent: headAfterEvent.bind(this) - })} -
-
-
-
- {createCardTable(AREA.bodyTable, { - showCheck: true, - showIndex: true, - onBeforeEvent: bodyBeforeEvent.bind(this), - onAfterEvent: bodyAfterEvent.bind(this), - onBatchChange: batchEvent.bind(this), - onSelected: buttonController.lineSelected.bind(this), - hideModelSave: true, - onSelectedAll: buttonController.lineSelected.bind(this), - onBatchSelected: buttonController.lineSelected.bind(this), - tableHead: this.getTableHead.bind(this, buttons), - adaptionHeight: true, - inputChange: inputChange.bind(this, FIELD.vrowno), - modelAddRow: () => { - //this.props.cardTable.addRow(AREA.bodyTable); - let rowcount = this.props.cardTable.getNumberOfRows(AREA.bodyTable); - RownoUtils.setRowNo(this.props, AREA.bodyTable, FIELD.vrowno); - newLineDefaultUtil.setDefault.call(this, this.props, AREA.bodyTable, rowcount - 1); - } - , - modelDelRowBefore: (props, moduleId, modelIndex, record) => { - return checkDeleteRows.call(this, [record]); - } - })} -
-
- {/* 展示审批详情 */} -
- -
-
{/* 指派 */} - {this.state.compositedisplay && { - this.setState({ compositedisplay: false }); - }} - />} -
-
{showUploader && }
- {createModal('orgChange')} - {createModal('ResumeMessageDlg', { - className: 'iframe-modal', - size: 'xlg' - })} - {createModal('delModal')} - {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" })} +
+
+ {/*sagas*/} + {this.props.button.createErrorFlag({ + headBtnAreaCode: AREA.cardHeadBtnArea + })} + {this.props.button.createButtonApp({ + area: AREA.cardHeadBtnArea, + onButtonClick: btnClickController.bind(this) + })} + { + this.setState({showTrack: false}); + }} + pk={this.state.cpickmid} + type={FIELD.billtype} + /> +
+ {this.state.status == UISTATE.browse ? ( +
+ {createCardPagination({ + handlePageInfoChange: pageInfoClickPage.bind(this), + dataSource: PickmCache.PickmCacheKey + })} +
+ ) : ( + '' + )} + + +
+ {createForm(AREA.formArea, { + onBeforeEvent: headBeforeEvent.bind(this), + onAfterEvent: headAfterEvent.bind(this) + })} +
+
+
+
+ {createCardTable(AREA.bodyTable, { + showCheck: true, + showIndex: true, + onBeforeEvent: bodyBeforeEvent.bind(this), + onAfterEvent: bodyAfterEvent.bind(this), + onBatchChange: batchEvent.bind(this), + onSelected: buttonController.lineSelected.bind(this), + hideModelSave: true, + onSelectedAll: buttonController.lineSelected.bind(this), + onBatchSelected: buttonController.lineSelected.bind(this), + tableHead: this.getTableHead.bind(this, buttons), + adaptionHeight: true, + inputChange: inputChange.bind(this, FIELD.vrowno), + modelAddRow: () => { + //this.props.cardTable.addRow(AREA.bodyTable); + let rowcount = this.props.cardTable.getNumberOfRows(AREA.bodyTable); + RownoUtils.setRowNo(this.props, AREA.bodyTable, FIELD.vrowno); + newLineDefaultUtil.setDefault.call(this, this.props, AREA.bodyTable, rowcount - 1); + } + , + modelDelRowBefore: (props, moduleId, modelIndex, record) => { + return checkDeleteRows.call(this, [record]); + } + })} +
+
+ {/* 展示审批详情 */} +
+ +
+
{/* 指派 */} + {this.state.compositedisplay && { + this.setState({compositedisplay: false}); + }} + />} +
+
{showUploader && }
+ {createModal('orgChange')} + {createModal('ResumeMessageDlg', { + className: 'iframe-modal', + size: 'xlg' + })} + {createModal('delModal')} + {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('NCTable_83c3abf9', { - title: '备料明细', - content: ( -
- {createSimpleTable("NCTable_83c3abf9", { showIndex: true })}
- ), - size: '500', - beSureBtnClick: () => { - let rowids = []; - let hids = []; - let hid; + {createModal(AREA.borrowMaterialDialog, { + title: '借料入库明细', + content: ( +
+ {createSimpleTable(AREA.borrowMaterialDialog, {showIndex: true})}
+ ), + size: 'xlg', + beSureBtnClick: () => { + let rowids = []; + let hids = []; + let hid; let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); - hid = this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; - hids.push(hid); - // 如果没有选中行,则提示并返回,不进行任何操作 - if (!rows || rows.length <= 0) { - hids.push(this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value); - } - else { - rows.map((item) => { - let cpickm_bid = this.props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'cpickm_bid').value; - rowids.push(cpickm_bid); - }); - } - let data = { - cpickmids: hids, - cpickmbids: rowids - } - ajax({ - url: URL.convertOtherIn, - data: data, - success: (res) => { - if (res.success) { - toast({ color: 'success', title: "推送成功" }); - this.props.modal.close('NCTable_83c3abf9'); - } - } - }); + hid = this.props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; + hids.push(hid); + // 如果没有选中行,则提示并返回,不进行任何操作 + if (!rows || rows.length <= 0) { + showWarningInfo('请选择行'); + return; + } + rows.map((item) => { + 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(AREA.borrowMaterialDialog); + } + } + }); - }, - cancelBtnClick: () => { - this.props.modal.close('NCTable_83c3abf9') - }, - userControl: true - })} -
- { - this.setState({ - showReserveQuery: false - }); - } - } - /> -
-
- { - this.setState({ showReserve: false }); - }} - onSave={() => { - this.setState( - { showReserve: false }, - //调用刷新 - btnClickController.bind(this, this.props, 'Refresh') - ); - }} - /> -
-
- ); - } + }, + cancelBtnClick: () => { + this.props.modal.close(AREA.borrowMaterialDialog) + }, + userControl: true + })} +
+ { + this.setState({ + showReserveQuery: false + }); + } + } + /> +
+
+ { + this.setState({showReserve: false}); + }} + onSave={() => { + this.setState( + {showReserve: false}, + //调用刷新 + btnClickController.bind(this, this.props, 'Refresh') + ); + }} + /> +
+
+ ); + } } + PickmCard = createPage({ - billinfo: { - billtype: 'card', - pagecode: PAGECARDCODE, - headcode: AREA.formArea, - bodycode: AREA.bodyTable - }, - orderOfHotKey: [AREA.formArea, AREA.bodyTable] + billinfo: { + billtype: 'card', + pagecode: PAGECARDCODE, + headcode: AREA.formArea, + bodycode: AREA.bodyTable + }, + orderOfHotKey: [AREA.formArea, AREA.bodyTable] })(PickmCard); export default PickmCard; diff --git a/src/mmpac/mmpac/pickm/card/viewController/btnClickControllor.js b/src/mmpac/mmpac/pickm/card/viewController/btnClickControllor.js index 81c85ba..92e1adf 100644 --- a/src/mmpac/mmpac/pickm/card/viewController/btnClickControllor.js +++ b/src/mmpac/mmpac/pickm/card/viewController/btnClickControllor.js @@ -1,670 +1,687 @@ - 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; - switch (id) { - //刷新 - case CARD_BTN.Refresh: - let refresh = true; - pageInfoClick.bind(this, props, null, refresh)(); - return; - // 保存 - case CARD_BTN.Save: - //cancelCommon.call(this, this.props); - let save = saveBtnClick.bind(this); - return save(props); - // 保存新增 - case CARD_BTN.SaveAdd: - //cancelCommon.call(this, this.props); - let saveadd = saveBtnClick.bind(this); - return saveadd(props, true); - // 保存提交 - case CARD_BTN.SaveCommit: - //cancelCommon.call(this, this.props); - let savecommit = saveCommitBtnClick.bind(this); - return savecommit(props); - //备料重算 - case CARD_BTN.PickmSubItems: - //cancelCommon.call(this, this.props); - let subItems = subItemsBtnClick.bind(this); - return subItems(props); - // 提交 - case CARD_BTN.Commit: - let commit = commitBtnClick.bind(this); - return commit(props); - //打印 - case CARD_BTN.Print: - let print = printBtnClick.bind(this, props); - return print(props); - //输出 - case CARD_BTN.Output: - let output = outputBtnClick.bind(this, props); - return output(props); - // 收回 - case CARD_BTN.UnCommit: - let uncommit = unCommitBtnClick.bind(this); - return uncommit(props); - // 取消 - case CARD_BTN.Cancel: - //cancelCommon.call(this, this.props); - let cancel = cancelBtnClick.bind(this); - return cancel(props); - // 新增行 - case CARD_BTN.AddLine: - props.cardTable.addRow(AREA.bodyTable); - 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); - break; - // 删除行 record有值走行删除逻辑,没有值走批量处理逻辑 - case CARD_BTN.DeleteLine: - let delRepItem = []; - let isDelete = false; - let delRows = []; - let rowIds = []; - let delIds=[]; - let mainids = []; - if (record) { - delRows.push(record); - rowIds.push(index); - isDelete = await checkDeleteRows.call(this, [record]); - if (isDelete) { - if (record.values.creplacesrcid && record.values.creplacesrcid.value) { - delRepItem.push(record); - mainids.push(record.values.creplacesrcid.value); - delIds.push(record.values.cpickm_bid.value); - } - if (delRepItem.length < 1) { - props.cardTable.delRowsByIndex(AREA.bodyTable, index); - props.cardTable.saveChangedRowsOldValue(AREA.bodyTable, index, FIELD.cbmaterialvid, null); - buttonController.lineSelected.call(this); - } - } - } else { - let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); - rows.map((item) => { - rowIds.push(item.index); - delRows.push(item.data); - if (item.data.values.creplacesrcid && item.data.values.creplacesrcid.value) { - delRepItem.push(item.data); - mainids.push(item.data.values.creplacesrcid.value); - delIds.push(item.data.values.cpickm_bid.value); - } - }); - isDelete = await checkDeleteRows.call(this, delRows); - if (isDelete) { - if (delRepItem.length < 1) { - this.props.cardTable.delRowsByIndex(AREA.bodyTable, rowIds); - rowIds.forEach((rowId) => { - props.cardTable.saveChangedRowsOldValue(AREA.bodyTable, rowId, FIELD.cbmaterialvid, null); - }); - buttonController.lineSelected.call(this); - } - } - } - if (isDelete) { - if (delRepItem.length > 0) { - let bodyData = props.cardTable.getAllRows(AREA.bodyTable); - let mainAndRepItem = []; + let _this = this; + switch (id) { + //刷新 + case CARD_BTN.Refresh: + let refresh = true; + pageInfoClick.bind(this, props, null, refresh)(); + return; + // 保存 + case CARD_BTN.Save: + //cancelCommon.call(this, this.props); + let save = saveBtnClick.bind(this); + return save(props); + // 保存新增 + case CARD_BTN.SaveAdd: + //cancelCommon.call(this, this.props); + let saveadd = saveBtnClick.bind(this); + return saveadd(props, true); + // 保存提交 + case CARD_BTN.SaveCommit: + //cancelCommon.call(this, this.props); + let savecommit = saveCommitBtnClick.bind(this); + return savecommit(props); + //备料重算 + case CARD_BTN.PickmSubItems: + //cancelCommon.call(this, this.props); + let subItems = subItemsBtnClick.bind(this); + return subItems(props); + // 提交 + case CARD_BTN.Commit: + let commit = commitBtnClick.bind(this); + return commit(props); + //打印 + case CARD_BTN.Print: + let print = printBtnClick.bind(this, props); + return print(props); + //输出 + case CARD_BTN.Output: + let output = outputBtnClick.bind(this, props); + return output(props); + // 收回 + case CARD_BTN.UnCommit: + let uncommit = unCommitBtnClick.bind(this); + return uncommit(props); + // 取消 + case CARD_BTN.Cancel: + //cancelCommon.call(this, this.props); + let cancel = cancelBtnClick.bind(this); + return cancel(props); + // 新增行 + case CARD_BTN.AddLine: + props.cardTable.addRow(AREA.bodyTable); + 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); + break; + // 删除行 record有值走行删除逻辑,没有值走批量处理逻辑 + case CARD_BTN.DeleteLine: + let delRepItem = []; + let isDelete = false; + let delRows = []; + let rowIds = []; + let delIds = []; + let mainids = []; + if (record) { + delRows.push(record); + rowIds.push(index); + isDelete = await checkDeleteRows.call(this, [record]); + if (isDelete) { + if (record.values.creplacesrcid && record.values.creplacesrcid.value) { + delRepItem.push(record); + mainids.push(record.values.creplacesrcid.value); + delIds.push(record.values.cpickm_bid.value); + } + if (delRepItem.length < 1) { + props.cardTable.delRowsByIndex(AREA.bodyTable, index); + props.cardTable.saveChangedRowsOldValue(AREA.bodyTable, index, FIELD.cbmaterialvid, null); + buttonController.lineSelected.call(this); + } + } + } else { + let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); + rows.map((item) => { + rowIds.push(item.index); + delRows.push(item.data); + if (item.data.values.creplacesrcid && item.data.values.creplacesrcid.value) { + delRepItem.push(item.data); + mainids.push(item.data.values.creplacesrcid.value); + delIds.push(item.data.values.cpickm_bid.value); + } + }); + isDelete = await checkDeleteRows.call(this, delRows); + if (isDelete) { + if (delRepItem.length < 1) { + this.props.cardTable.delRowsByIndex(AREA.bodyTable, rowIds); + rowIds.forEach((rowId) => { + props.cardTable.saveChangedRowsOldValue(AREA.bodyTable, rowId, FIELD.cbmaterialvid, null); + }); + buttonController.lineSelected.call(this); + } + } + } + if (isDelete) { + if (delRepItem.length > 0) { + let bodyData = props.cardTable.getAllRows(AREA.bodyTable); + let mainAndRepItem = []; - bodyData.map((item, i) => { - if (rowIds.indexOf(i) < 0) { - 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) { - mainAndRepItem.push(item); - } - //替代料非关键料一起删掉 - else if (item.values.cgroupkeyrowid && item.values.cgroupkeyrowid.value && delIds.indexOf(item.values.cgroupkeyrowid.value) > -1) { - rowIds.push(i); - } - } + bodyData.map((item, i) => { + if (rowIds.indexOf(i) < 0) { + 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) { + mainAndRepItem.push(item); + } + //替代料非关键料一起删掉 + else if (item.values.cgroupkeyrowid && item.values.cgroupkeyrowid.value && delIds.indexOf(item.values.cgroupkeyrowid.value) > -1) { + rowIds.push(i); + } + } - } - }); - let headData = props.form.getAllFormValueSimple('card_head'); - let delParam = { - pageid: PAGECARDCODE, - cmaterialvid: headData.rows[0].values.cmaterialvid.value, - pk_org: headData.rows[0].values.pk_org.value, - fprodmode: headData.rows[0].values.fprodmode.value, - transTypeid: headData.rows[0].values.vbusitypeid.value, - fsourcetype: headData.rows[0].values.fsourcetype.value, - headNum: headData.rows[0].values.nnumber ? headData.rows[0].values.nnumber.value : 0, - headAstNum: headData.rows[0].values.nastnum ? headData.rows[0].values.nastnum.value : 0, - delRepItems: JSON.stringify({ - pageid: PAGECARDCODE, - model: { - areaType: "table", - pageinfo: null, - rows: delRepItem, - areacode: AREA.bodyTable, - } - }), - mainAndRepItems: JSON.stringify({ - pageid: PAGECARDCODE, - model: { - areaType: "table", - pageinfo: null, - rows: mainAndRepItem, - areacode: AREA.bodyTable, - } - }) - } - ajax({ - url: URL.deleteLineURL, - data: delParam, - success: res => { - if (res.success && res.data) { - let len = props.cardTable.getNumberOfRows(AREA.bodyTable); - let cpcikmbid; - let updateArray = []; - 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] }; - updateArray.push(obj); - } - } - if (updateArray.length > 0) { - props.cardTable.updateDataByIndexs(AREA.bodyTable, updateArray); - props.cardTable.delRowsByIndex(AREA.bodyTable, rowIds, false); - rowIds.forEach((rowId) => { - props.cardTable.saveChangedRowsOldValue(AREA.bodyTable, rowId, FIELD.cbmaterialvid, null); - }); - buttonController.lineSelected.call(this); - } - } - } - }); - } - } - break; - // 肩上-复制行 - case CARD_BTN.CopyLine: - if (record) { - if (record.values.creplacesrcid && record.values.creplacesrcid.value) { - showWarningInfo(null, getLangByResId(this, '5008Pickm-000057'));/* 国际化处理: 替代料行不支持复制!*/ - return; - } - rowCopyPasteUtils.copyRow.call( - _this, - props, - record, - AREA.bodyTable, - CARD_BTN.cardBodyInit, - CARD_BTN.cardBodyCopy - ); - } else { - let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); - let flag = false; - let copyErr = getLangByResId(this, '5008Pickm-000058');/* 国际化处理: 行*/ - rows.map((item) => { - let vrowno = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'vrowno'); - let creplacesrcid = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'creplacesrcid'); - if (creplacesrcid && creplacesrcid.value) { - copyErr = copyErr + '[' + vrowno.value + ']'; - flag = true; - } - }); - if (flag) { - showWarningInfo(null, copyErr + getLangByResId(this, '5008Pickm-000059'));/* 国际化处理: 为替代料行,不支持复制!*/ - return; - } - rowCopyPasteUtils.copyRows.call( - _this, - props, - AREA.bodyTable, - CARD_BTN.cardBodyInit, - CARD_BTN.cardBodyCopy - ); - } - break; - // 肩上- 复制取消 - case CARD_BTN.PasteCancel: - cancelCommon.call(this, this.props); - buttonController.lineSelected.call(this); - break; - case CARD_BTN.PasteLast: // 物料 粘贴至末行 - rowCopyPasteUtils.pasteRowsToTail.call( - _this, - props, - AREA.bodyTable, - CARD_BTN.cardBodyInit, - CARD_BTN.cardBodyCopy, - [FIELD.vrowno] - ); - RownoUtils.setRowNo(props, AREA.bodyTable, FIELD.vrowno); - buttonController.lineSelected.call(this); - break; - case CARD_BTN.PasteThis: // 物料 粘贴至此 - rowCopyPasteUtils.pasteRowsToIndex.call( - _this, - props, - AREA.bodyTable, - index, - CARD_BTN.cardBodyInit, - CARD_BTN.cardBodyCopy, - [FIELD.vrowno] - ); - RownoUtils.setRowNo(props, AREA.bodyTable, FIELD.vrowno); - buttonController.lineSelected.call(this); - break; + } + }); + let headData = props.form.getAllFormValueSimple('card_head'); + let delParam = { + pageid: PAGECARDCODE, + cmaterialvid: headData.rows[0].values.cmaterialvid.value, + pk_org: headData.rows[0].values.pk_org.value, + fprodmode: headData.rows[0].values.fprodmode.value, + transTypeid: headData.rows[0].values.vbusitypeid.value, + fsourcetype: headData.rows[0].values.fsourcetype.value, + headNum: headData.rows[0].values.nnumber ? headData.rows[0].values.nnumber.value : 0, + headAstNum: headData.rows[0].values.nastnum ? headData.rows[0].values.nastnum.value : 0, + delRepItems: JSON.stringify({ + pageid: PAGECARDCODE, + model: { + areaType: "table", + pageinfo: null, + rows: delRepItem, + areacode: AREA.bodyTable, + } + }), + mainAndRepItems: JSON.stringify({ + pageid: PAGECARDCODE, + model: { + areaType: "table", + pageinfo: null, + rows: mainAndRepItem, + areacode: AREA.bodyTable, + } + }) + } + ajax({ + url: URL.deleteLineURL, + data: delParam, + success: res => { + if (res.success && res.data) { + let len = props.cardTable.getNumberOfRows(AREA.bodyTable); + let cpcikmbid; + let updateArray = []; + 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]}; + updateArray.push(obj); + } + } + if (updateArray.length > 0) { + props.cardTable.updateDataByIndexs(AREA.bodyTable, updateArray); + props.cardTable.delRowsByIndex(AREA.bodyTable, rowIds, false); + rowIds.forEach((rowId) => { + props.cardTable.saveChangedRowsOldValue(AREA.bodyTable, rowId, FIELD.cbmaterialvid, null); + }); + buttonController.lineSelected.call(this); + } + } + } + }); + } + } + break; + // 肩上-复制行 + case CARD_BTN.CopyLine: + if (record) { + if (record.values.creplacesrcid && record.values.creplacesrcid.value) { + showWarningInfo(null, getLangByResId(this, '5008Pickm-000057'));/* 国际化处理: 替代料行不支持复制!*/ + return; + } + rowCopyPasteUtils.copyRow.call( + _this, + props, + record, + AREA.bodyTable, + CARD_BTN.cardBodyInit, + CARD_BTN.cardBodyCopy + ); + } else { + let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); + let flag = false; + let copyErr = getLangByResId(this, '5008Pickm-000058');/* 国际化处理: 行*/ + rows.map((item) => { + let vrowno = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'vrowno'); + let creplacesrcid = props.cardTable.getValByKeyAndIndex(AREA.bodyTable, item.index, 'creplacesrcid'); + if (creplacesrcid && creplacesrcid.value) { + copyErr = copyErr + '[' + vrowno.value + ']'; + flag = true; + } + }); + if (flag) { + showWarningInfo(null, copyErr + getLangByResId(this, '5008Pickm-000059'));/* 国际化处理: 为替代料行,不支持复制!*/ + return; + } + rowCopyPasteUtils.copyRows.call( + _this, + props, + AREA.bodyTable, + CARD_BTN.cardBodyInit, + CARD_BTN.cardBodyCopy + ); + } + break; + // 肩上- 复制取消 + case CARD_BTN.PasteCancel: + cancelCommon.call(this, this.props); + buttonController.lineSelected.call(this); + break; + case CARD_BTN.PasteLast: // 物料 粘贴至末行 + rowCopyPasteUtils.pasteRowsToTail.call( + _this, + props, + AREA.bodyTable, + CARD_BTN.cardBodyInit, + CARD_BTN.cardBodyCopy, + [FIELD.vrowno] + ); + RownoUtils.setRowNo(props, AREA.bodyTable, FIELD.vrowno); + buttonController.lineSelected.call(this); + break; + case CARD_BTN.PasteThis: // 物料 粘贴至此 + rowCopyPasteUtils.pasteRowsToIndex.call( + _this, + props, + AREA.bodyTable, + index, + CARD_BTN.cardBodyInit, + CARD_BTN.cardBodyCopy, + [FIELD.vrowno] + ); + RownoUtils.setRowNo(props, AREA.bodyTable, FIELD.vrowno); + buttonController.lineSelected.call(this); + break; - 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); - break; - //重排行号 - case CARD_BTN.Resetno: - let bodyRows = props.cardTable.getVisibleRows(AREA.bodyTable); - if(bodyRows.length<1){ - showWarningInfo(null, getLangByResId(this, '5008Pickm-000100')); - return; - } - let billstatus = props.form.getFormItemsValue(AREA.formArea, 'fbillstatus'); - //审批态,行号不能修改 - if (billstatus && billstatus.value && billstatus.value == 1) { - showWarningInfo(null, getLangByResId(this, '5008Pickm-000101')); - return; - } - RownoUtils.resetRowNo(props, AREA.bodyTable, FIELD.vrowno); - this.forceUpdate(); - break; - // 新增 - case CARD_BTN.Add: - let add = addBtnClick.bind(this); - return add(props); - // 复制单据 - case CARD_BTN.Copy: - let copy = copyBtnClick.bind(this); - return copy(props); - // 返回 - case CARD_BTN.Back: - return backBtnClick(props); - // 修改 - case CARD_BTN.Edit: - let edit = editBtnClick.bind(this); - return edit(props); - // 删除 - case CARD_BTN.Delete: - let del = delBtnClick.bind(this); - return del(props); - //展开 - case CARD_BTN.OpenRow: - let status = props.getUrlParam('status'); + 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); + break; + //重排行号 + case CARD_BTN.Resetno: + let bodyRows = props.cardTable.getVisibleRows(AREA.bodyTable); + if (bodyRows.length < 1) { + showWarningInfo(null, getLangByResId(this, '5008Pickm-000100')); + return; + } + let billstatus = props.form.getFormItemsValue(AREA.formArea, 'fbillstatus'); + //审批态,行号不能修改 + if (billstatus && billstatus.value && billstatus.value == 1) { + showWarningInfo(null, getLangByResId(this, '5008Pickm-000101')); + return; + } + RownoUtils.resetRowNo(props, AREA.bodyTable, FIELD.vrowno); + this.forceUpdate(); + break; + // 新增 + case CARD_BTN.Add: + let add = addBtnClick.bind(this); + return add(props); + // 复制单据 + case CARD_BTN.Copy: + let copy = copyBtnClick.bind(this); + return copy(props); + // 返回 + case CARD_BTN.Back: + return backBtnClick(props); + // 修改 + case CARD_BTN.Edit: + let edit = editBtnClick.bind(this); + return edit(props); + // 删除 + case CARD_BTN.Delete: + let del = delBtnClick.bind(this); + return del(props); + //展开 + case CARD_BTN.OpenRow: + let status = props.getUrlParam('status'); - if (status == UISTATE.browse) { - //浏览态 - props.cardTable.toggleRowView(AREA.bodyTable, record); - this.state.lineShowType[index] = 1; - this.setState({ - lineShowType: this.state.lineShowType - }); - } else { - //编辑态 - props.cardTable.openModel(AREA.bodyTable, UISTATE.edit, record, index); - } - break; - //收起 - case CARD_BTN.CloseRow: - let statuss = props.getUrlParam('status'); + if (status == UISTATE.browse) { + //浏览态 + props.cardTable.toggleRowView(AREA.bodyTable, record); + this.state.lineShowType[index] = 1; + this.setState({ + lineShowType: this.state.lineShowType + }); + } else { + //编辑态 + props.cardTable.openModel(AREA.bodyTable, UISTATE.edit, record, index); + } + break; + //收起 + case CARD_BTN.CloseRow: + let statuss = props.getUrlParam('status'); - if (statuss == UISTATE.browse) { - //浏览态 - props.cardTable.toggleRowView(AREA.bodyTable, record); - this.state.lineShowType[index] = 0; - this.setState({ - lineShowType: this.state.lineShowType - }); - } else { - //编辑态 - props.cardTable.openModel(AREA.bodyTable, UISTATE.edit, record, index); - } - break; - //单据追溯 - case CARD_BTN.LinkQuery: - let pk = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; - this.setState({ cpickmid: pk, showTrack: true }) - break; - //附件管理 - case CARD_BTN.FileManage: - let flag = this.state.showUploader; - pk = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; - this.setState({ - cpickmid: pk, - showUploader: !flag - // target: event.target - }); - break; - //审批详情 - case CARD_BTN.ApproveInfo: - let billId = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; - let billtype = props.form.getFormItemsValue(AREA.formArea, FIELD.vtrantypecode).value; - this.setState({ - show: true, - vtrantypecode: billtype, - cpickmid: billId - }); - break; - // 完成 - case CARD_BTN.PickmFinish: - let pickmFinish = finishBtnClick.bind(this); - return pickmFinish(props); - // 取消完成 - case CARD_BTN.PickmUnFinish: - let pickmUnFinish = unfinishBtnClick.bind(this); - return pickmUnFinish(props); - // 存量查询 - case CARD_BTN.QueryCL: - clqueryBtnClick.call(this, this.props, record); - break; - case CARD_BTN.PickmDeliveryWithSet: // 成套发料 - let cpickmid = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; - let data = { - cpickmids: [cpickmid], - isReSet: false, - pageid: DIALOGCODE.DELIVERSETDLG, - appcode: props.getAppCode() - } - pickmSetDeliver.call(this, this.props, data); - break; - case CARD_BTN.PickmReDeliveryWithSet: // 补成套发料 - cpickmid = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; - data = { - cpickmids: [cpickmid], - isReSet: true, - pageid: DIALOGCODE.DELIVERSETDLG, - appcode: props.getAppCode() - } - pickmSetDeliver.call(this, this.props, data); - break; - case CARD_BTN.ToReqPickm: - let rowids = []; - let 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); - }); + if (statuss == UISTATE.browse) { + //浏览态 + props.cardTable.toggleRowView(AREA.bodyTable, record); + this.state.lineShowType[index] = 0; + this.setState({ + lineShowType: this.state.lineShowType + }); + } else { + //编辑态 + props.cardTable.openModel(AREA.bodyTable, UISTATE.edit, record, index); + } + break; + //单据追溯 + case CARD_BTN.LinkQuery: + let pk = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; + this.setState({cpickmid: pk, showTrack: true}) + break; + //附件管理 + case CARD_BTN.FileManage: + let flag = this.state.showUploader; + pk = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; + this.setState({ + cpickmid: pk, + showUploader: !flag + // target: event.target + }); + break; + //审批详情 + case CARD_BTN.ApproveInfo: + let billId = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; + let billtype = props.form.getFormItemsValue(AREA.formArea, FIELD.vtrantypecode).value; + this.setState({ + show: true, + vtrantypecode: billtype, + cpickmid: billId + }); + break; + // 完成 + case CARD_BTN.PickmFinish: + let pickmFinish = finishBtnClick.bind(this); + return pickmFinish(props); + // 取消完成 + case CARD_BTN.PickmUnFinish: + let pickmUnFinish = unfinishBtnClick.bind(this); + return pickmUnFinish(props); + // 存量查询 + case CARD_BTN.QueryCL: + clqueryBtnClick.call(this, this.props, record); + break; + case CARD_BTN.PickmDeliveryWithSet: // 成套发料 + let cpickmid = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; + let data = { + cpickmids: [cpickmid], + isReSet: false, + pageid: DIALOGCODE.DELIVERSETDLG, + appcode: props.getAppCode() + } + pickmSetDeliver.call(this, this.props, data); + break; + case CARD_BTN.PickmReDeliveryWithSet: // 补成套发料 + cpickmid = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; + data = { + cpickmids: [cpickmid], + isReSet: true, + pageid: DIALOGCODE.DELIVERSETDLG, + appcode: props.getAppCode() + } + pickmSetDeliver.call(this, this.props, data); + break; + case CARD_BTN.ToReqPickm: + let rowids = []; + let 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.checkToReqpickm, - data: data, - success: (res) => { - if (res.success) { - cacheTools.set('pickmToReqpcikmBIds', res.data.pks); - if (props.getAppCode().startsWith('5009')) { - props.openTo(null, { - pagecode: '50080106_card', - appcode: '50090106', - channelType: 'pickmToReqpickm', - vsrcAppcode: props.getAppCode(), - channelAddress: 'list', - status: UISTATE.edit, - type: '55A3' - }); - } else { - props.openTo(null, { - pagecode: '50080106_card', - appcode: '50080106', - channelType: 'pickmToReqpickm', - vsrcAppcode: props.getAppCode(), - channelAddress: 'list', - status: UISTATE.edit, - type: '55A3' - }); - } - } - } - }); - break; - // 领料 - case CARD_BTN.PickmDelivery: - rowids = []; - hids = []; - if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { - rowids.push(record.values.cpickm_bid.value); - } else { - let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); - // 如果没有选中行,则提示并返回,不进行任何操作 - 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.checkToReqpickm, + data: data, + success: (res) => { + if (res.success) { + cacheTools.set('pickmToReqpcikmBIds', res.data.pks); + if (props.getAppCode().startsWith('5009')) { + props.openTo(null, { + pagecode: '50080106_card', + appcode: '50090106', + channelType: 'pickmToReqpickm', + vsrcAppcode: props.getAppCode(), + channelAddress: 'list', + status: UISTATE.edit, + type: '55A3' + }); + } else { + props.openTo(null, { + pagecode: '50080106_card', + appcode: '50080106', + channelType: 'pickmToReqpickm', + vsrcAppcode: props.getAppCode(), + channelAddress: 'list', + status: UISTATE.edit, + type: '55A3' + }); + } + } + } + }); + break; + // 领料 + case CARD_BTN.PickmDelivery: + rowids = []; + hids = []; + if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { + rowids.push(record.values.cpickm_bid.value); + } else { + let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); + // 如果没有选中行,则提示并返回,不进行任何操作 + 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, - appcode: props.getAppCode() - } - ajax({ - url: URL.checkToDeliver, - data: data, - success: (res) => { - if (res.success) { - let deliverParam = { - cpickmbids: res.data.pks, - deliverType: 1,//1,领料,2,成套领料,3,补成套领料 - pageCode:res.data.deliverPagecode - }; - cacheTools.set('pickmDeliverParam', deliverParam); - props.openTo(null, { - appcode: res.data.deliverAppcode, - pagecode: res.data.deliverPagecode, - type: '55A3', - isDispersed: true - }); + } + } + data = { + cpickmids: hids, + cpickmbids: rowids, + appcode: props.getAppCode() + } + ajax({ + url: URL.checkToDeliver, + data: data, + success: (res) => { + if (res.success) { + let deliverParam = { + cpickmbids: res.data.pks, + deliverType: 1,//1,领料,2,成套领料,3,补成套领料 + pageCode: res.data.deliverPagecode + }; + cacheTools.set('pickmDeliverParam', deliverParam); + props.openTo(null, { + appcode: res.data.deliverAppcode, + pagecode: res.data.deliverPagecode, + type: '55A3', + isDispersed: true + }); - } - } - }); - break; - // 直接备料 - case CARD_BTN.DirectTrans: - rowids = []; - hids = []; - if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { - rowids.push(record.values.cpickm_bid.value); - } else { - let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); - // 如果没有选中行,则提示并返回,不进行任何操作 - 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); - }); + } + } + }); + break; + // 直接备料 + case CARD_BTN.DirectTrans: + rowids = []; + hids = []; + if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { + rowids.push(record.values.cpickm_bid.value); + } else { + let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); + // 如果没有选中行,则提示并返回,不进行任何操作 + 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, - appcode: props.getAppCode() - } - ajax({ - url: URL.checkToDirectTrans, - data: data, - success: (res) => { - if (res.success) { - let param = { - cpickmbids: res.data.pks, + } + } + data = { + cpickmids: hids, + cpickmbids: rowids, + appcode: props.getAppCode() + } + ajax({ + url: URL.checkToDirectTrans, + data: data, + success: (res) => { + if (res.success) { + let param = { + cpickmbids: res.data.pks, deliverType: 4//1,领料,2,成套领料,3,补成套领料,4直接备料 - }; - cacheTools.set('pickmDirectTransParam', param); - props.openTo(null, { - appcode: res.data.deliverAppcode, - pagecode: res.data.deliverPagecode, - type: 'direct' - }); - } - } - }); - break; - case CARD_BTN.PickmBackDelivery: // 退料 - 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 || 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); - }); + }; + cacheTools.set('pickmDirectTransParam', param); + props.openTo(null, { + appcode: res.data.deliverAppcode, + pagecode: res.data.deliverPagecode, + type: 'direct' + }); + } + } + }); + break; + case CARD_BTN.PickmBackDelivery: // 退料 + 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 || 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); + }); - } - } - data = { - cpickmids: [hid], - cpickmbids: bids, - appcode: props.getAppCode() - } - 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.setState({ - lineShowType: [], - vbillcode: result.head[AREA.formArea].rows[0].values.vbillcode.value, - billId: result.head[AREA.formArea].rows[0].values.cpickmid.value, - billtype: result.head[AREA.formArea].rows[0].values.vbusitype.value - }); - let fbillstatus = result.head[AREA.formArea].rows[0].values.fbillstatus.value; - setBtnShow(this, fbillstatus); - buttonController.lineSelected.call(this); - } + } + } + data = { + cpickmids: [hid], + cpickmbids: bids, + appcode: props.getAppCode() + } + 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.setState({ + lineShowType: [], + vbillcode: result.head[AREA.formArea].rows[0].values.vbillcode.value, + billId: result.head[AREA.formArea].rows[0].values.cpickmid.value, + billtype: result.head[AREA.formArea].rows[0].values.vbusitype.value + }); + let fbillstatus = result.head[AREA.formArea].rows[0].values.fbillstatus.value; + setBtnShow(this, fbillstatus); + buttonController.lineSelected.call(this); + } - let pkid = result.head[AREA.formArea].rows[0].values.cpickmid.value; - updateCacheData( - this.props, - FIELD.hid, - pkid, - result, - AREA.formArea, - PickmCache.PickmCacheKey - ); - if (result.body) { - this.props.cardTable.setTableData(AREA.bodyTable, result.body[AREA.bodyTable], null, true, true); - } - }); - break; - case CARD_BTN.PickmBackDeliveryWithSet: // 成套退料 - cpickmid = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; - data = { - cpickmids: [cpickmid], - appcode: props.getAppCode() - } - 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.setState({ - lineShowType: [], - vbillcode: res.data.head[AREA.formArea].rows[0].values.vbillcode.value, - billId: res.data.head[AREA.formArea].rows[0].values.cpickmid.value, - billtype: res.data.head[AREA.formArea].rows[0].values.vbusitype.value - }); - let fbillstatus = res.data.head[AREA.formArea].rows[0].values.fbillstatus.value; - setBtnShow(this, fbillstatus); - buttonController.lineSelected.call(this); - } - let pkid = res.data.head[AREA.formArea].rows[0].values.cpickmid.value; - updateCacheData( - this.props, - FIELD.hid, - pkid, - res.data, - AREA.formArea, - PickmCache.PickmCacheKey - ); - if (res.data.body) { - this.props.cardTable.setTableData(AREA.bodyTable, res.data.body[AREA.bodyTable], null, true, true); - } - }); - break; - case CARD_BTN.PickmTakeOver: // 接收 - let bid; - if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { - bid = record.values.cpickm_bid.value; - } else { - let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); - // 如果没有选中行,则提示并返回,不进行任何操作 - if (rows.length <= 0) { - showWarningInfo(getLangByResId(this, '5008Pickm-000060')/* 国际化处理: 请选择需要接收的备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ - ); - return; - } - else if (rows.length > 1) { - showWarningInfo(getLangByResId(this, '5008Pickm-000061')/* 国际化处理: 请选择一行备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ - ); - return; - } - bid = rows[0].values.cpickm_bid.value; - } - data = { - pickmbid: bid, - isUnTakeOver: false, - pageid: DIALOGCODE.TAKEOVERDLG - } - pickmTakeOver.call(this, this.props, data, PAGECARDCODE,(res)=>{ - if (data === undefined) { + let pkid = result.head[AREA.formArea].rows[0].values.cpickmid.value; + updateCacheData( + this.props, + FIELD.hid, + pkid, + result, + AREA.formArea, + PickmCache.PickmCacheKey + ); + if (result.body) { + this.props.cardTable.setTableData(AREA.bodyTable, result.body[AREA.bodyTable], null, true, true); + } + }); + break; + case CARD_BTN.PickmBackDeliveryWithSet: // 成套退料 + cpickmid = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value; + data = { + cpickmids: [cpickmid], + appcode: props.getAppCode() + } + 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.setState({ + lineShowType: [], + vbillcode: res.data.head[AREA.formArea].rows[0].values.vbillcode.value, + billId: res.data.head[AREA.formArea].rows[0].values.cpickmid.value, + billtype: res.data.head[AREA.formArea].rows[0].values.vbusitype.value + }); + let fbillstatus = res.data.head[AREA.formArea].rows[0].values.fbillstatus.value; + setBtnShow(this, fbillstatus); + buttonController.lineSelected.call(this); + } + let pkid = res.data.head[AREA.formArea].rows[0].values.cpickmid.value; + updateCacheData( + this.props, + FIELD.hid, + pkid, + res.data, + AREA.formArea, + PickmCache.PickmCacheKey + ); + if (res.data.body) { + this.props.cardTable.setTableData(AREA.bodyTable, res.data.body[AREA.bodyTable], null, true, true); + } + }); + break; + case CARD_BTN.PickmTakeOver: // 接收 + let bid; + if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { + bid = record.values.cpickm_bid.value; + } else { + let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); + // 如果没有选中行,则提示并返回,不进行任何操作 + if (rows.length <= 0) { + showWarningInfo(getLangByResId(this, '5008Pickm-000060')/* 国际化处理: 请选择需要接收的备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ + ); + return; + } else if (rows.length > 1) { + showWarningInfo(getLangByResId(this, '5008Pickm-000061')/* 国际化处理: 请选择一行备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ + ); + return; + } + bid = rows[0].values.cpickm_bid.value; + } + data = { + pickmbid: bid, + isUnTakeOver: false, + pageid: DIALOGCODE.TAKEOVERDLG + } + pickmTakeOver.call(this, this.props, data, PAGECARDCODE, (res) => { + if (data === undefined) { //订单编号 this.setState({ vbillcode: '', @@ -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, @@ -698,33 +715,32 @@ export default async function clickBtn(props, id, text, record, index) { if (res.data.body) { this.props.cardTable.setTableData(AREA.bodyTable, res.data.body[AREA.bodyTable], null, true, true); } - }); - break; - case CARD_BTN.PickmUnTakeOver: // 取消接收 - if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { - bid = record.values.cpickm_bid.value; - } else { - let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); - // 如果没有选中行,则提示并返回,不进行任何操作 - if (rows.length <= 0) { - showWarningInfo(getLangByResId(this, '5008Pickm-000062')/* 国际化处理: 请选择需要取消接收的备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ - ); - return; - } - else if (rows.length > 1) { - showWarningInfo(getLangByResId(this, '5008Pickm-000061')/* 国际化处理: 请选择一行备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ - ); - return; - } - bid = rows[0].values.cpickm_bid.value; - } - data = { - pickmbid: bid, - isUnTakeOver: true, - pageid: DIALOGCODE.TAKEOVERDLG - } - pickmTakeOver.call(this, this.props, data, PAGECARDCODE,(res)=>{ - if (data === undefined) { + }); + break; + case CARD_BTN.PickmUnTakeOver: // 取消接收 + if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { + bid = record.values.cpickm_bid.value; + } else { + let rows = this.props.cardTable.getCheckedRows(AREA.bodyTable); + // 如果没有选中行,则提示并返回,不进行任何操作 + if (rows.length <= 0) { + showWarningInfo(getLangByResId(this, '5008Pickm-000062')/* 国际化处理: 请选择需要取消接收的备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ + ); + return; + } else if (rows.length > 1) { + showWarningInfo(getLangByResId(this, '5008Pickm-000061')/* 国际化处理: 请选择一行备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ + ); + return; + } + bid = rows[0].values.cpickm_bid.value; + } + data = { + pickmbid: bid, + isUnTakeOver: true, + pageid: DIALOGCODE.TAKEOVERDLG + } + pickmTakeOver.call(this, this.props, data, PAGECARDCODE, (res) => { + if (data === undefined) { //订单编号 this.setState({ vbillcode: '', @@ -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, @@ -758,98 +774,102 @@ export default async function clickBtn(props, id, text, record, index) { if (res.data.body) { this.props.cardTable.setTableData(AREA.bodyTable, res.data.body[AREA.bodyTable], null, true, true); } - }); - break; - case CARD_BTN.PickmReplace: - let rows = []; - if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { - rows.push(record); - } else { - let selectRows = props.cardTable.getCheckedRows(AREA.bodyTable); - // 如果没有选中行,则提示并返回,不进行任何操作 - if (selectRows && selectRows.length > 0) { - selectRows.map((item) => { - if (item.data.values.cpickm_bid && item.data.values.cpickm_bid.value) { - rows.push(item.data); - } - }); - } - else { - showWarningInfo(getLangByResId(this, '5008Pickm-000092')/* 国际化处理: 请选择需要替代的备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ - ); - } - } - if (rows.length <= 0) { - showWarningInfo(getLangByResId(this, '5008Pickm-000094')/* 国际化处理: 请保存后再进行替代操作!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ - ); - return; - } - data = props.createMasterChildDataSimple(PAGECARDCODE, AREA.formArea, AREA.bodyTable); - data.body.card_body.rows = rows; - data.pageid = PAGECARDCODE; - replaceBtnClick.call(this, this.props, data); - break; - case CARD_BTN.PickmPreStock: - let pickmReservStock = reserveBtnClick.bind(this); - return pickmReservStock(props); - case CARD_BTN.PickmQueryYL: - 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: "只有审批后单据才能生产其他入库单" }); - } - - // 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); - // }); + }); + break; + case CARD_BTN.PickmReplace: + let rows = []; + if (record && record.values.cpickm_bid && record.values.cpickm_bid.value) { + rows.push(record); + } else { + let selectRows = props.cardTable.getCheckedRows(AREA.bodyTable); + // 如果没有选中行,则提示并返回,不进行任何操作 + if (selectRows && selectRows.length > 0) { + selectRows.map((item) => { + if (item.data.values.cpickm_bid && item.data.values.cpickm_bid.value) { + rows.push(item.data); + } + }); + } else { + showWarningInfo(getLangByResId(this, '5008Pickm-000092')/* 国际化处理: 请选择需要替代的备料计划表明细!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ + ); + } + } + if (rows.length <= 0) { + showWarningInfo(getLangByResId(this, '5008Pickm-000094')/* 国际化处理: 请保存后再进行替代操作!*//*getLangByResId(this, '4004POORDER-000068') 国际化处理: 请选择需要删除的数据!*/ + ); + return; + } + data = props.createMasterChildDataSimple(PAGECARDCODE, AREA.formArea, AREA.bodyTable); + data.body.card_body.rows = rows; + data.pageid = PAGECARDCODE; + replaceBtnClick.call(this, this.props, data); + break; + case CARD_BTN.PickmPreStock: + let pickmReservStock = reserveBtnClick.bind(this); + return pickmReservStock(props); + case CARD_BTN.PickmQueryYL: + 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; + } - // } - // } - // data = { - // cpickmids: hids, - // cpickmbids: rowids - // } - // ajax({ - // url: URL.convertOtherIn, - // data: data, - // success: (res) => { - // if (res.success) { - // toast({ color: 'success', title: "推送成功" }); - // } - // } - // }); - break; - default: - break; - } + // 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: "只有审批后单据才能生产其他入库单"}); + } + + break; + default: + break; + } } + function cancelCommon(props) { - rowCopyPasteUtils.cancel.call( - this, - props, - AREA.bodyTable, - CARD_BTN.cardBodyInit, - CARD_BTN.cardBodyCopy - ); + rowCopyPasteUtils.cancel.call( + this, + props, + AREA.bodyTable, + CARD_BTN.cardBodyInit, + CARD_BTN.cardBodyCopy + ); +} + +// 本地安全数值转换方法,null/undefined/空对象转0 +function getNumber(data) { + if (data && data.value != null) { + return +data.value; + } else { + return 0; + } } diff --git a/src/mmpac/mmpac/pickm/constance/index.js b/src/mmpac/mmpac/pickm/constance/index.js index d313e5c..bcc9093 100644 --- a/src/mmpac/mmpac/pickm/constance/index.js +++ b/src/mmpac/mmpac/pickm/constance/index.js @@ -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';//製造場景 diff --git a/src/mmpac/public/lang/standard/simpchn/5008Pickm.json b/src/mmpac/public/lang/standard/simpchn/5008Pickm.json index 07f0174..d2ee4d8 100644 --- a/src/mmpac/public/lang/standard/simpchn/5008Pickm.json +++ b/src/mmpac/public/lang/standard/simpchn/5008Pickm.json @@ -104,5 +104,6 @@ "5008Pickm-000102": "确定", "5008Pickm-000103": "自动匹配", "5008Pickm-000104": "自动匹配成功", - "5008Pickm-000105": "是替代料的非关键料行,不可删除" + "5008Pickm-000105": "是替代料的非关键料行,不可删除", + "5008Pickm-000106": "借料数量必须大于0,请检查对应行数据" } \ No newline at end of file