Commit 1c6eedec by Zhang Xin

fix bug 2818 & add log & 完善需求168

parent fe8beba5
......@@ -4,6 +4,7 @@ import actionTypes_error from '../actiontype/error'
let domain = ENV.domain;
export function scanBarCodeGetProductInfo(postData) {
return (dispatch) => {
UTILPATH.myLogger.info("scanning_sku_barcode_for_add_loss_task bodyData ",postData);
let url = String(domain+'machine_pad/scanning_sku_barcode_for_add_loss_task');
fetch(url,{
credentials : 'include',
......@@ -25,14 +26,15 @@ export function scanBarCodeGetProductInfo(postData) {
dispatch(throwError(json.meta.message))
}
}
).catch(e=>dispatch(console.log("出现错误"))
)
/* dispatch(initSuccess(fakeJsonData.data))*/
).catch(e=>{
UTILPATH.myLogger.error("scanning_sku_barcode_for_add_loss_task error ",e);
})
}
}
export function submitProductInfo(postData) {
return (dispatch)=>{
let url = String(domain+'machine_pad/submit_add_loss_task');
UTILPATH.myLogger.info("submit_add_loss_task bodyData ",postData);
fetch(url,{
credentials : 'include',
method : 'POST',
......@@ -52,7 +54,9 @@ export function submitProductInfo(postData) {
dispatch(submitProductSuccess(submit))
}
}
).catch(e=>{console.error(e)}
).catch(e=>{
UTILPATH.myLogger.error("submit_add_loss_task error ",e);
}
)
/* */
......
......@@ -11,6 +11,7 @@ const checkProductQuantity = (data)=>{
let {quantity,skuPassId,workListId}=tokeProductInfo;
let bodyData={storeId,taskId,area,quantity,skuPassId,workListId,employeeId,currentTaskType}
let url=domain+`machine_pad/work/ck`;
UTILPATH.myLogger.info("checkProductQuantity bodyData ",bodyData);
return (dispatch)=>{
fetch(url,{
credentials : 'include',
......@@ -26,7 +27,9 @@ const checkProductQuantity = (data)=>{
dispatch(getTaskList(commonInfo))
}
dispatch(checkQuantity({type:json.data}))
}).catch(e=>{console.log('err'+e)})
}).catch(e=>{
UTILPATH.myLogger.error("checkProductQuantity error ",e);
})
}
}
......
......@@ -12,7 +12,8 @@ const getBarCodeProductInfo = (data)=>{
let currentTaskType = taskInfo.currentTaskType || '';
let area = taskInfo.area || ''
let taskId = taskInfo.taskId || 0
let url=`${domain}machine_pad/barcode/${storeId}/${taskId}/${area}/${currentTaskType}/${barcode}`
let url=`${domain}machine_pad/barcode/${storeId}/${taskId}/${area}/${currentTaskType}/${barcode}`;
UTILPATH.myLogger.info("getBarCodeProductInfo url",url);
return (dispatch)=>{
fetch(url,{
credentials : 'include',
......@@ -77,6 +78,8 @@ const getBarCodeProductInfo = (data)=>{
}
}
}).catch(e=>{
UTILPATH.myLogger.error("getBarCodeProductInfo error ",e);
})
}
......
......@@ -17,7 +17,9 @@ const submitBreakageProduct = (data)=>{
let machineId=commonInfo.storeInfo.id;
let {skuPosition,skuId,skuStatus}=productDetail;
let bodyData={skuPosition,skuId,skuStatus,machineId,taskId}
let url=domain+`machine_pad/lr/${userId}`
let url=domain+`machine_pad/lr/${userId}`;
UTILPATH.myLogger.info("submitBreakageProduct url",url);
UTILPATH.myLogger.info("submitBreakageProduct request",bodyData);
return (dispatch)=>{
fetch(url,{
// credentials : 'include',
......@@ -31,6 +33,8 @@ const submitBreakageProduct = (data)=>{
}).then((response)=>response.json())
.then((json)=>{
dispatch(getSubmitStatus(json.meta))
}).catch(e=>{
UTILPATH.myLogger.error("submitBreakageProduct error ",e);
})
}
}
......@@ -39,8 +43,9 @@ const submitBreakageProduct = (data)=>{
//test 没有散落货品
const hasNoSku = (commonInfo)=>{
let {storeInfo={},userInfo={},taskInfo={}} = commonInfo;
return (dispatch)=>{
let url = `${domain}machine_pad/work/lr/status/${taskInfo.taskId}/${taskInfo.area}/${taskInfo.currentTaskType}`;
UTILPATH.myLogger.info("hasNoSku url",url);
return (dispatch)=>{
fetch(url,{
// credentials : 'include',
method : 'PUT',
......@@ -49,6 +54,8 @@ const hasNoSku = (commonInfo)=>{
}).then(response=>response.json())
.then((json)=>{
dispatch(getTaskList(commonInfo))
}).catch(e=>{
UTILPATH.myLogger.error("hasNoSku 没有散落货品 error ",e);
})
}
}
......
......@@ -8,7 +8,9 @@ const willCloseDoor=(data,flag=false)=>{
let userId=userInfo.employeeId;
let machineId=storeInfo.id;
let {taskId,area,currentTaskType}=taskInfo;
let bodyData={area,storeId:machineId,taskId,userId,taskType:currentTaskType}
let bodyData={area,storeId:machineId,taskId,userId,taskType:currentTaskType};
UTILPATH.myLogger.info("finish_task url",url);
UTILPATH.myLogger.info("finish_task request",bodyData);
return (dispatch)=>{
fetch(url,{
credentials : 'include',
......@@ -29,6 +31,8 @@ const willCloseDoor=(data,flag=false)=>{
// dispatch(saveCommonInfo(Object.assign({},{taskInfo:{currentTaskType:'FINISH'}})))
}
// dispatch(closeDoorSuccess(data));
}).catch(e=>{
UTILPATH.myLogger.error("finish_task error ",e);
})
}
}
......@@ -40,7 +44,9 @@ const closeDoorSuccess=(data)=>{
let machineId=storeInfo.id;
let {taskId,area}=taskInfo;
let bodyData={storeId:machineId,taskId,area,userId}
let url=domain+'machine_pad/update_door_status.action'
let url=domain+'machine_pad/update_door_status.action';
UTILPATH.myLogger.info("update_door_status url",url);
UTILPATH.myLogger.info("update_door_status request",bodyData);
return (dispatch)=>{
fetch(url,{
credentials : 'include',
......@@ -54,6 +60,8 @@ const closeDoorSuccess=(data)=>{
}).then((response)=>response.json())
.then((json)=>{
dispatch(logout())
}).catch(e=>{
UTILPATH.myLogger.error("update_door_status error ",e);
})
}
}
......
......@@ -14,6 +14,7 @@ let myHeaders = new Headers({
const getStoreInfo = (storeId)=>{
return(dispatch)=>{
let bodyData = {storeId};
UTILPATH.myLogger.info("getMachineData request",bodyData);
fetch(domain + 'pad_warehouse/getMachineData.action',{
credentials : 'include',
method : 'POST',
......@@ -25,9 +26,13 @@ const getStoreInfo = (storeId)=>{
let storeInfo = Object.assign({},{id:storeId});
if(json.meta.success && json.data.warehouse){
storeInfo = Object.assign({},storeInfo,json.data.warehouse)
}else{
UTILPATH.myLogger.error("getMachineData error ",json);
}
dispatch(saveCommonInfo(Object.assign({},{storeInfo})))
}).catch(e=>{console.error(e)})
}).catch(e=>{
UTILPATH.myLogger.error("getMachineData error ",e);
})
}
......@@ -36,7 +41,8 @@ const getStoreInfo = (storeId)=>{
//获取用户信息
const getUserinfo = (employeeId,storeId)=>{
let bodyData = Object.assign({},{employeeId,storeId})
let bodyData = Object.assign({},{employeeId,storeId});
UTILPATH.myLogger.info("get_alowed_task request",bodyData);
return(dispatch)=>{
fetch(domain + 'machine_pad/get_alowed_task.action',{
credentials : 'include',
......@@ -58,16 +64,19 @@ const getUserinfo = (employeeId,storeId)=>{
}
dispatch(saveCommonInfo(Object.assign({},{userInfo})));
}
}).catch(e=>{console.error(e)})
}).catch(e=>{
UTILPATH.myLogger.error("get_alowed_task error ",e);
})
}
};
//拉取工单
const getTaskList = (data={})=>{
const getTaskList = (data={},callback=null)=>{
let {storeInfo={},userInfo={},taskInfo={}} = data;
let taskId=taskInfo.taskId || 0;
let url =`${domain}machine_pad/work/list/${storeInfo.id}/${taskInfo.area}/${taskId}/${userInfo.employeeId}`;
UTILPATH.myLogger.info("getTaskList url",url);
return (dispatch)=>{
if(!userInfo.id){
dispatch(addErrorInfo('没有获取用户信息'))
......@@ -84,9 +93,6 @@ const getTaskList = (data={})=>{
let data =Object.assign({});
if(json.meta.success && json.data){
data.taskInfo = Object.assign({},json.data.flatCommonVo);
// if(json.data.flatCommonVo.currentTaskType !== 'ADDR'){
// data.taskList = Object.assign({},json.data.skuFlatVo);
// }
data.taskList = Object.assign({},json.data.skuFlatVo);
let childNum = 0;
let currentTaskType = json.data.flatCommonVo.currentTaskType;
......@@ -96,6 +102,14 @@ const getTaskList = (data={})=>{
dispatch(addErrorInfo(json.meta.message))
}
dispatch(saveCommonInfo(Object.assign({},data)))
if(callback){
callback()
}
}).catch(e=>{
if(callback){
callback()
}
UTILPATH.myLogger.error("getTaskList error ",e);
})
}
}
......
......@@ -51,7 +51,6 @@ const getIp = ()=>{
dispatch(saveIp(domainIp + i + ':7788'))
})
.catch((err) =>{
console.error("Err:",err);
failTotal++;
if(failTotal >= totalIndex + initIndex){
initIndex = totalIndex + initIndex > 255 ? 1 : totalIndex + initIndex;
......
......@@ -52,7 +52,7 @@ const getStoreInfo = (data)=>{
}else{
//没有店铺信息
}
}).catch(e=>{console.error(e)})
}).catch(e=>{})
}
......
......@@ -6,128 +6,6 @@ import {saveCommonInfo,getTaskList} from "./common";
const domain = ENV.domain;
let meta = {
"meta": {"code": "200", "message": "成功", "success": true},
"data": {
"details": [{
"id": 660,
"storeId": 7,
"errorCode": "ER00021",
"type": "KN",
"description": "1:回零故障,2:直流电机回位错误或步进电机初始化错误(根据前一条故障代码判断)",
"taskId": 0,
"isExistProblem": 0,
"imagesFileId": "3879,3878,3846,3843",
"superType": 1,
"subType": 2,
"parentProblemType": 0,
"subProblemType": 0,
"explanation": null,
"handler": 0,
"files": [{
"id": 3843,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-07/1533637758512.jpg"
}, {
"id": 3846,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-07/1533638079031.jpg"
}, {
"id": 3878,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-08/1533721929622.jpg"
}, {"id": 3879, "filePath": "http://preprod.mjitech.com/static/tmp/2018-08-08/1533722112773.jpg"}],
"parentProblemName": null,
"subProblemName": null,
"sellOrderNumber": "0"
},{
"id": 660,
"storeId": 7,
"errorCode": "ER00022",
"type": "KN",
"description": "1:回零故障,2:直流电机回位错误或步进电机初始化错误(根据前一条故障代码判断)",
"taskId": 0,
"isExistProblem": 0,
"imagesFileId": "3879,3878,3846,3843",
"superType": 1,
"subType": 2,
"parentProblemType": 0,
"subProblemType": 0,
"explanation": null,
"handler": 0,
"files": [{
"id": 3843,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-07/1533637758512.jpg"
}, {
"id": 3846,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-07/1533638079031.jpg"
}, {
"id": 3878,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-08/1533721929622.jpg"
}, {"id": 3879, "filePath": "http://preprod.mjitech.com/static/tmp/2018-08-08/1533722112773.jpg"}],
"parentProblemName": null,
"subProblemName": null,
"sellOrderNumber": "0"
},{
"id": 660,
"storeId": 7,
"errorCode": "ER00023",
"type": "KN",
"description": "1:回零故障,2:直流电机回位错误或步进电机初始化错误(根据前一条故障代码判断)",
"taskId": 0,
"isExistProblem": 0,
"imagesFileId": "3879,3878,3846,3843",
"superType": 1,
"subType": 2,
"parentProblemType": 0,
"subProblemType": 0,
"explanation": null,
"handler": 0,
"files": [{
"id": 3843,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-07/1533637758512.jpg"
}, {
"id": 3846,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-07/1533638079031.jpg"
}, {
"id": 3878,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-08/1533721929622.jpg"
}, {"id": 3879, "filePath": "http://preprod.mjitech.com/static/tmp/2018-08-08/1533722112773.jpg"}],
"parentProblemName": null,
"subProblemName": null,
"sellOrderNumber": "0"
},
{
"id": 660,
"storeId": 7,
"errorCode": "ER00024",
"type": "KN",
"description": "1:回零故障,2:直流电机回位错误或步进电机初始化错误(根据前一条故障代码判断)",
"taskId": 0,
"isExistProblem": 0,
"imagesFileId": "3879,3878,3846,3843",
"superType": 1,
"subType": 2,
"parentProblemType": 0,
"subProblemType": 0,
"explanation": null,
"handler": 0,
"files": [{
"id": 3843,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-07/1533637758512.jpg"
}, {
"id": 3846,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-07/1533638079031.jpg"
}, {
"id": 3878,
"filePath": "http://preprod.mjitech.com/static/tmp/2018-08-08/1533721929622.jpg"
}, {"id": 3879, "filePath": "http://preprod.mjitech.com/static/tmp/2018-08-08/1533722112773.jpg"}],
"parentProblemName": null,
"subProblemName": null,
"sellOrderNumber": "0"
}
], "taskId": 256, "sellOrderId": "0"
}
}
const saveTroubleList = (data) => {
return {
type: actionTypes.SAVETROUBLELIST,
......@@ -145,8 +23,6 @@ const saveUserInfo = (data) => {
var myHeaders = new Headers({
'Access-Control-Allow-Origin': '*',
// 'Content-Type': 'text/plain;charset=UTF-8',
// 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Content-Type': 'application/json; charset=UTF-8',
});
......@@ -158,6 +34,7 @@ const getTroubleList = (info) => {
employeeId: userInfo.employeeId,
storeId: storeInfo.id
});
UTILPATH.myLogger.info("getTroubleList request ",bodyData);
fetch(domain + 'machine_pad/list_fault.action', {
credentials: 'include',
method: 'POST',
......@@ -171,7 +48,7 @@ const getTroubleList = (info) => {
dispatch(saveTroubleList(json.data))
}
}).catch(e => {
console.error(e)
UTILPATH.myLogger.error("getTroubleList error ",e);
})
}
};
......@@ -179,7 +56,7 @@ const getTroubleList = (info) => {
const updateTroubleList = (info, headerInfo) => {
let {taskInfo={},userInfo={},storeInfo={}} = headerInfo;
let bodyData = Object.assign({}, {details: info}, {taskId:taskInfo.taskId,employeeId:userInfo.employeeId,storeId:storeInfo.id});
UTILPATH.myLogger.info("save_all_error request ",bodyData);
//todo 更新故障处理,并且获取新的工单
return (dispatch) => {
fetch(domain + 'machine_pad/save_all_error.action', {
......@@ -192,7 +69,7 @@ const updateTroubleList = (info, headerInfo) => {
.then(json => {
dispatch(getTaskList(headerInfo))
}).catch(e => {
console.error(e)
UTILPATH.myLogger.error("save_all_error error ",e);
})
}
};
......
......@@ -23,7 +23,7 @@ export function initGetOtherProblem(postData) {
}
}
).catch(e=>{console.error(e)}
).catch(e=>{}
)
/* */
}
......@@ -49,7 +49,7 @@ export function addNewProbem(postData) {
}
}
).catch(e=>{console.error(e)}
).catch(e=>{}
)
/* */
}
......@@ -83,7 +83,7 @@ export function deleteProblem(postData) {
}
}
).catch(e=>{console.error(e)}
).catch(e=>{}
)
}
......@@ -109,7 +109,7 @@ export function submitProblemList(postData) {
}
}
).catch(e=>{console.error(e)}
).catch(e=>{}
)
}
}
......
......@@ -9,19 +9,25 @@ let myHeaders = new Headers({
'Content-Type': 'application/json; charset=UTF-8',
});
let lock = false;
const finishBoxRecovery = (info)=>{
//已放入回收箱
let {userInfo,taskInfo,storeInfo,taskList} = info;
let bodyData = Object.assign({},{
storeId : storeInfo.id,
taskId : taskInfo.taskId,
userId : userInfo.employeeId,
id : taskList.workListId,
taskType : taskInfo.currentTaskType,
area : taskInfo.area
})
let url=`${domain}machine_pad/update_machine_recovery_sku.action`
return (dispatch)=>{
if(!lock){
lock = true;
let {userInfo={},taskInfo={},storeInfo={},taskList={}} = info;
let bodyData = Object.assign({},{
storeId : storeInfo.id || 0,
taskId : taskInfo.taskId || 0,
userId : userInfo.employeeId || 0,
id : taskList.workListId || 0,
taskType : taskInfo.currentTaskType || "",
area : taskInfo.area || ""
});
UTILPATH.myLogger.info("update_machine_recovery_sku request",bodyData);
let url=`${domain}machine_pad/update_machine_recovery_sku.action`;
fetch(url,{
credentials : 'include',
method : 'POST',
......@@ -31,9 +37,15 @@ const finishBoxRecovery = (info)=>{
}).then(response=>response.json())
.then((json)=>{
dispatch(saveProductInfo({}));
dispatch(getTaskList(info));
dispatch(getTaskList(info,()=>{
lock = false;
}));
}).catch(e=>{
lock = false;
UTILPATH.myLogger.error("update_machine_recovery_sku error ",e);
})
}
}
};
export {finishBoxRecovery}
......@@ -44,7 +44,7 @@ const getRefreshImg = (errorId,type)=>{
};
dispatch(refreshImg(data))
}
}).catch(e=>{console.error(e)})
}).catch(e=>{})
}
};
......@@ -67,7 +67,7 @@ const deleteImg = (errorId,type,fileId)=>{
}
})
.catch((err) =>{
console.error("Err:",err);
});
}
......
......@@ -36,6 +36,7 @@ const finishReplenish = (info,source)=>{
id : source === 1 ? taskList.workListId : 0,
});
let url=`${domain}machine_pad/trigger_ck_task_sku.action`
UTILPATH.myLogger.info("trigger_ck_task_sku request",bodyData);
return (dispatch)=>{
fetch(url,{
credentials : 'include',
......@@ -46,6 +47,8 @@ const finishReplenish = (info,source)=>{
}).then(response=>response.json())
.then((json)=>{
dispatch(getTaskList(info));
}).catch(e=>{
UTILPATH.myLogger.error("trigger_ck_task_sku error ",e);
})
}
}
......
......@@ -21,7 +21,7 @@ export function getReportDamageList (postData) {
}else{
dispatch(throwError(json.meta.message))
}
}).catch(e=>{console.error(e)}
}).catch(e=>{}
)
}
}
......@@ -48,7 +48,7 @@ export function deleteDamageItem(postaData) {
dispatch(throwError(json.meta.message))
}
}
).catch(e=>{console.error(e)}
).catch(e=>{}
)
/* dispatch(initSuccess(fakeJsonData.data))*/
}
......
......@@ -26,7 +26,7 @@ const uploadErrorOld = (info)=>{
}).then((response)=>response.json())
.then(json=>{
}).catch(e=>{console.error(e)});
}).catch(e=>{});
})
};
/**
......@@ -47,6 +47,7 @@ const uploadError = (info,exceptionType,getTask=true)=>{
taskType : taskInfo.currentTaskType || '',
area : taskInfo.area || ''
});
UTILPATH.myLogger.info("exception_skupass_sku bodyData ",bodyData);
return (dispatch =>{
fetch(domain + 'machine_pad/exception_skupass_sku.action',{
credentials : 'include',
......@@ -61,7 +62,9 @@ const uploadError = (info,exceptionType,getTask=true)=>{
dispatch(getTaskList(info));
dispatch(saveProductInfo({}))
}
}).catch(e=>{console.error(e)});
}).catch(e=>{
UTILPATH.myLogger.error("exception_skupass_sku error ",e);
});
})
};
......@@ -76,10 +79,10 @@ const timeoutAlarm = (info)=>{
let {storeInfo={},taskInfo={},userInfo={}} = info;
let bodyData = Object.assign({},{
storeId : storeInfo.id || 0,
taskId : taskInfo.taskId || 0,
userId : userInfo.employeeId || 0,
area : taskInfo.area || ""
});
UTILPATH.myLogger.info("expired_send_error_msg bodyData ",bodyData);
return (dispatch=>{
fetch(domain + 'machine_pad/expired_send_error_msg.action',{
credentials : 'include',
......@@ -92,7 +95,9 @@ const timeoutAlarm = (info)=>{
.then(json=>{
}).catch(e=>{console.error(e)});
}).catch(e=>{
UTILPATH.myLogger.error("expired_send_error_msg error ",e);
});
})
}
......
......@@ -4,21 +4,6 @@ import {saveHeaderInfo} from './initHeader'
import {addErrorInfo} from './uploadError'
const domain = ENV.domain;
let json = {
"meta": {
"code": "200",
"message": "成功",
"success": true
},
"data": {
"type":'ER',
"employee":{
"id": 5,
"employeeName": "机器库管员",
"headImageUrl": "http://www.mjitech.com/static/coupon/gounian/banner_hongbaotupian-3-14.jpg",
},
}
}
const saveUserinfo = (data)=>{
return{
......@@ -29,8 +14,6 @@ const saveUserinfo = (data)=>{
var myHeaders = new Headers({
'Access-Control-Allow-Origin': '*',
// 'Content-Type': 'text/plain;charset=UTF-8',
// 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Content-Type': 'application/json; charset=UTF-8',
});
......@@ -56,7 +39,7 @@ const getUserinfo = (info,headerInfo)=>{
dispatch(addErrorInfo('没有任务需要处理'))
}
}
}).catch(e=>{console.error(e)})
}).catch(e=>{})
}
}
......
......@@ -20,7 +20,6 @@ export default class EditProblemItem extends React.Component{
}
componentWillMount(){
let props = this.props;
// console.log(state)
let Problems_format = {};
let {baseInfo,problemInfo} = props;
props.problemInfo.map((item,index)=>{
......
......@@ -16,6 +16,7 @@ export default class RecoveryScanPage extends React.Component{
this.changeShowInput = this.changeShowInput.bind(this);
this.getPopInfo = this.getPopInfo.bind(this);
this.correctQrcode = this.correctQrcode.bind(this);
this.hidePop = this.hidePop.bind(this); //关闭弹窗
this.state = {
barcodeText : '',
barcodeErrorText : '',
......@@ -52,6 +53,14 @@ export default class RecoveryScanPage extends React.Component{
</div>
}
hidePop(){
this.setState({
barcodeText:""
},()=>{
this.props.hidePopup();
});
}
handleInputChange(e){
this.setState({
barcodeText:e.target.value
......@@ -89,7 +98,7 @@ export default class RecoveryScanPage extends React.Component{
wrongQrcode(){
//拿错货品
let {showPopup,hidePopup} = this.props;
let btnDom = <Button btnContainer={"recoveryContainerQrcode font32 bordere5e5e5"} key={"recoveryContainerWrongQrcode"} style={{marginTop:'10%'}} text={"关闭"} option={hidePopup}/>
let btnDom = <Button btnContainer={"recoveryContainerQrcode font32 bordere5e5e5"} key={"recoveryContainerWrongQrcode"} style={{marginTop:'10%'}} text={"关闭"} option={this.hidePop}/>
let popDom =
<PopModel popupTitle={"遇到问题-货品不对"} classContainer={"recoveryPopInfo"}>
<div className={"icon iconfont icon-wrong font150 colf00"} />
......@@ -154,14 +163,16 @@ export default class RecoveryScanPage extends React.Component{
}else{
//提示条形码不正确
this.setState({
barcodeErrorText : '条形码输入错误,请重新输入'
barcodeErrorText : '条形码输入错误,请重新输入',
barcodeText : ''
})
}
}else{
//提示输入条形码
this.setState({
barcodeErrorText : '请输入条形码'
barcodeErrorText : '请输入条形码',
barcodeText : ''
})
}
......
......@@ -385,7 +385,6 @@ export default class ReplenishScanPage extends React.Component{
}
_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
......
......@@ -42,7 +42,6 @@ import {sendMsg} from '../../util/socket'
/*二期引用 end*/
import {on,remove} from '../../util/event';
import common from "../../reducers/common";
require('./index.css');
......@@ -148,17 +147,20 @@ class PageContainer extends React.Component {
let {dispatch} = this.props;
// this.beginCountBack();
//
// dispatch(saveCommonInfo({ip:"192.168.10.128"}));
// dispatch(getStoreInfo(20));
// dispatch(getStoreInfo(34));
// dispatch(saveCommonInfo({userInfo:{employeeId:14}}));
// dispatch(getUserinfo(14,20))
// dispatch(getUserinfo(14,34))
// dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:'A'}})))
on(CONFIG.socketType.GETSTOREINFO,this,function (data) {
UTILPATH.myLogger.info(CONFIG.socketType.GETSTOREINFO ,data);
dispatch(saveCommonInfo({ip:data.ip}));
dispatch(getStoreInfo(data.storeId));
});
on(CONFIG.socketType.GETSOCKETMSG,this,function (data) {
UTILPATH.myLogger.info(CONFIG.socketType.GETSOCKETMSG ,data);
that.getSocketMsg(data)
});
// on(CONFIG.socketType.SOCKETERROR,this,()=>{
......@@ -218,6 +220,8 @@ class PageContainer extends React.Component {
});
break;
case 'SUCCESS_CLOSEDOOR':
UTILPATH.myLogger.info("SUCCESS_CLOSEDOOR isSend ",isSend);
UTILPATH.myLogger.info("SUCCESS_CLOSEDOOR area ",area);
if(isSend){
let {info={}} = data;
let {left_door=0,right_door=0} = info;
......@@ -246,6 +250,8 @@ class PageContainer extends React.Component {
handleCloseDoor(){
let {dispatch,state} = this.props;
let {commonInfo={}} = state;
UTILPATH.myLogger.info("handleCloseDoor commonInfo ",commonInfo);
this.setState({
showPage : showPage[initPage],
showClock : false,
......@@ -253,7 +259,7 @@ class PageContainer extends React.Component {
successCloseDoor : true,
isSend:false
},()=>{
dispatch(closeDoorSuccess(state.commonInfo));
dispatch(closeDoorSuccess(commonInfo));
});
}
......@@ -415,7 +421,6 @@ class PageContainer extends React.Component {
}
countBack(){
console.log("countBackTime ",this.countBackTime);
if(!this.countbackTimer && this.countBackTime >= 0){
this.countBackTime--;
this.countbackTimer = window.setTimeout(()=>{
......
......@@ -28,6 +28,6 @@ function renderPage(store) {
let store = activateVendor();
UTILPATH.socket.getIp1();
// UTILPATH.socket.getTestIp(182);
// UTILPATH.socket.getTestIp(203);
renderPage(store);
\ No newline at end of file
import fetch from 'isomorphic-fetch';
let domain = "";
const myHeaders = new Headers({
// 'Access-Control-Allow-Origin': '*',
// 'Content-Type': 'text/plain;charset=UTF-8',
// 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Content-Type': 'application/json; charset=UTF-8',
});
const myLogger = {};
myLogger.saveDomain = (ip)=>{
domain = `http://${ip}:7788`;
};
myLogger.info = function () {
let args = [].slice.call(arguments) || [];
if(domain && args.length > 0){
let bodyData = {};
let time = new Date().getTime();
bodyData["time"] = time;
bodyData[args[0]] = args.slice(1);
fetch(domain+'/track',{
method : 'POST',
mode : 'cors',
headers : myHeaders,
body : JSON.stringify(bodyData)
}).then(response=>response.json())
.then((json)=>{
}).catch(e=>{
})
}else{
}
};
myLogger.error = function () {
let args = [].slice.call(arguments) || [];
if(domain && args.length > 0){
let bodyData = {};
let time = new Date().getTime();
bodyData["time"] = time;
bodyData[args[0]] = args.slice(1);
fetch(domain+'/errortrack',{
method : 'POST',
mode : 'cors',
headers : myHeaders,
body : JSON.stringify(bodyData)
}).then(response=>response.json())
.then((json)=>{
}).catch(e=>{
})
}else{
}
};
module.exports = myLogger;
\ No newline at end of file
import fetch from 'isomorphic-fetch';
import {emit} from './event'
import myLogger from './logger'
let domainIp = '192.168.10.';
......@@ -10,7 +9,7 @@ let totalCount = 0;
let getIpING = false; //正在获取IP
let currentIpIndex = 255;
let ws = null;
let storeId = 0
let storeId = 0;
socket.getIp1 = ()=>{
if(!getIpING) {
......@@ -80,12 +79,10 @@ socket.getTestIp = (ip) => {
const getError = ()=>{
console.error("socket error");
getClose();
}
const getClose = ()=>{
console.error("socket close ",currentIpIndex);
//如果有currentIp就没有必要再次循环
ws = null;
if(!getIpING){
......@@ -111,16 +108,16 @@ const init = (ip,storeid,from = false)=>{
currentIpIndex = ip;
storeId = storeid;
getIpING = false;
myLogger.saveDomain(domainIp+ip);
emit(CONFIG.socketType.GETSTOREINFO,{ip:domainIp+ip,storeId:storeid})
};
ws.onmessage = function (evt)
{
console.log(evt.data);
if(evt.data === "ping"){
let o = {
type : 'PONG'
}
};
ws.send(JSON.stringify(o));
}else{
var received_msg = JSON.parse(evt.data); //String
......@@ -132,11 +129,12 @@ const init = (ip,storeid,from = false)=>{
ws.onclose = function(err)
{
// 关闭 websocket
myLogger.error("socket close & getIpING",err,getIpING);
emit(CONFIG.socketType.SOCKETERROR,"");
getClose();
};
ws.onerror = function (err) {
console.error("error : ",err);
myLogger.error("socket error & getIpING",err,getIpING);
emit(CONFIG.socketType.SOCKETERROR,"");
getError();
}
......@@ -151,7 +149,6 @@ socket.sendMsg = (msg) => {
try{
ws.send(msg);
}catch (e) {
console.error("sendMsg error :",e)
}
}
......@@ -163,7 +160,6 @@ const closeSocket = ()=>{
ws.close();
ws = null;
}catch (e) {
console.error("closeSocket error :",e)
}
}
}
......
import image from './image';
import socket from './socket';
import myLogger from './logger';
const getRemByPx = (num)=>{
return (num / BASEREM ).toFixed(6) + 'rem';
};
module.exports = {...image,socket,getRemByPx};
\ No newline at end of file
module.exports = {...image,socket,getRemByPx,myLogger};
\ No newline at end of file
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