示例其他入库拉新节点(入库申请单)
一、按钮注册
1、注册
应用注册-》其他入库
2、列表
按钮编码:Ref488S
按钮名称:入库申请单
父按钮编码:add2
按钮区域:list_head
3、卡片
按钮编码:Ref488S
按钮名称:入库申请单
父按钮编码:add2
按钮区域:list_head
二、单据类型
入库申请单(488S)增加下游单据其他入库(4A)
三、单据转换规则
1、增加规则
2、设置规则
按需求需要上游携带到下游的字段,自行配置
注:这四个字段必须配置,关系到“单据追溯”功能
四、配置拉单模板
1、其他入库单拉入库申请单
页面编码:400800888_488Sto4A
页面名称:其他入库单拉入库申请单
页面地址:../../../../ic/ic/generalin/main/index.html#/ref488S
2、入库申请按钮
按钮编码:Refresh
按钮区域:transfer_head
3、页面模板注册
模板编码:400800888_list_transfer
模板名称:其他入库单拉入库申请单界面
聚合类:nc.vo.ic.icgapply.GapplyVO
设置表头(表头设置出来才可选):表头
4、配置模板
注意区域类型
4.1、查询区
区域编码:search
查询区:查询区
设置类:nc.vo.ic.icgapply.GapplyHeadVO
关联元数据:入库申请单表头
4.2、表头
区域编码:head
区域名称:表头
设置类:nc.vo.ic.icgapply.GapplyHeadVO
关联元数据:入库申请单表头
4.3、表体
区域编码:body
区域名称:表体
设置类:nc.vo.ic.icgapply.GapplyBodyVO
关联元数据:入库申请单表体
4.4、主子表单
区域编码:view
区域名称:主子表单
关联元数据:入库申请单表头
五、前端代码
1、代码结构
2、常量
2.1、定义按钮和跳转
const URL = {
goto488STransfer: 'ref488S', //跳转到入库申请单界面
};
const BTNID = {
Ref488S: 'Ref488S', // 入库申请单
};
const AREA = {
browse: 'form_browse', // 浏览态展开
edit: 'childform2', // 编辑态展开
tableArea: 'generalinList',
queryArea: 'generalinQuery',
formArea: 'generalinhead',
bodyTable: 'generalinbody',
left: 'left',
listHeadBtnArea: 'list_head', //列表表头按钮区域
listInnerBtnArea: 'list_inner', //列表操作列按钮区域
cardHeadBtnArea: 'card_head', //卡片表头按钮区域
cardBodyBtnArea: 'card_body', //卡片表体按钮区域
cardBodyInnerBtnArea: 'card_body_inner' //卡片表体操作按钮区域
};
const BATCHCODE_FIELD = [
'pk_batchcode', //批次主键
'vbatchcode', //批次号
'dproducedate', //生产日期
'dvalidate', //失效日期
'ibcversion', //版本
'cqualitylevelid', //质量等级
'vvendbatchcode', //供应商批次号
'vbatchcodenote', //备注
'dinbounddate', //首次入库日期
'tchecktime', //检验时间
'bcseal', //批次是否封存
'tbcts', //批次时间戳
'vbcdef1',
'vbcdef2',
'vbcdef3',
'vbcdef4',
'vbcdef5',
'vbcdef6',
'vbcdef7',
'vbcdef8',
'vbcdef9',
'vbcdef10',
'vbcdef11',
'vbcdef12',
'vbcdef13',
'vbcdef14',
'vbcdef15',
'vbcdef16',
'vbcdef17',
'vbcdef18',
'vbcdef19',
'vbcdef20'
];
const PAGECODE = '400800820_list';
const PAGECARDCODE = '400800820_card';
const URL = {
combine: '/nccloud/ic/generalin/combine.do', // 合并显示
combineprint: '/nccloud/ic/pub/combineprint.do', // 合并打印
querypageURL: '/nccloud/platform/templet/querypage.do',
queryURL: '/nccloud/ic/generalin/querylist.do',
queryURLByPKs: '/nccloud/ic/generalin/querypks.do',
queryCardURL: '/nccloud/ic/generalin/queryCard.do',
maintainURL: '/nccloud/ic/generalin/maintain.do',
saveURL: '/nccloud/ic/generalin/save.do',
copyURL: '/nccloud/ic/generalin/copy.do',
canBeCopyURL: '/nccloud/ic/generalin/canbecopy.do', //判断是否有来源
signURL: '/nccloud/ic/generalin/sign.do',
saveSignURL: '/nccloud/ic/generalin/saveSign.do',
queryLocationURL: '/nccloud/ic/generalin/locationquery.do',
printUrl: '/nccloud/ic/generalin/print.do', //打印
printLocUrl: '/nccloud/ic/generalin/printloc.do', //打印货位
cardURL: '/card',
listURL: '/list',
gotoList: '/list',
gotoCard: '/card',
generalSetpiece: '/nccloud/ic/pub/generalSetpiece.do',
headAfterEdit: '/nccloud/ic/generalin/headAfterEdit.do', //卡片态表头编辑后事件处理
bodyAfterEdit: '/nccloud/ic/generalin/bodyAfterEdit.do', //卡片态表体编辑后事件处理
importSrcBillSN: '/nccloud/ic/generalin/importSrcBillSN.do', //导入来源单据序列号
checkMissionURL: '/nccloud/ic/generalin/checkpermission.do', //打印,修改数据权限校验
goto4A61Transfer: 'ref4A61', //跳转到领用单转单界面
goto4A63Transfer: 'ref4A63', //跳转到借用单转单界面
goto4A72Transfer: 'ref4A72', //跳转到租出归还
//lhw 20240125 入库申请单 begin
goto488STransfer: 'ref488S', //跳转到入库申请单界面
//end
transfer: '/nccloud/ic/generalin/transferinvo.do' //转单
};
const qryTemplateID = '1001Z81000000000746B';
const appID = '0001Z81000000002WTYR'; //采购入库小应用主键
const appcode = '400800820';
const tabURL = '/list';
const cardURL = '/card';
const UISTATE = {
edit: 'edit',
browse: 'browse'
};
const dataType = {
processing: 'processing',
unSign: 'unsign',
sign: 'sign',
all: 'all'
};
const queryConsCacheKey = 'generalinkey';
const tabCodeKey = 'generalintabcodekey';
const FIELD = {
status: 'status',
billtype: '4A',
id: 'id',
hid: 'cgeneralhid',
vbillcode: 'vbillcode',
fbillflag: 'fbillflag',
cwarehouseid: 'cwarehouseid',
pk_org_v: 'pk_org_v',
cmaterialvid: 'cmaterialvid',
bid: 'cgeneralbid',
ctrantypeid: 'ctrantypeid',
vtrantypecode: 'vtrantypecode',
formArea: 'generalinhead',
cardTable: 'generalinbody',
left: 'left'
};
//孙表信息常量
const SUBCHILD = {
pagecode: '400800820_loc', //模板编码
headcode: 'locHead', //表头区域
bodycode: 'locBody', //表体区域
headpk: 'cgeneralbid', //表头主键(原始单据的表体主键)
billtype: 'in', //单据类型,标识出库还是入库
loccode: 'locationVOs', //孙表信息挂到子表行上的字段key
locCollect: 'locCollect', // 货位汇总表格主键
isLoc: 'isLoc', //是否货位
isSerial: 'isSerial' //是否序列号
};
//////////////////////////////////////////////////////////
//表体需要组织过滤的字段编码数组
const body_fileds_orgfilter = [
FIELD.bid + '.' + 'cmaterialoid',
FIELD.bid + '.' + 'cmaterialvid',
FIELD.bid + '.' + 'cvmivendervid',
FIELD.bid + '.' + 'ctplcustomervid',
FIELD.bid + '.' + 'cvendorvid',
FIELD.bid + '.' + 'casscustvid',
'cmaterialoid',
'cmaterialvid',
'cvmivendervid',
'ctplcustomervid',
'cvendorvid',
'casscustvid'
];
const BTNID = {
SaveSign: 'SaveSign',
ExSnTem: 'ExSnTem',
PasteEnd: 'PasteEnd',
Refresh: 'Refresh',
CancelPaste: 'CancelPaste',
ExportSerial: 'ExportSerial',
Save: 'Save', // 保存
Cancel: 'Cancel', // 取消
Add: 'Add', // 自制
FetchAuto: 'FetchAuto', //自动取数
AddLine: 'AddLine', // 增行
DeleteLine: 'DeleteLine', //删行
CopyLine: 'CopyLine', //复制行
OnhandnumQuery: 'OnhandnumQuery', //存量查拣
LOCSNBarCode: 'LOCSNBarCode', //货位序列号
ReOrderRowNum: 'ReOrderRowNum', // 重排行号
OpenCard: 'OpenCard', // 展开
InsertInnerLine: 'InsertInnerLine', //插入行
DelInnerLine: 'DelInnerLine', // 删行
CopyInnerLine: 'CopyInnerLine', // 复制行
ImportSN: 'ImportSN', // 导入序列号
SetPiece: 'SetPiece', //成套件信息
Edit: 'Edit', //修改
ImportSrcBillSN: 'ImportSrcBillSN', //导入来源单据序列号
Delete: 'Delete', //删除
More: 'More', //更多
Copy: 'Copy', //复制
File: 'File', //附件管理
LinkQryAction: 'LinkQryAction', //单据追溯
Print: 'Print', // 打印
Preview: 'Preview', //v预览
Output: 'Output', //输出
CombinePrint: 'CombinePrint', // 合并显示
SumPrint: 'SumPrint', //汇总打印
BtnPrintLoc: 'BtnPrintLoc', //打印货位
DirPrintBarcode: 'DirPrintBarcode', // 直接打印条形码
PrintBarcode: 'PrintBarcode', // 打印条形码
Match: 'Match', //套件拆卸入库
Sign: 'Sign', //签字
UnSign: 'UnSign', //取消签字
exportserial: 'ExportSerial',
Back: 'Back', //返回
FetchOutOnhand: 'FetchOutOnhand', //去转出信息(转库使用) add by yinl 20180807
Ref4A61: 'Ref4A61', //拉领用归还单
Ref4A63: 'Ref4A63', //拉借用归还单
Ref4A72: 'Ref4A72', //拉租出归还单
//lhw 20240125 入库申请单 begin
Ref488S: 'Ref488S', // 入库申请单
//end
QuitTrans: 'QuitTrans',
printCountQuery: 'PrintCountQuery' // 打印次数查询
};
const datasourceKey = {
listCardKey: 'scm.ic.generalin.listcardkey'
};
const FREEFIELD = {
ccustomerid: 'casscustid',
ccustomervid: 'casscustvid',
cvendorid: 'cvendorid',
cvendorvid: 'cvendorvid'
};
export {
datasourceKey,
AREA,
FIELD,
SUBCHILD,
PAGECODE,
URL,
BTNID,
UISTATE,
PAGECARDCODE,
tabURL,
cardURL,
qryTemplateID,
dataType,
appID,
queryConsCacheKey,
tabCodeKey,
appcode,
body_fileds_orgfilter,
BATCHCODE_FIELD,
FREEFIELD
};
2.2、定义拉单常量
const URL = {
search488S: '/nccloud/ic/generalin/query488S.do'//拉入库申请单查询
};
const PAGEAREA = {
head488S: 'head',//表头模板
body488S: 'body',//表体模板
search488S: 'search',//查询模板
view488S: 'view'//主子表单模板
};
const DATASOURCE = {
ref488SDataSource: 'ref488SDataSource'//缓存数据源
};
const PK = {
head488S: 'pk_gapply_h',//入库申请单表头主键
body488S: 'pk_gapply_b'//入库申请单表体主键
};
const PAGECODE = {
pagecode488S: '400800888_488Sto4A'//页面编码
};
const APPCODE = {
appcode488S: '400800888'//应用编码
};
const fileds_orgfilter_488S = [];
export { PAGEAREA, DATASOURCE, PK, PAGECODE, APPCODE,fileds_orgfilter_488S };
const URL = {
search4A61: '/nccloud/ic/generalin/query4A61.do',
search4A63: '/nccloud/ic/generalin/query4A63.do',
search4A72: '/nccloud/ic/generalin/query4A72.do'
//lhw 20240125 入库申请单 begin
,
search488S: '/nccloud/ic/generalin/query488S.do'
//end
};
const PAGEAREA = {
head4A61: 'head',
body4A61: 'body',
search4A61: 'search',
view4A61: 'view',
head4A63: 'head',
body4A63: 'body',
search4A63: 'search',
view4A63: 'view',
head4A72: 'head',
body4A72: 'bodyvos',
search4A72: 'search',
view4A72: 'transfermain'
//lhw 20240125 入库申请单 begin
,
head488S: 'head',
body488S: 'body',
search488S: 'search',
view488S: 'view'
//end
};
const DATASOURCE = {
ref4A61DataSource: 'ref4A61DataSource',
ref4A63DataSource: 'ref4A63DataSource',
ref4A72DataSource: 'ref4A72DataSource'
//lhw 20240125 入库申请单 begin
,
ref488SDataSource: 'ref488SDataSource'
//end
};
const PK = {
head4A61: 'pk_assign',
body4A61: 'pk_assign_b',
head4A63: 'pk_borrow',
body4A63: 'pk_borrow_b',
head4A72: 'pk_accept',
body4A72: 'pk_accept_c'
//lhw 20240125 入库申请单 begin
,
head488S: 'pk_gapply_h',
body488S: 'pk_gapply_b'
//end
};
const PAGECODE = {
pagecode4A61: '458001008A_4A61to4A',
pagecode4A63: '458001508A_4A63to4A',
pagecode4A72: '458300512A_4A72to4A'
//lhw 20240125 入库申请单 begin
,
pagecode488S: '400800888_488Sto4A'
//end
};
const APPCODE = {
appcode4A61: '458001008A',
appcode4A63: '458001508A',
appcode4A72: '458300512A'
//lhw 20240125 入库申请单 begin
,
appcode488S: '400800888'
//end
};
const fileds_orgfilter_4A61 = [];
const fileds_orgfilter_4A63 = [];
const fileds_orgfilter_4A72 = ['pk_org'];
//lhw 20240125 入库申请单 begin
const fileds_orgfilter_488S = [];
// export { PAGEAREA, DATASOURCE, PK, PAGECODE, APPCODE, fileds_orgfilter_4A61, URL, fileds_orgfilter_4A63 };
export { PAGEAREA, DATASOURCE, PK, PAGECODE, APPCODE, fileds_orgfilter_4A61, URL, fileds_orgfilter_4A63, fileds_orgfilter_488S };
//end
2.3、拉单按钮处理
2.3.1、跳转查询卡片
import { URL } from '../../constance';
import { DATASOURCE, PAGECODE } from '../../transfer/const';
import { clearTransferCache } from '../../../../../scmpub/scmpub/pub/cache';
export default function clickAddBtn(props) {
clearTransferCache(props, DATASOURCE.ref488SDataSource);
props.pushTo(URL.goto488STransfer, {
type: 'ref488S',
usecache: 'N', //跳转到转单查询区不使用缓存
pagecode: PAGECODE.pagecode488S
});
}
2.3.2、列表拉单按钮跳转
import ref488SBtnClick from '../../list/btnClicks/ref488SBtnClick';
export default function buttonClick(props, btnid, text, record, index) {
switch (btnid) {
case BTNID.Ref488S:
return ref488SBtnClick(props, constance);
}
}
import { ajax } from 'nc-lightapp-front';
import { showWarningInfo } from '../../../../../scmpub/scmpub/pub/tool/messageUtil';
import { getLangByResId } from '../../../../../scmpub/scmpub/pub/tool/multiLangUtil';
import {
searchBtnClick,
refreshBtnClick,
addBtnClick,
unSignBtnClick,
signBtnClick,
delBtnClick,
editBtnClick,
fileMngBtnClick,
linkQueryBtnClick,
outputBtnClick,
printlocBtnClick,
barCodePrintBtnClick,
printbarCodeBtnClick
} from '../../../pub/btnClicks';
import ref4A61BtnClick from '../../list/btnClicks/ref4A61BtnClick';
import ref4A63BtnClick from '../../list/btnClicks/ref4A63BtnClick';
import ref4A72BtnClick from '../../list/btnClicks/ref4A72BtnClick';
//lhw 20240125 入库申请单 begin
import ref488SBtnClick from '../../list/btnClicks/ref488SBtnClick';
//end
let oprcodes = { print: 'print', edit: 'edit', delete: 'delete', sign: 'sign', unsign: 'cancelsign' };
import {
AREA,
SUBCHILD,
PAGECODE,
URL,
BTNID,
PAGECARDCODE,
tabURL,
cardURL,
qryTemplateID,
dataType,
appID,
queryConsCacheKey,
datasourceKey,
tabCodeKey,
FIELD
} from '../../constance';
let constance = {
AREA,
PAGECODE,
URL,
PAGECARDCODE,
tabURL,
cardURL,
qryTemplateID,
dataType,
appID,
SUBCHILD,
queryConsCacheKey,
tabCodeKey,
datasourceKey,
oprcodes
};
import printBtnClick from '../../../pub/btnClicks/print_BtnClick';
import printCountQuery from '../../../../../scmpub/scmpub/pub/tool/printCountQuery';
export default function buttonClick(props, btnid, text, record, index) {
switch (btnid) {
//打印条形码
case 'PrintBarCode':
let ids2 = props.table.getCheckedRows(AREA.tableArea)[0].data.values.cgeneralhid.value;
let params2 = {
billtype: '4A',
oids: ids2
};
printbarCodeBtnClick.call(this, props, params2);
break;
//直接打印条形码
case BTNID.DirPrintBarcode:
let ids = [];
let heads = props.table.getCheckedRows(AREA.tableArea);
heads.forEach((element) => {
ids.push(element.data.values.cgeneralhid.value);
});
let params = {
billtype: '4A',
oids: ids
};
barCodePrintBtnClick.call(this, props, params);
break;
case 'BtnPrintLoc':
let datas = props.table.getCheckedRows(AREA.tableArea);
let id = [];
datas.forEach((element) => {
id.push(element.data.values.cgeneralhid.value);
});
return printlocBtnClick.call(this, props, 'locprint', URL.printLocUrl, id);
case 'Output':
outputBtnClick.call(this, this.props, 'list', AREA.tableArea, 'print', 'cgeneralhid', URL.printUrl);
break;
//查询
case 'query':
return searchBtnClick.call(this, props, constance);
case BTNID.Add:
addBtnClick.call(this, props, constance);
break;
//新增自制
case 'Manual':
return addBtnClick(props, constance);
//领用归还单
case BTNID.Ref4A61:
ref4A61BtnClick.call(this, props);
break;
//借用归还单
case BTNID.Ref4A63:
return ref4A63BtnClick(props, constance);
//租出归还单
case BTNID.Ref4A72:
return ref4A72BtnClick(props, constance);
//lhw 20240125 入库申请单 begin
case BTNID.Ref488S:
return ref488SBtnClick(props, constance);
//end
//修改//修改
case 'Edit':
return editBtnClick(props, constance, text);
// 刷新
case 'Refresh':
return refreshBtnClick.call(this, props, constance);
//签字
case 'Sign':
return signBtnClick.call(this, props, constance);
//取消签字
case 'UnSign':
return unSignBtnClick.call(this, props, constance);
//删除
case 'Delete':
return delBtnClick.call(this, props, constance, text, index);
//复制
case BTNID.Copy:
let data = record.cgeneralhid.value;
ajax({
url: URL.canBeCopyURL,
data: data,
method: 'post',
success: (res) => {
if (res.data == true) {
showWarningInfo('', getLangByResId(this, '4008GENERALIN-000005')); /* 国际化处理: 有来源单据不能复制!*/
} else {
const { cardURL } = constance;
props.pushTo(cardURL, {
status: 'add',
copyid: record.cgeneralhid.value,
pagecode: PAGECARDCODE
});
}
}
});
break;
//打印
case BTNID.Print:
printBtnClick.bind(this, props, constance, '40080608', '4A', 'print')();
break;
//单据追溯
case BTNID.LinkQryAction:
linkQueryBtnClick.bind(this, props, constance)();
break;
//附件管理
case BTNID.File:
fileMngBtnClick.bind(this, props, constance)();
break;
// 打印次数查询
case BTNID.printCountQuery:
let CONST = { hid: FIELD.hid, area: AREA.tableArea };
printCountQuery.call(this, props, { type: 1, CONST, modal: 'code-config' });
break;
}
}
2.3.3、卡片拉单按钮跳转
import ref488SBtnClick from '../../list/btnClicks/ref488SBtnClick';
export default function commonBtnClicks(props, id, text, record, index, info) {
switch (id) {
case BTNID.Ref488S:
return ref488SBtnClick(props, constance);
}
}
import addBtnClick from '../../../pub/cardBtnClicks/addBtnClick';
//import canelBtnClick from './canelBtnClick';
import {
signBtnClick,
delBtnClick,
unSignBtnClick,
generate4A00BtnClick,
deltransassetbillBtnClick,
generatehjBtnClick,
cancelgenerate4a00BtnClick,
openCardBtnClick,
backBtnClick,
editBtnClick,
canelBtnClick,
setPieceBtnClick,
copyBtnClick,
fetchAutoBtnClick,
copyLineBtnClick,
cancelPasteBtnClick,
pasteLineBtnClick,
importSrcBillSNBtnClick,
exportSerialBtnClick,
printbarCodeBtnClick,
inboundOnhandBtnClick
} from '../../../pub/cardBtnClicks/index';
//import editBtnClick from './editBtnClick';
import saveBtnClick from '../../../pub/btnClicks/saveBtnClick';
import locBtnClick from '../../../pub/btnClicks/locBtnClick';
import quitBtnClick from '../../../pub/btnClicks/outboundcard/quitBtnClick';
import ref4A61BtnClick from '../../list/btnClicks/ref4A61BtnClick';
import ref4A63BtnClick from '../../list/btnClicks/ref4A63BtnClick';
import ref4A72BtnClick from '../../list/btnClicks/ref4A72BtnClick';
//lhw 20240125 入库申请单 begin
import ref488SBtnClick from '../../list/btnClicks/ref488SBtnClick';
//end
let oprcodes = { print: 'print', edit: 'edit', delete: 'delete', sign: 'sign', unsign: 'cancelsign' };
import {
BTNID,
cardURL,
tabURL,
FIELD,
URL,
UISTATE,
AREA,
PAGECODE,
SUBCHILD,
PAGECARDCODE,
tabCodeKey,
datasourceKey
} from '../../constance/index';
import { RownoUtils } from 'src/scmpub/scmpub/pub/tool/cardTableTools';
import {
fileMngBtnClick,
linkQueryBtnClick,
outputBtnClick,
printlocBtnClick,
barCodePrintBtnClick
} from '../../../pub/btnClicks';
import { pageQueryClick } from '../btnClicks/index';
let constance = {
FIELD,
BTNID,
tabURL,
tabCodeKey,
URL,
UISTATE,
AREA,
PAGECODE,
SUBCHILD,
cardURL,
PAGECARDCODE,
datasourceKey,
oprcodes
};
import { getLangByResId } from '../../../../../scmpub/scmpub/pub/tool/multiLangUtil';
import { combinePrintInOrOutBtnClick } from '../../../pub/btnClicks';
import printBtnClick from '../../../pub/btnClicks/print_BtnClick';
import printCountQuery from '../../../../../scmpub/scmpub/pub/tool/printCountQuery';
import locationUtils from '../../../pub/utils/locationUtils';
import { showSuccessInfo, showErrorInfo } from '../../../../../scmpub/scmpub/pub/tool/messageUtil';
export default function commonBtnClicks(props, id, text, record, index, info) {
switch (id) {
case BTNID.ImportSN: //序列号导入
if (info && info.file) {
if (info.file.status !== 'uploading') {
console.log(getLangByResId(this, '4008GENERALIN-000012')); /* 国际化处理: 正在上传...*/
}
if (info.file.status === 'done') {
if (
info.file.response &&
info.file.response.data &&
info.file.response.data[SUBCHILD.bodycode] &&
info.file.response.data[SUBCHILD.bodycode].rows
) {
showSuccessInfo('', getLangByResId(this, '4008GENERALIN-000013')); /* 国际化处理: 导入成功*/
// record.values[SUBCHILD.loccode] = { rows: info.file.response.data[SUBCHILD.bodycode].rows };
record.values[SUBCHILD.loccode] = {
value: JSON.stringify({
locBody: {
rows: info.file.response.data[SUBCHILD.bodycode].rows,
areacode: 'icLocation'
}
})
};
//如果导入的序列号只有一条,则把孙表中和表体相同的字段的值赋给表体
record = locationUtils.updateBodyData(record, info.file.response.data[SUBCHILD.bodycode].rows);
props.cardTable.updateDataByIndexs(AREA.bodyTable, { index, data: record });
} else if (info.file.response.error && info.file.response.error.message) {
showErrorInfo.call(this, info.file.response.error.message);
}
} else if (info.file.status === 'error') {
console.log(data);
}
}
break;
case 'OnhandnumQuery':
inboundOnhandBtnClick.call(this, props, AREA.formArea, AREA.bodyTable, '4A');
break;
case 'PrintBarCode':
let params1 = { billtype: '4A', headarea: AREA.formArea, bodyarea: AREA.bodyTable };
printbarCodeBtnClick.call(this, props, params1);
break;
//直接打印条形码
case BTNID.DirPrintBarcode:
let params = {
billtype: '4A',
oids: [ props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value ],
headarea: AREA.formArea,
bodyarea: AREA.bodyTable
};
barCodePrintBtnClick.call(this, props, params);
break;
case BTNID.CombinePrint: // 合并显示
let area = { head: AREA.formArea, body: AREA.bodyTable, browse: AREA.browse, edit: AREA.edit };
let funcodeCombine = '';
let nodekeyCombine = 'combine';
let filed = {
nodekeyCombine,
cmaterialvid: 'cmaterialvid',
billTitle: getLangByResId(this, '4008GENERALIN-000004'),
cgeneralhid: 'cgeneralhid'
}; /* 国际化处理: 库存其他入库单合并显示*/
let url = { combine: URL.combine, combineprint: URL.combineprint };
combinePrintInOrOutBtnClick.bind(this, props, { AREA: area, FIELD: filed, URL: url })();
break;
case 'BtnPrintLoc':
let pk = [];
pk.push(props.form.getFormItemsValue(AREA.formArea, 'cgeneralhid').value);
printlocBtnClick.call(this, props, 'locprint', URL.printLocUrl, pk);
break;
case 'Output':
outputBtnClick.call(this, this.props, 'card', AREA.formArea, 'print', 'cgeneralhid', URL.printUrl);
break;
//打印
case BTNID.Print:
printBtnClick.bind(this, props, constance, '40080608', '4A', 'print')();
break;
case 'Refresh':
let freshid = props.form.getFormItemsValue(AREA.formArea, FIELD.hid).value;
pageQueryClick.call(this, props, freshid, true);
break;
//导出序列号模板
case 'ExSnTem':
exportSerialBtnClick.call(this);
break;
case BTNID.ImportSrcBillSN:
importSrcBillSNBtnClick.call(this, props, constance);
break;
case BTNID.Add:
addBtnClick.call(this, props, constance);
break;
case BTNID.Edit:
editBtnClick.bind(this, props, constance)();
break;
case BTNID.Delete:
delBtnClick.bind(this, props, constance)();
break;
//新增自制
case 'Manual':
return addBtnClick.call(this, props, constance);
//领用归还单
case BTNID.Ref4A61:
ref4A61BtnClick.call(this, props);
break;
//借用归还单
case BTNID.Ref4A63:
return ref4A63BtnClick(props, constance);
//借用归还单
case BTNID.Ref4A72:
return ref4A72BtnClick(props, constance);
//lhw 20240125 入库申请单 begin
case BTNID.Ref488S:
return ref488SBtnClick(props, constance);
//end
//返回
case BTNID.Back:
backBtnClick.bind(this, props, constance)();
break;
//退出转单
case BTNID.QuitTrans:
quitBtnClick.call(this, this.props, constance);
break;
//自动取数
case BTNID.FetchAuto:
let cons = {
FIELD: { cardTable: AREA.bodyTable, formArea: AREA.formArea },
PAGECODE: { card: PAGECARDCODE },
URL,
ATTRCODE: {},
SUBCHILD,
AREA
};
fetchAutoBtnClick.bind(this, props, cons)();
break;
case BTNID.Sign:
signBtnClick.bind(this, props, constance)();
break;
case BTNID.UnSign:
unSignBtnClick.bind(this, props, constance)();
break;
//生成设备卡片
case BTNID.Generate4A00:
generate4A00BtnClick.bind(this, props, constance, record)();
break;
//取消生成设备卡片
case BTNID.CancelGenerate4A00:
cancelgenerate4a00BtnClick.bind(this, props, constance, record)();
break;
//生成转固单
case BTNID.GenerateHJ:
generatehjBtnClick.bind(this, props, constance, record)();
break;
//取消生成转固单
case BTNID.DelTransAssetBill:
deltransassetbillBtnClick.bind(this, props, constance, record)();
break;
//展开
case BTNID.OpenCard: //展开物料浏览行
openCardBtnClick.bind(this, props, constance, record, index)();
break;
//货位序列号
case BTNID.LOCSNBarCode:
locBtnClick.call(this, props, constance, record);
break;
//保存
case BTNID.Save:
if (this.copyRowDatas) {
cancelPasteBtnClick.bind(this, props, constance, record, index)();
}
saveBtnClick.call(this, props, constance);
break;
//取消
case BTNID.Cancel:
if (this.copyRowDatas) {
cancelPasteBtnClick.bind(this, props, constance, record, index)();
}
canelBtnClick.bind(this, props, constance)();
break;
//重排行号
case BTNID.ReOrderRowNum:
RownoUtils.resetRowNo(props, AREA.bodyTable, 'crowno');
break;
//增行
case BTNID.AddLine:
props.cardTable.addRow(AREA.bodyTable);
RownoUtils.setRowNo(props, AREA.bodyTable, 'crowno');
break;
//删行(操作列)
case BTNID.DelInnerLine:
props.cardTable.delRowsByIndex(AREA.bodyTable, index);
break;
//删行
case BTNID.DeleteLine:
let rows = props.cardTable.getCheckedRows(AREA.bodyTable);
let indexs = [];
rows.map((row) => {
indexs.push(row.index);
});
props.cardTable.delRowsByIndex(AREA.bodyTable, indexs);
this.setBtnVisible();
break;
case 'InsertInnerLine':
props.cardTable.addRow(AREA.bodyTable, index);
RownoUtils.setRowNo(props, AREA.bodyTable, 'crowno');
break;
//复制行(操作列)
case BTNID.CopyInnerLine:
copyLineBtnClick.bind(this, props, constance, record, index)();
// cancelPasteBtnClick,
// pasteLineBtnClick,
break;
case BTNID.CopyLine:
copyLineBtnClick.bind(this, props, constance, record, index)();
break;
//粘贴至此
case 'PasteThis':
pasteLineBtnClick.bind(this, props, constance, record, index)();
break;
//粘贴至末行
case 'PasteEnd':
pasteLineBtnClick.bind(this, props, constance, record, index)();
break;
//取消粘贴
case 'CancelPaste':
cancelPasteBtnClick.bind(this, props, constance, record, index)();
break;
//成套件信息
case BTNID.SetPiece:
setPieceBtnClick.bind(this, props, constance, record, index)();
break;
//复制
case BTNID.Copy:
let data = props.form.getFormItemsValue(AREA.formArea, 'cgeneralhid').value;
// ajax({
// url: URL.canBeCopyURL,
// data: data,
// method: 'post',
// success: (res) => {
// if (res.data == true) {
// showWarningInfo('', getLangByResId(this, '4008GENERALIN-000005'));/* 国际化处理: 有来源单据不能复制!*/
// return;
// }
// }
// });
copyBtnClick.bind(
this,
props,
URL.copyURL,
PAGECARDCODE,
props.form.getFormItemsValue(AREA.formArea, 'cgeneralhid').value,
constance
)();
break;
//单据追溯
case BTNID.LinkQryAction:
linkQueryBtnClick.bind(this, props, constance)();
break;
//附件管理
case BTNID.File:
fileMngBtnClick.bind(this, props, constance)();
break;
// 打印次数查询
case BTNID.printCountQuery:
let CONST = { hid: FIELD.hid, area: AREA.formArea };
printCountQuery.call(this, props, { type: 2, CONST, modal: 'code-config' });
break;
default:
break;
}
}
export { commonBtnClicks, pageQueryClick };
3、拉单
3.1、配置路由
const ref488S = asyncComponent(() =>
import('../single488Stransfer/single488Stransfer')
);
const routes = [
{
path: '/ref488S',
component: ref488S
}
];
import { asyncComponent } from 'nc-lightapp-front';
import List from '../list/list';
const card = asyncComponent(() =>
import(/*webpackChunkName: "ic/ic/generalin/card/card"*/ /* webpackMode: "eager" */ '../card/card')
);
const ref4A61 = asyncComponent(() =>
import(/*webpackChunkName: "ic/ic/generalin/single4A61transfer/ref4A61"*/ /* webpackMode: "eager" */ '../single4A61transfer/single4A61transfer')
);
const ref4A63 = asyncComponent(() =>
import(/*webpackChunkName: "ic/ic/generalin/single4A63transfer/ref4A63"*/ /* webpackMode: "eager" */ '../single4A63transfer/single4A63transfer')
);
const ref4A72 = asyncComponent(() =>
import(/*webpackChunkName: "ic/ic/generalin/single4A72transfer/ref4A72"*/ /* webpackMode: "eager" */ '../single4A72transfer/single4A72transfer')
);
//lhw 20240125 入库申请单 begin
const ref488S = asyncComponent(() =>
import(/*webpackChunkName: "ic/ic/generalin/single488Stransfer/ref4A72"*/ /* webpackMode: "eager" */ '../single488Stransfer/single488Stransfer')
);
//end
const routes = [
{
path: '/',
component: List,
exact: true
},
{
path: '/list',
component: List
},
{
path: '/card',
component: card
},
{
path: '/ref4A61',
component: ref4A61
},
{
path: '/ref4A63',
component: ref4A63
},
{
path: '/ref4A72',
component: ref4A72
}
//lhw 20240125 入库申请单 begin
,
{
path: '/ref488S',
component: ref488S
}
//end
];
export default routes;
3.2、拉单模板
import React, { Component } from 'react';
import { base, createPage } from 'nc-lightapp-front';
import { PAGEAREA, DATASOURCE, PAGECODE } from '../transfer/const';
import { URL, PAGECARDCODE } from '../constance';
import { searchAfterEvent } from '../transfer/afterEvent';
//import getNumber from '../transfer/utils/getNumber';
import init488STemplate from '../transfer/init/init488STemplate';
import { search488S_BtnClick, refresh_BtnClick } from '../transfer/btnClicks';
import { initLang, getLangByResId } from '../../../../scmpub/scmpub/pub/tool/multiLangUtil';
class TransferTable extends Component {
constructor(props) {
super(props);
this.formId = PAGEAREA.head488S;
this.tableId = PAGEAREA.body488S;
this.serachId = PAGEAREA.search488S;
this.state = {
ntotalnum: 0,
toggleViewStatus: false
};
props.use.search(PAGEAREA.search488S);
initLang(this, [ '4008generalin', '4008pub' ], 'ic', init488STemplate.bind(this, this.props));
}
componentDidMount() {
this.props.transferTable.setTransferTableValue(
this.formId,
this.tableId,
[],
PAGEAREA.head488S,
PAGEAREA.body488S
);
}
backClick = (props) => {
props.pushTo(URL.listURL, { status: 'browse', pagecode: PAGECARDCODE });
};
// 主组织编辑后事件
renderCompleteEvent = () => {
// 给通过交易类型发布的节点,查询区的交易类型字段赋默认值
let pk_org = this.props.search.getSearchValByField(PAGEAREA.search488S, 'pk_org');
if (pk_org && pk_org.value && pk_org.value.firstvalue) {
let value = pk_org.value.firstvalue;
let arr = value.split(',');
arr = arr.map((item) => {
return { refpk: item };
});
searchAfterEvent.call(this, PAGEAREA.search488S, 'pk_org', arr);
} else {
searchAfterEvent.call(this, PAGEAREA.search488S, 'pk_org', []);
}
};
// react:界面渲染函数
render() {
const { transferTable, search, button } = this.props;
const { NCCreateSearch } = search;
const { createButtonApp } = button;
const { createTransferTable } = transferTable;
const { NCToggleViewBtn } = base;
const { createBillHeadInfo } = this.props.BillHeadInfo;
let isShowSel = transferTable.getSelectedListDisplay(PAGEAREA.head488S);
let totalstr = `${getLangByResId(this, '4008GENERALIN-000051')}`; /* 国际化处理: 本次出库主数量*/
return (
{!isShowSel ? (
{createBillHeadInfo({
title: '选择入库申请单' /* 国际化处理: '选择入库申请单'*/,
backBtnClick: this.backClick.bind(this, this.props)
})}
{createButtonApp({
area: 'transfer_head',
buttonLimit: 8,
onButtonClick: refresh_BtnClick.bind(this, DATASOURCE.ref488SDataSource),
popContainer: document.querySelector('.header-button-area')
})}
expand={this.state.toggleViewStatus} onClick={() => { let meta = this.props.meta.getMeta(); if (!meta[PAGEAREA.view488S]) { init488STemplate.call(this, this.props, PAGEAREA.view488S); //加载主子拉平模板 } this.props.transferTable.changeViewType(PAGEAREA.view488S); this.setState({ toggleViewStatus: !this.state.toggleViewStatus }); }} />
{NCCreateSearch(
this.serachId,
{
clickSearchBtn: search488S_BtnClick.bind(this, null, false),
onAfterEvent: searchAfterEvent.bind(this, PAGEAREA.search488S),
renderCompleteEvent: this.renderCompleteEvent,
statusChangeEvent: this.renderCompleteEvent,
useCache: this.props.getUrlParam('usecache') != 'N'
}
//模块id
)}
) : (
''
)}
{createTransferTable({
dataSource: DATASOURCE.ref488SDataSource,
totalKey: [ 'main_num' ],
totalTitle: [ totalstr ],
headTableId: this.formId, //表格组件id
bodyTableId: this.tableId, //子表模板id
fullTableId: PAGEAREA.view488S,
searchAreaCode: PAGEAREA.search488S,
//点击加号展开,设置表格数据
transferBtnText: getLangByResId(this, '4008GENERALIN-000050'), //转单按钮显示文字/* 国际化处理: '生成入库单'*/
containerSelector: '#transferList',
onTransferBtnClick: (ids) => {
this.props.pushTo(URL.cardURL, {
status: 'edit',
type: 'ref488S',
pagecode: PAGECODE.pagecode488S
});
},
onChangeViewClick: () => {
let meta = this.props.meta.getMeta();
if (!meta[PAGEAREA.view488S]) {
init488STemplate.call(this, this.props, PAGEAREA.view488S); //加载主子拉平模板
}
this.props.transferTable.changeViewType(PAGEAREA.view488S);
this.setState({ toggleViewStatus: !this.state.toggleViewStatus });
}
})}
);
}
}
TransferTable = createPage({})(TransferTable);
// ReactDOM.render(
export default TransferTable;
3.3、初始化拉单模板
import { PAGECODE, PAGEAREA, APPCODE, fileds_orgfilter_488S } from '../const';
import { setPsndocShowLeavePower, setRefShowDisabledData } from '../../../../../scmpub/scmpub/pub/tool/refUtils';
import { transferSkipToSrcBillUtil } from '../../../../../scmpub/scmpub/pub/tool/transferSkipToSrcBillUtil';
export default function(props) {
props.createUIDom(
{
pagecode: PAGECODE.pagecode488S, //卡片页面编码
appcode: APPCODE.appcode488S
// appid: APPID //应用主键
},
(data) => {
if (data.template) {
let meta = data.template;
meta = modify.call(this, props, meta);
props.meta.addMeta(meta);
this.setState({ templateid: meta.pageid });
}
if (data.button) {
let button = data.button;
props.button.setButtons(button);
}
}
);
}
function modify(props, meta) {
meta[PAGEAREA.search488S].items.map((item, index) => {
if (fileds_orgfilter_488S.includes(item.attrcode)) {
item.queryCondition = () => {
let pk_org = props.search.getSearchValByField(PAGEAREA.search488S, 'pk_org');
return {
pk_org:
pk_org && pk_org.value
? pk_org.value.firstvalue.includes(',') ? null : pk_org.value.firstvalue
: null
};
};
}
});
// 设置查询区meta
let queryitems = meta[PAGEAREA.search488S].items;
queryitems = queryitems.map((item) => {
item.isShowUnit = true;
setPsndocShowLeavePower(item);
setRefShowDisabledData(item);
if (item.attrcode == 'cwarehouseid') {
// 仓库
item.queryCondition = () => {
let pk_org = props.search.getSearchValByField(PAGEAREA.search488S, 'pk_org');
return {
pk_org:
pk_org && pk_org.value
? pk_org.value.firstvalue.includes(',') ? null : pk_org.value.firstvalue
: null
};
};
} else if (item.attrcode == 'billtype') {
// 库存单据类型【单据类型】
item.isMultiSelectedEnabled = false;
item.queryCondition = () => {
return {
type: 'in2out',
GridRefActionExt: 'nccloud.web.ic.pub.ref.ICBillTypeRefSqlBuilder'
};
};
} else if (item.attrcode == 'ctrantypeid') {
// 出入库类型【交易类型】
item.queryCondition = () => {
let billtype = props.search.getSearchValByField(PAGEAREA.search488S, 'billtype');
return {
parentbilltype: billtype ? billtype.value.firstvalue : '1',
istransation: 'Y'
};
};
} else if (item.attrcode == 'pk_org') {
item.isShowUnit = false;
item.queryCondition = () => {
return { GridRefActionExt: 'nccloud.web.scmpub.ref.AppPermissionOrgRefFilter' };
};
} else if (item.attrcode == 'bodyvos.pk_material') {
// 物料过滤
item.queryCondition = () => {
let pk_org = props.search.getSearchValByField(PAGEAREA.search488S, 'pk_org');
return {
pk_org:
pk_org && pk_org.value
? pk_org.value.firstvalue.includes(',') ? null : pk_org.value.firstvalue
: null, //组织过滤,
GridRefActionExt: 'nccloud.web.ampub.rmbase.common.refcondition.Pk_material_vRefExtraSql'
};
};
} else {
item.queryCondition = () => {
let pk_org = props.search.getSearchValByField(PAGEAREA.search488S, 'pk_org');
return {
pk_org:
pk_org && pk_org.value
? pk_org.value.firstvalue.includes(',') ? null : pk_org.value.firstvalue
: null //组织过滤
};
};
}
return item;
});
meta[PAGEAREA.head488S].items.map((item, key) => {
transferSkipToSrcBillUtil.call(
this,
props,
item,
{
billcodefield: 'bill_code',
billtypefield: 'transi_type'
},
true
);
});
return meta;
}
3.4、定义拉单查询
import search488S_BtnClick from './search488S_BtnClick';
export { search488S_BtnClick,refresh_BtnClick };
import search4A61_BtnClick from './search4A61_BtnClick';
import search4A63_BtnClick from './search4A63_BtnClick';
import search4A72_BtnClick from './search4A72_BtnClick';
//lhw 20240125 入库申请单 begin
import search488S_BtnClick from './search488S_BtnClick';
//end
import refresh_BtnClick from './refresh_BtnClick';
//lhw 20240125 入库申请单 begin
// export { search4A61_BtnClick, search4A63_BtnClick, search4A72_BtnClick,refresh_BtnClick };
export { search4A61_BtnClick, search4A63_BtnClick, search4A72_BtnClick,search488S_BtnClick,refresh_BtnClick };
//end
3.5、拉单查询
import { PAGECODE, PAGEAREA, PK, URL, DATASOURCE } from '../const';
import { ajax } from 'nc-lightapp-front';
import { transtypeUtils } from '../../../../../scmpub/scmpub/pub/tool';
import { setDefData } from '../../../../../scmpub/scmpub/pub/cache';
import { getLangByResId } from '../../../../../scmpub/scmpub/pub/tool/multiLangUtil';
import { showSuccessInfo, showWarningInfo } from '../../../../../scmpub/scmpub/pub/tool/messageUtil';
export default function clickSerachBtn(cacheSearchData, isRefresh) {
let queryInfo = {};
if (!isRefresh) {
let searchVal = this.props.search.getAllSearchData(PAGEAREA.search488S);
if (!searchVal) {
return;
}
queryInfo = this.props.search.getQueryInfo(PAGEAREA.search488S, false);
queryInfo.querycondition = searchVal ? searchVal : null;
//缓存查询条件
setDefData(DATASOURCE.ref488SDataSource, PAGEAREA.search488S, queryInfo);
} else {
//刷新
if (!cacheSearchData) {
showWarningInfo(getLangByResId(this, '4008PUB-000204')); /* 国际化处理: 请先查询数据!*/
return;
}
queryInfo = cacheSearchData;
}
let transtypecode = transtypeUtils.getTranstypeCode.call(this);
queryInfo.userdefObj = { transtype: transtypecode };
let data = {
templetid: this.state.templateid,
queryInfo: queryInfo,
pageCode: PAGECODE.pagecode488S //页面编码
};
ajax({
url: URL.search488S,
data: data,
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
props.dealFormulamsg(
res.formulamsg //参数一:返回的公式对象
);
}
let { success, data } = res;
if (success) {
if (isRefresh) {
showSuccessInfo(getLangByResId(this, '4008PUB-000193')); /* 国际化处理: 刷新成功!*/
}
if (data && data.length > 0) {
if (!isRefresh) {
}
} else {
data = [];
this.props.transferTable.setTransferTableValue(
PAGEAREA.head488S,
PAGEAREA.body488S,
null,
PK.head488S,
PK.body488S
);
if (!isRefresh) {
//getLangByResId(this, '4008PUB-000202')
showWarningInfo(getLangByResId(this, '4008PUB-000202')); /* 国际化处理: 未查询出符合条件的数据!*/
return;
}
}
this.props.transferTable.setTransferTableValue(
PAGEAREA.head488S,
PAGEAREA.body488S,
data,
PK.head488S,
PK.body488S
);
}
}
});
}
3.6、刷新
import search488S_BtnClick from './search488S_BtnClick';
export default function buttonClick(tabKey) {
if (tabKey == DATASOURCE.ref488SDataSource) {
search488S_BtnClick.call(this, getDefData(DATASOURCE.ref488SDataSource, PAGEAREA.search488S), true);
}
}
import search4A61_BtnClick from './search4A61_BtnClick';
import search4A63_BtnClick from './search4A63_BtnClick';
import search4A72_BtnClick from './search4A72_BtnClick';
//lhw 20240125 入库申请单 begin
import search488S_BtnClick from './search488S_BtnClick';
//end
import { getDefData } from '../../../../../scmpub/scmpub/pub/cache';
import { DATASOURCE, PAGEAREA } from '../const';
export default function buttonClick(tabKey) {
if (tabKey == DATASOURCE.ref4A61DataSource) {
search4A61_BtnClick.call(this, getDefData(DATASOURCE.ref4A61DataSource, PAGEAREA.search4A61), true);
} else if (tabKey == DATASOURCE.ref4A63DataSource) {
search4A63_BtnClick.call(this, getDefData(DATASOURCE.ref4A63DataSource, PAGEAREA.search4A63), true);
} else if (tabKey == DATASOURCE.ref4A72DataSource) {
search4A72_BtnClick.call(this, getDefData(DATASOURCE.ref4A63DataSource, PAGEAREA.search4A72), true);
}
//lhw 20240125 入库申请单 begin
else if (tabKey == DATASOURCE.ref488SDataSource) {
search488S_BtnClick.call(this, getDefData(DATASOURCE.ref488SDataSource, PAGEAREA.search488S), true);
}
//end
}
3.7、数据选中按钮显示
props.button.setButtonVisible([ 'Ref488S' ], this.isAmEnable);
function setBtnVisible(props) {
//let tabcode = this.state.cachetabcode;
//props.button.setButtonVisible([ 'PrintBarcode' ], false);
let checkdatas = props.table.getCheckedRows('generalinList');
const { setButtonDisabled } = props.button;
//lhw 20240125 入库申请单 begin
// props.button.setButtonVisible([ 'Ref4A61', 'Ref4A63', 'Ref4A72'], this.isAmEnable);
props.button.setButtonVisible([ 'Ref4A61', 'Ref4A63', 'Ref4A72', 'Ref488S' ], this.isAmEnable);
//end
if (checkdatas.length == 0) {
setTabChangeBtnVisible.call(this, props);
return;
}
setButtonDisabled(
[
'LinkQryAction',
'File',
'Print',
'PrintCountQuery',
'Preview',
'Output',
'BtnPrintLoc',
'DirPrintBarcode',
'PrintBarCode'
],
false
);
if (checkdatas && checkdatas.length == 1 && checkdatas[0].data.values.fbillflag.value == 3) {
setButtonDisabled([ 'Sign', 'Edit', 'Delete' ], true);
setButtonDisabled([ 'UnSign' ], false);
} else if (checkdatas && checkdatas.length == 1 && checkdatas[0].data.values.icbillstatus.value == 2) {
setButtonDisabled([ 'Sign', 'Edit', 'Delete' ], false);
setButtonDisabled([ 'UnSign' ], true);
} else if (checkdatas && checkdatas.length == 1 && checkdatas[0].data.values.icbillstatus.value == 1) {
setButtonDisabled([ 'Edit', 'Delete' ], false);
setButtonDisabled([ 'UnSign', 'Sign' ], true);
} else if (checkdatas && checkdatas.length > 1) {
setButtonDisabled([ 'Sign', 'Edit', 'Delete', 'UnSign' ], false);
}
}
//页签切换按钮显示控制
function setTabChangeBtnVisible(props) {
//props.button.setButtonVisible([ 'PrintBarcode' ], false);
const { setButtonDisabled } = props.button;
setButtonDisabled(
[
'Delete',
'Sign',
'UnSign',
'LinkQryAction',
'File',
'Print',
'PrintCountQuery',
'Preview',
'Output',
'BtnPrintLoc',
'DirPrintBarcode',
'PrintBarCode'
],
true
);
setButtonDisabled([ 'Add' ], false);
}
export { setTabChangeBtnVisible, setBtnVisible };
4、转单界面
if (type == 'ref488S') {
cbilltype = '488S';
}
import React, { Component } from 'react';
import { createPage, base, high } from 'nc-lightapp-front';
const { BillTrack } = high;
import NCUploader from 'uap/common/components/NCUploader';
import { initTemplate, transfer } from './init';
import { commonBtnClicks, pageQueryClick, buttonController } from './viewController/index';
import { commonBodyEvent } from '../../pub/afterEvents';
import { FIELD, BTNID, URL, PAGECARDCODE, UISTATE, AREA, SUBCHILD, datasourceKey, appcode } from '../constance';
import Location from 'ic/ic/components/location';
import { okCallback } from '../../pub/locationEvents/oprEvents';
import { headAfterEvent, bodyAfterEvent } from './afterEvents';
import { headBeforeEvent, bodyBeforeEvent } from './beforeEvents';
import { batchEvents } from './batchEvents';
const { NCAffix, NCDiv } = base;
import ExtendRefer from 'ic/ic/components/onhandRefer';
import inputChange from '../../../../scmpub/scmpub/pub/tool/rownoInputUtil';
import { createCardTitle } from '../../../../scmpub/scmpub/pub/tool/titleUtil';
import '../../refers/serialNoRefer/index.less';
import { onHandBtnSelected } from '../../pub/btnClicks/onHandSelected';
import BarCode from 'ic/ic/components/barcode';
import { combineMaterialInfo } from 'ic/ic/components/barcode';
import MergePrinting from 'scmpub/scmpub/components/MergePrinting';
import { RownoUtils } from 'src/scmpub/scmpub/pub/tool/cardTableTools';
import { initLang, getLangByResId } from '../../../../scmpub/scmpub/pub/tool/multiLangUtil';
import SetPiece from 'ic/ic/components/setPiece';
import backBtnClick from '../../pub/btnClicks/outboundcard/backBtnClick';
import { transtypeUtils } from '../../../../scmpub/scmpub/pub/tool';
import { getUrlParam } from '../../pub/utils';
import {rowClick} from "../../generalin/card/btnClicks";
const constance = {
FIELD: { cardTable: AREA.bodyTable, formArea: AREA.formArea },
PAGECODE: { card: PAGECARDCODE },
URL,
ATTRCODE: {},
appcode: appcode,
pagecodecard: PAGECARDCODE,
pagecodechi: SUBCHILD.pagecode,
SUBCHILD
};
export default class PurchaseInCard extends Component {
constructor(props) {
props.use.form(AREA.formArea);
props.use.cardTable(AREA.bodyTable);
super(props);
this.meta;
this.pageQueryClick = pageQueryClick;
this.combineData; // 合并显示变量:存放合并数据
this.billcode = '';
this.setPieceData = {};
this.curindex = 0;
this.transferStatus = {};
this.copyRowDatas = null; //复制行数据
this.state = {
hideAdd: false,
hideDel: false,
headRows: {}, //用于存量查拣
showOnhandBtn: false, //是否显示存量查拣按钮
showLoc: false,
locStatus: 1,
warehouse: '',
locType: {
isLoc: true,
isSer: true
},
showTrack: false, //单据追溯
pk: '',
target: null, //附件管理弹出框目标位置
showUploader: false, //是否显示附件管理弹出框
tableData: { rows: [] },
refreshFlag: 0,
editable: false, //页面是否可以编辑
status: UISTATE.browse, // 页面标志,默认浏览态
showSetPiece: false, //显示成套件信息
showConditionModal: false, //合并显示
currentindex: 0
};
initLang(this, [ '4008generalin', '4008pub', '4008serialnorefer' ], 'ic', initTemplate.bind(this, this.props));
}
// 渲染页面前,执行
componentWillMount() {
// 关闭浏览器
window.onbeforeunload = () => {
let status = this.props.getUrlParam('status');
if (!status) status == 'browse';
status = status == 'browse' ? 'browse' : 'edit';
if (status == 'edit') {
return getLangByResId(this, '4008GENERALIN-000006'); /* 国际化处理: 当前单据未保存,您确认离开此页面?*/
}
};
}
// 渲染页面后,执行
componentDidMount() {
//设置状态
// this.props.BillHeadInfo.setBillHeadInfoVisible({
// showBackBtn: true, //控制显示返回按钮: true为显示,false为隐藏 ---非必传
// showBillCode: true, //控制显示单据号:true为显示,false为隐藏 ---非必传
// billCode: '' //修改单据号---非必传
// });
}
initData = (isRefresh) => {
let type = getUrlParam(this.props.getUrlParam, 'type');
if (type && type != 'transfer' && !isRefresh) {
this.toggleShow.call(this);
let transferIds = this.props.transferTable.getTransferTableSelectedId();
if (transferIds) {
let orderbids = new Set();
let orderhids = new Set();
let cbilltype = '';
transferIds.map((v) => {
if (type == 'ref4642') {
v.bodys.map((body) => {
orderbids.add(body.pk + ',' + body.ts);
});
orderhids.add(v.head.pk + ',' + v.head.ts);
} else {
v.bodys.map((body) => {
orderbids.add(body.pk);
});
orderhids.add(v.head.pk);
}
});
if (type == 'ref4A61') {
cbilltype = '4A61';
} else if (type == 'ref4A63') {
cbilltype = '4A63';
} else if (type == 'ref4A72') {
cbilltype = '4A72';
}
//lhw 20240125 入库申请单 begin
else if (type == 'ref488S') {
cbilltype = '488S';
}
//end
let ids = [ { cbilltype: cbilltype, hids: orderhids, bids: orderbids } ];
transfer.call(this, ids);
}
} else {
// 解析请求路径中的参数,通过参数解控制界面按钮的展示
let id = getUrlParam(this.props.getUrlParam, 'id');
let status = getUrlParam(this.props.getUrlParam, 'status') || UISTATE.browse;
let copypk = getUrlParam(this.props.getUrlParam, 'copypk');
if (id) {
pageQueryClick.call(this, this.props, id, null, isRefresh);
} else {
//不是编辑
if (status == 'edit' && copypk) {
//复制
let data = { pageid: PAGECODE.card, pk: copypk };
ajax({
url: URL.copy,
data: data,
method: 'post',
success: (res) => {
processICBill.call(this, res.data);
this.props.form.setAllFormValue({
[FIELD.formArea]: res.data.billcard.head[FIELD.formArea]
});
this.props.cardTable.setTableData(FIELD.cardTable, res.data.billcard.body[FIELD.cardTable]);
this.toggleShow.call(this);
}
});
} else {
let billcodeStr = '';
this.props.form.EmptyAllFormValue(FIELD.formArea);
this.props.cardTable.setTableData(FIELD.cardTable, { rows: [] });
this.props.BillHeadInfo.setBillHeadInfoVisible({
billCode: '' //修改单据号---非必传
});
}
}
}
};
//切换页面状态
toggleShow = () => {
buttonController.call(this, this.props, AREA.formArea, AREA.bodyTable);
};
//获取列表肩部信息
getTableHead = (buttons) => {
return (
{this.props.button.createButtonApp({
area: 'card_body',
ignoreHotkeyCode: 'LOCSNBarCode',
onButtonClick: commonBtnClicks.bind(this)
})}
);
};
getTableHeadLeft = () => {
return (
pagecode={PAGECARDCODE} locPagecode={SUBCHILD.pagecode} formarea={AREA.formArea} cardarea={AREA.bodyTable} pk_org_field={'pk_org'} placeholder={getLangByResId(this, '4008PUB-000064') /* 国际化处理: 请输入条形码*/} billtype={'4A'} setSerMnger={(isLocationManaged, materialSerialMap, materialSnunitMap) => { combineMaterialInfo.call(this, isLocationManaged, materialSerialMap, materialSnunitMap); }} {...this.props} /> ); }; /** * 数据选中时机设置的按钮显示 * @param {number} 页签的key */ setBtnVisible = () => { let checkdatas = this.props.cardTable.getCheckedRows(AREA.bodyTable); const { setButtonDisabled } = this.props.button; if (checkdatas.length > 0) { setButtonDisabled([ BTNID.DeleteLine, BTNID.CopyLine ], false); } else { setButtonDisabled([ BTNID.DeleteLine, BTNID.CopyLine ], true); } }; change = (data) => { console.log(data); }; hideModal = () => { this.setState({ showSetPiece: false }); }; closeModal = () => { this.state.showLoc = false; this.setState(this.state); }; onhandToggleShow = () => { this.setState({ showOnhandBtn: !this.state.showOnhandBtn }); }; // 转单左侧列表点击切换事件 transferListClick = (record, index, status) => { this.props.beforeUpdatePage(FIELD.formArea, FIELD.cardTable); this.curindex = index; //点击转单缩略图的钩子函数 let isEdit = this.transferStatus[this.curindex]; this.props.form.setAllFormValue({ [FIELD.formArea]: record.head[FIELD.formArea] }, isEdit == 'browse'); transtypeUtils.setValue.call(this, FIELD.formArea, FIELD.ctrantypeid, FIELD.vtrantypecode); this.props.cardTable.setTableData(FIELD.cardTable, record.body[FIELD.cardTable], null, isEdit == 'browse'); let pk = record.head[FIELD.formArea].rows[0].values.cgeneralhid; this.props.setUrlParam({ id: pk ? pk.value : null, status: isEdit, type: getUrlParam(this.props.getUrlParam, 'type') }); let vbillcode = record.head[FIELD.formArea].rows[0].values.vbillcode; this.props.BillHeadInfo.setBillHeadInfoVisible({ billCode: vbillcode && vbillcode.value ? vbillcode.value : '' }); this.props.updatePage(FIELD.formArea, FIELD.cardTable); this.toggleShow.call(this); }; // 获取转单界面 getTransferView = () => { let { form, cardTable, button, transferTable, modal, socket } = this.props; const { createTransferList } = transferTable; let { createForm } = form; let { createCardTable } = cardTable; let { createModal } = modal; let buttons = button.getButtons(); let locStatus = getUrlParam(this.props.getUrlParam, 'status') || UISTATE.browse; let { pagecode, headcode, bodycode, headpk, billtype, loccode } = SUBCHILD; const { NCDiv } = base; let { showUploader, target } = this.state; let refdatasource = getUrlParam(this.props.getUrlParam, 'type') + 'DataSource'; const MergePrintingProps = { jsonData: this.combineData, toggleConditionModal: () => { this.setState({ showConditionModal: !this.state.showConditionModal }); }, showConditionModal: this.state.showConditionModal }; // 默认不自动聚焦 this.props.controlAutoFocus(true); return ( {socket.connectMesg({ headBtnAreaCode: AREA.cardHeadBtnArea, // 表头按钮区域ID formAreaCode: AREA.formArea, // 表头Form区域ID billtype: FIELD.billtype, billpkname: FIELD.hid, dataSource: datasourceKey.listCardKey })}
{createCardTitle(this, { backBtnClick: backBtnClick.bind(this, this.props, constance) })} {button.createErrorFlag({ headBtnAreaCode: 'card_head' })} {this.props.button.createButtonApp({ area: 'card_head', onButtonClick: commonBtnClicks.bind(this) })} show={this.state.showTrack} close={() => { this.setState({ showTrack: false }); }} pk={this.state.pk} type="4A" /> {/* 合并显示组件 */} {this.combineData && {createTransferList({ dataSource: refdatasource, //表格组件id headcode: FIELD.formArea, bodycode: FIELD.cardTable, transferListId: FIELD.left, //转单列表id onTransferItemSelected: (record, status, index) => { this.props.beforeUpdatePage(FIELD.formArea, FIELD.cardTable); let isEdit = this.props.cardTable.getStatus(AREA.bodyTable); let cgeneralhid = this.props.form.getFormItemsValue(FIELD.formArea, 'cgeneralhid').value; if (!status) { isEdit = 'edit'; } if (status && index == 0 && !cgeneralhid) { //如果是取消自动跳转到第0条,且第0条是浏览态,则应该是浏览态 isEdit = 'browse'; } if (this.transferStatus[index]) { isEdit = this.transferStatus[index]; } this.curindex = index; this.setState({ currentindex: index }); this.props.form.setAllFormValue( { [FIELD.formArea]: record.head[FIELD.formArea] ? record.head[FIELD.formArea] : record.head.head }, isEdit == 'browse' ); transtypeUtils.setValue.call(this, FIELD.formArea, FIELD.ctrantypeid, FIELD.vtrantypecode); this.props.cardTable.setTableData( FIELD.cardTable, record.body[FIELD.cardTable] ? record.body[FIELD.cardTable] : record.body.body, null, isEdit == 'browse' ); let pk = record.head[FIELD.formArea].rows[0].values.cgeneralhid; this.props.setUrlParam({ id: pk ? pk.value : null, status: isEdit, type: getUrlParam(this.props.getUrlParam, 'type') }); let vbillcode = record.head[FIELD.formArea].rows[0].values.vbillcode; this.props.BillHeadInfo.setBillHeadInfoVisible({ billCode: vbillcode && vbillcode.value ? vbillcode.value : '' }); this.props.updatePage(FIELD.formArea, FIELD.cardTable); this.toggleShow.call(this); }, onTransferItemClick: (record, index, status) => { // 如果编辑过,则弹框提示,让用户选择是否继续 this.setState({ currentindex: index }); this.transferListClick(record, index, status); } })} className="transferList-content-right nc-bill-card" id="puarrival-card" style={{ position: 'relative' }} > {createForm(AREA.formArea, { onAfterEvent: headAfterEvent.bind(this), onBeforeEvent: headBeforeEvent.bind(this) })} {createCardTable(AREA.bodyTable, { tableHead: this.getTableHead.bind(this, buttons), tableHeadLeft: this.getTableHeadLeft, //modelSave: btnClickController.bind(this), onAfterEvent: bodyAfterEvent.bind(this), onRowClick: rowClick.bind(this), showCheck: true, hideModelSave: true, hideAdd: true, hideDel: this.state.hideDel, onBeforeEvent: bodyBeforeEvent.bind(this), onBatchChange: batchEvents.bind(this), inputChange: inputChange.bind(this, 'crowno'), adaptionHeight: true, //卡片高度自适应适配 modelAddRow: () => { RownoUtils.setRowNo(this.props, FIELD.cardTable, 'crowno'); } })} headRows={this.state.headRows} onChange={(data) => { onHandBtnSelected.call( this, { AREA: { body: AREA.bodyTable, formArea: AREA.formArea }, FIELD: { cwarehouseid: FIELD.cwarehouseid }, PAGECODE: { card: PAGECARDCODE } }, commonBodyEvent.bind( this, this.props, AREA.bodyTable, 'nnum', [ { oldvalue: { value: '' }, newvalue: { value: 1 } } ], -1, constance, null ), data ); }} showBatch={false} appcode={'400802200'} headTemplateCode={'400802200_in_head'} bodyTemplateCode={'400802200_in_body'} undealNumCode={'onhandshouldnum'} thisNumCode={'onhandcurrentnum'} isSatisfyCode={'fulfiltype'} editable={status == UISTATE.edit || status == 'add'} show={this.state.showOnhandBtn} toggleShow={this.onhandToggleShow} /> {this.state.showSetPiece && ( show={this.state.showSetPiece} headSetPiece={this.setPieceData.headSetPiece} bodySetPiece={this.setPieceData.bodySetPiece} onHide={this.hideModal} /> )} title={getLangByResId(this, '4008GENERALOUT-000009')} /* 国际化处理: 货位序列号*/ show={this.state.showLoc} onHide={this.closeModal} okBtnClick={okCallback.bind(this, { SUBCHILD, AREA, onAfterEvent: bodyAfterEvent.bind(this) })} uiInfo={{ pageCode: pagecode, headCode: headcode, bodyCode: bodycode }} headPK={headpk} refreshFlag={this.state.refreshFlag} locCode={loccode} locStatus={locStatus} locType={this.state.locType} tableData={this.state.tableData} billType={billtype} warehouse={this.state.warehouse} /> {showUploader && ( billId={this.state.pk} target={target} onHide={() => { this.setState({ showUploader: false }); }} /> )} {createModal('ResumeMessageDlg', { className: 'iframe-modal', size: 'xlg' })} {createModal('MessageDlg', { className: 'iframe-modal', size: 'xlg' })} {createModal('code-config')} {createModal('delModal')} {createModal('message', { title: getLangByResId(this, '4008GENERALOUT-000010'), // 弹框表头信息/* 国际化处理: 提示*/ content: '', //弹框内容,可以是字符串或dom rightBtnName: getLangByResId(this, '4008GENERALOUT-000011') //左侧按钮名称,默认关闭/* 国际化处理: 取消*/ })} {/* 打印次数 */} {createModal('printService', { className: 'print-service' })}
);
};
//获取正常页面
getNormalView = () => {
let status = this.props.getUrlParam('status');
let { cardTable, form, modal, cardPagination, button, socket } = this.props;
let buttons = this.props.button.getButtons();
let { createForm } = form;
let { createCardTable } = cardTable;
let { createModal } = modal;
let locStatus = this.props.getUrlParam('status');
let { pagecode, headcode, bodycode, headpk, billtype, loccode } = SUBCHILD;
const { createCardPagination } = cardPagination;
let { showUploader, target } = this.state;
//光标默认聚焦关闭,由业务开发控制,配合props.controlAutoFocus()使用。
// if (this.status == 'add') {
// //添加聚焦
// this.props.controlAutoFocus();
// } else {
// //其他情况关闭聚焦
// this.props.controlAutoFocus(true);
// }
const MergePrintingProps = {
jsonData: this.combineData,
toggleConditionModal: () => {
this.setState({ showConditionModal: !this.state.showConditionModal });
},
showConditionModal: this.state.showConditionModal
};
return (
{socket.connectMesg({
headBtnAreaCode: AREA.cardHeadBtnArea, // 表头按钮区域ID
formAreaCode: AREA.formArea, // 表头Form区域ID
billtype: FIELD.billtype,
billpkname: FIELD.hid,
dataSource: datasourceKey.listCardKey
})}
{createCardTitle(this, {
billCode: this.billcode, //单据号
backBtnClick: () => {
commonBtnClicks.bind(this, this.props, 'Back')();
}
})}
{button.createErrorFlag({
headBtnAreaCode: 'card_head'
})}
{this.props.button.createButtonApp({
area: 'card_head',
onButtonClick: commonBtnClicks.bind(this)
})}
{this.state.status == UISTATE.browse ? (
{createCardPagination({
handlePageInfoChange: pageQueryClick.bind(this),
dataSource: datasourceKey.listCardKey
})}
) : (
''
)}
{createForm(AREA.formArea, {
onBeforeEvent: headBeforeEvent.bind(this),
onAfterEvent: headAfterEvent.bind(this)
})}
{/* {this.getTableHead(buttons)} */}
{createCardTable(AREA.bodyTable, {
hideModelSave: true,
tableHead: this.getTableHead.bind(this, buttons),
tableHeadLeft: this.getTableHeadLeft,
modelSave: commonBtnClicks.bind(this),
onBeforeEvent: bodyBeforeEvent.bind(this),
onAfterEvent: bodyAfterEvent.bind(this),
onRowClick: rowClick.bind(this),
inputChange: inputChange.bind(this, 'crowno'),
showCheck: true,
adaptionHeight: true, //卡片高度自适应适配
hideAdd: this.state.hideAdd,
onBatchChange: batchEvents.bind(this),
hideDel: this.state.hideDel,
modelAddRow: () => {
RownoUtils.setRowNo(this.props, AREA.bodyTable, 'crowno');
},
onSelectedAll: () => this.setBtnVisible(),
onSelected: () => this.setBtnVisible()
})}
headRows={this.state.headRows} onChange={(data) => { onHandBtnSelected.call( this, { AREA: { body: AREA.bodyTable, formArea: AREA.formArea }, FIELD: { cwarehouseid: FIELD.cwarehouseid }, PAGECODE: { card: PAGECARDCODE } }, commonBodyEvent.bind( this, this.props, AREA.bodyTable, 'nnum', [ { oldvalue: { value: '' }, newvalue: { value: 1 } } ], -1, constance, null ), data ); }} showBatch={false} appcode={'400802200'} headTemplateCode={'400802200_in_head'} bodyTemplateCode={'400802200_in_body'} undealNumCode={'onhandshouldnum'} thisNumCode={'onhandcurrentnum'} isSatisfyCode={'fulfiltype'} editable={status == UISTATE.edit || status == 'add'} show={this.state.showOnhandBtn} toggleShow={this.onhandToggleShow} /> show={this.state.showTrack} close={() => { this.setState({ showTrack: false }); }} pk={this.state.pk} type="4A" /> {/* 合并显示组件 */} {this.combineData && {this.state.showSetPiece && ( show={this.state.showSetPiece} headSetPiece={this.setPieceData.headSetPiece} bodySetPiece={this.setPieceData.bodySetPiece} onHide={this.hideModal} /> )} title={getLangByResId(this, '4008GENERALIN-000008')} /* 国际化处理: 货位序列号*/ show={this.state.showLoc} onHide={this.closeModal} okBtnClick={okCallback.bind(this, { SUBCHILD, AREA, onAfterEvent: bodyAfterEvent.bind(this) })} uiInfo={{ pageCode: pagecode, headCode: headcode, bodyCode: bodycode }} headPK={headpk} refreshFlag={this.state.refreshFlag} locCode={loccode} locStatus={locStatus} locType={this.state.locType} tableData={this.state.tableData} billType={billtype} warehouse={this.state.warehouse} /> {showUploader && ( billId={this.state.pk} target={target} onHide={() => { this.setState({ showUploader: false }); }} /> )} {createModal('code-config')} {createModal('ResumeMessageDlg', { className: 'iframe-modal', size: 'xlg' })} {createModal('delModal')}
);
};
render() {
let type = getUrlParam(this.props.getUrlParam, 'type');
if (type) {
return this.getTransferView();
} else {
return this.getNormalView();
}
}
}
PurchaseInCard = createPage({
billinfo: {
billtype: 'card',
pagecode: PAGECARDCODE,
headcode: AREA.formArea,
bodycode: {
[AREA.bodyTable]: 'cardTable'
}
},
orderOfHotKey: [ AREA.formArea, AREA.bodyTable ]
})(PurchaseInCard);
六、后端代码
1、拉单查询
package nccloud.web.ic.inbound.generalin.action;
import nc.itf.ic.ic_gapply.gapplyheadvo.IGapplyHeadVOService;
import nc.ui.querytemplate.querytree.IQueryScheme;
import nc.vo.ic.icgapply.GapplyVO;
import nccloud.dto.scmpub.page.entity.SCMQueryTreeFormatVO;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.framework.core.json.IJson;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.action.itf.ICommonAction;
import nccloud.framework.web.container.IRequest;
import nccloud.framework.web.json.JsonFactory;
import nccloud.framework.web.ui.pattern.billgrid.BillGrid;
import nccloud.framework.web.ui.pattern.billgrid.BillGridOperator;
import nccloud.pubitf.platform.query.INCCloudQueryService;
public class QueryRef488SAction implements ICommonAction {
public Object doAction(IRequest request) {
String read = request.read();
IJson json = JsonFactory.create();
SCMQueryTreeFormatVO info = (SCMQueryTreeFormatVO) json.fromJson(read, SCMQueryTreeFormatVO.class);
INCCloudQueryService queryutil = (INCCloudQueryService) ServiceLocator.find(INCCloudQueryService.class);
IQueryScheme scheme = queryutil.convertCondition(info.getQueryInfo());
String searchSql = "";
if(scheme != null && scheme.getWhereSQLOnly() != null) {
searchSql = scheme.getWhereSQLOnly();
}
try {
IGapplyHeadVOService service = ServiceLocator.find(IGapplyHeadVOService.class);
GapplyVO[] vos = service.listGapplyVOByCondition(searchSql);
if (vos != null) {
BillGridOperator operator = new BillGridOperator(info.getTempletid(), info.getPageCode());
BillGrid[] grids = operator.toBillGrids(vos);
// BillGrid[] var13 = grids;
// int var14 = grids.length;
// for (int var15 = 0; var15 < var14; ++var15) {
// BillGrid grid = var13[var15];
// (new AssignSetScaleField()).setFieldsScale(grid);
// }
return grids;
}
} catch (Exception var17) {
ExceptionUtils.wrapException(var17);
}
return null;
}
}
鉴权文件
2、单据转换
package nccloud.pubimpl.ic.inbound.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import nc.bs.dao.BaseDAO;
import nc.bs.framework.common.NCLocator;
import nc.impl.pubapp.pattern.data.vo.VOQuery;
import nc.itf.ic.ic_gapply.gapplyheadvo.IGapplyHeadVOService;
import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil;
import nc.jdbc.framework.processor.BeanListProcessor;
import nc.pubitf.org.cache.IOrgUnitPubService_C;
import nc.vo.am.constant.BillTypeConst_RM;
import nc.vo.ic.icgapply.GapplyBodyVO;
import nc.vo.ic.icgapply.GapplyHeadVO;
import nc.vo.ic.icgapply.GapplyVO;
import nc.vo.ic.m46.entity.FinProdInHeadVO;
import nc.vo.ic.m46.entity.FinProdInVO;
import nc.vo.ic.m4a.entity.GeneralInHeadVO;
import nc.vo.ic.m4a.entity.GeneralInVO;
import nc.vo.ic.pub.util.CollectionUtils;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;
import nc.vo.pub.CircularlyAccessibleValueObject;
import nc.vo.pub.lang.UFDate;
import nc.vo.pubapp.AppContext;
import nc.vo.rom.accept.AcceptHeadVO;
import nc.vo.rom.accept.AcceptVO;
import nc.vo.rom.accept.ActualRestore;
import nc.vo.rum.assign.AssignVO;
import nc.vo.rum.assign.restore.AssignReturnBodyVO;
import nc.vo.rum.assign.restore.AssignReturnHeadVO;
import nc.vo.rum.borrow.restore.RestoreBodyVO;
import nc.vo.rum.borrow.restore.RestoreHeadVO;
import nc.vo.rum.borrow.restore.RestoreVO;
import nc.vo.scmpub.res.billtype.ICBillType;
import nccloud.dto.ic.pub.entity.TransVoInfo;
import nccloud.dto.ic.pub.entity.TransferInfo;
import nccloud.pubitf.ic.inbound.service.IInboundTransferVoService;
public class InboundTransferVoServiceImpl implements IInboundTransferVoService {
public GeneralInVO[] transTo4A(TransferInfo info) throws BusinessException {
if (null == info) {
return null;
} else {
TransVoInfo[] voInfos = info.getInfo();
if (voInfos.length < 1) {
return null;
} else {
List
AssignReturnHeadVO[] hvos4A61 = new AssignReturnHeadVO[0];
AssignReturnBodyVO[] bvos4A61 = new AssignReturnBodyVO[0];
RestoreHeadVO[] hvos4A63 = new RestoreHeadVO[0];
RestoreBodyVO[] bvos4A63 = new RestoreBodyVO[0];
AcceptHeadVO[] hvos4A72 = new AcceptHeadVO[0];
ActualRestore[] bvos4A72 = new ActualRestore[0];
//lhw 20240129 入库申请单 begin
GapplyHeadVO[] hvos488S = new GapplyHeadVO[0];
GapplyBodyVO[] bvos488S = new GapplyBodyVO[0];
//end
if (voInfos.length > 0) {
for (int i = 0; i < voInfos.length; ++i) {
String cbilltype = voInfos[i].getCbilltype();
VOQuery query;
VOQuery queryb;
int j;
ArrayList bodyvo;
int z;
AggregatedValueObject[] vochange;
if (BillTypeConst_RM.RUM_ASSIGNRETURN.equals(cbilltype)) {
query = new VOQuery(AssignReturnHeadVO.class);
hvos4A61 = (AssignReturnHeadVO[]) query.query(voInfos[i].getHids());
queryb = new VOQuery(AssignReturnBodyVO.class);
bvos4A61 = (AssignReturnBodyVO[]) queryb.query(voInfos[i].getBids());
AssignVO[] volist = new AssignVO[hvos4A61.length];
for (j = 0; j < hvos4A61.length; ++j) {
AssignVO vo = new AssignVO();
vo.setParentVO(hvos4A61[j]);
bodyvo = new ArrayList();
for (z = 0; z < bvos4A61.length; ++z) {
if (bvos4A61[z].getPk_assign().equals(hvos4A61[j].getPk_assign())) {
bodyvo.add(bvos4A61[z]);
}
}
vo.setChildrenVO(
(CircularlyAccessibleValueObject[]) bodyvo.toArray(new AssignReturnBodyVO[0]));
volist[j] = vo;
}
vochange = PfServiceScmUtil.executeVOChange(cbilltype, ICBillType.GeneralIn.getCode(),
volist);
CollectionUtils.addArrayToList(resultvos, (GeneralInVO[]) ((GeneralInVO[]) vochange));
this.fillDate(resultvos);
} else if (BillTypeConst_RM.RUM_BORROWRETURN.equals(cbilltype)) {
query = new VOQuery(RestoreHeadVO.class);
hvos4A63 = (RestoreHeadVO[]) query.query(voInfos[i].getHids());
queryb = new VOQuery(RestoreBodyVO.class);
bvos4A63 = (RestoreBodyVO[]) queryb.query(voInfos[i].getBids());
RestoreVO[] volist = new RestoreVO[hvos4A63.length];
for (j = 0; j < hvos4A63.length; ++j) {
RestoreVO vo = new RestoreVO();
vo.setParentVO(hvos4A63[j]);
bodyvo = new ArrayList();
for (z = 0; z < bvos4A63.length; ++z) {
if (bvos4A63[z].getPk_borrow().equals(hvos4A63[j].getPk_borrow())) {
bodyvo.add(bvos4A63[z]);
}
}
vo.setChildrenVO(
(CircularlyAccessibleValueObject[]) bodyvo.toArray(new RestoreBodyVO[0]));
volist[j] = vo;
}
vochange = PfServiceScmUtil.executeVOChange(cbilltype, ICBillType.GeneralIn.getCode(),
volist);
CollectionUtils.addArrayToList(resultvos, (GeneralInVO[]) ((GeneralInVO[]) vochange));
this.fillDate(resultvos);
} else if (BillTypeConst_RM.ROM_ACCEPT.equals(cbilltype)) {
query = new VOQuery(AcceptHeadVO.class);
hvos4A72 = (AcceptHeadVO[]) query.query(voInfos[i].getHids());
queryb = new VOQuery(ActualRestore.class);
bvos4A72 = (ActualRestore[]) queryb.query(voInfos[i].getBids());
AcceptVO[] volist = new AcceptVO[hvos4A72.length];
for (j = 0; j < hvos4A72.length; ++j) {
AcceptVO vo = new AcceptVO();
vo.setParentVO(hvos4A72[j]);
bodyvo = new ArrayList();
for (z = 0; z < bvos4A72.length; ++z) {
if (bvos4A72[z].getPk_accept().equals(hvos4A72[j].getPk_accept())) {
bodyvo.add(bvos4A72[z]);
}
}
vo.setChildrenVO(
(CircularlyAccessibleValueObject[]) bodyvo.toArray(new ActualRestore[0]));
volist[j] = vo;
}
vochange = PfServiceScmUtil.executeVOChange(cbilltype, ICBillType.GeneralIn.getCode(),
volist);
CollectionUtils.addArrayToList(resultvos, (GeneralInVO[]) ((GeneralInVO[]) vochange));
this.fillDate(resultvos);
}
//lhw 20240129 入库申请单 begin
else if("488S".equals(cbilltype)) {
IGapplyHeadVOService gapplyservice = NCLocator.getInstance().lookup(IGapplyHeadVOService .class);
hvos488S = gapplyservice.listGapplyHeadVOByPk(voInfos[i].getHids());
StringBuffer parameter = new StringBuffer();
if(voInfos[i].getBids().length > 1) {
for (int k = 0; k < voInfos[i].getBids().length; k++) {
parameter.append("'"+(voInfos[i].getBids())[k]+"'");
if(k < voInfos[i].getBids().length-1) {
parameter.append(",");
}
}
}
else {
parameter.append("'"+(voInfos[i].getBids())[0]+"'");
}
String sql = "select * from ic_gapply_b where ic_gapply_b.pk_gapply_b in ("+parameter+") and ic_gapply_b.dr=0 ";
List
bvos488S = new GapplyBodyVO[lsGbvos.size()];
for (int k = 0; k < lsGbvos.size(); k++) {
bvos488S[k] = lsGbvos.get(k);
}
GapplyVO[] volist = new GapplyVO[hvos488S.length];
for (j = 0; j < hvos488S.length; ++j) {
GapplyVO vo = new GapplyVO();
vo.setParentVO(hvos488S[j]);
bodyvo = new ArrayList();
for (z = 0; z < bvos488S.length; ++z) {
if (bvos488S[z].getPk_gapply_h().equals(hvos488S[j].getPk_gapply_h())) {
bodyvo.add(bvos488S[z]);
}
}
vo.setChildrenVO(
(CircularlyAccessibleValueObject[]) bodyvo.toArray(new GapplyBodyVO[0]));
volist[j] = vo;
}
vochange = PfServiceScmUtil.executeVOChange(cbilltype, ICBillType.GeneralIn.getCode(),
volist);
CollectionUtils.addArrayToList(resultvos, (GeneralInVO[]) ((GeneralInVO[]) vochange));
this.fillDate(resultvos);
}
//end
}
}
return (GeneralInVO[]) CollectionUtils.listToArray(resultvos);
}
}
}
private void fillDate(List
String[] pk_orgs = new String[resultvos.size()];
for (int i = 0; i < resultvos.size(); ++i) {
String pk_org = ((GeneralInVO) resultvos.get(i)).getParentVO().getPk_org();
pk_orgs[i] = pk_org;
}
IOrgUnitPubService_C service = (IOrgUnitPubService_C) NCLocator.getInstance()
.lookup(IOrgUnitPubService_C.class);
UFDate data = AppContext.getInstance().getBusiDate();
HashMap
for (int i = 0; i < resultvos.size(); ++i) {
GeneralInHeadVO head = ((GeneralInVO) resultvos.get(i)).getHead();
head.setPk_org_v((String) pk_org_v.get(head.getPk_org()));
}
}
@Override
public FinProdInVO[] transTo46(TransferInfo info) throws BusinessException {
if (null == info) {
return null;
} else {
TransVoInfo[] voInfos = info.getInfo();
if (voInfos.length < 1) {
return null;
} else {
List
GapplyHeadVO[] hvos488S = new GapplyHeadVO[0];
GapplyBodyVO[] bvos488S = new GapplyBodyVO[0];
if (voInfos.length > 0) {
for (int i = 0; i < voInfos.length; ++i) {
String cbilltype = voInfos[i].getCbilltype();
VOQuery query;
VOQuery queryb;
int j;
ArrayList bodyvo;
int z;
AggregatedValueObject[] vochange;
if("488S".equals(cbilltype)) {
IGapplyHeadVOService gapplyservice = NCLocator.getInstance().lookup(IGapplyHeadVOService .class);
hvos488S = gapplyservice.listGapplyHeadVOByPk(voInfos[i].getHids());
StringBuffer parameter = new StringBuffer();
if(voInfos[i].getBids().length > 1) {
for (int k = 0; k < voInfos[i].getBids().length; k++) {
parameter.append("'"+(voInfos[i].getBids())[k]+"'");
if(k < voInfos[i].getBids().length-1) {
parameter.append(",");
}
}
}
else {
parameter.append("'"+(voInfos[i].getBids())[0]+"'");
}
String sql = "select * from ic_gapply_b where ic_gapply_b.pk_gapply_b in ("+parameter+") and ic_gapply_b.dr=0 ";
List
bvos488S = new GapplyBodyVO[lsGbvos.size()];
for (int k = 0; k < lsGbvos.size(); k++) {
bvos488S[k] = lsGbvos.get(k);
}
GapplyVO[] volist = new GapplyVO[hvos488S.length];
for (j = 0; j < hvos488S.length; ++j) {
GapplyVO vo = new GapplyVO();
vo.setParentVO(hvos488S[j]);
bodyvo = new ArrayList();
for (z = 0; z < bvos488S.length; ++z) {
if (bvos488S[z].getPk_gapply_h().equals(hvos488S[j].getPk_gapply_h())) {
bodyvo.add(bvos488S[z]);
}
}
vo.setChildrenVO(
(CircularlyAccessibleValueObject[]) bodyvo.toArray(new GapplyBodyVO[0]));
volist[j] = vo;
}
vochange = PfServiceScmUtil.executeVOChange(cbilltype, ICBillType.ProductionIn.getCode(),
volist);
CollectionUtils.addArrayToList(resultvos, (FinProdInVO[]) ((FinProdInVO[]) vochange));
this.fillProDate(resultvos);
}
}
}
return (FinProdInVO[]) CollectionUtils.listToArray(resultvos);
}
}
}
private void fillProDate(List
String[] pk_orgs = new String[resultvos.size()];
for (int i = 0; i < resultvos.size(); ++i) {
String pk_org = ((FinProdInVO) resultvos.get(i)).getParentVO().getPk_org();
pk_orgs[i] = pk_org;
}
IOrgUnitPubService_C service = (IOrgUnitPubService_C) NCLocator.getInstance()
.lookup(IOrgUnitPubService_C.class);
UFDate data = AppContext.getInstance().getBusiDate();
HashMap
for (int i = 0; i < resultvos.size(); ++i) {
FinProdInHeadVO head = ((FinProdInVO) resultvos.get(i)).getHead();
head.setPk_org_v((String) pk_org_v.get(head.getPk_org()));
}
}
}
源码地址
链接:https://pan.baidu.com/s/1TkrQBWkzD435QvJyOcwt7A?pwd=1ltv
提取码:1ltv