备料计划关联importjs

This commit is contained in:
李正@用友 2025-05-19 17:46:56 +08:00
parent fed95c72e8
commit 957ab91bc7
32 changed files with 1760 additions and 0 deletions

View File

@ -0,0 +1,66 @@
import { ajax,toast } from 'nc-lightapp-front';
import {URL} from '../../pickmconstance';
import PickmBackDeliverDLG from '../card';
import pickmBackDeliverOKBtnClicks from './pikcmBackDeliverOKBtnClicks';
import {clickSerialnoBtn} from './pickmBackSerialnoBtnClick';
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
export function pickmBackDeliver(props,param,isPickm,pageid,isCard,thirdPartyClient,callback) {
if (param == undefined || param == null) {
return;
}
this.backDeliverData = {};
this.isPickm=isPickm;
this.pageid=pageid;
this.isCard=isCard;
let setBackDeliverData = (val) => {
this.backDeliverData = val;
};
this.backDeliverProps = {};
let setBackDeliverProps = (val) => {
this.backDeliverProps = val;
};
this.backSerialnoData = {};
let setBackSerialnoData = (val) => {
this.backSerialnoData = val;
};
param['isCard']=true;
param['pageid']='50080102_backdeliver';
let url = URL.backDeliverQueryURL;
//来自投放计划等第三方调用退料页面
if(thirdPartyClient && thirdPartyClient.url){
url = thirdPartyClient.url;
thirdPartyClient.appcode = param.appcode;
}
ajax({
url: url,
data: param,
success: res => {
if (res.success && res.data) {
let backData={
head:res.data.head['back_head'],
body:res.data.body['back_body']
}
setBackDeliverData(backData);
props.modal.show('BackDeliverDlg', {
size: 'xlg',
title: getLangByResId(this, '5008Pub-000018'), /* 国际化处理: 退料*/
content:<PickmBackDeliverDLG backData={backData} props={this.props} setBackDeliverData={setBackDeliverData}
setBackDeliverProps={setBackDeliverProps}
backSerialnoData={this.backSerialnoData} setBackSerialnoData={setBackSerialnoData} clickSerialnoBtn={clickSerialnoBtn.bind(this,props,thirdPartyClient)}/>,
userControl :true,
leftBtnName: getLangByResId(this, '5008Pub-000001'),/* 国际化处理: 确定*/
rightBtnName: getLangByResId(this, '5008Pub-000002'),/* 国际化处理: 取消*/
beSureBtnClick:pickmBackDeliverOKBtnClicks.bind(this,props,thirdPartyClient,callback),
cancelBtnClick:() => {
props.modal.close('BackDeliverDlg');
},
hideRightBtn: false, //隐藏足部右边的按钮默认是false不隐藏隐藏是true
hideLeftBtn: false //隐藏足部左边的按钮默认是false不隐藏隐藏是true
});
}
}
});
}

View File

@ -0,0 +1,64 @@
import { ajax, toast } from 'nc-lightapp-front';
import { URL } from '../../pickmconstance';
import { showWarningInfo, showSuccessInfo } from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
const TABLE_HEAD = 'serialno_head';
const TABLE_BODY = 'serialno_body';
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
export function serialnoAddLineBtn(props) {
let rowNum = this.props.cardTable.getNumberOfRows(TABLE_BODY);
if (rowNum > 0) {
let num = this.props.cardTable.getValByKeyAndIndex(TABLE_BODY, 0, 'nserialnum');
let nastnum = this.props.cardTable.getValByKeyAndIndex(TABLE_BODY, 0, 'nserialastnum');
let unit = this.props.cardTable.getValByKeyAndIndex(TABLE_BODY, 0, 'itemunitid');
let astunit = this.props.cardTable.getValByKeyAndIndex(TABLE_BODY, 0, 'itemastunitid');
this.props.cardTable.addRow(TABLE_BODY, rowNum, {
'nserialnum': num,
'nserialastnum': nastnum,
'itemunitid': unit,
'itemastunitid': astunit
});
}
else {
let index = 0;
let head = this.props.editTable.getClickRowIndex(TABLE_HEAD);
if (head && head.index) {
index = head.index;
}
let pk_org = this.props.editTable.getValByKeyAndIndex(TABLE_HEAD, index, 'cdeliverorgid');
if (!pk_org) {
showWarningInfo(getLangByResId(this, '5008Pub-000019'))/* 国际化处理: 发料组织不能为空,请返回退料界面维护发料组织!*/
return;
}
//add by maqna 生产订单使用备料计划的序列号弹窗-需要appcode
let appcode = '50080102';
if (this.props.getAppCode().startsWith('5009')) {
appcode = '50090102';
}
let material = this.props.editTable.getValByKeyAndIndex(TABLE_HEAD, index, 'cbmaterialvid').value;
let unitid = this.props.editTable.getValByKeyAndIndex(TABLE_HEAD, index, 'cbunitid').value;
let astunitid = this.props.editTable.getValByKeyAndIndex(TABLE_HEAD, index, 'cbastunitid').value;
let vchangerate = this.props.editTable.getValByKeyAndIndex(TABLE_HEAD, index, 'vbchangerate').value;
let param = {
pk_org: pk_org.value,
material: material,
unitid: unitid,
astunitid: astunitid,
vchangerate: vchangerate,
pageid: '50080102_serialno',
appcode: appcode
};
ajax({
url: URL.serialnoAddLineURL,
data: param,
success: res => {
if (res.success && res.data) {
this.props.cardTable.addRow(TABLE_BODY);
this.props.cardTable.setValByKeysAndIndex(TABLE_BODY, 0, res.data[TABLE_BODY].rows[0].values);
}
}
});
}
}

View File

@ -0,0 +1,87 @@
import { ajax, toast } from 'nc-lightapp-front';
import { showWarningInfo, showSuccessInfo } from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { URL } from '../../pickmconstance';
import PickmBackSerialnoDlg from '../serialno';
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
//import pickmBackDeliverOKBtnClicks from './pikcmBackDeliverOKBtnClicks';
export function clickSerialnoBtn(props, thirdPartyClient) {
let setSerialnoData = (val) => {
this.backSerialnoData = val;
};
let serialnoData = {};
if (this.backSerialnoData) {
for (let key in this.backSerialnoData) {
serialnoData[key] = this.backSerialnoData[key];
}
}
let items = [];
let item;
let itemfeild = ['cpickm_bid', 'ts', 'cdeliverorgid', 'cdeliverorgvid', 'coutstockid',
'csupplyorgid', 'csupplyorgvid', 'cinstockid', 'vbatchcode', 'pk_batchcode', 'nbccknum',
'nbcckastnum', 'naccoutnum', 'naccoutastnum', 'clocationid'];
let hts = this.backDeliverData.head.rows[0].values.ts.value;
let cpickmid = this.backDeliverData.head.rows[0].values.cpickmid.value;
this.backDeliverData.body.rows.forEach((row) => {
item = {};
itemfeild.forEach((feild) => {
item[feild] = row.values[feild] ? row.values[feild].value : null;
});
item['cpickmid'] = cpickmid;
items.push(item);
});
let param = {
backData: items,
pageid: '50080102_serialno',
};
if (thirdPartyClient && thirdPartyClient.appcode) {
param.appcode = thirdPartyClient.appcode;//来自投放计划第三方打开 需要传appocode
}
ajax({
url: URL.backSerialnoURL,
data: param,
success: res => {
if (res.success && res.data) {
let headData = res.data;
this.props.modal.show('BackSerialnoDlg', {
size: 'xlg',
title: getLangByResId(this, '5008Pub-000020'),/* 国际化处理: 序列号*/
content: <PickmBackSerialnoDlg serialnoData={serialnoData} headData={headData} props={this.props} setSerialnoData={setSerialnoData} />,
userControl: true,
leftBtnName: getLangByResId(this, '5008Pub-000001'),/* 国际化处理: 确定*/
rightBtnName: getLangByResId(this, '5008Pub-000002'),/* 国际化处理: 取消*/
beSureBtnClick: () => {
let err = ''
let codes = [];
let code = {};
for (let key in serialnoData) {
serialnoData[key].forEach((row) => {
code = row.values.vcode;
if (codes && code && codes.includes(code.value)) {
err = err + '[' + code.value + ']';
}
else {
codes.push(code.value);
}
});
}
if (err) {
showWarningInfo(getLangByResId(this, '5008Pub-000021') + err);/* 国际化处理: 请检查,存在重复序列号:*/
return;
}
this.backSerialnoData = serialnoData;
this.props.modal.close('BackSerialnoDlg');
},
cancelBtnClick: () => {
this.props.modal.close('BackSerialnoDlg');
},
hideRightBtn: false, //隐藏足部右边的按钮默认是false不隐藏隐藏是true
hideLeftBtn: false //隐藏足部左边的按钮默认是false不隐藏隐藏是true
});
}
}
});
}

View File

@ -0,0 +1,99 @@
import { ajax, toast } from 'nc-lightapp-front';
import { showWarningInfo, showSuccessInfo } from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { URL } from '../../pickmconstance';
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
let tableID = 'back_body';
export default function clickOKBtn(props, thirdPartyClient, callback) {
//表格必输校验
let tableData = this.backDeliverProps.cardTable.getAllData(tableID, true)
// 2111版本添加表头表体必输项一起校验
let flag = this.backDeliverProps.validatePageToToast([
{ name: tableID, type: 'cardTable' }
]);
if (!flag.allPassed) {
return;
}
let data = this.backDeliverProps.createMasterChildDataSimple('50080102_backdeliver', 'back_head', tableID);
this.backDeliverProps.validateToSave(data, () => {
let items = [];
let item;
let itemfeild = ['cpickm_bid', 'ts', 'cdeliverorgid', 'cdeliverorgvid', 'coutstockid',
'csupplyorgid', 'csupplyorgvid', 'cinstockid', 'vbatchcode', 'pk_batchcode', 'nbccknum',
'nbcckastnum', 'naccoutnum', 'naccoutastnum', 'clocationid',
'cpickbillid', 'vpickbillcode', 'vpickbilltype', 'cpickbillrowid', 'vpickbillrowno'
];
let defandFreeFeild = ['cbvendorid', 'cbproductorid', 'cbprojectid', 'cbcustomerid', 'cbqualitylevelid', 'cbffileid',
'vbfree1', 'vbfree2', 'vbfree3', 'vbfree4', 'vbfree5',
'vbfree6', 'vbfree7', 'vbfree8', 'vbfree9', 'vbfree10',
'vbdef1', 'vbdef2', 'vbdef3', 'vbdef4', 'vbdef5', 'vbdef6', 'vbdef7', 'vbdef8', 'vbdef9', 'vbdef10',
'vbdef11', 'vbdef12', 'vbdef13', 'vbdef14', 'vbdef15', 'vbdef16', 'vbdef17', 'vbdef18', 'vbdef19', 'vbdef20']
let hts = this.backDeliverData.head.rows[0].values.ts.value;
let cpickmid = this.backDeliverData.head.rows[0].values.cpickmid.value;
let snParams = [];
let snParam = {};
let cpickm_bid;
let defandFree = {};
let backData = this.backDeliverProps.createMasterChildDataSimple('50080102_backdeliver', 'back_head', tableID);
backData.body[tableID].rows.forEach((row) => {
item = {};
defandFree = {};
itemfeild.forEach((feild) => {
item[feild] = row.values[feild] && row.values[feild].value ? row.values[feild].value : null;
});
defandFreeFeild.forEach((feild) => {
defandFree[feild] = row.values[feild] && row.values[feild].value ? row.values[feild].value : null;
});
item['hts'] = hts;
item['cpickmid'] = cpickmid;
item['defAndFree'] = defandFree;
cpickm_bid = row.values.cpickm_bid.value;
snParams = [];
if (this.backSerialnoData && this.backSerialnoData[cpickm_bid]) {
this.backSerialnoData[cpickm_bid].forEach((row) => {
snParam = {
'pk_sn': row.values.pk_serialno.value,
'vsncode': row.values.vcode.value,
'nnum': row.values.nserialnum.value,
'nastnum': row.values.nserialastnum.value,
'csnunitid': row.values.csnunitid.value
};
snParams.push(snParam);
});
}
item['snParams'] = snParams;
items.push(item);
});
let data = {
backData: items,
pageid: this.pageid,
isCard: this.isCard
}
ajax({
url: URL.backDeliverURL,
data: data,
success: res => {
if (res.success) {
if (this.isPickm) {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
props.dealFormulamsg(res.formulamsg);
}
if (data === undefined) {
//订单编号
this.setState({
vbillcode: '',
billId: ''
});
return;
}
//渲染数据,
if (callback) {
callback.call(this, res.data);
}
}
props.modal.close('BackDeliverDlg');
showSuccessInfo(getLangByResId(this, '5008Pub-000022'));/* 国际化处理: 退料成功*/
}
}
});
});
}

View File

@ -0,0 +1,107 @@
/*
* @Author: hujieh
* @PageInfo: 物料编辑后事件功能(单据处理辅助属性相关)
* @Date: 2018-08-14 19:10:07
* @Last Modified by: hujieh
* @Last Modified time: 2018-10-23 20:58:19
*/
import { ajax, base, toast } from 'nc-lightapp-front';
import { stringify } from 'querystring';
/**
* 物料辅助属性编辑前处理如果是参照类型添加过滤控制
* @param {*} props
* @param {*} appcode 小应用编码可以为空
* @param {*} pagecode 页面编码
* @param {*} areacode 辅助属性所在的区域编码
* @param {*} key 触发事件的字段编码
* @param {*} record 行数据
*/
function resetItem(props, appcode, pagecode, areacode, key, record, configName, pk_org_field) {
let meta = props.meta.getMeta();
let item = meta[areacode].items.find((item) => item.attrcode == key);
if (item.itemtype == 'refer') {
item.queryCondition = (params) => {
let queryCondition = {};
//queryCondition = {
// ...(typeof queryCondition === 'function'
// ? queryCondition(params)
// : typeof queryCondition === 'object' ? queryCondition : {})
//};
let reftype_key = 'TreeRefActionExt';
if (params.refType == 'grid' || params.refType == 'gridTree') {
reftype_key = 'GridRefActionExt';
}
if (pk_org_field && record.values[pk_org_field]) {
queryCondition.pk_org = record.values[pk_org_field].value;
}
else if (record.values['pk_org']) {
queryCondition.pk_org = record.values['pk_org'].value;
}
queryCondition.appcode = appcode;
queryCondition.pagecode = pagecode;
queryCondition.areacode = areacode;
queryCondition.configName = configName;
queryCondition.data = JSON.stringify({ [areacode]: { areacode: areacode, rows: [record] } });
queryCondition.defineField = key;
queryCondition[reftype_key] = 'nccloud.web.mmpub.pub.marasst.MarAsstDefaultRef';
queryCondition['UsualGridRefActionExt'] = 'nccloud.web.mmpub.pub.marasst.MarAsstDefaultRef';
return queryCondition;
};
props.meta.setMeta(meta);
}
}
/**
* 物料辅助属性编辑后处理如果受控字段的值不在值域内则清空
* @param {*} props
* @param {*} appcode
* @param {*} pagecode
* @param {*} areacode
* @param {*} key
* @param {*} material_field
* @param {*} record
* @param {*} index
*/
function afterEdit(props, appcode, pagecode, areacode, key, material_field, record, index,configName) {
let data = {
appcode,
pagecode,
areacode,
configName,
controlField: key,
controlValue: (record.values[key] || {}).value,
materialvid: (record.values[material_field] || {}).value
};
ajax({
url: '/nccloud/mmpub/pub/marasstAfterEdit.do',
data: data,
mode: 'normal',
success: (res) => {
console.log(res, 'hj');
if (res.data && res.data.data) {
for (let i in res.data.data) {
let values = res.data.data[i];
if (!values || values.length == 0) {
props.cardTable.setValByKeyAndIndex(areacode, index, i, {
value: null,
display: null,
scale: -1
});
} else {
let value = (record.values[i] || {}).value;
if (!values.includes(value)) {
props.cardTable.setValByKeyAndIndex(areacode, index, i, {
value: null,
display: null,
scale: -1
});
}
}
}
}
}
});
}
export default { resetItem, afterEdit };

View File

@ -0,0 +1,196 @@
import { ajax } from 'nc-lightapp-front';
import { URL } from '../../../pickmconstance';
import { simplifyData } from '../../../../../../mmpub/mmpub/pub/tool/simplifyDataUtil';
import { showSuccessInfo, showErrorInfo, showWarningInfo } from '../../../../../../mmpub/mmpub/pub/tool/messageUtil';
import clocationBeforeEvent from '../../../utils/pickmClocationBeforEvent';
let tableId = 'back_body';
let formId = 'back_head';
export default async function batchEvents(obj) {
if (!obj) {
return;
}
let areaCode = obj.areaCode; //区域编码
let column = obj.column; //列信息
let newValue = obj.newValue; //变更的行信息
let queryValue = [];
let changedrows = obj.changedrows; //变更的信息仅包含newValue和OldValue
let currentIndex = obj.currentIndex; //当前行
let indexs = [];
let rows = [];
let attrcode = column.attrcode; //列code
let queryCondition; //统一过滤的过滤条件
let isManyCondition = null; //是否多个过滤条件
let pasteData = obj.pasteData; //粘贴的值
let pageCode = '50080102_backdeliver';
let editFields = [
'cdeliverorgid', 'cdeliverorgvid', 'coutstockid', 'csupplyorgid', 'csupplyorgvid',
'cinstockid', 'vbatchcode', 'nbccknum', 'nbcckastnum', 'clocationid',
'cbvendorid', 'cbproductorid', 'cbprojectid', 'cbcustomerid', 'cbqualitylevelid', 'cbffileid',
'vbfree1', 'vbfree2', 'vbfree3', 'vbfree4', 'vbfree5',
'vbfree6', 'vbfree7', 'vbfree8', 'vbfree9', 'vbfree10',
'vbdef1', 'vbdef2', 'vbdef3', 'vbdef4', 'vbdef5', 'vbdef6', 'vbdef7', 'vbdef8', 'vbdef9', 'vbdef10',
'vbdef11', 'vbdef12', 'vbdef13', 'vbdef14', 'vbdef15', 'vbdef16', 'vbdef17', 'vbdef18', 'vbdef19', 'vbdef20'
];
if (!editFields.includes(attrcode)) {
return false;
}
//计划出库数量
if (attrcode == 'nbccknum' || attrcode == 'nbcckastnum') {
for (let i = 0; i < newValue.length; i++) {
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
}
//发料组织
else if (attrcode == 'cdeliverorgid' || attrcode == 'cdeliverorgvid') {
for (let i = 0; i < newValue.length; i++) {
//备料来源=备料的表体行的发料组织不允许编辑
if (newValue[i].values.fitemsource && newValue[i].values.fitemsource.value && newValue[i].values.fitemsource.value == 0) {
continue;
}
newValue[i].values.coutstockid = {
value: null,
display: null
};
newValue[i].values.clocationid = {
value: null,
display: null
};
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
}
else if (attrcode == 'coutstockid') {//发料仓库
for (let i = 0; i < newValue.length; i++) {
//如果发料组织没有值就不允许编辑
if (!(newValue[i].values.cdeliverorgid && newValue[i].values.cdeliverorgid.value)) {
continue;
}
newValue[i].queryCondition = {
pk_org: newValue[i].values.cdeliverorgid.value,
// isWW: refWW,
GridRefActionExt: URL.stordocRefURL
};
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
isManyCondition = true;
}
//货位
else if (attrcode == 'clocationid') {
for (let i = 0; i < newValue.length; i++) {
let stockid = newValue[i].values.coutstockid;
if (!(stockid && stockid.value)) {
continue;
}
let flag = await clocationBeforeEvent.call(this, props, null, attrcode, stockid.value);
if (!flag) {
continue;
}
newValue[i].queryCondition = {
pk_stordoc: stockid.value,
TreeRefActionExt: 'nccloud.web.mmpub.pub.ref.ClocationRefSqlBuilder'
};
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
isManyCondition = true;
}
else {
for (let i = 0; i < newValue.length; i++) {
if (!(newValue[i].values.cbmaterialvid && newValue[i].values.cbmaterialvid.value)) {
continue;
}
queryValue.push(newValue[i]);
indexs[i] = currentIndex + i;
rows[i] = [i];
}
}
this.props.cardTable.updateAfterBatchChange({
areaCode,
column,
indexs,
queryValue,
changedrows,
pasteData,
queryCondition,
isManyCondition
})
.then((res) => {
let props = res.props;
changedrows = res.changedrows;
indexs = res.indexs;
let userobject = { };
let data = createGridCardTableAfterBatchData(props,pageCode,tableId,tableId,attrcode,changedrows,indexs,userobject);
ajax({
url: '/nccloud/mmpac/pickm/backDeliverAfterEdit.do',
data: data,
async: false,
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
props.dealFormulamsg(
res.formulamsg, //参数一:返回的公式对象
{
card_body: 'cardTable'
}
);
}
if (res.success) {
if (res.data && res.data.grid['back_body']) {
let rows = res.data.grid['back_body'].rows;
let updateArray = [];
for (let j = 0; j < indexs.length; j++) {
let i = indexs[j];
let row = rows[i];
let obj = { index: i, data: row };
updateArray.push(obj);
}
if (updateArray.length > 0) {
props.cardTable.updateDataByIndexs(areaCode, updateArray);
}
}
}
if(res.data.userObject&&res.data.userObject.batchMsg){
showWarningInfo(null,res.data.userObject.batchMsg);
}
}
});
});
}
function createGridCardTableAfterBatchData(props, pageCode, areaCode, moduleId, key, changedrows, indexs, userobject) {
let grid = {
templetid: props.meta.getMeta().pageid,
pageid: pageCode,
[pageCode]: {
areaType: 'table',
areacode: areaCode,
rows: props.cardTable.getAllRows(areaCode, false)
}
};
// 减少上行流量
grid[areaCode] = simplifyData(grid[areaCode]);
return {
attrcode: key,
changedrows: changedrows,
grid: grid,
index: 0,
indexs : indexs ,
userobject: userobject
};
}

View File

@ -0,0 +1,181 @@
import { showWarningInfo } from '../../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { ajax, base, toast } from 'nc-lightapp-front';
import {
createGridCardTableAfterEventData,
processGridCardTableEditResult
} from '../../../../../../mmpub/mmpub/pub/tool/afterEditUtil';
import { bodyfixAssts, FIELD ,bodyCustAndSupFild} from '../../../pickmconstance';
import { marAsstUtils } from '../../../../../../mmpub/mmpub/pub/tool';
import { processBatchCodeValue } from '../../../utils/pickmBatchCodeUtil';
import { getLangByResId } from '../../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
export default async function afterEvent(props, moduleId, key, value, changedrows, i, record) {
let afterEditFile = ['coutstockid', 'cinstockid', 'vbatchcode', 'nbccknum', 'nbcckastnum'];
if (changedrows && changedrows[0].newvalue.value == changedrows[0].oldvalue.value && key != 'vbatchcode') {
return;
}
if (key == 'vbatchcode') {
if (changedrows[0].newvalue.value && changedrows[0].newvalue.value.includes(',')) {
showWarningInfo(getLangByResId(this, '5008Pub-000023'));/* 国际化处理: 退料时批次号不支持多选!*/
props.cardTable.setValByKeyAndIndex(moduleId, i, 'vbatchcode', {
value: changedrows[0].oldvalue.value,
display: changedrows[0].oldvalue.value
});
return;
}
props.cardTable.setValByKeyAndIndex(moduleId, index, 'vbatchcode', {
value: null,
display: null,
scale: '-1'
});
props.cardTable.setValByKeyAndIndex(moduleId, index, 'pk_batchcode', {
value: null,
display: null,
scale: '-1'
});
}
//发料组织
if (key == 'cdeliverorgid' || key == 'cdeliverorgvid') {
props.cardTable.setValByKeyAndIndex(moduleId, i, 'coutstockid', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'clocationid', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'vbatchcode', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'pk_batchcode', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'noutstocknum', {
value: null,
display: null
});
let ninstocknum = props.cardTable.getValByKeyAndIndex(moduleId, i, 'ninstocknum');
if (ninstocknum && ninstocknum.value) {
props.cardTable.setValByKeyAndIndex(moduleId, i, 'ntotalstocknum', {
value: ninstocknum.value,
display: ninstocknum.display
});
}
else {
props.cardTable.setValByKeyAndIndex(moduleId, i, 'ntotalstocknum', {
value: null,
display: null
});
}
}
//供应组织
else if (key == 'csupplyorgid' || key == 'csupplyorgvid') {
props.cardTable.setValByKeyAndIndex(moduleId, i, 'cinstockid', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'clocationid', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'vbatchcode', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'pk_batchcode', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'ninstocknum', {
value: null,
display: null
});
let noutstocknum = props.cardTable.getValByKeyAndIndex(moduleId, i, 'noutstocknum');
if (noutstocknum && noutstocknum.value) {
props.cardTable.setValByKeyAndIndex(moduleId, i, 'ntotalstocknum', {
value: noutstocknum.value,
display: noutstocknum.display
});
}
else {
props.cardTable.setValByKeyAndIndex(moduleId, i, 'ntotalstocknum', {
value: null,
display: null
});
}
}
else if (key == 'nbccknum' || key == 'nbcckastnum') {
if (!changedrows[0].newvalue || !changedrows[0].newvalue.value) {
props.cardTable.setValByKeyAndIndex(moduleId, i, 'nbccknum', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'nbcckastnum', {
value: null,
display: null
});
return;
}
}
//需用工序
else if (key == 'vpmoprocessno' || key == 'vdmoprocessno') {
if (!value) {
props.cardTable.setValByKeyAndIndex(moduleId, i, 'vprocessno', {
value: null,
display: null
});
props.cardTable.setValByKeyAndIndex(moduleId, i, 'vprocesscode', {
value: null,
display: null
});
return;
}
}
else if (bodyfixAssts.includes(key) || key.startsWith('vbfree')) {
let appcode = '50080102';
if (props.getAppCode().startsWith('5009')) {
appcode = '50090102';
}
marAsstUtils.afterEdit.call(this, props, appcode, '50080102_backdeliver', moduleId, key, FIELD.cbmaterialvid, record, i, 'mmpac.mm_pickm_b',bodyCustAndSupFild);
}
//编辑后处理
// if (afterEditFile.includes(key)) {
let userobject = {};
if (key == 'vbatchcode') {
userobject = processBatchCodeValue(props, moduleId, value, []);
}
let data = createGridCardTableAfterEventData(
props,
'50080102_backdeliver',
'back_body',
moduleId,
key,
changedrows,
i,
userobject
);
ajax({
url: '/nccloud/mmpac/pickm/backDeliverAfterEdit.do',
data: data,
async: false,
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
props.dealFormulamsg(res.formulamsg);
}
// if (res.data && res.data.body && res.data.body[moduleId]) {
// props.cardTable.setTableData(moduleId, res.data.body[moduleId]);
// }
processGridCardTableEditResult(props, moduleId, res.data, i);
//RownoUtils.setRowNo(props, moduleId, ATTRCODES.crowno);
let tableData = props.cardTable.getAllData(moduleId, true);
let backData = props.backData;
backData.body = tableData;
this.props.setBackDeliverData(backData);
}
});
//}
}

View File

@ -0,0 +1,182 @@
import { isWWPickmTransType } from '../../../utils/pickmTransTypeUtil';
import { URL, FIELD, bodyfixAssts,bodyCustAndSupFild } from '../../../pickmconstance';
import clocationBeforeEvent from '../../../utils/pickmClocationBeforEvent';
import vfreeBeforeEvent from '../../../utils/pickmVfreeBeforeEvent';
import { marAsstUtils } from '../../../../../../mmpub/mmpub/pub/tool';
import { processBatchCodeItem, batchcodeBeforeEvent } from '../../../utils/pickmBatchCodeUtil';
let formId = 'back_head';
let tableId = 'back_body';
export default async function beforeEvent(props, moduleId, key, value, index, record) {
let meta = this.props.meta.getMeta();
let editFields = [
'cdeliverorgid', 'cdeliverorgvid', 'coutstockid', 'csupplyorgid', 'csupplyorgvid',
'cinstockid', 'vbatchcode', 'nbccknum', 'nbcckastnum', 'clocationid',
'cbvendorid', 'cbvendorvid', 'cbproductorid', 'cbprojectid', 'cbcustomerid', 'cbcustomervid','cbqualitylevelid', 'cbffileid',
'vbfree1', 'vbfree2', 'vbfree3', 'vbfree4', 'vbfree5',
'vbfree6', 'vbfree7', 'vbfree8', 'vbfree9', 'vbfree10',
'vbdef1', 'vbdef2', 'vbdef3', 'vbdef4', 'vbdef5', 'vbdef6', 'vbdef7', 'vbdef8', 'vbdef9', 'vbdef10',
'vbdef11', 'vbdef12', 'vbdef13', 'vbdef14', 'vbdef15', 'vbdef16', 'vbdef17', 'vbdef18', 'vbdef19', 'vbdef20'
];
if (!editFields.includes(key)) {
return false;
}
let flag = true;
let isWW = false;
let cbusitype = props.form.getFormItemsValue(formId, 'vbusitypeid');
if (cbusitype && cbusitype.value) {
//是否委外
isWW = await isWWPickmTransType.call(this, props, cbusitype.value);
}
//供应组织
if (key == 'csupplyorgid' || key == 'csupplyorgvid') {
if (!isWW) {
return false;
}
let item = meta[moduleId].items.find((item) => item.attrcode == key);
let pk_org = this.props.form.getFormItemsValue(formId, 'pk_org').value;
let cmaterialvid = props.cardTable.getValByKeyAndIndex(tableId, index, 'cbmaterialvid').value;
item.queryCondition = () => {
return {
orgtype: item.attrcode == 'csupplyorgid' ? 'pk_org' : 'pk_org_v',
pk_org: pk_org,
cmaterialvid: cmaterialvid,
GridRefActionExt: URL.relationOrgRefURL
};
}
}
//供应仓库
else if (key == 'cinstockid') {
if (!isWW) {
return false;
}
let item = meta[moduleId].items.find((item) => item.attrcode == key);
let pk_org = props.cardTable.getValByKeyAndIndex(tableId, index, 'csupplyorgid').value;
item.queryCondition = () => {
return {
pk_org: pk_org,
isWW: false,
GridRefActionExt: URL.stordocRefURL
};
}
}
//发料组织
else if (key == 'cdeliverorgid' || key == 'cdeliverorgvid') {
if (isWW) {
return false;
}
let fitemsource = props.cardTable.getValByKeyAndIndex(tableId, index, 'fitemsource');
//备料来源=备料的表体行的发料组织不允许编辑
if (fitemsource && fitemsource.value && fitemsource.value == 0) {
return false;
}
let item = meta[moduleId].items.find((item) => item.attrcode == key);
let pk_org = this.props.form.getFormItemsValue(formId, 'pk_org').value;
let cmaterialvid = props.cardTable.getValByKeyAndIndex(tableId, index, 'cbmaterialvid').value;
item.queryCondition = () => {
return {
orgtype: item.attrcode == 'cdeliverorgid' ? 'pk_org' : 'pk_org_v',
pk_org: pk_org,
cmaterialvid: cmaterialvid,
GridRefActionExt: URL.relationOrgRefURL
};
}
}
//发料仓库
else if (key == 'coutstockid') {
if (isWW) {
return false;
}
let item = meta[moduleId].items.find((item) => item.attrcode == key);
let pk_org = props.cardTable.getValByKeyAndIndex(tableId, index, 'cdeliverorgid').value;
item.queryCondition = () => {
return {
pk_org: pk_org,
isWW: isWW,
GridRefActionExt: URL.stordocRefURL
};
}
}
//货位
else if (key == 'clocationid') {
let stockid = props.cardTable.getValByKeyAndIndex(tableId, index, 'coutstockid');
//委外类型
if (isWW) {
stockid = props.cardTable.getValByKeyAndIndex(tableId, index, 'cinstockid');
}
if (!stockid || !stockid.value) {
return false;
}
flag = await clocationBeforeEvent.call(this, props, moduleId, key, stockid.value);
if (!flag) {
return flag;
}
let item = meta[moduleId].items.find((item) => item.attrcode == key);
item.queryCondition = () => {
return {
pk_stordoc: stockid.value,
TreeRefActionExt: 'nccloud.web.mmpub.pub.ref.ClocationRefSqlBuilder'
};
}
}
//批次号
else if (key == 'vbatchcode') {
let pk_org = props.form.getFormItemsValue(formId, 'pk_org');
let materialvid = props.cardTable.getValByKeyAndIndex(tableId, index, 'cbmaterialvid');
if (!materialvid || !materialvid.value) {
return false;
}
else {
flag = await batchcodeBeforeEvent.call(this, props, moduleId, key, pk_org.value, materialvid.value);
}
if (!flag) {
return false;
} //当批次号可编辑时,处理批次号参照弹出框里的数据
processBatchCodeItem.call(this, props, moduleId, key, record, '55A3');
}
else if (key.startsWith('vbfree')) {
//辅助属性
let pk_org = this.props.form.getFormItemsValue(formId, FIELD.pk_org).value;
let materialvid = props.cardTable.getValByKeyAndIndex(tableId, index, FIELD.cbmaterialvid);
if (!materialvid || !materialvid.value) {
return false;
}
let constance = {};
constance.key = key;
constance.params = {
key: key,
pk_org: pk_org,
cmaterialvid: materialvid.value,
prefix: 'vbfree'
};
flag = await vfreeBeforeEvent(this.props, constance);
if (flag) {
let appcode = '50080102';
if (props.getAppCode().startsWith('5009')) {
appcode = '50090102';
}
marAsstUtils.resetItem.call(this, props, appcode, '50080102_backdeliver', moduleId, key, record, 'mmpac.mm_pickm_b','pk_org',bodyCustAndSupFild);
}
}else if (bodyfixAssts.includes(key)) {
let bmvid = props.cardTable.getValByKeyAndIndex(tableId, index, FIELD.cbmaterialvid);
if (bmvid && bmvid.value) {
let appcode = '50080102';
if (props.getAppCode().startsWith('5009')) {
appcode = '50090102';
}
marAsstUtils.resetItem.call(this, props, appcode, '50080102_backdeliver', moduleId, key, record, 'mmpac.mm_pickm_b','pk_org',bodyCustAndSupFild);
}
flag = true;
}else{
let item = meta[moduleId].items.find((item) => item.attrcode == key);
let pk_org = props.cardTable.getValByKeyAndIndex(moduleId, index, 'pk_org').value;
item.queryCondition = () => {
return {
pk_org: pk_org
};
}
}
this.props.meta.setMeta(meta);
return flag;
}

View File

@ -0,0 +1,4 @@
import bodyafterEvent from './bodyafterEvent';
import bodybeforeEvent from './bodybeforeEvent';
import batchEvent from './batchEvent';
export { bodyafterEvent, bodybeforeEvent,batchEvent };

View File

@ -0,0 +1,94 @@
import { createPage, base, ajax, high } from 'nc-lightapp-front';
import React, { Component } from 'react';
import { initLang, getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import { initTemplate } from './init';
import { bodybeforeEvent, bodyafterEvent ,batchEvent } from './events';
import './index.less';
let { NCButton: Button, NCModal: Modal } = base;
class PickmBackDeliverDLG extends Component {
constructor(props) {
super(props);
this.BodyContent = null;
props.use.form('back_head');
props.use.cardTable('back_body');
this.state = {
show: false // 操作列弹窗的显示
};
initLang(this, ['5008Pub'], 'mmpac', initTemplate.bind(this, this.props));
}
componentDidMount() {
//this.initData();
}
//请求列表数据
initData = () => {
let showdata = this.props.backData;
if (showdata.head && showdata.body&& showdata.body.rows) {
this.props.form.setAllFormValue({ ['back_head']: showdata.head });
this.props.cardTable.setTableData('back_body',showdata.body);
}
else {
this.props.form.EmptyAllFormValue('back_head');
this.props.cardTable.setTableData('back_body', { rows: [] });
}
this.props.setBackDeliverProps(this.props);
};
clickSerialnoBtn = () => {
this.props.clickSerialnoBtn();
}
getTableHead = (buttons) => {
return (
<div className='definition-icons'>
<Button onClick={() => this.clickSerialnoBtn()}>{getLangByResId(this, '5008Pub-000020')}</Button>{/* 国际化处理 序列号*/}
</div>
);
};
render() {
let { show, form, cardTable, editTable } = this.props;
let { createForm } = form;
let { createCardTable } = cardTable;
let title = getLangByResId(this, '5008Pub-000018');/* 国际化处理: 退料*/
let size = 'normal-size';
return (
<div className="nc-bill-card pickmback-nc-bill-card" >
<div className='nc-bill-form-area'>
{createForm('back_head', {
})}
</div>
<div className="nc-bill-table-area ">
{/* {this.getTableHead(buttons)} */}
{createCardTable('back_body', {
tableHead: this.getTableHead.bind(this),
//tableHeadLeft: this.getTableHeadLeft,
onAfterEvent: bodyafterEvent.bind(this),
showCheck: false,
hideAdd: false,
showIndex: true,
maxZIndex: 290,
adaptionHeight: true,
showToggleAngle: false,
hideSwitch: () => { return false },
//hideModelSave: true,
//onSelected: this.delLineDis.bind(this),
//onSelectedAll: this.delLineDis.bind(this),
onBeforeEvent: bodybeforeEvent.bind(this),
onBatchChange : batchEvent.bind(this),
scrollContainer: () => document.querySelector('.base-modal-body')
})}
</div>
</div>
);
}
}
PickmBackDeliverDLG = createPage({
billinfo: {
billtype: 'card',
pagecode: '50080102_backdeliver',
headcode: 'back_head',
bodycode: 'back_body'
},
//initTemplate: initTemplate
orderOfHotKey:['back_body']
})(PickmBackDeliverDLG);
export default PickmBackDeliverDLG;

View File

@ -0,0 +1,8 @@
.pickmback-nc-bill-card {
background-color: white;
background-color: var(--pui-black-derived-color-11, white);
}
.pickmback-nc-bill-card .pickmback-nc-bill-bottom-area {
background: white;
background: var(--pui-black-derived-color-11, white);
}

View File

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

View File

@ -0,0 +1,29 @@
import { ajax } from 'nc-lightapp-front';
import { columnSortUtils } from '../../../../../../mmpub/mmpub/pub/tool/columnSortUtils';
export default function (props) {
let appcode = props.getAppCode();
if (props.getAppCode().startsWith('5009')) {
appcode = '50090102';
}
else if (props.getAppCode().startsWith('5008')) {
appcode = '50080102';
}
let dlgcode = '50080102_backdeliver';
let TABLE_ID = 'back_body';
//请求模板数据
props.createUIDom(
{
appcode: appcode,
pagecode: dlgcode //卡片页面编码
},
(templedata) => {
if (templedata.template) {
let meta = templedata.template;
// 行号排序处理
columnSortUtils.numberSort(meta, TABLE_ID, 'vrowno');// 行号排序处理
props.meta.setMeta(meta);
this.initData();
props.cardTable.setStatus(TABLE_ID, 'edit');
}
});
}

View File

@ -0,0 +1,3 @@
{
"hash": false
}

View File

@ -0,0 +1,3 @@
import PickmBackDeliverDLG from './card';
import {pickmBackDeliver} from './btnClicks/pickmBackDeliver';
export {PickmBackDeliverDLG,pickmBackDeliver};

View File

@ -0,0 +1,86 @@
import { showWarningInfo } from '../../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { ajax, base, toast } from 'nc-lightapp-front';
import {
createGridCardTableAfterEventData,
processGridCardTableEditResult
} from '../../../../../../mmpub/mmpub/pub/tool/afterEditUtil';
const TABLE_HEAD = 'serialno_head';
const TABLE_BODY = 'serialno_body';
export default async function bodyAfterEvent(props, moduleId, key, value, changedrows, i) {
if (changedrows &&changedrows.length==1&& changedrows[0].newvalue.value == changedrows[0].oldvalue.value) {
return;
}
let meta = this.props.meta.getMeta();
let itemFields = [
'nserialnum',
'nserialastnum',
'itemunitid',
'itemastunitid'
];
if (key === 'vcode') {
if (value.length == 0 || !value.values) {
meta[TABLE_BODY].items.forEach((item) => {
if (!itemFields.includes(item.attrcode)) {
props.cardTable.setValByKeyAndIndex(moduleId, i, item.attrcode, {
value: null,
display: null
});
}
});
return;
}
let num = this.props.cardTable.getValByKeyAndIndex(TABLE_BODY, 0, 'nserialnum');
let nastnum = this.props.cardTable.getValByKeyAndIndex(TABLE_BODY, 0, 'nserialastnum');
let unit = this.props.cardTable.getValByKeyAndIndex(TABLE_BODY, 0, 'itemunitid');
let astunit = this.props.cardTable.getValByKeyAndIndex(TABLE_BODY, 0, 'itemastunitid');
let headindex=0;
let head=this.props.editTable.getClickRowIndex('serialno_head');
if (head&&head.index) {
headindex = head.index;
}
let cpickmbid = props.editTable.getValByKeyAndIndex('serialno_head', headindex, 'cpickm_bid');
let userobject = {
cpickmbid:cpickmbid.value,
nserialnum:num.value,
nserialastnum:nastnum.value,
itemunitid:unit.value,
itemastunitid:astunit.value
};
let data = createGridCardTableAfterEventData(
props,
'50080102_serialno',
TABLE_BODY,
moduleId,
key,
changedrows,
i,
userobject
);
ajax({
url: '/nccloud/mmpac/pickm/backSerialnoAfterEdit.do',
data: data,
async: false,
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
props.dealFormulamsg(res.formulamsg);
}
// if (res.data && res.data.body && res.data.body[STOREREQ_CARD.tableId]) {
// props.cardTable.setTableData(STOREREQ_CARD.tableId, res.data.body[STOREREQ_CARD.tableId]);
// }
//props.editTable.updateTableData(moduleId,res.data.grid[moduleId]);
processGridCardTableEditResult(props, moduleId, res.data, i);
//RownoUtils.setRowNo(props, STOREREQ_CARD.tableId, ATTRCODES.crowno);
let tableData=props.cardTable.getAllData(moduleId, true);
let bodys=[];
tableData.rows.forEach((row) => {
if(row.values.vcode&&row.values.vcode.value){
bodys.push(row);
}
});
props.serialnoData[cpickmbid.value]=bodys;
}
});
}
}

View File

@ -0,0 +1,26 @@
export default async function bodyBeforeEvent(props, moduleId, key, value, index, record) {
let meta = this.props.meta.getMeta();
if (key == 'vcode') {
let item = meta[moduleId].items.find((item) => item.attrcode == key);
item.isMultiSelectedEnabled = true;
let headindex = 0;
let head = this.props.editTable.getClickRowIndex('serialno_head');
if (head && head.index) {
headindex = head.index;
}
let cpickmbid = props.editTable.getValByKeyAndIndex('serialno_head', headindex, 'cpickm_bid');
item.queryCondition = () => {
return {
cpickmbid: cpickmbid.value
};
}
this.props.meta.setMeta(meta);
return true;
}
else {
return false;
}
}

View File

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

View File

@ -0,0 +1,107 @@
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { createPage, ajax, base, high } from 'nc-lightapp-front';
const { Refer } = high;
import { initTemplate } from './init';
import { serialnoAddLineBtn } from '../btnClicks/pickmBackSerialnoAddLineClick';
import { initLang, getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
import { bodyBeforeEvent, bodyAfterEvent } from './events'
const { NCModal } = base;
const TABLE_HEAD = 'serialno_head';
const TABLE_BODY = 'serialno_body';
let { NCButton: Button, NCModal: Modal } = base;
class PickmBackSerialnoDlg extends Component {
constructor(props) {
super(props);
props.use.editTable(TABLE_HEAD);
props.use.cardTable(TABLE_BODY);
this.state = {
};
initLang(this, ['5008Pub'], 'mmpac', initTemplate.bind(this, this.props));
}
componentDidMount() {
// this.initData();
}
//请求列表数据
initData = () => {
let headData = this.props.headData;
this.props.editTable.setTableData(TABLE_HEAD, headData[TABLE_HEAD]);
if (this.props.serialnoData) {
let cpickmbid = this.props.editTable.getValByKeyAndIndex(TABLE_HEAD, 0, 'cpickm_bid').value;
let bodys = this.props.serialnoData[cpickmbid] ? { rows: this.props.serialnoData[cpickmbid] } : { rows: [] };
this.props.cardTable.setTableData(TABLE_BODY, bodys);
}
};
onRowClick = (props, moduleId, record, index, e) => {
let bodys = { rows: [] };
if (this.props.serialnoData) {
let cpickmbid = this.props.editTable.getValByKeyAndIndex(TABLE_HEAD, index, 'cpickm_bid').value;
if (this.props.serialnoData[cpickmbid]) {
bodys.rows = this.props.serialnoData[cpickmbid];
}
}
this.props.cardTable.setTableData(TABLE_BODY, bodys);
}
onRowDoubleClick = (record, index, props, e) => {
let bodys = { rows: [] };
if (this.props.serialnoData) {
let cpickmbid = this.props.editTable.getValByKeyAndIndex(TABLE_HEAD, index, 'cpickm_bid').value;
if (this.props.serialnoData[cpickmbid]) {
bodys.rows = this.props.serialnoData[cpickmbid];
}
}
this.props.cardTable.setTableData(TABLE_BODY, bodys);
}
getTableHead = (buttons) => {
return (
<div className='definition-icons'>
<Button onClick={serialnoAddLineBtn.bind(this)}>{getLangByResId(this, '5008Pub-000024')}</Button></div>
);
};
render() {
let { cardTable, editTable } = this.props;
let { createCardTable } = cardTable;
let { createEditTable } = editTable;
return <div class="flex-container" style={{ height: '100%' }}>
<div class="flex-container">
{createEditTable(TABLE_HEAD, {
showIndex: true,
height: 150,
onRowClick: this.onRowClick.bind(this),
onRowDoubleClick: this.onRowDoubleClick.bind(this),
//onAfterEvent: headAfterEvent.bind(this),
//onBeforeEvent: headBeforeEvent.bind(this),
adaptionHeight: false,
isAddRow: false,
showCheck: false
})}</div>
<div class="flex-container">
{/* {this.getTableHead(buttons)} */}
{createCardTable(TABLE_BODY, {
tableHead: this.getTableHead.bind(this),
//tableHeadLeft: this.getTableHeadLeft,
onBeforeEvent: bodyBeforeEvent.bind(this),
onAfterEvent: bodyAfterEvent.bind(this),
showCheck: false,
hideAdd: false,
showIndex: true,
adaptionHeight: true,
hideSwitch: () => { return false }
})}
</div>
</div>;
}
}
PickmBackSerialnoDlg = createPage({
billinfo: {
billtype: 'grid',
pagecode: '50080102_serialno',
bodycode: 'serialno_body'
}
})(PickmBackSerialnoDlg);
export default PickmBackSerialnoDlg;

View File

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

View File

@ -0,0 +1,96 @@
import { ajax, base } from 'nc-lightapp-front';
import { getLangByResId } from '../../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
let { NCButton: Button, NCModal: Modal, NCPopconfirm } = base;
const TABLE_HEAD = 'serialno_head';
const TABLE_BODY = 'serialno_body';
export default function (props) {
let appcode = props.getAppCode();
if (props.getAppCode().startsWith('50090108')) {
appcode = '50090108';
}else if (props.getAppCode().startsWith('50080108')) {
appcode = '50080108';
}else if (props.getAppCode().startsWith('5009')) {
appcode = '50090102';
}else if (props.getAppCode().startsWith('5008')) {
appcode = '50080102';
} else if (props.sourceType && props.sourceType.startsWith('50090102')) {
appcode = '50090102';
} else if (props.sourceType && props.sourceType.startsWith('50080102')) {
appcode = '50080102';
} else if (props.sourceType && props.sourceType.startsWith('50090108')) {
appcode = '50090102';
} else if (props.sourceType && props.sourceType.startsWith('50080108')) {
appcode = '50080102';
}
let dlgcode = '50080102_serialno';
if(appcode == '50080108' || appcode == '50090108'){
dlgcode = '50080108_serialno';
}
//请求模板数据
props.createUIDom(
{
appcode: appcode,
pagecode: dlgcode //卡片页面编码
},
(templedata) => {
if (templedata.template) {
let meta = templedata.template;
meta[TABLE_BODY].items.forEach((item) => {
if (item.attrcode == 'vcode') {
props.cardTable.setColEditableByKey(TABLE_BODY, 'vcode', false);
// 序列号过滤
item.itemtype = 'refer';
item.refcode = 'mmpac/refer/PickmSerialNoRef/SerialNoRef/index.js';
item.isMultiSelectedEnabled = true;
}
else {
props.cardTable.setColEditableByKey(TABLE_BODY, item.attrcode, true);
}
});
let bporCol = {
label: getLangByResId(this, '5008Pub-000015'),/* 国际化处理: 操作*/
attrcode: 'cust_opr',
className: 'table-opr',
itemtype: 'customer', //默认必输
fixed: 'right', //锁定操作列
visible: true,
width: '100px',
render: (text, record, index) => {
return (<span className="code-detail-link" onClick={bodyDeleteLineBtnClick.bind(this, props, record, index)}
> {getLangByResId(this, '5008Pub-000025')}{/* 国际化处理: 删行*/}
</span>)
}
};
meta[TABLE_BODY].items.push(bporCol);
props.meta.setMeta(meta);
this.initData();
props.cardTable.setStatus(TABLE_BODY, 'edit');
}
});
}
function bodyDeleteLineBtnClick(props, record, index) {
props.cardTable.delRowsByIndex(TABLE_BODY, index);
let tableData = props.cardTable.getAllData(TABLE_BODY);
let bodys = [];
tableData.rows.forEach((row) => {
if (row.values.vcode && row.values.vcode.value) {
bodys.push(row);
}
});
let headindex = 0;
let head = props.editTable.getClickRowIndex(TABLE_HEAD);
if (head && head.index) {
headindex = head.index;
}
let cpickmbid = props.editTable.getValByKeyAndIndex(TABLE_HEAD, headindex, 'cpickm_bid');
props.serialnoData[cpickmbid.value] = bodys;
}

View File

@ -0,0 +1,37 @@
import { ajax, toast } from 'nc-lightapp-front';
import { URL } from '../../pickmconstance';
import PickmTakeOverDlg from '../list';
import pickmTakeOverOKBtnClicks from './pickmTakeOverOKBtnClicks';
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
export function pickmTakeOver(props, data,pageid,callback) {
debugger;
this.isUnTakeOver = data.isUnTakeOver;
this.pageid=pageid;
this.takeoverData = '';
let setTakeOverData = (val) => {
this.takeoverData = val;
};
ajax({
url: URL.takeoverQueryURL,
data: data,
success: res => {
if (res.success && res.data) {
props.modal.show('TakeOverDlg', {
size: 'xlg',
title: data.isUnTakeOver == true ? getLangByResId(this, '5008Pub-000037') : getLangByResId(this, '5008Pub-000038'),/* 国际化处理: 取消接收,接收*/
content:<PickmTakeOverDlg billQueryPara={res.data} param={data} props={this.props} setTakeOverData={setTakeOverData} />,
userControl :true,
leftBtnName: data.isUnTakeOver == true ? getLangByResId(this, '5008Pub-000037') : getLangByResId(this, '5008Pub-000038'),/* 国际化处理: 取消接收,接收*/
rightBtnName: getLangByResId(this, '5008Pub-000002'),/* 国际化处理: 取消*/
beSureBtnClick: pickmTakeOverOKBtnClicks.bind(this,props,data.isUnTakeOver,data.pickmbid,callback),
cancelBtnClick: () => {
props.modal.close('TakeOverDlg');
},
hideRightBtn: false, //隐藏足部右边的按钮默认是false不隐藏隐藏是true
hideLeftBtn: false //隐藏足部左边的按钮默认是false不隐藏隐藏是true
});
}
}
});
}

View File

@ -0,0 +1,55 @@
import { showWarningInfo, showSuccessInfo } from '../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { ajax, toast } from 'nc-lightapp-front';
import { URL, AREA, FIELD, PickmCache } from '../../pickmconstance';
import { getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
export default function clickOKBtn(props, isUnTakeOver, cpickmbid,callback) {
let items = [];
let item;
let itemfeild = isUnTakeOver ? ['chandtakebid', 'ts'] : ['chandtakebid', 'ts', 'crcvwhid', 'nrcvastnum', 'nrcvnum'];
let errInfo='';
if (!this.takeoverData || this.takeoverData.length < 1) {
showWarningInfo(isUnTakeOver ? getLangByResId(this, '5008Pub-000039') : getLangByResId(this, '5008Pub-000040'));/* 国际化处理: 请选择需要取消接收的数据!,请选择需要接收的数据!*/
return;
}
this.takeoverData.forEach((row) => {
if (!row.data.values.nrcvnum || row.data.values.nrcvnum.value <= 0 || !row.data.values.nrcvastnum || row.data.values.nrcvastnum.value <= 0) {
errInfo = errInfo + getLangByResId(this, '5008Pub-000041') + (row.index + 1) + getLangByResId(this, '5008Pub-000042')/* 国际化处理: 第,行接收数量必须大于0*/
}
else if (!row.data.values.crcvwhid || !row.data.values.crcvwhid.value) {
errInfo = errInfo + getLangByResId(this, '5008Pub-000041') + (row.index + 1) + getLangByResId(this, '5008Pub-000043')/* 国际化处理: 第,行移交仓库不能为空!*/
}
item = {};
itemfeild.forEach((feild) => {
item[feild] = row.data.values[feild] ? row.data.values[feild].value : null;
});
items.push(item);
});
if (errInfo) {
showWarningInfo(errInfo);
return;
}
let data = {
pickmbid: cpickmbid,
takeOverData: items,
isUnTakeOver: isUnTakeOver,
pageid: this.pageid,
}
ajax({
url: URL.takeoverURL,
data: data,
success: res => {
debugger;
if (res.success) {
if(callback){
callback.call(this,res);
}
props.modal.close('TakeOverDlg');
showSuccessInfo(isUnTakeOver ?getLangByResId(this, '5008Pub-000044'):getLangByResId(this, '5008Pub-000045'));/* 国际化处理: 取消接收成功,接收成功*/
}
}
});
}

View File

@ -0,0 +1,3 @@
{
"hash": false
}

View File

@ -0,0 +1,3 @@
import PickmTakeOverDlg from './list';
import {pickmTakeOver} from './btnClicks/pickmTakeOver'
export {PickmTakeOverDlg,pickmTakeOver}

View File

@ -0,0 +1,64 @@
import { showWarningInfo } from '../../../../../../mmpub/mmpub/pub/tool/messageUtil';
import { ajax, base, toast } from 'nc-lightapp-front';
import {
createGridAfterEventData,
processGridEditResult
} from '../../../../../../mmpub/mmpub/pub/tool/afterEditUtil';
import { getLangByResId } from '../../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
export default async function afterEvent(props, moduleId, key, value, changedrows, i) {
if (changedrows && changedrows[0].newvalue.value == changedrows[0].oldvalue.value) {
return;
}
if (key == 'nrcvastnum') {
let astnum = props.editTable.getValByKeyAndIndex(moduleId, i, 'ncanrcvastnum');
let ncanrcvastnum = astnum.value-0;
if (value < 0 || value > ncanrcvastnum) {
showWarningInfo(null, getLangByResId(this, '5008Pub-000046'));/* 国际化处理: 本次接收数量必须大于0,且不能大于可接收数量!!*/
props.editTable.setValByKeyAndIndex(moduleId, i, 'nrcvastnum', {
value: changedrows[0].oldvalue.value,
display: changedrows[0].oldvalue.display
});
return;
}
}
else if(key == 'nrcvnum'){
let nnum = props.editTable.getValByKeyAndIndex(moduleId, i, 'ncanrcvnum');
let ncanrcvnum = nnum.value-0;
if (value < 0 || value > ncanrcvnum) {
showWarningInfo(null, getLangByResId(this, '5008Pub-000046'));/* 国际化处理: 本次接收数量必须大于0,且不能大于可接收数量!!*/
props.editTable.setValByKeyAndIndex(moduleId, i, 'nrcvnum', {
value: changedrows[0].oldvalue.value,
display: changedrows[0].oldvalue.display
});
return;
}
}
if(key == 'nrcvastnum'||key == 'nrcvnum'){
let userobject={};
let data=createGridAfterEventData(
props,
'50080102_takeover',
'takeover',
moduleId,
key,
changedrows,
i,
userobject
);
ajax({
url: '/nccloud/mmpac/pickm/takeoverAfterEdit.do',
data: data,
async: false,
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
props.dealFormulamsg(res.formulamsg);
}
processGridEditResult(props, moduleId, res.data, i);
}
});
}
let tableData=this.props.editTable.getCheckedRows(moduleId);
this.props.setTakeOverData(tableData);
}

View File

@ -0,0 +1,28 @@
export default function beforeEvent(props, moduleId, item, index, value, record) {
debugger;
let meta = this.props.meta.getMeta();
let attrcode = item.attrcode;
let key = item.attrcode;
if (props.param.isUnTakeOver) {
return false;
}
let editFields = ['nrcvastnum', 'nrcvnum', 'crcvwhid'];
if (!editFields.includes(key)) {
return false;
}
if (key == 'crcvwhid') {
let item = meta[moduleId].items.find((item) => item.attrcode == attrcode);
let pk_org = props.editTable.getValByKeyAndIndex(moduleId, index, 'pk_org').value;
item.queryCondition = () => {
return {
pk_org:pk_org,
isWW:false,
GridRefActionExt: 'nccloud.web.mmpac.pickm.util.StordocSqlBuilder'
};
}
props.meta.setMeta(meta);
}
return true;
}

View File

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

View File

@ -0,0 +1,62 @@
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { createPage, ajax, base, high } from 'nc-lightapp-front';
let { NCButton: Button, NCModal: Modal } = base;
import { initLang, getLangByResId } from '../../../../../mmpub/mmpub/pub/tool/multiLangUtil';
const { Refer } = high;
import { initTemplate } from './init';
import { beforeEvent, afterEvent } from './events'
const { NCModal } = base;
const TABLE_ID = 'takeover';
class PickmTakeOverDlg extends Component {
constructor(props) {
super(props);
props.use.editTable(TABLE_ID);
debugger;
this.state = {
};
initLang(this, ['5008Pub'], 'mmpac', () => { });
}
componentDidMount() {
this.initData();
}
//请求列表数据
initData = () => {
debugger;
let showdata = null;
if (this.props.billQueryPara == undefined || this.props.billQueryPara == null) {
showdata = { rows: [] };
} else {
showdata = this.props.billQueryPara[TABLE_ID];
}
this.props.editTable.setTableData(TABLE_ID, showdata);
};
render() {
let { editTable } = this.props;
let { createEditTable } = editTable;
return <div class="flex-container" style={{ height: '100%' }}>
{createEditTable(TABLE_ID, {
showIndex: true,
onAfterEvent: afterEvent.bind(this),
onBeforeEvent: beforeEvent.bind(this),
isAddRow: false,
adaptionHeight: true,
showCheck: true,
selectedChange: () => {
let rows = this.props.editTable.getCheckedRows(TABLE_ID);
this.props.setTakeOverData(rows);
},
})}
</div>;
}
}
PickmTakeOverDlg = createPage({
initTemplate: initTemplate
})(PickmTakeOverDlg);
export default PickmTakeOverDlg;

View File

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

View File

@ -0,0 +1,35 @@
import { ajax } from 'nc-lightapp-front';
const TABLE_ID = 'takeover';
export default function (props) {
let appcode = props.getAppCode();
if (props.getAppCode().startsWith('5009')) {
appcode = '50090102';
}
else if (props.getAppCode().startsWith('5008')) {
appcode = '50080102';
}
let dlgcode = '50080102_takeover';
//请求模板数据
props.createUIDom(
{
appcode: appcode,
pagecode: dlgcode //卡片页面编码
},
(templedata) => {
if (templedata.template) {
let meta = templedata.template;
debugger;
props.meta.setMeta(meta);
if (props.param.isUnTakeOver) {
props.editTable.setStatus(TABLE_ID, 'browse');
props.editTable.hideColByKey(TABLE_ID, 'ncanrcvastnum');
props.editTable.hideColByKey(TABLE_ID, 'ncanrcvnum');
}
else {
props.editTable.setStatus(TABLE_ID, 'edit');
}
}
});
}

View File

@ -0,0 +1,23 @@
import { high } from 'nc-lightapp-front';
import { conf as unitConf } from '../../../../uap/refer/riart/groupTreeRef/index';
const { Refer } = high;
export var conf = {
multiLang: {
domainName: 'uapbd',
currentLocale: 'zh-CN',
moduleId: 'refer_uapbd',
},
refType: 'grid',
refName: 'refer-000218',/* 国际化处理: 工厂*/
placeholder: 'refer-000218',/* 国际化处理: 工厂*/
refCode: 'uapbd.refer.org.FactoryGridRef',
queryGridUrl: '/nccloud/uapbd/org/FactoryGridRef.do',
isMultiSelectedEnabled: false,
columnConfig: [{ name: ['refer-000002', 'refer-000003'], code: ['refcode', 'refname'] }],/* 国际化处理: 编码,名称*/
unitProps: unitConf,
isShowUnit: false
};
export default function (props = {}) {
return <Refer {...conf} {...props} />
}