Commit 3d59efbf by fukai

提交79场校验

parent 92fd234c
const config = {
mt103:{
t111:{visible:true,value:'',read:false,required:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
mt202:{
t111:{visible:true,value:'',read:false,required:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
mt202cov:{
t111:{visible:true,value:'',read:false,required:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
// mt199:{
// t111:{visible:true,value:'001',read:true},
// t121:{visible:true,value:'',read:false,required:true},
// title:''
// },
mt199_fk:{
t111:{visible:true,value:'001',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
// mt299:{
// t111:{visible:true,value:'001',read:true},
// t121:{visible:true,value:'',read:false,required:true},
// title:''
// },
mt299_fk:{
t111:{visible:true,value:'001',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
// mt192:{
// t111:{visible:true,value:'001',read:true},
// t121:{visible:true,value:'',read:false,required:true},
// title:''
// },
mt192_zf:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
mt192_fk:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
mt199_zf:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:'MT 199止付'
},
mt199_zffk:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:'MT 199止付反馈'
},
mt196_zffk:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:'MT 196止付反馈'
},
}
export default function (mty,subflag)
{
let key = mty
if(subflag && subflag!='NONE')
key = `${mty}_${subflag}`
return config[key]
}
\ No newline at end of file
...@@ -32,6 +32,9 @@ const Routes = ({ history }) => ...@@ -32,6 +32,9 @@ const Routes = ({ history }) =>
<Route path="swift/:action/:mctid/:key" component={SWFPage}/> <Route path="swift/:action/:mctid/:key" component={SWFPage}/>
<Route path="swift/:action/:mctid/:key/:rcvbic" component={SWFPage}/> <Route path="swift/:action/:mctid/:key/:rcvbic" component={SWFPage}/>
<Route path="swift/:action/:mctid/:key/:sndbic/:rcvbic" component={SWFPage}/> <Route path="swift/:action/:mctid/:key/:sndbic/:rcvbic" component={SWFPage}/>
<Route path="swift/:action/:t111/:mctid/:key/:sndbic/:rcvbic" component={SWFPage}/>
<Route path="app" component={App}/> <Route path="app" component={App}/>
<Route path="preview/:kind" component={Preview}/> <Route path="preview/:kind" component={Preview}/>
<Route path="result/:kind" component={Result}/> <Route path="result/:kind" component={Result}/>
......
...@@ -23,3 +23,8 @@ export function updateSwiftMessage(swift_message) ...@@ -23,3 +23,8 @@ export function updateSwiftMessage(swift_message)
{ {
return {type:types.SWIFT_UPDATE_SWIFT_MESSAGE,payload:{swift_message}} return {type:types.SWIFT_UPDATE_SWIFT_MESSAGE,payload:{swift_message}}
} }
export function initGpiConf(conf)
{
return {type:types.SWIFT_INIT_GPI_CONF,payload:{conf}}
}
\ No newline at end of file
...@@ -27,5 +27,7 @@ export default createReducer(initialState, { ...@@ -27,5 +27,7 @@ export default createReducer(initialState, {
return objectAssign({},state,{swift_message}) return objectAssign({},state,{swift_message})
}, },
[`${types.SWIFT_INIT_GPI_CONF}`]: (state,{conf})=>{
return objectAssign({},state,{gpi:conf})
},
}) })
\ No newline at end of file
const InitState = { const InitState = {
gpi:{
inited:false,
t111:{visible:false,value:'',err_msg:'',read:true},
t121:{visible:false,value:'',err_msg:'',read:true},
title:''
},
swift_message:"", swift_message:"",
rcv_bic_info:{rcv_bic:'',err_msg:''}, rcv_bic_info:{rcv_bic:'',err_msg:''},
snd_bic_info:{snd_bic:'',err_msg:''}, snd_bic_info:{snd_bic:'',err_msg:''},
......
...@@ -31,5 +31,5 @@ export default keyMirror({ ...@@ -31,5 +31,5 @@ export default keyMirror({
SWIFT_UPDATE_SND_BIC:null, SWIFT_UPDATE_SND_BIC:null,
SWIFT_INIT_TREE_VALUE:null, SWIFT_INIT_TREE_VALUE:null,
SWIFT_UPDATE_SWIFT_MESSAGE:null, SWIFT_UPDATE_SWIFT_MESSAGE:null,
SWIFT_INIT_GPI_CONF:null
}) })
...@@ -3,7 +3,7 @@ import {bindActionCreators} from 'redux'; ...@@ -3,7 +3,7 @@ import {bindActionCreators} from 'redux';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {Table,Steps,Row,Col} from 'antd' import {Table,Steps,Row,Col} from 'antd'
import { updateTreeValue,updateRcvBic,initSwiftMessageTree ,updateSwiftMessage} from '../store/modules/swift/swift_action'; import { updateTreeValue,updateRcvBic,initSwiftMessageTree ,updateSwiftMessage,initGpiConf} from '../store/modules/swift/swift_action';
const Step = Steps.Step; const Step = Steps.Step;
...@@ -11,6 +11,7 @@ const Step = Steps.Step; ...@@ -11,6 +11,7 @@ const Step = Steps.Step;
export const mty=[ export const mty=[
{mty:"mt103",desp:"MT 103 Single Customer Credit Transfer"}, {mty:"mt103",desp:"MT 103 Single Customer Credit Transfer"},
{mty:"mt192",desp:"MT 192 Request for Cancellation"},
{mty:"mt195",desp:"MT 195 Queries"}, {mty:"mt195",desp:"MT 195 Queries"},
{mty:"mt196",desp:"MT 196 Answers"}, {mty:"mt196",desp:"MT 196 Answers"},
{mty:"mt199",desp:"MT 199 Free Format Message"}, {mty:"mt199",desp:"MT 199 Free Format Message"},
...@@ -62,6 +63,7 @@ export class LeadPage extends Component ...@@ -62,6 +63,7 @@ export class LeadPage extends Component
render:(text,record)=>{ render:(text,record)=>{
return <a href="javascript:void(0);" onClick={()=>{ return <a href="javascript:void(0);" onClick={()=>{
this.props.actions.initSwiftMessageTree(null) //清空 this.props.actions.initSwiftMessageTree(null) //清空
this.props.actions.initGpiConf({inited:false})
this.props.history.push(`swift/edit/${this.props.params.mctid||'NONE'}/${record.mty}/NONE`) this.props.history.push(`swift/edit/${this.props.params.mctid||'NONE'}/${record.mty}/NONE`)
} }
}>Create {record.desp}</a> }>Create {record.desp}</a>
...@@ -107,7 +109,7 @@ const mapStateToProps = (state) => { ...@@ -107,7 +109,7 @@ const mapStateToProps = (state) => {
function mapDispatchToProps(dispatch) { function mapDispatchToProps(dispatch) {
return { return {
actions: bindActionCreators({ initSwiftMessageTree }, dispatch) actions: bindActionCreators({ initSwiftMessageTree,initGpiConf }, dispatch)
}; };
} }
......
const Tags = [
{"tag":"20","status":"M","tno":1,"letter":[],"label":"Transaction Reference Number","tagValue":[{},null]},
{"tag":"21","status":"M","tno":2,"letter":[],"label":"Related Reference","tagValue":[{},null]},
{"tag":"11S","status":"M","tno":3,"letter":[],"label":"MT and Date of the Original Message","tagValue":[{},null]},
{"tag":"79","status":"O","tno":4,"letter":[],"label":"Narrative Description of the Original Message","tagValue":[{},null]},
{"tag":"","status":"O","tno":5,"letter":[],"label":"Copy of at least the Mandatory Fields of the Original Message","tagValue":[{},null]}
]
const Title="Request for Cancellation"
export default { Tags,Title}
\ No newline at end of file
import MTn96 from './MTn96' import MTn96 from './MTn96'
import MTn95 from './MTn95' import MTn95 from './MTn95'
import MTn92 from './MTn92'
import MTn99 from './MTn99' import MTn99 from './MTn99'
import MT760 from './MT760' import MT760 from './MT760'
import MT420 from './MT420' import MT420 from './MT420'
...@@ -83,4 +84,6 @@ export default function MTFactory(mty) ...@@ -83,4 +84,6 @@ export default function MTFactory(mty)
return MTn95 return MTn95
if(/mt\d99/.test(mty)) if(/mt\d99/.test(mty))
return MTn99 return MTn99
if(/mt\d92/.test(mty))
return MTn92
} }
\ No newline at end of file
...@@ -32,4 +32,17 @@ function mt707({Tags}){ ...@@ -32,4 +32,17 @@ function mt707({Tags}){
return `45B,46B,47B,49M,49N总长度不得超过63400个字符` return `45B,46B,47B,49M,49N总长度不得超过63400个字符`
} }
const FUNC_SET={mt700,mt707}
\ No newline at end of file function mt199(tree){
console.log(tree)
}
function mt192(tree){
console.log(tree)
}
function mt196(tree){
console.log(tree)
}
function mt299(tree){
console.log(tree)
}
const FUNC_SET={mt700,mt707,mt192,mt196,mt199,mt299}
\ No newline at end of file
import {RegMap} from './TagRegMap' import {RegMap} from './TagRegMap'
export function TagV(tag,status,value,tno,mty) export function TagV(tag,status,value,tno,mty,t111)
{ {
let regobj = RegMap[tag] let regobj = RegMap[tag]
let obj = value[0] let obj = value[0]
...@@ -135,6 +135,9 @@ export function TagV(tag,status,value,tno,mty) ...@@ -135,6 +135,9 @@ export function TagV(tag,status,value,tno,mty)
if(errmsg[ek]) if(errmsg[ek])
return false return false
} }
let msg = gpiValidate(mty,t111,tag,tno,value)
if(msg)
return false
return true return true
} }
...@@ -292,3 +295,309 @@ function TestAdr(adr,reg,line,length) ...@@ -292,3 +295,309 @@ function TestAdr(adr,reg,line,length)
msg.push(linemsg) msg.push(linemsg)
return msg.join(';') return msg.join(';')
} }
function gpiValidate(mty,t111,tag,tno,value){
let mval = value[1]
let errors = value[2]
if(!mval)
return
let lines = mval.split(/[\r\n]{1,2}/g)
let msg = undefined
if(tag=='T79' && t111=='fk' && mty=='mt199')
{
if(lines.length < 4)
{
msg = '至少有4行文字'
errors.s1 = msg
return msg
}
for(let i=0;i<lines.length;i++)
{
if(!lines[i].startsWith("//"))
{
msg = '每行必须以\"//\"起头'
errors.s1 = msg
return msg
}
if(i == 0 && !/^\/\/\d{10}\+\d{4}$/.test(lines[i]))
{
msg = '第一行请填写固定的日期和时间偏量'
errors.s1 = msg
return msg
}
if(i==3 && (lines[i].indexOf("/SHA") > -1 || lines[i].indexOf("/BEN") > -1))
{
if(lines.length ==4)
{
msg = '用承担方式为shaben时,请在第五行补充//:71F:明细'
errors.s1 = msg
return msg
}else{
if(!lines[i+1].startsWith("//:71F:"))
{
msg = '用承担方式为shaben时后续必须跟//:71F:明细'
errors.s1 = msg
return msg
}
}
}
}
//暂时屏蔽
// let first = lines[1]
// if(!/^\/[A-Z]{4}\/([A-Z0-9]{4})?$/.test(first))
// {
// msg = '请在第二行填写正确的状态码——"/状态码/子状态码"'
// errors.s1 = msg
// return msg
// }
// let firstCode = first.substring(1,5)
// let subCode = first.substring(6)
// if(mt199_299.indexOf(firstCode) > -1)
// {
// if(firstCode == 'ACSP')
// {
// if( subCode && ACSP.indexOf(subCode)< 0)
// {
// msg = '状态码为"ACSP"时,子状态码请填写:'+ACSP.join(',')
// errors.s1 = msg
// return msg
// }
// }
// else if(firstCode == 'RJCT')
// {
// if(subCode && PDCR.indexOf(subCode)< 0 )
// {
// msg = '状态码为"RJCT"时,子状态码请填写:'+RJCT.join(',')
// errors.s1 = msg
// return msg
// }
// }
// }
// else
// {
// msg = '请在第二行填写以下状态码:'+mt196_199.join(',')
// errors.s1 = msg
// return msg
// }
}
else if(tag=='T79' && t111=='fk' && mty=='mt299')
{
if(lines.length < 4)
{
msg = '至少有4行文字'
errors.s1 = msg
return msg
}
for(let i=0;i<lines.length;i++)
{
if(!lines[i].startsWith("//"))
{
msg = '每行必须以\"//\"起头'
errors.s1 = msg
return msg
}
if(i == 0 && /^\d{10}\+\d{4}/.test(lines[i]))
{
msg = '第一行请填写固定的日期和时间偏量'
errors.s1 = msg
return msg
}
}
//判断码表
//暂时屏蔽
// let first = lines[1]
// if(!/^\/[A-Z]{4}\/([A-Z0-9]{4})?$/.test(first))
// {
// msg = '请在第二行填写正确的状态码——"/状态码/子状态码"'
// errors.s1 = msg
// return msg
// }
// let firstCode = first.substring(1,5)
// let subCode = first.substring(6)
// if(mt199_299.indexOf(firstCode) > -1)
// {
// if(firstCode == 'ACSP')
// {
// if( subCode && ACSP.indexOf(subCode)< 0)
// {
// msg = '状态码为"ACSP"时,子状态码请填写:'+ACSP.join(',')
// errors.s1 = msg
// return msg
// }
// }
// else if(firstCode == 'RJCT')
// {
// if(subCode && PDCR.indexOf(subCode)< 0 )
// {
// msg = '状态码为"RJCT"时,子状态码请填写:'+RJCT.join(',')
// errors.s1 = msg
// return msg
// }
// }
// }
// else
// {
// msg = '请在第二行填写以下状态码:'+mt196_199.join(',')
// errors.s1 = msg
// return msg
// }
}
else if((tag=='T79' && t111=='zf' && mty=='mt199')
||
(tag=='T79' && t111=='zf' && mty=='mt192')
) //校验状态码
{
let first = lines[0]
if(!/^\/[A-Z]{4}\/([A-Z]{4})?$/.test(first))
{
msg = '请在第一行填写正确的状态码——"状态码/子状态码"'
errors.s1 = msg
return msg
}
let firstCode = first.substring(1,5)
let subCode = first.substring(6)
if(mt192_199.indexOf(firstCode) > -1)
{
if(subCode && subCode != INDM)
{
msg = '子状态码请填写:'+INDM
errors.s1 = msg
return msg
}
}
else
{
msg = '请在第一行填写以下状态码:'+mt192_199.join(',')
errors.s1 = msg
return msg
}
}else if(
(tag=='T76' && t111=='zffk' && mty=='mt196')
||
(tag=='T79' && t111=='zffk' && mty=='mt199')
)//校验状态码
{
let first = lines[0]
if(!/^\/[A-Z]{4}\/([A-Z]{4})?$/.test(first))
{
msg = '请在第一行填写正确的状态码——"/状态码/子状态码"'
errors.s1 = msg
return msg
}
let firstCode = first.substring(1,5)
let subCode = first.substring(6)
if(mt196_199.indexOf(firstCode) > -1)
{
if(firstCode == 'RJCR')
{
if( subCode && RJCR.indexOf(subCode)< 0)
{
msg = '状态码为"RJCR"时,子状态码请填写:'+RJCR.join(',')
errors.s1 = msg
return msg
}
}
else if(firstCode == 'PDCR')
{
if(subCode && PDCR.indexOf(subCode)< 0 )
{
msg = '状态码为"PDCR"时,子状态码请填写:'+PDCR.join(',')
errors.s1 = msg
return msg
}
}
}
else
{
msg = '请在第一行填写以下状态码:'+mt196_199.join(',')
errors.s1 = msg
return msg
}
}
}
const mt199_299 =[
"ACCC",
"ACSP",
"RJCT",
"RETN",
]
const ACSP = [
"G000",
"G001",
"G002",
"G003",
"G004",
]
const RJCT = [
"AC01",
"AC04",
"AC06",
"BE01",
"NOAS",
"RR03",
"FF07",
"RC01",
"G004",
"RC08",
"FOCR",
"DUPL",
"RR05",
"AM06",
"CUST",
"MS03",
]
const mt192_199=[ //支付发起
"DUPL",
"AGNT",
"CURR",
"CUST",
"UPAY",
"CUTA",
"TECH",
"FRAD",
"COVR",
"AM09",
]
const INDM ="INDM"
const mt196_199=[ //支付反馈
"PDCR",
"CNCL",
"RJCR",
]
const RJCR = [
"LEGL",
"AGNT",
"CUST",
"ARDT",
"NOAS",
"NOOR",
"AC04",
"AM04",
"INDM",
"FRNA",
]
const PDCR = [
"PTNA",
"RQDA",
"INDM",
]
\ No newline at end of file
...@@ -35,7 +35,7 @@ export default class T77A extends Component ...@@ -35,7 +35,7 @@ export default class T77A extends Component
validateStatus={errmsg.s1?'error':null} validateStatus={errmsg.s1?'error':null}
> >
<TextArea type= "textarea" maxLength={20*35} cols={35} rows={10} style={{imeMode:'disabled'}} placeholder="Narrative" value={value.s1} onChange={(e)=>this.onChange(e.target.value)}/> <TextArea disabled={this.props.mty=='mt196' && this.props.t111=='zffk'} type= "textarea" maxLength={20*35} cols={35} rows={10} style={{imeMode:'disabled'}} placeholder="Narrative" value={value.s1} onChange={(e)=>this.onChange(e.target.value)}/>
</FormItem> </FormItem>
</Col> </Col>
......
...@@ -29,6 +29,9 @@ export default class T79 extends Component ...@@ -29,6 +29,9 @@ export default class T79 extends Component
let errmsg = value && value.length==3?value[2]:{} let errmsg = value && value.length==3?value[2]:{}
value = value && value.length? value[0] : {} value = value && value.length? value[0] : {}
return (<Row> return (<Row>
<Col> <Col>
<FormItem <FormItem
...@@ -36,7 +39,7 @@ export default class T79 extends Component ...@@ -36,7 +39,7 @@ export default class T79 extends Component
validateStatus={errmsg.s1?'error':null} validateStatus={errmsg.s1?'error':null}
> >
<TextArea wrap="physical" type= "textarea" maxLength={1750} cols={50} rows={35} style={{imeMode:'disabled'}} placeholder="Narrative Description of the Original Message to Which the Answer Relates" value={value.s1} onChange={(e)=>this.onChange(e.target.value)}/> <TextArea wrap="physical" disabled={this.props.mty=='mt196' && this.props.t111=='zffk'} type= "textarea" maxLength={1750} cols={50} rows={35} style={{imeMode:'disabled'}} placeholder="Narrative Description of the Original Message to Which the Answer Relates" value={value.s1} onChange={(e)=>this.onChange(e.target.value)}/>
</FormItem> </FormItem>
</Col> </Col>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment