Commit ff098860 by Zhang Xin

完成平板需求168 & 添加log & 修改平板BUG2818

parents de87f78f 2b057a5c
......@@ -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,7 +33,9 @@ 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;
let url = `${domain}machine_pad/work/lr/status/${taskInfo.taskId}/${taskInfo.area}/${taskInfo.currentTaskType}`;
UTILPATH.myLogger.info("hasNoSku url",url);
return (dispatch)=>{
let url = `${domain}machine_pad/work/lr/status/${taskInfo.taskId}/${taskInfo.area}/${taskInfo.currentTaskType}`;
fetch(url,{
// credentials : 'include',
method : 'PUT',
......@@ -49,7 +54,9 @@ 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,7 +31,9 @@ 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,7 +60,10 @@ const closeDoorSuccess=(data)=>{
}).then((response)=>response.json())
.then((json)=>{
dispatch(logout())
})
}).catch(e=>{
UTILPATH.myLogger.error("update_door_status error ",e);
closeDoorSuccess(data);
})
}
}
export {willCloseDoor,closeDoorSuccess}
\ No newline at end of file
......@@ -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,7 +102,15 @@ 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,30 +9,42 @@ 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)=>{
fetch(url,{
credentials : 'include',
method : 'POST',
mode : 'cors',
headers: myHeaders,
body:JSON.stringify(bodyData)
}).then(response=>response.json())
.then((json)=>{
dispatch(saveProductInfo({}));
dispatch(getTaskList(info));
})
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',
mode : 'cors',
headers: myHeaders,
body:JSON.stringify(bodyData)
}).then(response=>response.json())
.then((json)=>{
dispatch(saveProductInfo({}));
dispatch(getTaskList(info,()=>{
lock = false;
}));
}).catch(e=>{
lock = false;
UTILPATH.myLogger.error("update_machine_recovery_sku error ",e);
})
}
}
};
......
......@@ -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,7 +47,9 @@ 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,15 +62,43 @@ 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);
});
})
}
};
const addErrorInfo = (errMsg)=>{
return{
type : actionType.ADDERRORINFO,
errMsg
}
};
const timeoutAlarm = (info)=>{
let {storeInfo={},taskInfo={},userInfo={}} = info;
let bodyData = Object.assign({},{
storeId : storeInfo.id || 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',
method : 'POST',
mode : 'cors',
headers:myHeaders,
body : JSON.stringify(bodyData)
}).then((response)=>response.json())
.then(json=>{
}).catch(e=>{
UTILPATH.myLogger.error("expired_send_error_msg error ",e);
});
})
}
export {uploadError,addErrorInfo}
export {uploadError,addErrorInfo,timeoutAlarm}
......@@ -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
......
......@@ -45,7 +45,7 @@ export default class FinishAskContainer extends React.Component{
/>;
let popDom = <PopModel classNames={"popupExtClass"} popupText={"检测到店铺反常,请站出店铺,关闭店铺门后重新验证您的身份"} popupButtons={[btnDom,clockDom]}/>
this.props.showPopup({popupChild:popDom});
this.props.uploadErrs(2);
this.props.uploadErrs();
}
......@@ -59,7 +59,7 @@ export default class FinishAskContainer extends React.Component{
/>;
let popDom = <PopModel popupText={"您的任务是否已结束"} popupButtons={[btnDom,clockDom]}/>
this.props.showPopup({popupChild:popDom});
this.props.uploadErrs(2);
this.props.uploadErrs();
}
render(){
......
......@@ -44,6 +44,7 @@ export default class HomePageContainer extends React.Component{
closeDoorStatus : 1
},()=>{
this.props.willCloseDoor();
this.props.endCountBack();
let msg={type:'WILL_CLOSEDOOR'};
sendMsg(JSON.stringify(msg));
this.props.changeIsSend(true);
......
......@@ -9,7 +9,7 @@ import {initGetOtherProblem,addNewProbem,deleteProblem,editProblemItem,submitPro
import {scanBarCodeGetProductInfo,submitProductInfo,saveEditProductInfo,submitProductSuccess,clearProductSuccess} from "../../actions/ScanBarCode"
import {getReportDamageList,deleteDamageItem} from '../../actions/reportDamageList'
import {getRefreshImg,deleteImg,emptyImg} from "../../actions/refreshImg"
import {uploadError,addErrorInfo} from '../../actions/uploadError'
import {uploadError,addErrorInfo,timeoutAlarm} from '../../actions/uploadError'
import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent'
import TroubleContainer from '../TroubleContainer/TroubleContainer'
import ScanBarCodeContainer from '../ScanBarCodeContainer/ScanBarCodeContaienr'
......@@ -42,7 +42,6 @@ import {sendMsg} from '../../util/socket'
/*二期引用 end*/
import {on,remove} from '../../util/event';
import common from "../../reducers/common";
require('./index.css');
......@@ -78,8 +77,9 @@ class PageContainer extends React.Component {
successCloseDoor : false,
showClassify : false, //显示右侧菜单栏,默认不显示,目前没用
isSend:false,
area:''//区域
area:'',//区域
maxTime : 300,
showAlarm : false // 是否已报警,已报警为true,未报警为false
};
this.getPages = this.getPages.bind(this); //获取当前页面
this.showPopup = this.showPopup.bind(this); //显示弹窗
......@@ -145,16 +145,22 @@ class PageContainer extends React.Component {
this.getPageStyle();
let that = this;
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,()=>{
......@@ -197,12 +203,26 @@ class PageContainer extends React.Component {
dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:info.area,taskId:0,currentTaskType:'OPEN'}})))
}
let maxTime = this.maxCountBackTime;
if(parseInt(info.maxTime)){
maxTime = parseInt(info.maxTime);
}
this.setState({
successCloseDoor : false,
area:info.area
area:info.area,
showAlarm : false,
maxTime : maxTime
},()=>{
//开门开始倒计时
this.countBackTime = maxTime;
this.beginCountBack()
});
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;
......@@ -231,20 +251,22 @@ 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,
showAlarm : false,
popupInfo : defaultPopupInfo,
successCloseDoor : true,
isSend:false
},()=>{
dispatch(closeDoorSuccess(state.commonInfo));
this.endCountBack();
dispatch(closeDoorSuccess(commonInfo));
});
}
componentDidMount(){
// this.beginCountBack()
let {dispatch} = this.props;
}
componentDidUpdate() {
}
......@@ -352,7 +374,7 @@ class PageContainer extends React.Component {
this.setState({
showPage : showPage[1]
},()=>{
this.beginCountBack();
// this.beginCountBack();
});
}
showSecondTroubelPage(info){
......@@ -371,16 +393,28 @@ class PageContainer extends React.Component {
//开始倒计时,看有没有操作,只是在整个开门过程中才监听
beginCountBack(){
this.countBackTime = this.maxCountBackTime;
clearTimeout(this.countbackTimer);
this.countbackTimer = null;
this.countBack.bind(this)();
if(this.countbackTimer){
clearTimeout(this.countbackTimer);
this.countbackTimer = null;
}
if(!this.countbackTimer){
this.setState({
showAlarm : false
},()=>{
this.countBackTime = this.state.maxTime;
this.countBack.bind(this)();
})
}
}
endCountBack(){
this.countBackTime = -1;
clearTimeout(this.countbackTimer);
if(this.countbackTimer){
clearTimeout(this.countbackTimer);
}
this.countbackTimer = null;
UTILPATH.myLogger.info("endCountBack countBackTime ",this.countBackTime);
}
overTimeSolve(){
......@@ -393,6 +427,7 @@ class PageContainer extends React.Component {
}
countBack(){
// UTILPATH.myLogger.info("countBack countBackTime ",this.countBackTime);
if(!this.countbackTimer && this.countBackTime >= 0){
this.countBackTime--;
this.countbackTimer = window.setTimeout(()=>{
......@@ -407,7 +442,8 @@ class PageContainer extends React.Component {
let btnWidth = UTILPATH.getRemByPx(260);
let btnMarginLeft = UTILPATH.getRemByPx(30);
let btnBorderRadius = UTILPATH.getRemByPx(10);
let btnDom = <Button key={"pagecountBack1"} style={{'width':btnWidth}} text={"确定"} option={this.overTimeSolve}/>
let border = "2px solid #e5e5e5";
let btnDom = <Button key={"pagecountBack1"} style={{'width':btnWidth,'border':border}} text={"确定"} option={this.overTimeSolve}/>
let clockDom = <Clock key={"pagecountBack2"} totalTime={60}
style={{'width':btnWidth,'marginLeft':btnMarginLeft,'borderRadius':btnBorderRadius}}
callback={this.showAlarm}
......@@ -423,9 +459,10 @@ class PageContainer extends React.Component {
}
uploadErrs(type){
uploadErrs(){
let {dispatch,state} = this.props;
dispatch(uploadError(Object.assign({},state.commonInfo,{exceptionType:type})));
let {commonInfo={}} = state;
dispatch(timeoutAlarm(commonInfo));
}
......@@ -448,11 +485,24 @@ class PageContainer extends React.Component {
//弹出警告弹窗,并报警
showAlarm(){
//屏幕超过300s无人操作
this.uploadErrs(errorType[1])
//TODO 上报300s无人操作
this.uploadErrs();
this.setState({
showAlarm : true,
popupInfo : defaultPopupInfo
},()=>{
this.playAlarmMusic()
})
/*
let btnWidth = UTILPATH.getRemByPx(260);
let btnMarginLeft = UTILPATH.getRemByPx(30);
let btnBorderRadius = UTILPATH.getRemByPx(10);
let btnDom = <Button key={"pagecountBack1"} style={{'width':btnWidth}} text={"确定"} option={this.beginCloseDoor}/>
let border = "2px solid #e5e5e5"
let btnDom = <Button key={"pagecountBack1"} style={{'width':btnWidth,'border':border}} text={"确定"} option={this.beginCloseDoor}/>
let clockDom = <Clock key={"pagecountBack2"} totalTime={30}
style={{'width':btnWidth,'marginLeft':btnMarginLeft,'borderRadius':btnBorderRadius}}
callback={this.beginCloseDoor}
......@@ -468,6 +518,8 @@ class PageContainer extends React.Component {
this.playAlarmMusic()
})
*/
}
//关门
......@@ -475,6 +527,11 @@ class PageContainer extends React.Component {
let btnWidth = UTILPATH.getRemByPx(260);
let btnMarginLeft = UTILPATH.getRemByPx(30);
let btnBorderRadius = UTILPATH.getRemByPx(10);
//老机器
// this.handleCloseDoor();
/*
this.setState({
popupInfo:defaultPopupInfo
},()=>{
......@@ -487,8 +544,17 @@ class PageContainer extends React.Component {
popupText : '关门倒数,请尽快站到设备外关闭设备门',
popupButtons:[clockDom]
});
this.showPopup({popupChild:beginCloseDoorDom})
this.showPopup({popupChild:beginCloseDoorDom});
//新机器 todo
// sendMsg(JSON.stringify({type:'WILL_CLOSEDOOR'}));
// this.changeIsSend.bind(this)(true);
})
*/
}
......@@ -498,21 +564,19 @@ class PageContainer extends React.Component {
failCloseDoor(){
this.playAlarmMusic();
this.uploadErrs(errorType[3]);
this.uploadErrs();
}
judgeDoorStatus(){
//成功关门
//关门失败
// this.emptyUser();
// this.failCloseDoor()
if(!this.state.successCloseDoor){
//关门失败,上传警报
this.failCloseDoor();
}
//写死的数据
// this.tempLogout();
this.setState({
showPage : showPage[initPage],
popupInfo : defaultPopupInfo,
},()=>{
if(!this.state.successCloseDoor){
//关门失败,上传警报
this.failCloseDoor();
}
});
}
playAlarmMusic(){
......@@ -706,7 +770,7 @@ class PageContainer extends React.Component {
changePages={(data)=>this.changePages(data)}
showOpenDoorPage={()=>this.showOpenDoorPage.bind(this)()}
showPopup={(info)=>this.showPopup(info)}
uploadErrs={(type)=>this.uploadErrs(type)}
uploadErrs={()=>this.uploadErrs()}
hidePopup={()=>this.hidePopup()}
/>;
break;
......@@ -739,6 +803,7 @@ class PageContainer extends React.Component {
closeDoor={true}
tempLogout={()=>this.tempLogout.bind(this)()}
changeIsSend ={this.changeIsSend.bind(this)}
endCountBack={this.endCountBack}
/>;
break;
case showPage[12]:
......@@ -841,7 +906,14 @@ class PageContainer extends React.Component {
handleTouch(){
this.countBackTime = this.maxCountBackTime;
this.countBackTime = this.state.maxTime;
if(this.state.showAlarm){
this.setState({
showAlarm : false
},()=>{
this.beginCountBack();
})
}
}
render() {
......
......@@ -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
......@@ -21,6 +21,8 @@ const saveCommonInfo = (newState,data)=>{
};
const emptyCommInfo = (state,data)=>{
UTILPATH.myLogger.info("emptyCommInfo data ",data);
UTILPATH.myLogger.info("emptyCommInfo ",Object.assign({},state,data));
return Object.assign({},state,data)
}
......
import fetch from 'isomorphic-fetch';
let domain = "";
const domainPort = "7788";
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}:${domainPort}`;
};
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=>{
})
}
};
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=>{
})
}
};
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.8.';
const domainPort = "7788";
const socket = {};
let totalCount = 0;
let getIpING = false; //正在获取IP
let currentIpIndex = 255;
let ws = null;
let storeId = 0
let storeId = 0;
socket.getIp1 = ()=>{
if(!getIpING) {
getIpING = true;
for(let j = 0; j< 255 ; j ++){
let wsUrl = 'ws://' + domainIp + j + ':7788/notify?from=plant';
let wsUrl = `ws://${domainIp}${j}:${domainPort}/notify?from=plant`;
let ws1 = new WebSocket(wsUrl);
ws1.onopen = function()
{
......@@ -54,7 +55,7 @@ socket.getIp1 = ()=>{
socket.getTestIp = (ip) => {
let wsUrl = 'ws://' + domainIp + ip + ':7788/notify?from=plant';
let wsUrl = `ws://${domainIp}${ip}:${domainPort}/notify?from=plant`;
let ws1 = new WebSocket(wsUrl);
ws1.onopen = function()
{
......@@ -80,12 +81,10 @@ socket.getTestIp = (ip) => {
const getError = ()=>{
console.error("socket error");
getClose();
}
const getClose = ()=>{
console.error("socket close ",currentIpIndex);
//如果有currentIp就没有必要再次循环
ws = null;
if(!getIpING){
......@@ -100,7 +99,7 @@ const getClose = ()=>{
const init = (ip,storeid,from = false)=>{
let wsUrl = 'ws://' + domainIp + ip + ':7788/notify?from=plant&storeId=' + storeid;
let wsUrl = `ws://${domainIp}${ip}:${domainPort}/notify?from=plant&storeId=${storeid}`;
if("WebSocket" in window && !ws && ip && storeid && (currentIpIndex === 255 || from)){
ws = new WebSocket(wsUrl);
......@@ -111,16 +110,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 +131,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 +151,6 @@ socket.sendMsg = (msg) => {
try{
ws.send(msg);
}catch (e) {
console.error("sendMsg error :",e)
}
}
......@@ -163,7 +162,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
......@@ -7,9 +7,9 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"clean": "rm -rf static/*",
"start": "set NODE_ENV=development && webpack-dev-server --env=dev -d --history-api-fallback --hot --inline --progress --colors --port 80 --host 0.0.0.0",
"build": "set NODE_ENV=production && webpack --env=build --progress --color",
"build:prod": "set NODE_ENV=development && webpack --env=build --progress --color"
"start": "cross-env NODE_ENV=development webpack-dev-server --env=dev -d --history-api-fallback --hot --inline --progress --colors --port 80 --host 0.0.0.0",
"build": "cross-env NODE_ENV=production webpack --env=build --progress --color",
"build:prod": "cross-env NODE_ENV=development webpack --env=build --progress --color"
},
"author": "",
"license": "MIT",
......@@ -43,6 +43,7 @@
"webpack-dev-server": "^2.11.2"
},
"dependencies": {
"cross-env": "^5.2.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
......
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