Commit 644e9bd1 by Zhang Xin

é“联调捕补货

parent 0846eb2f
...@@ -27,6 +27,7 @@ const getBarCodeProductInfo = (data)=>{ ...@@ -27,6 +27,7 @@ const getBarCodeProductInfo = (data)=>{
dispatch(saveCommonInfo(info)) dispatch(saveCommonInfo(info))
dispatch(saveProductInfo(json.data)) dispatch(saveProductInfo(json.data))
}else{ }else{
dispatch(saveProductInfo({}));
switch (taskInfo.currentTaskType){ switch (taskInfo.currentTaskType){
case 3 : case 3 :
//回收任务 //回收任务
...@@ -68,6 +69,7 @@ const saveProductInfo = (data)=>{ ...@@ -68,6 +69,7 @@ const saveProductInfo = (data)=>{
type : barcodeActionType.GETPRODUCTINFO, type : barcodeActionType.GETPRODUCTINFO,
data data
} }
} }
export {getBarCodeProductInfo} export {getBarCodeProductInfo,saveProductInfo}
\ No newline at end of file \ No newline at end of file
...@@ -73,6 +73,11 @@ const getTaskList = (data={})=>{ ...@@ -73,6 +73,11 @@ const getTaskList = (data={})=>{
let taskId=taskInfo.taskId || 0; let taskId=taskInfo.taskId || 0;
let url =`${domain}flat/work/list/${storeInfo.id}/${taskInfo.area}/${taskId}/${userInfo.id}`; let url =`${domain}flat/work/list/${storeInfo.id}/${taskInfo.area}/${taskId}/${userInfo.id}`;
return (dispatch)=>{ return (dispatch)=>{
if(!userInfo.id){
dispatch(addErrorInfo('没有获取用户信息'))
}else if(!taskInfo.area){
dispatch(addErrorInfo('没有获取区域信息'))
}else {
fetch(url,{ fetch(url,{
// credentials : 'include', // credentials : 'include',
method : 'GET', method : 'GET',
...@@ -90,13 +95,18 @@ const getTaskList = (data={})=>{ ...@@ -90,13 +95,18 @@ const getTaskList = (data={})=>{
let currentTaskNum = json.data.flatCommonVo.currentTaskNum; let currentTaskNum = json.data.flatCommonVo.currentTaskNum;
if(currentTaskType === 'RE'){ if(currentTaskType === 'RE'){
//回收 //回收
if(taskInfo.currentTaskType !== "RE"){
childNum = json.data.skuFlatVo.whetherType ? 1 : 2 childNum = json.data.skuFlatVo.whetherType ? 1 : 2
}else{
childNum = 2
}
} }
dispatch(getTaskName(currentTaskType,childNum)) dispatch(getTaskName(currentTaskType,childNum))
} }
dispatch(saveCommonInfo(Object.assign({},data))) dispatch(saveCommonInfo(Object.assign({},data)))
}) })
} }
}
} }
const saveCommonInfo = (data)=>{ const saveCommonInfo = (data)=>{
......
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
import {getTaskList} from "./common"; import {getTaskList} from "./common";
import {saveProductInfo} from './barcodeCommon'
const domain = ENV.domain; const domain = ENV.domain;
let myHeaders = new Headers({ let myHeaders = new Headers({
// 'Access-Control-Allow-Origin': '*', // 'Access-Control-Allow-Origin': '*',
...@@ -29,10 +30,10 @@ const finishBoxRecovery = (info)=>{ ...@@ -29,10 +30,10 @@ const finishBoxRecovery = (info)=>{
body:JSON.stringify(bodyData) body:JSON.stringify(bodyData)
}).then(response=>response.json()) }).then(response=>response.json())
.then((json)=>{ .then((json)=>{
dispatch(saveProductInfo({}));
dispatch(getTaskList(info)); dispatch(getTaskList(info));
}) })
} }
}; };
export {finishBoxRecovery} export {finishBoxRecovery}
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
import actionType from '../actiontype/replenish' import actionType from '../actiontype/replenish'
import {getTaskList} from "./common"; import {getTaskList} from "./common";
import {saveProductInfo} from "./barcodeCommon";
const domain = ENV.domain; const domain = ENV.domain;
let myHeaders = new Headers({ let myHeaders = new Headers({
...@@ -22,4 +23,29 @@ const emptyErrorInfo = ()=>{ ...@@ -22,4 +23,29 @@ const emptyErrorInfo = ()=>{
} }
} }
export default {wrongQrcode,emptyErrorInfo} const finishReplenish = (info)=>{
//已放入回收箱
let {userInfo,taskInfo,storeInfo} = info;
let bodyData = Object.assign({},{
storeId : storeInfo.id,
taskId : taskInfo.taskId,
userId : userInfo.id,
taskType : taskInfo.currentTaskType,
area : taskInfo.area
})
let url=`${domain}machine_pad/trigger_ck_task_sku.action`
return (dispatch)=>{
fetch(url,{
credentials : 'include',
method : 'POST',
mode : 'cors',
headers: myHeaders,
body:JSON.stringify(bodyData)
}).then(response=>response.json())
.then((json)=>{
dispatch(getTaskList(info));
})
}
}
export default {wrongQrcode,emptyErrorInfo,finishReplenish}
import fetch from 'isomorphic-fetch' import fetch from 'isomorphic-fetch'
import actionType from '../actiontype/error' import actionType from '../actiontype/error'
import {getTaskList} from './common' import {getTaskList} from './common';
let domain = 'http://192.168.10.37:8080/maxbox/web/'; import {saveProductInfo} from './barcodeCommon'
let domain = ENV.domain;
var myHeaders = new Headers({ var myHeaders = new Headers({
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
...@@ -51,6 +52,7 @@ const uploadError = (info,exceptionType)=>{ ...@@ -51,6 +52,7 @@ const uploadError = (info,exceptionType)=>{
}).then((response)=>response.json()) }).then((response)=>response.json())
.then(json=>{ .then(json=>{
dispatch(getTaskList(info)); dispatch(getTaskList(info));
dispatch(saveProductInfo({}))
}).catch(e=>{console.error(e)}); }).catch(e=>{console.error(e)});
}) })
} }
......
...@@ -4,13 +4,22 @@ require('./index.css'); ...@@ -4,13 +4,22 @@ require('./index.css');
export default class ButtonComponent extends React.Component{ export default class ButtonComponent extends React.Component{
constructor(props){ constructor(props){
super(props); super(props);
this.handleButtonClick = this.handleButtonClick.bind(this)
}
handleButtonClick(){
let props = this.props;
let {option=null} = props;
if(option){
option();
}
} }
render(){ render(){
let props = this.props; let props = this.props;
let {btnContainer="",style={},option=null} = props; let {btnContainer="",style={},option=null} = props;
return( return(
<div className={`buttonComponent ${btnContainer}`} style={style} onClick={()=>{option()}}> <div className={`buttonComponent ${btnContainer}`} style={style} onClick={this.handleButtonClick}>
{props.text} {props.text}
</div> </div>
) )
......
...@@ -27,7 +27,7 @@ export default class SkuInfoComponent extends React.Component{ ...@@ -27,7 +27,7 @@ export default class SkuInfoComponent extends React.Component{
render(){ render(){
let props = this.props; let props = this.props;
let {classNames='',style={},skuInfo={}} = props; let {classNames='',style={},skuInfo={},taskType=""} = props;
return ( return (
<div className={"skuInfoComponent " + classNames} style={style}> <div className={"skuInfoComponent " + classNames} style={style}>
<div className={"img"}> <div className={"img"}>
...@@ -48,7 +48,7 @@ export default class SkuInfoComponent extends React.Component{ ...@@ -48,7 +48,7 @@ export default class SkuInfoComponent extends React.Component{
} }
</span> </span>
{ {
skuInfo.recoverNum ? <span className={"currentNum"}>已回收数量:<span className={"font40 colff775c"}>{skuInfo.recoverNum || 0}</span></span> taskType === "RE" ? <span className={"currentNum"}>已回收数量:<span className={"font40 colff775c"}>{skuInfo.recoverNum || 0}</span></span>
: null : null
} }
......
...@@ -8,11 +8,12 @@ export default class RecoveryFirstPage extends React.Component{ ...@@ -8,11 +8,12 @@ export default class RecoveryFirstPage extends React.Component{
render(){ render(){
let props = this.props; let props = this.props;
let {headerInfo} = props;
let {taskInfo={}} = headerInfo;
return( return(
<div className={"recoveryFirstPage"}> <div className={"recoveryFirstPage"}>
<div className={"text font40 col333"}>任务目标:请将A区回收箱进行整体更换</div> <div className={"text font40 col333"}>任务目标:请将{taskInfo.area || ""}区回收箱进行整体更换</div>
<Button btnContainer={"RecoveryFirstPageBtn font32 backff775c colfff"} key={"RecoveryFirstPageBtn"} text={'已替换完成'} option={props.finishBoxRecovery}/> <Button btnContainer={"RecoveryFirstPageBtn font32 backff775c colfff"} key={"RecoveryFirstPageBtn"} text={'已替换完成'} option={props.handleFinishBoxRecovery}/>
<div className={"tips font24"}>查看回收箱位置</div> <div className={"tips font24"}>查看回收箱位置</div>
</div> </div>
) )
......
...@@ -78,7 +78,7 @@ export default class RecoveryScanPage extends React.Component{ ...@@ -78,7 +78,7 @@ export default class RecoveryScanPage extends React.Component{
let btnDom = <Button btnContainer={"recoveryContainerQrcode font32"} key={"recoveryContainerWrongQrcode"} style={{marginTop:'10%'}} text={"关闭"} option={hidePopup}/> let btnDom = <Button btnContainer={"recoveryContainerQrcode font32"} key={"recoveryContainerWrongQrcode"} style={{marginTop:'10%'}} text={"关闭"} option={hidePopup}/>
let popDom = let popDom =
<PopModel popupTitle={"遇到问题-货品不对"} classContainer={"recoveryPopInfo"}> <PopModel popupTitle={"遇到问题-货品不对"} classContainer={"recoveryPopInfo"}>
<div className={"icon iconfont icon-wrong font150"} /> <div className={"icon iconfont icon-wrong font150 colf00"} />
<div className={"text font40 col000"}> <div className={"text font40 col000"}>
<p>您拿错货品了,请放回货架!</p> <p>您拿错货品了,请放回货架!</p>
</div> </div>
......
...@@ -13,10 +13,29 @@ export default class RecoverySecondPage extends React.Component{ ...@@ -13,10 +13,29 @@ export default class RecoverySecondPage extends React.Component{
style : { style : {
width:"100%", width:"100%",
height : "auto" height : "auto"
},
btnClock : false
} }
} }
componentWillReceiveProps(nextProps) {
let nextHeaderInfo = nextProps.headerInfo;
let headerInfo = this.props.headerInfo;
if(
nextHeaderInfo.taskList &&
nextHeaderInfo.taskList.skuId &&
headerInfo.taskList &&
headerInfo.taskList.skuId &&
headerInfo.taskList.skuId !== nextHeaderInfo.taskList.skuId
){
this.setState({
btnClock : false
})
}
} }
wrongSku(){ wrongSku(){
//货道商品不符 //货道商品不符
let {showPopup,hidePopup} = this.props; let {showPopup,hidePopup} = this.props;
...@@ -39,7 +58,15 @@ export default class RecoverySecondPage extends React.Component{ ...@@ -39,7 +58,15 @@ export default class RecoverySecondPage extends React.Component{
uploadWrongSku(){ uploadWrongSku(){
//货品不符上报 //货品不符上报
this.props.uploadError(CONFIG.taskErrorType.WRONG_SKU); if(!this.state.btnClock){
this.setState({
btnClock: true
},()=>{
this.props.uploadError(CONFIG.taskErrorType.WRONGSHELF);
})
}
} }
...@@ -53,11 +80,12 @@ export default class RecoverySecondPage extends React.Component{ ...@@ -53,11 +80,12 @@ export default class RecoverySecondPage extends React.Component{
render(){ render(){
let props = this.props; let props = this.props;
let {headerInfo} = props; let {headerInfo} = props;
let {taskInfo={},taskList={}} = headerInfo;
return( return(
<div className={"RecoverySecondPage commonPage"}> <div className={"RecoverySecondPage commonPage"}>
<div className={"title font40 col333 pageTitle"}>任务目标:请将该货道货品进行扫码回收</div> <div className={"title font40 col333 pageTitle"}>任务目标:请将该货道货品进行扫码回收</div>
<div className={"box pagebox"}> <div className={"box pagebox"}>
<SkuInfoComponent style={{'display':'flex'}} skuInfo={headerInfo.taskList || {}}/> <SkuInfoComponent style={{'display':'flex'}} skuInfo={taskList} taskType={taskInfo.currentTaskType || ""}/>
<div className={"btn"}> <div className={"btn"}>
<Button btnContainer={"recoverySecondPageBtn font32 colfff"} key={"RecoverySecondPageBtn"} text={'扫码回收'} option={this.scanQrcode}/> <Button btnContainer={"recoverySecondPageBtn font32 colfff"} key={"RecoverySecondPageBtn"} text={'扫码回收'} option={this.scanQrcode}/>
<div className={"text colff775c font28"} onClick={()=>this.wrongSku()}>货品不符?</div> <div className={"text colff775c font28"} onClick={()=>this.wrongSku()}>货品不符?</div>
......
...@@ -17,6 +17,7 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -17,6 +17,7 @@ export default class ReplenishScanPage extends React.Component{
this.changeShowInput = this.changeShowInput.bind(this); this.changeShowInput = this.changeShowInput.bind(this);
this.getScanDom = this.getScanDom.bind(this); this.getScanDom = this.getScanDom.bind(this);
this.hidePop = this.hidePop.bind(this); this.hidePop = this.hidePop.bind(this);
this.showErrorInfo = this.showErrorInfo.bind(this);
this.state = { this.state = {
barcodeText : '', barcodeText : '',
barcodeErrorText : '', barcodeErrorText : '',
...@@ -24,13 +25,21 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -24,13 +25,21 @@ export default class ReplenishScanPage extends React.Component{
} }
} }
shouldComponentUpdate(nextProps,nextState){
return !!(nextProps.replenishInfo && nextProps.replenishInfo.errorInfo && (
!nextProps.replenishInfo.errorInfo.errorMessage || !this.props.replenishInfo || !this.props.replenishInfo.errorInfo ||
!this.props.replenishInfo.errorInfo.errorMessage || (this.props.replenishInfo.errorInfo.errorMessage !== nextProps.replenishInfo.errorInfo.errorMessage)
) || (JSON.stringify(nextState) !== JSON.stringify(this.state)))
}
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
console.log("ReplenishScanPage componentWillReceiveProps ",nextProps); console.log("ReplenishScanPage componentWillReceiveProps ",nextProps);
let props = this.props; let props = this.props;
let {replenishInfo} = props; let {replenishInfo,barcodeInfo} = props;
if(JSON.stringify(this.props) !== JSON.stringify(nextProps)){
if(nextProps.replenishInfo && nextProps.replenishInfo.errorInfo && nextProps.replenishInfo.errorInfo.errorMessage){ if(nextProps.replenishInfo && nextProps.replenishInfo.errorInfo && nextProps.replenishInfo.errorInfo.errorMessage){
//有错误信息,再对应页面弹出错误信息弹窗,要区分错误信息 //有错误信息,再对应页面弹出错误信息弹窗,要区分错误信息
// nextProps.hidePopup(); // nextProps.hidePopup();
...@@ -48,29 +57,63 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -48,29 +57,63 @@ export default class ReplenishScanPage extends React.Component{
}else{ }else{
//没有错误类型的错误 //没有错误类型的错误
console.log("ReplenishScanPage ",nextProps.replenishInfo.errorInfo.errorMessage) console.log("ReplenishScanPage ",nextProps.replenishInfo.errorInfo.errorMessage)
this.showErrorInfo(nextProps.replenishInfo.errorInfo.errorMessage);
}
} }
}else if(nextProps.barcodeInfo && nextProps.barcodeInfo.product && nextProps.barcodeInfo.product.skuId && (
!this.props.barcodeInfo || !this.props.barcodeInfo.product || !this.props.barcodeInfo.skuId ||
this.props.barcodeInfo.skuId !== nextProps.barcodeInfo.product.skuId
)){
this.goBack.bind(this)(2)
} }
} }
} }
goBack(){ componentDidMount(){
this._startScan()
}
showErrorInfo(errMsg){
let {showPopup,hidePopup,barcodeInfo} = this.props;
let {product} = barcodeInfo;
let btnDom = <Button btnContainer={"replenishScanPageErrorSkuBtn font32 backff775c colfff"} key={"replenishScanPageErrorSkuBtn"} text={"确定"} option={this.hidePop}/>
let popDom =
<PopModel popupTitle={"扫描出错"} classContainer={"replenishPopInfo replenishScanPageErrorInfo"}>
<div className={"icon iconfont icon-exclamation colf5a623 font150"} />
<div className={"text font40 col000"}>
<p>{errMsg}</p>
</div>
<div className={"btn"}>
{btnDom}
</div>
</PopModel>
showPopup({popupChild:popDom});
}
goBack(type){
let {emptyErrorInfo,goBack,hidePopup} = this.props; let {emptyErrorInfo,goBack,hidePopup} = this.props;
emptyErrorInfo(); emptyErrorInfo();
hidePopup(); hidePopup();
goBack() goBack(type)
} }
hidePop(){ hidePop(){
let {emptyErrorInfo,hidePopup} = this.props; let {emptyErrorInfo,hidePopup} = this.props;
emptyErrorInfo(); emptyErrorInfo();
hidePopup(); hidePopup();
this.setState({
barcodeText : ''
});
if(!this.state.showInput){
this._startScan()
}
} }
getOtherHeader(){ getOtherHeader(){
let {headerInfo} = this.props; let {headerInfo} = this.props;
let {taskInfo={}} = headerInfo; let {taskInfo={}} = headerInfo;
return <div className={"otherHeader replenishScanQrcodeHeader font32 clearfix colfff "}> return <div className={"otherHeader replenishScanQrcodeHeader font32 clearfix colfff "}>
<i className={"iconfont middle icon font50 icon-circle-left circleIcon fl"} onClick={()=>this.goBack.bind(this)()}/> <i className={"iconfont middle icon font50 icon-circle-left circleIcon fl"} onClick={()=>this.goBack.bind(this)(1)}/>
<span className={"middle"}>任务目标:将{taskInfo.area || ""}区补货箱中的货品扫码后放到货架上</span> <span className={"middle"}>任务目标:将{taskInfo.area || ""}区补货箱中的货品扫码后放到货架上</span>
</div> </div>
} }
...@@ -96,14 +139,14 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -96,14 +139,14 @@ export default class ReplenishScanPage extends React.Component{
//扫描货品异常 //扫描货品异常
errorSku(){ errorSku(){
//货道已满解决办法 //货道已满解决办法
let {showPopup,hidePopup,barcodeInfo} = this.props; let {showPopup,hidePopup,headerInfo} = this.props;
let {product} = barcodeInfo; let {taskList={}} = headerInfo;
let btnDom = <Button btnContainer={"replenishScanPageErrorSkuBtn font32 backff775c colfff"} key={"replenishScanPageErrorSkuBtn"} text={"确认扫描完毕"} option={this.hidePop}/> let btnDom = <Button btnContainer={"replenishScanPageErrorSkuBtn font32 backff775c colfff"} key={"replenishScanPageErrorSkuBtn"} text={"确认扫描完毕"} option={this.hidePop}/>
let popDom = let popDom =
<PopModel popupTitle={"扫描货品异常"} classContainer={"replenishPopInfo replenishScanPageErrorSku"}> <PopModel popupTitle={"扫描货品异常"} classContainer={"replenishPopInfo replenishScanPageErrorSku"}>
<div className={"icon iconfont icon-exclamation colf5a623 font150"} /> <div className={"icon iconfont icon-exclamation colf5a623 font150"} />
<div className={"text font40 col000"}> <div className={"text font40 col000"}>
<p>您需要补完【{product.skuName || ""}】,才能补其他货品</p> <p>您需要补完【{taskList.skuName || ""}】,才能补其他货品</p>
</div> </div>
<div className={"btn"}> <div className={"btn"}>
{btnDom} {btnDom}
...@@ -116,7 +159,7 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -116,7 +159,7 @@ export default class ReplenishScanPage extends React.Component{
//忘记样子 //忘记样子
forgetSku(){ forgetSku(){
let {showPopup,hidePopup} = this.props; let {showPopup,hidePopup} = this.props;
let btnDom = <Button btnContainer={"replenishScanPageForgetSkuBtn font32 backff775c colfff"} style={{marginTop:"10%"}} key={"replenishScanPageForgetSkuBtn"} text={"继续扫描"} option={this.hidePop}/> let btnDom = <Button btnContainer={"replenishScanPageForgetSkuBtn font32 backff775c colfff"} style={{marginTop:"0"}} key={"replenishScanPageForgetSkuBtn"} text={"继续扫描"} option={this.hidePop}/>
let popDom = let popDom =
<PopModel popupTitle={"扫描货品异常"} classContainer={"replenishPopInfo replenishScanPageForgetSku"}> <PopModel popupTitle={"扫描货品异常"} classContainer={"replenishPopInfo replenishScanPageForgetSku"}>
{this.getSkuInfo()} {this.getSkuInfo()}
...@@ -146,25 +189,26 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -146,25 +189,26 @@ export default class ReplenishScanPage extends React.Component{
} }
getSkuInfo(){ getSkuInfo(){
let {barcodeInfo} = this.props; let {headerInfo} = this.props;
let {taskList={}} = headerInfo;
return( return(
<div className={"replenishSkuInfo"}> <div className={"replenishSkuInfo"}>
<div className={"skuName font30 col333"}>商品名称:{barcodeInfo.skuName || ""}</div> <div className={"skuName font30 col333"}>商品名称:{taskList.skuName || ""}</div>
<div className={"skuInfo"}> <div className={"skuInfo"}>
<div className={"skuImg"}> <div className={"skuImg"}>
<img src="" alt=""/> <img src={taskList.skuImage || UTILPATH.localImg.defaultImg} alt=""/>
</div> </div>
<div className={"areaImg"}> <div className={"areaImg"}>
<img src="" alt=""/> <img src={taskList.areaImage || UTILPATH.localImg.defaultImg} alt=""/>
</div> </div>
<div className={"skuPos col333 font30"}> <div className={"skuPos col333 font30"}>
<ul> <ul>
<li><span className={"skuPosTitle fl"}>所在区域:</span>{barcodeInfo.area || ""}区域<span className={"colff775c showAreaImg"}>区域照片</span></li> <li><span className={"skuPosTitle fl"}>所在区域:</span>{taskList.area || ""}区域<span className={"colff775c showAreaImg"}>区域照片</span></li>
<li className={""}> <li className={""}>
<span className={"skuPosTitle"}>货道信息:</span> <span className={"skuPosTitle"}>货道信息:</span>
<span className={""}>{barcodeInfo.position || ""}</span> <span className={""}>{taskList.position || ""}</span>
</li> </li>
<li><span className={"skuPosTitle fl"}>货道编号:</span>{barcodeInfo.positionNum || ""}</li> <li><span className={"skuPosTitle fl"}>货道编号:</span>{taskList.positionNum || ""}</li>
</ul> </ul>
</div> </div>
</div> </div>
...@@ -217,6 +261,25 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -217,6 +261,25 @@ export default class ReplenishScanPage extends React.Component{
return reg.test(str); return reg.test(str);
} }
_onBarCodeRead = (e) => {
// console.log(`e.nativeEvent.data.type = ${e.nativeEvent.data.type}, e.nativeEvent.data.code = ${e.nativeEvent.data.code}`)
this._stopScan();
this.setState({
barcodeText : e.nativeEvent.data.code
},()=>{
this.submitBarcode()
});
};
_startScan = (e) => {
// this._barCode.startScan()
};
_stopScan = (e) => {
// this._barCode.stopScan()
}
/** /**
* 调用扫描条形码 * 调用扫描条形码
...@@ -236,7 +299,14 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -236,7 +299,14 @@ export default class ReplenishScanPage extends React.Component{
changeShowInput(){ changeShowInput(){
this.setState({ this.setState({
showInput : !this.state.showInput, showInput : !this.state.showInput,
barcodeText :"" barcodeText :"",
barcodeErrorText:""
},()=>{
if(this.state.showInput){
this._stopScan()
}else{
this._startScan()
}
}) })
} }
......
//异常类型("SU"货道不符 ,"SLT"货品少拿 ,"SUM"货品种类不符,"SF"货道已满) //异常类型("SU"货道不符 ,"SLT"货品少拿 ,"SUM"货品种类不符,"SF"货道已满,"SD"商品破损)
const errorType = { const errorType = {
WRONG_SKU:'SU', //回收 货品不符合 WRONGSHELF:'SU',
SLT:'SLT', LOWSKU:'SLT',
SUM :'SUM', WRONGSKU :'SUM',
SF : 'SF' OVERSHELF : 'SF',
BADSKU : 'SD'
} }
module.exports = errorType; module.exports = errorType;
\ No newline at end of file
...@@ -12,7 +12,6 @@ export default class LeftContainer extends React.Component{ ...@@ -12,7 +12,6 @@ export default class LeftContainer extends React.Component{
<div className={"leftContainer"}> <div className={"leftContainer"}>
<ul> <ul>
<li className={"icon iconfont icon-task font90"} /> <li className={"icon iconfont icon-task font90"} />
<li className={"taskNumber font40 col333"}>任务{taskInfo.currentTaskNum || ''}</li> <li className={"taskNumber font40 col333"}>任务{taskInfo.currentTaskNum || ''}</li>
<li className={"leftText font30"}>{taskInfo.taskName || ''}</li> <li className={"leftText font30"}>{taskInfo.taskName || ''}</li>
</ul> </ul>
......
...@@ -37,6 +37,7 @@ import replenishAction from "../../actions/replenish"; ...@@ -37,6 +37,7 @@ import replenishAction from "../../actions/replenish";
/*二期引用 end*/ /*二期引用 end*/
import {on,remove} from '../../util/event'; import {on,remove} from '../../util/event';
import common from "../../reducers/common";
require('./index.css'); require('./index.css');
...@@ -205,28 +206,24 @@ class PageContainer extends React.Component { ...@@ -205,28 +206,24 @@ class PageContainer extends React.Component {
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
let {state,dispatch} = nextProps; let {state,dispatch} = nextProps;
console.log("pagecontainer nextProps ",nextProps) let nextCommonInfo = state.commonInfo;
console.log("pagecontainer nextProps ",Object.keys(nextProps)) let nextUserInfo = nextCommonInfo.userInfo || {};
console.log("pagecontainer nextProps ",nextProps.state) if(nextUserInfo && nextUserInfo.taskType && nextUserInfo.id) {
console.log("pagecontainer nextProps ",Object.keys(nextProps.state)) let commonInfo = state.commonInfo;
let userinfo = state.userInfo; let {userInfo={}} = commonInfo.userInfo;
let nowUserInfo = this.props.state.userInfo; if(!userInfo || !userInfo.taskType || !userInfo.id || (
let isNotOneUser = userinfo && userinfo.employee && userinfo.employee.id && userInfo.id !== nextUserInfo.id
(!nowUserInfo || !nowUserInfo.employee || (nowUserInfo.employee.id !== userinfo.employee.id)); ) || (
let isNotOneTask = userinfo && userinfo.type && userinfo.type !== nowUserInfo.type; userInfo.taskType !== nextUserInfo.taskType
)){
if(isNotOneUser && isNotOneTask){ //如果不是同一个用户或者不是同一个任务,会再次进入
//不是同一个用户,并且不是同一个任务 this.dealPageByType(nextUserInfo.taskType);
this.dealPageByType(userinfo.type); }
}
if(state.errMsg && state.errMsg.errMsg){ //补货人员,根据type判断显示页面
//有错误信息,弹出错误信息弹窗 let nextTaskInfo = nextCommonInfo.taskInfo || {};
this.showError(state.errMsg.errMsg) if(nextUserInfo.taskType === "BH" && nextTaskInfo && nextTaskInfo.currentTaskType){
} switch (nextTaskInfo.currentTaskType) {
//根据后台数据控制该显示的页面
if(nextProps.state.commonInfo && nextProps.state.commonInfo.taskInfo){
let type=nextProps.state.commonInfo.taskInfo.currentTaskType;
switch(type){
case 'LR' : case 'LR' :
this.changePages(CONFIG.showPage[5]); this.changePages(CONFIG.showPage[5]);
break; break;
...@@ -241,6 +238,13 @@ class PageContainer extends React.Component { ...@@ -241,6 +238,13 @@ class PageContainer extends React.Component {
break; break;
} }
} }
}
if(state.errMsg && state.errMsg.errMsg){
//有错误信息,弹出错误信息弹窗
this.showError(state.errMsg.errMsg)
}
} }
componentWillUnmount(){ componentWillUnmount(){
} }
...@@ -360,13 +364,13 @@ class PageContainer extends React.Component { ...@@ -360,13 +364,13 @@ class PageContainer extends React.Component {
getPopDom(info){ getPopDom(info){
let {text='',popupButtons=[],style={}} = info let {popupText='',popupButtons=[],style={}} = info
let dom = popupButtons.map((a,k)=>{ let dom = popupButtons.map((a,k)=>{
return a; return a;
}); });
return <div className={"defaultPopup col333"} style={style}> return <div className={"defaultPopup col333"} style={style}>
<div className={"defaultPopupText font30"}> <div className={"defaultPopupText font30"}>
{text} {popupText}
</div> </div>
<div className={"defaultPopupButtons font32"}> <div className={"defaultPopupButtons font32"}>
{dom} {dom}
...@@ -617,7 +621,7 @@ class PageContainer extends React.Component { ...@@ -617,7 +621,7 @@ class PageContainer extends React.Component {
recoveryInfo = {state.recoveryInfo} recoveryInfo = {state.recoveryInfo}
showPopup={(info)=>this.showPopup(info)} showPopup={(info)=>this.showPopup(info)}
hidePopup={()=>this.hidePopup()} hidePopup={()=>this.hidePopup()}
getTaskName={()=>dispatch(getTaskName(3,2))} getTaskName={()=>dispatch(getTaskName(state.commonInfo.taskInfo.currentTaskType,2))}
finishBoxRecovery={()=>dispatch(finishBoxRecovery(state.commonInfo))} finishBoxRecovery={()=>dispatch(finishBoxRecovery(state.commonInfo))}
uploadError={(exceptionType)=>dispatch(uploadError(state.commonInfo,exceptionType))} uploadError={(exceptionType)=>dispatch(uploadError(state.commonInfo,exceptionType))}
getBarCodeProductInfo={(barcode)=>{dispatch(getBarCodeProductInfo({barcode,commonInfo:state.commonInfo}))}} getBarCodeProductInfo={(barcode)=>{dispatch(getBarCodeProductInfo({barcode,commonInfo:state.commonInfo}))}}
...@@ -633,6 +637,7 @@ class PageContainer extends React.Component { ...@@ -633,6 +637,7 @@ class PageContainer extends React.Component {
getBarCodeProductInfo={(barcode)=>{dispatch(getBarCodeProductInfo({barcode,commonInfo:state.commonInfo}))}} getBarCodeProductInfo={(barcode)=>{dispatch(getBarCodeProductInfo({barcode,commonInfo:state.commonInfo}))}}
finishBoxRecovery={()=>dispatch(finishBoxRecovery(state.commonInfo))} finishBoxRecovery={()=>dispatch(finishBoxRecovery(state.commonInfo))}
emptyErrorInfo={()=>dispatch(replenishAction.emptyErrorInfo())} emptyErrorInfo={()=>dispatch(replenishAction.emptyErrorInfo())}
uploadError={(exceptionType)=>dispatch(uploadError(state.commonInfo,exceptionType))}
/> />
/*以下是二期页面 end*/ /*以下是二期页面 end*/
} }
......
...@@ -22,7 +22,7 @@ export default class RecoveryContainer extends React.Component{ ...@@ -22,7 +22,7 @@ export default class RecoveryContainer extends React.Component{
this.getFirstPage = this.getFirstPage.bind(this); //展示第一页 this.getFirstPage = this.getFirstPage.bind(this); //展示第一页
this.getSecondPage = this.getSecondPage.bind(this); //展示第二页 this.getSecondPage = this.getSecondPage.bind(this); //展示第二页
this.getPage = this.getPage.bind(this); //获取要展示的页面 this.getPage = this.getPage.bind(this); //获取要展示的页面
this.finishBoxRecovery = this.finishBoxRecovery.bind(this); //完成回收箱商品回收 this.handleFinishBoxRecovery = this.handleFinishBoxRecovery.bind(this); //完成回收箱商品回收
this.setPage = this.setPage.bind(this); //完成回收箱商品回收 this.setPage = this.setPage.bind(this); //完成回收箱商品回收
} }
...@@ -50,13 +50,13 @@ export default class RecoveryContainer extends React.Component{ ...@@ -50,13 +50,13 @@ export default class RecoveryContainer extends React.Component{
let taskList = headerInfo.taskList; let taskList = headerInfo.taskList;
if(taskList.skuId !== oldTaskList.skuId || (taskList.skuId === oldTaskList.skuId && taskList.recoverNum !== oldTaskList.recoverNum)){ if(taskList.skuId !== oldTaskList.skuId || (taskList.skuId === oldTaskList.skuId && taskList.recoverNum !== oldTaskList.recoverNum)){
hidePopup(); hidePopup();
this.finishBoxRecovery(); this.handleFinishBoxRecovery();
} }
} }
} }
finishBoxRecovery(){ handleFinishBoxRecovery(){
//完成回收箱物品回收 //完成回收箱物品回收
let props = this.props; let props = this.props;
props.getTaskName() props.getTaskName()
...@@ -67,7 +67,7 @@ export default class RecoveryContainer extends React.Component{ ...@@ -67,7 +67,7 @@ export default class RecoveryContainer extends React.Component{
getFirstPage(props){ getFirstPage(props){
return ( return (
<RecovertyFirstPage finishBoxRecovery={()=>this.finishBoxRecovery()}/> <RecovertyFirstPage handleFinishBoxRecovery={()=>this.handleFinishBoxRecovery()} {...props}/>
) )
} }
getSecondPage(props){ getSecondPage(props){
......
...@@ -32,21 +32,42 @@ export default class ReplenishContainer extends React.Component{ ...@@ -32,21 +32,42 @@ export default class ReplenishContainer extends React.Component{
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
console.log("componentWillReceiveProps ",nextProps) console.log("componentWillReceiveProps ",nextProps);
if(nextProps.barcodeInfo && nextProps.barcodeInfo.product && nextProps.replenishInfo && (!nextProps.replenishInfo.errorInfo || !nextProps.replenishInfo.errorInfo.errorMessage)){
//有条形码信息且 没有错误信息 进入条形码扫描成功页面 //如果有错误信息,弹出错误信息
console.log("in ",this.state.pageType,typeof this.state.pageType); //如果有条形码信息,展示条形码信息
if(this.state.pageType !== 2){ // if(!nextProps.replenishInfo.errorInfo || !nextProps.replenishInfo.errorInfo.errorMessage){
console.log("2222222"); //
nextProps.hidePopup(); // }else{
this.setState({ //
pageType : 2, // }
showScanQrcode : false //
}) //
} //
}else if(nextProps.replenishInfo && nextProps.replenishInfo.errorInfo && nextProps.replenishInfo.errorInfo.errorMessage){ //
//有错误信息,再对应页面弹出错误信息弹窗,要区分错误信息 //
} // if(nextProps.barcodeInfo && nextProps.barcodeInfo.product && nextProps.barcodeInfo.product.skuId && nextProps.replenishInfo && (!nextProps.replenishInfo.errorInfo || !nextProps.replenishInfo.errorInfo.errorMessage)){
// //有条形码信息且 没有错误信息 进入条形码扫描成功页面
// console.log("in ",this.state.pageType,typeof this.state.pageType);
// if(this.state.pageType !== 2){
// console.log("2222222");
// nextProps.hidePopup();
// this.setState({
// pageType : 2,
// showScanQrcode : false
// })
// }
// }else if(nextProps.replenishInfo && nextProps.replenishInfo.errorInfo && nextProps.replenishInfo.errorInfo.errorMessage){
// //有错误信息,再对应页面弹出错误信息弹窗,要区分错误信息
// }else if(!nextProps.barcodeInfo || !nextProps.barcodeInfo.product || !nextProps.barcodeInfo.product.skuId){
// if(this.state.pageType !== 3){
// nextProps.hidePopup();
// this.setState({
// pageType : 3,
// showScanQrcode : false
// })
// }
// }
} }
getPage(type){ getPage(type){
...@@ -79,10 +100,10 @@ export default class ReplenishContainer extends React.Component{ ...@@ -79,10 +100,10 @@ export default class ReplenishContainer extends React.Component{
return <ReplenishScanPage {...props}/> return <ReplenishScanPage {...props}/>
} }
goBack(){ goBack(type){
this.setState({ this.setState({
showScanQrcode : false, showScanQrcode : false,
pageType : 1 pageType : type
}) })
} }
......
...@@ -3,12 +3,12 @@ import barcodeActionType from '../actiontype/barcodeCommon' ...@@ -3,12 +3,12 @@ import barcodeActionType from '../actiontype/barcodeCommon'
//扫码商品的信息 //扫码商品的信息
const saveProductInfo = (data,content)=>{ const saveProductInfo = (data,content)=>{
return Object.assign({},data,{product:content}) let newState = JSON.parse(JSON.stringify(data));
return Object.assign({},newState,{product:content})
} }
export default function(state={}, action) { export default function(state={}, action) {
switch (action.type) { switch (action.type) {
case barcodeActionType.GETPRODUCTINFO: case barcodeActionType.GETPRODUCTINFO:
console.log(action.data,'吴加宝打印barcode reducer')
return saveProductInfo(state,action.data); return saveProductInfo(state,action.data);
default: default:
return state; return state;
......
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