Commit 1c6eedec by Zhang Xin

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

parent fe8beba5
...@@ -4,6 +4,7 @@ import actionTypes_error from '../actiontype/error' ...@@ -4,6 +4,7 @@ import actionTypes_error from '../actiontype/error'
let domain = ENV.domain; let domain = ENV.domain;
export function scanBarCodeGetProductInfo(postData) { export function scanBarCodeGetProductInfo(postData) {
return (dispatch) => { 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'); let url = String(domain+'machine_pad/scanning_sku_barcode_for_add_loss_task');
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
...@@ -25,14 +26,15 @@ export function scanBarCodeGetProductInfo(postData) { ...@@ -25,14 +26,15 @@ export function scanBarCodeGetProductInfo(postData) {
dispatch(throwError(json.meta.message)) dispatch(throwError(json.meta.message))
} }
} }
).catch(e=>dispatch(console.log("出现错误")) ).catch(e=>{
) UTILPATH.myLogger.error("scanning_sku_barcode_for_add_loss_task error ",e);
/* dispatch(initSuccess(fakeJsonData.data))*/ })
} }
} }
export function submitProductInfo(postData) { export function submitProductInfo(postData) {
return (dispatch)=>{ return (dispatch)=>{
let url = String(domain+'machine_pad/submit_add_loss_task'); let url = String(domain+'machine_pad/submit_add_loss_task');
UTILPATH.myLogger.info("submit_add_loss_task bodyData ",postData);
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
...@@ -52,7 +54,9 @@ export function submitProductInfo(postData) { ...@@ -52,7 +54,9 @@ export function submitProductInfo(postData) {
dispatch(submitProductSuccess(submit)) 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)=>{ ...@@ -11,6 +11,7 @@ const checkProductQuantity = (data)=>{
let {quantity,skuPassId,workListId}=tokeProductInfo; let {quantity,skuPassId,workListId}=tokeProductInfo;
let bodyData={storeId,taskId,area,quantity,skuPassId,workListId,employeeId,currentTaskType} let bodyData={storeId,taskId,area,quantity,skuPassId,workListId,employeeId,currentTaskType}
let url=domain+`machine_pad/work/ck`; let url=domain+`machine_pad/work/ck`;
UTILPATH.myLogger.info("checkProductQuantity bodyData ",bodyData);
return (dispatch)=>{ return (dispatch)=>{
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
...@@ -26,7 +27,9 @@ const checkProductQuantity = (data)=>{ ...@@ -26,7 +27,9 @@ const checkProductQuantity = (data)=>{
dispatch(getTaskList(commonInfo)) dispatch(getTaskList(commonInfo))
} }
dispatch(checkQuantity({type:json.data})) 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)=>{ ...@@ -12,7 +12,8 @@ const getBarCodeProductInfo = (data)=>{
let currentTaskType = taskInfo.currentTaskType || ''; let currentTaskType = taskInfo.currentTaskType || '';
let area = taskInfo.area || '' let area = taskInfo.area || ''
let taskId = taskInfo.taskId || 0 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)=>{ return (dispatch)=>{
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
...@@ -77,6 +78,8 @@ const getBarCodeProductInfo = (data)=>{ ...@@ -77,6 +78,8 @@ const getBarCodeProductInfo = (data)=>{
} }
} }
}).catch(e=>{
UTILPATH.myLogger.error("getBarCodeProductInfo error ",e);
}) })
} }
......
...@@ -17,7 +17,9 @@ const submitBreakageProduct = (data)=>{ ...@@ -17,7 +17,9 @@ const submitBreakageProduct = (data)=>{
let machineId=commonInfo.storeInfo.id; let machineId=commonInfo.storeInfo.id;
let {skuPosition,skuId,skuStatus}=productDetail; let {skuPosition,skuId,skuStatus}=productDetail;
let bodyData={skuPosition,skuId,skuStatus,machineId,taskId} 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)=>{ return (dispatch)=>{
fetch(url,{ fetch(url,{
// credentials : 'include', // credentials : 'include',
...@@ -31,7 +33,9 @@ const submitBreakageProduct = (data)=>{ ...@@ -31,7 +33,9 @@ const submitBreakageProduct = (data)=>{
}).then((response)=>response.json()) }).then((response)=>response.json())
.then((json)=>{ .then((json)=>{
dispatch(getSubmitStatus(json.meta)) dispatch(getSubmitStatus(json.meta))
}) }).catch(e=>{
UTILPATH.myLogger.error("submitBreakageProduct error ",e);
})
} }
} }
...@@ -39,8 +43,9 @@ const submitBreakageProduct = (data)=>{ ...@@ -39,8 +43,9 @@ const submitBreakageProduct = (data)=>{
//test 没有散落货品 //test 没有散落货品
const hasNoSku = (commonInfo)=>{ const hasNoSku = (commonInfo)=>{
let {storeInfo={},userInfo={},taskInfo={}} = 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)=>{ return (dispatch)=>{
let url = `${domain}machine_pad/work/lr/status/${taskInfo.taskId}/${taskInfo.area}/${taskInfo.currentTaskType}`;
fetch(url,{ fetch(url,{
// credentials : 'include', // credentials : 'include',
method : 'PUT', method : 'PUT',
...@@ -49,7 +54,9 @@ const hasNoSku = (commonInfo)=>{ ...@@ -49,7 +54,9 @@ const hasNoSku = (commonInfo)=>{
}).then(response=>response.json()) }).then(response=>response.json())
.then((json)=>{ .then((json)=>{
dispatch(getTaskList(commonInfo)) dispatch(getTaskList(commonInfo))
}) }).catch(e=>{
UTILPATH.myLogger.error("hasNoSku 没有散落货品 error ",e);
})
} }
} }
......
...@@ -8,7 +8,9 @@ const willCloseDoor=(data,flag=false)=>{ ...@@ -8,7 +8,9 @@ const willCloseDoor=(data,flag=false)=>{
let userId=userInfo.employeeId; let userId=userInfo.employeeId;
let machineId=storeInfo.id; let machineId=storeInfo.id;
let {taskId,area,currentTaskType}=taskInfo; 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)=>{ return (dispatch)=>{
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
...@@ -29,7 +31,9 @@ const willCloseDoor=(data,flag=false)=>{ ...@@ -29,7 +31,9 @@ const willCloseDoor=(data,flag=false)=>{
// dispatch(saveCommonInfo(Object.assign({},{taskInfo:{currentTaskType:'FINISH'}}))) // dispatch(saveCommonInfo(Object.assign({},{taskInfo:{currentTaskType:'FINISH'}})))
} }
// dispatch(closeDoorSuccess(data)); // dispatch(closeDoorSuccess(data));
}) }).catch(e=>{
UTILPATH.myLogger.error("finish_task error ",e);
})
} }
} }
...@@ -40,7 +44,9 @@ const closeDoorSuccess=(data)=>{ ...@@ -40,7 +44,9 @@ const closeDoorSuccess=(data)=>{
let machineId=storeInfo.id; let machineId=storeInfo.id;
let {taskId,area}=taskInfo; let {taskId,area}=taskInfo;
let bodyData={storeId:machineId,taskId,area,userId} 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)=>{ return (dispatch)=>{
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
...@@ -54,7 +60,9 @@ const closeDoorSuccess=(data)=>{ ...@@ -54,7 +60,9 @@ const closeDoorSuccess=(data)=>{
}).then((response)=>response.json()) }).then((response)=>response.json())
.then((json)=>{ .then((json)=>{
dispatch(logout()) dispatch(logout())
}) }).catch(e=>{
UTILPATH.myLogger.error("update_door_status error ",e);
})
} }
} }
export {willCloseDoor,closeDoorSuccess} export {willCloseDoor,closeDoorSuccess}
\ No newline at end of file
...@@ -14,6 +14,7 @@ let myHeaders = new Headers({ ...@@ -14,6 +14,7 @@ let myHeaders = new Headers({
const getStoreInfo = (storeId)=>{ const getStoreInfo = (storeId)=>{
return(dispatch)=>{ return(dispatch)=>{
let bodyData = {storeId}; let bodyData = {storeId};
UTILPATH.myLogger.info("getMachineData request",bodyData);
fetch(domain + 'pad_warehouse/getMachineData.action',{ fetch(domain + 'pad_warehouse/getMachineData.action',{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
...@@ -25,9 +26,13 @@ const getStoreInfo = (storeId)=>{ ...@@ -25,9 +26,13 @@ const getStoreInfo = (storeId)=>{
let storeInfo = Object.assign({},{id:storeId}); let storeInfo = Object.assign({},{id:storeId});
if(json.meta.success && json.data.warehouse){ if(json.meta.success && json.data.warehouse){
storeInfo = Object.assign({},storeInfo,json.data.warehouse) storeInfo = Object.assign({},storeInfo,json.data.warehouse)
}else{
UTILPATH.myLogger.error("getMachineData error ",json);
} }
dispatch(saveCommonInfo(Object.assign({},{storeInfo}))) 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)=>{ ...@@ -36,7 +41,8 @@ const getStoreInfo = (storeId)=>{
//获取用户信息 //获取用户信息
const getUserinfo = (employeeId,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)=>{ return(dispatch)=>{
fetch(domain + 'machine_pad/get_alowed_task.action',{ fetch(domain + 'machine_pad/get_alowed_task.action',{
credentials : 'include', credentials : 'include',
...@@ -58,16 +64,19 @@ const getUserinfo = (employeeId,storeId)=>{ ...@@ -58,16 +64,19 @@ const getUserinfo = (employeeId,storeId)=>{
} }
dispatch(saveCommonInfo(Object.assign({},{userInfo}))); 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 {storeInfo={},userInfo={},taskInfo={}} = data;
let taskId=taskInfo.taskId || 0; let taskId=taskInfo.taskId || 0;
let url =`${domain}machine_pad/work/list/${storeInfo.id}/${taskInfo.area}/${taskId}/${userInfo.employeeId}`; let url =`${domain}machine_pad/work/list/${storeInfo.id}/${taskInfo.area}/${taskId}/${userInfo.employeeId}`;
UTILPATH.myLogger.info("getTaskList url",url);
return (dispatch)=>{ return (dispatch)=>{
if(!userInfo.id){ if(!userInfo.id){
dispatch(addErrorInfo('没有获取用户信息')) dispatch(addErrorInfo('没有获取用户信息'))
...@@ -84,9 +93,6 @@ const getTaskList = (data={})=>{ ...@@ -84,9 +93,6 @@ const getTaskList = (data={})=>{
let data =Object.assign({}); let data =Object.assign({});
if(json.meta.success && json.data){ if(json.meta.success && json.data){
data.taskInfo = Object.assign({},json.data.flatCommonVo); 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); data.taskList = Object.assign({},json.data.skuFlatVo);
let childNum = 0; let childNum = 0;
let currentTaskType = json.data.flatCommonVo.currentTaskType; let currentTaskType = json.data.flatCommonVo.currentTaskType;
...@@ -96,7 +102,15 @@ const getTaskList = (data={})=>{ ...@@ -96,7 +102,15 @@ const getTaskList = (data={})=>{
dispatch(addErrorInfo(json.meta.message)) dispatch(addErrorInfo(json.meta.message))
} }
dispatch(saveCommonInfo(Object.assign({},data))) 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 = ()=>{ ...@@ -51,7 +51,6 @@ const getIp = ()=>{
dispatch(saveIp(domainIp + i + ':7788')) dispatch(saveIp(domainIp + i + ':7788'))
}) })
.catch((err) =>{ .catch((err) =>{
console.error("Err:",err);
failTotal++; failTotal++;
if(failTotal >= totalIndex + initIndex){ if(failTotal >= totalIndex + initIndex){
initIndex = totalIndex + initIndex > 255 ? 1 : totalIndex + initIndex; initIndex = totalIndex + initIndex > 255 ? 1 : totalIndex + initIndex;
......
...@@ -52,7 +52,7 @@ const getStoreInfo = (data)=>{ ...@@ -52,7 +52,7 @@ const getStoreInfo = (data)=>{
}else{ }else{
//没有店铺信息 //没有店铺信息
} }
}).catch(e=>{console.error(e)}) }).catch(e=>{})
} }
......
...@@ -6,128 +6,6 @@ import {saveCommonInfo,getTaskList} from "./common"; ...@@ -6,128 +6,6 @@ import {saveCommonInfo,getTaskList} from "./common";
const domain = ENV.domain; 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) => { const saveTroubleList = (data) => {
return { return {
type: actionTypes.SAVETROUBLELIST, type: actionTypes.SAVETROUBLELIST,
...@@ -145,8 +23,6 @@ const saveUserInfo = (data) => { ...@@ -145,8 +23,6 @@ const saveUserInfo = (data) => {
var myHeaders = new Headers({ var myHeaders = new Headers({
'Access-Control-Allow-Origin': '*', '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', 'Content-Type': 'application/json; charset=UTF-8',
}); });
...@@ -158,6 +34,7 @@ const getTroubleList = (info) => { ...@@ -158,6 +34,7 @@ const getTroubleList = (info) => {
employeeId: userInfo.employeeId, employeeId: userInfo.employeeId,
storeId: storeInfo.id storeId: storeInfo.id
}); });
UTILPATH.myLogger.info("getTroubleList request ",bodyData);
fetch(domain + 'machine_pad/list_fault.action', { fetch(domain + 'machine_pad/list_fault.action', {
credentials: 'include', credentials: 'include',
method: 'POST', method: 'POST',
...@@ -171,7 +48,7 @@ const getTroubleList = (info) => { ...@@ -171,7 +48,7 @@ const getTroubleList = (info) => {
dispatch(saveTroubleList(json.data)) dispatch(saveTroubleList(json.data))
} }
}).catch(e => { }).catch(e => {
console.error(e) UTILPATH.myLogger.error("getTroubleList error ",e);
}) })
} }
}; };
...@@ -179,7 +56,7 @@ const getTroubleList = (info) => { ...@@ -179,7 +56,7 @@ const getTroubleList = (info) => {
const updateTroubleList = (info, headerInfo) => { const updateTroubleList = (info, headerInfo) => {
let {taskInfo={},userInfo={},storeInfo={}} = headerInfo; let {taskInfo={},userInfo={},storeInfo={}} = headerInfo;
let bodyData = Object.assign({}, {details: info}, {taskId:taskInfo.taskId,employeeId:userInfo.employeeId,storeId:storeInfo.id}); let bodyData = Object.assign({}, {details: info}, {taskId:taskInfo.taskId,employeeId:userInfo.employeeId,storeId:storeInfo.id});
UTILPATH.myLogger.info("save_all_error request ",bodyData);
//todo 更新故障处理,并且获取新的工单 //todo 更新故障处理,并且获取新的工单
return (dispatch) => { return (dispatch) => {
fetch(domain + 'machine_pad/save_all_error.action', { fetch(domain + 'machine_pad/save_all_error.action', {
...@@ -192,7 +69,7 @@ const updateTroubleList = (info, headerInfo) => { ...@@ -192,7 +69,7 @@ const updateTroubleList = (info, headerInfo) => {
.then(json => { .then(json => {
dispatch(getTaskList(headerInfo)) dispatch(getTaskList(headerInfo))
}).catch(e => { }).catch(e => {
console.error(e) UTILPATH.myLogger.error("save_all_error error ",e);
}) })
} }
}; };
......
...@@ -23,7 +23,7 @@ export function initGetOtherProblem(postData) { ...@@ -23,7 +23,7 @@ export function initGetOtherProblem(postData) {
} }
} }
).catch(e=>{console.error(e)} ).catch(e=>{}
) )
/* */ /* */
} }
...@@ -49,7 +49,7 @@ export function addNewProbem(postData) { ...@@ -49,7 +49,7 @@ export function addNewProbem(postData) {
} }
} }
).catch(e=>{console.error(e)} ).catch(e=>{}
) )
/* */ /* */
} }
...@@ -83,7 +83,7 @@ export function deleteProblem(postData) { ...@@ -83,7 +83,7 @@ export function deleteProblem(postData) {
} }
} }
).catch(e=>{console.error(e)} ).catch(e=>{}
) )
} }
...@@ -109,7 +109,7 @@ export function submitProblemList(postData) { ...@@ -109,7 +109,7 @@ export function submitProblemList(postData) {
} }
} }
).catch(e=>{console.error(e)} ).catch(e=>{}
) )
} }
} }
......
...@@ -9,30 +9,42 @@ let myHeaders = new Headers({ ...@@ -9,30 +9,42 @@ let myHeaders = new Headers({
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
}); });
let lock = false;
const finishBoxRecovery = (info)=>{ 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)=>{ return (dispatch)=>{
fetch(url,{ if(!lock){
credentials : 'include', lock = true;
method : 'POST', let {userInfo={},taskInfo={},storeInfo={},taskList={}} = info;
mode : 'cors', let bodyData = Object.assign({},{
headers: myHeaders, storeId : storeInfo.id || 0,
body:JSON.stringify(bodyData) taskId : taskInfo.taskId || 0,
}).then(response=>response.json()) userId : userInfo.employeeId || 0,
.then((json)=>{ id : taskList.workListId || 0,
dispatch(saveProductInfo({})); taskType : taskInfo.currentTaskType || "",
dispatch(getTaskList(info)); 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)=>{ ...@@ -44,7 +44,7 @@ const getRefreshImg = (errorId,type)=>{
}; };
dispatch(refreshImg(data)) dispatch(refreshImg(data))
} }
}).catch(e=>{console.error(e)}) }).catch(e=>{})
} }
}; };
...@@ -67,7 +67,7 @@ const deleteImg = (errorId,type,fileId)=>{ ...@@ -67,7 +67,7 @@ const deleteImg = (errorId,type,fileId)=>{
} }
}) })
.catch((err) =>{ .catch((err) =>{
console.error("Err:",err);
}); });
} }
......
...@@ -36,6 +36,7 @@ const finishReplenish = (info,source)=>{ ...@@ -36,6 +36,7 @@ const finishReplenish = (info,source)=>{
id : source === 1 ? taskList.workListId : 0, id : source === 1 ? taskList.workListId : 0,
}); });
let url=`${domain}machine_pad/trigger_ck_task_sku.action` let url=`${domain}machine_pad/trigger_ck_task_sku.action`
UTILPATH.myLogger.info("trigger_ck_task_sku request",bodyData);
return (dispatch)=>{ return (dispatch)=>{
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
...@@ -46,7 +47,9 @@ const finishReplenish = (info,source)=>{ ...@@ -46,7 +47,9 @@ const finishReplenish = (info,source)=>{
}).then(response=>response.json()) }).then(response=>response.json())
.then((json)=>{ .then((json)=>{
dispatch(getTaskList(info)); dispatch(getTaskList(info));
}) }).catch(e=>{
UTILPATH.myLogger.error("trigger_ck_task_sku error ",e);
})
} }
} }
......
...@@ -21,7 +21,7 @@ export function getReportDamageList (postData) { ...@@ -21,7 +21,7 @@ export function getReportDamageList (postData) {
}else{ }else{
dispatch(throwError(json.meta.message)) dispatch(throwError(json.meta.message))
} }
}).catch(e=>{console.error(e)} }).catch(e=>{}
) )
} }
} }
...@@ -48,7 +48,7 @@ export function deleteDamageItem(postaData) { ...@@ -48,7 +48,7 @@ export function deleteDamageItem(postaData) {
dispatch(throwError(json.meta.message)) dispatch(throwError(json.meta.message))
} }
} }
).catch(e=>{console.error(e)} ).catch(e=>{}
) )
/* dispatch(initSuccess(fakeJsonData.data))*/ /* dispatch(initSuccess(fakeJsonData.data))*/
} }
......
...@@ -26,7 +26,7 @@ const uploadErrorOld = (info)=>{ ...@@ -26,7 +26,7 @@ const uploadErrorOld = (info)=>{
}).then((response)=>response.json()) }).then((response)=>response.json())
.then(json=>{ .then(json=>{
}).catch(e=>{console.error(e)}); }).catch(e=>{});
}) })
}; };
/** /**
...@@ -47,6 +47,7 @@ const uploadError = (info,exceptionType,getTask=true)=>{ ...@@ -47,6 +47,7 @@ const uploadError = (info,exceptionType,getTask=true)=>{
taskType : taskInfo.currentTaskType || '', taskType : taskInfo.currentTaskType || '',
area : taskInfo.area || '' area : taskInfo.area || ''
}); });
UTILPATH.myLogger.info("exception_skupass_sku bodyData ",bodyData);
return (dispatch =>{ return (dispatch =>{
fetch(domain + 'machine_pad/exception_skupass_sku.action',{ fetch(domain + 'machine_pad/exception_skupass_sku.action',{
credentials : 'include', credentials : 'include',
...@@ -61,7 +62,9 @@ const uploadError = (info,exceptionType,getTask=true)=>{ ...@@ -61,7 +62,9 @@ const uploadError = (info,exceptionType,getTask=true)=>{
dispatch(getTaskList(info)); dispatch(getTaskList(info));
dispatch(saveProductInfo({})) dispatch(saveProductInfo({}))
} }
}).catch(e=>{console.error(e)}); }).catch(e=>{
UTILPATH.myLogger.error("exception_skupass_sku error ",e);
});
}) })
}; };
...@@ -76,10 +79,10 @@ const timeoutAlarm = (info)=>{ ...@@ -76,10 +79,10 @@ const timeoutAlarm = (info)=>{
let {storeInfo={},taskInfo={},userInfo={}} = info; let {storeInfo={},taskInfo={},userInfo={}} = info;
let bodyData = Object.assign({},{ let bodyData = Object.assign({},{
storeId : storeInfo.id || 0, storeId : storeInfo.id || 0,
taskId : taskInfo.taskId || 0,
userId : userInfo.employeeId || 0, userId : userInfo.employeeId || 0,
area : taskInfo.area || "" area : taskInfo.area || ""
}); });
UTILPATH.myLogger.info("expired_send_error_msg bodyData ",bodyData);
return (dispatch=>{ return (dispatch=>{
fetch(domain + 'machine_pad/expired_send_error_msg.action',{ fetch(domain + 'machine_pad/expired_send_error_msg.action',{
credentials : 'include', credentials : 'include',
...@@ -92,7 +95,9 @@ const timeoutAlarm = (info)=>{ ...@@ -92,7 +95,9 @@ const timeoutAlarm = (info)=>{
.then(json=>{ .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' ...@@ -4,21 +4,6 @@ import {saveHeaderInfo} from './initHeader'
import {addErrorInfo} from './uploadError' import {addErrorInfo} from './uploadError'
const domain = ENV.domain; 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)=>{ const saveUserinfo = (data)=>{
return{ return{
...@@ -29,8 +14,6 @@ const saveUserinfo = (data)=>{ ...@@ -29,8 +14,6 @@ const saveUserinfo = (data)=>{
var myHeaders = new Headers({ var myHeaders = new Headers({
'Access-Control-Allow-Origin': '*', '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', 'Content-Type': 'application/json; charset=UTF-8',
}); });
...@@ -56,7 +39,7 @@ const getUserinfo = (info,headerInfo)=>{ ...@@ -56,7 +39,7 @@ const getUserinfo = (info,headerInfo)=>{
dispatch(addErrorInfo('没有任务需要处理')) dispatch(addErrorInfo('没有任务需要处理'))
} }
} }
}).catch(e=>{console.error(e)}) }).catch(e=>{})
} }
} }
......
...@@ -20,7 +20,6 @@ export default class EditProblemItem extends React.Component{ ...@@ -20,7 +20,6 @@ export default class EditProblemItem extends React.Component{
} }
componentWillMount(){ componentWillMount(){
let props = this.props; let props = this.props;
// console.log(state)
let Problems_format = {}; let Problems_format = {};
let {baseInfo,problemInfo} = props; let {baseInfo,problemInfo} = props;
props.problemInfo.map((item,index)=>{ props.problemInfo.map((item,index)=>{
......
...@@ -16,6 +16,7 @@ export default class RecoveryScanPage extends React.Component{ ...@@ -16,6 +16,7 @@ export default class RecoveryScanPage extends React.Component{
this.changeShowInput = this.changeShowInput.bind(this); this.changeShowInput = this.changeShowInput.bind(this);
this.getPopInfo = this.getPopInfo.bind(this); this.getPopInfo = this.getPopInfo.bind(this);
this.correctQrcode = this.correctQrcode.bind(this); this.correctQrcode = this.correctQrcode.bind(this);
this.hidePop = this.hidePop.bind(this); //关闭弹窗
this.state = { this.state = {
barcodeText : '', barcodeText : '',
barcodeErrorText : '', barcodeErrorText : '',
...@@ -52,6 +53,14 @@ export default class RecoveryScanPage extends React.Component{ ...@@ -52,6 +53,14 @@ export default class RecoveryScanPage extends React.Component{
</div> </div>
} }
hidePop(){
this.setState({
barcodeText:""
},()=>{
this.props.hidePopup();
});
}
handleInputChange(e){ handleInputChange(e){
this.setState({ this.setState({
barcodeText:e.target.value barcodeText:e.target.value
...@@ -89,7 +98,7 @@ export default class RecoveryScanPage extends React.Component{ ...@@ -89,7 +98,7 @@ export default class RecoveryScanPage extends React.Component{
wrongQrcode(){ wrongQrcode(){
//拿错货品 //拿错货品
let {showPopup,hidePopup} = this.props; 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 = let popDom =
<PopModel popupTitle={"遇到问题-货品不对"} classContainer={"recoveryPopInfo"}> <PopModel popupTitle={"遇到问题-货品不对"} classContainer={"recoveryPopInfo"}>
<div className={"icon iconfont icon-wrong font150 colf00"} /> <div className={"icon iconfont icon-wrong font150 colf00"} />
...@@ -154,14 +163,16 @@ export default class RecoveryScanPage extends React.Component{ ...@@ -154,14 +163,16 @@ export default class RecoveryScanPage extends React.Component{
}else{ }else{
//提示条形码不正确 //提示条形码不正确
this.setState({ this.setState({
barcodeErrorText : '条形码输入错误,请重新输入' barcodeErrorText : '条形码输入错误,请重新输入',
barcodeText : ''
}) })
} }
}else{ }else{
//提示输入条形码 //提示输入条形码
this.setState({ this.setState({
barcodeErrorText : '请输入条形码' barcodeErrorText : '请输入条形码',
barcodeText : ''
}) })
} }
......
...@@ -385,7 +385,6 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -385,7 +385,6 @@ export default class ReplenishScanPage extends React.Component{
} }
_onBarCodeRead = (e) => { _onBarCodeRead = (e) => {
// console.log(`e.nativeEvent.data.type = ${e.nativeEvent.data.type}, e.nativeEvent.data.code = ${e.nativeEvent.data.code}`)
this._stopScan(); this._stopScan();
this.setState({ this.setState({
barcodeText : e.nativeEvent.data.code barcodeText : e.nativeEvent.data.code
......
...@@ -42,7 +42,6 @@ import {sendMsg} from '../../util/socket' ...@@ -42,7 +42,6 @@ import {sendMsg} from '../../util/socket'
/*二期引用 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');
...@@ -148,17 +147,20 @@ class PageContainer extends React.Component { ...@@ -148,17 +147,20 @@ class PageContainer extends React.Component {
let {dispatch} = this.props; let {dispatch} = this.props;
// this.beginCountBack(); // this.beginCountBack();
//
// dispatch(saveCommonInfo({ip:"192.168.10.128"})); // dispatch(saveCommonInfo({ip:"192.168.10.128"}));
// dispatch(getStoreInfo(20)); // dispatch(getStoreInfo(34));
// dispatch(saveCommonInfo({userInfo:{employeeId:14}})); // dispatch(saveCommonInfo({userInfo:{employeeId:14}}));
// dispatch(getUserinfo(14,20)) // dispatch(getUserinfo(14,34))
// dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:'A'}}))) // dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:'A'}})))
on(CONFIG.socketType.GETSTOREINFO,this,function (data) { on(CONFIG.socketType.GETSTOREINFO,this,function (data) {
UTILPATH.myLogger.info(CONFIG.socketType.GETSTOREINFO ,data);
dispatch(saveCommonInfo({ip:data.ip})); dispatch(saveCommonInfo({ip:data.ip}));
dispatch(getStoreInfo(data.storeId)); dispatch(getStoreInfo(data.storeId));
}); });
on(CONFIG.socketType.GETSOCKETMSG,this,function (data) { on(CONFIG.socketType.GETSOCKETMSG,this,function (data) {
UTILPATH.myLogger.info(CONFIG.socketType.GETSOCKETMSG ,data);
that.getSocketMsg(data) that.getSocketMsg(data)
}); });
// on(CONFIG.socketType.SOCKETERROR,this,()=>{ // on(CONFIG.socketType.SOCKETERROR,this,()=>{
...@@ -218,6 +220,8 @@ class PageContainer extends React.Component { ...@@ -218,6 +220,8 @@ class PageContainer extends React.Component {
}); });
break; break;
case 'SUCCESS_CLOSEDOOR': case 'SUCCESS_CLOSEDOOR':
UTILPATH.myLogger.info("SUCCESS_CLOSEDOOR isSend ",isSend);
UTILPATH.myLogger.info("SUCCESS_CLOSEDOOR area ",area);
if(isSend){ if(isSend){
let {info={}} = data; let {info={}} = data;
let {left_door=0,right_door=0} = info; let {left_door=0,right_door=0} = info;
...@@ -246,6 +250,8 @@ class PageContainer extends React.Component { ...@@ -246,6 +250,8 @@ class PageContainer extends React.Component {
handleCloseDoor(){ handleCloseDoor(){
let {dispatch,state} = this.props; let {dispatch,state} = this.props;
let {commonInfo={}} = state;
UTILPATH.myLogger.info("handleCloseDoor commonInfo ",commonInfo);
this.setState({ this.setState({
showPage : showPage[initPage], showPage : showPage[initPage],
showClock : false, showClock : false,
...@@ -253,7 +259,7 @@ class PageContainer extends React.Component { ...@@ -253,7 +259,7 @@ class PageContainer extends React.Component {
successCloseDoor : true, successCloseDoor : true,
isSend:false isSend:false
},()=>{ },()=>{
dispatch(closeDoorSuccess(state.commonInfo)); dispatch(closeDoorSuccess(commonInfo));
}); });
} }
...@@ -415,7 +421,6 @@ class PageContainer extends React.Component { ...@@ -415,7 +421,6 @@ class PageContainer extends React.Component {
} }
countBack(){ countBack(){
console.log("countBackTime ",this.countBackTime);
if(!this.countbackTimer && this.countBackTime >= 0){ if(!this.countbackTimer && this.countBackTime >= 0){
this.countBackTime--; this.countBackTime--;
this.countbackTimer = window.setTimeout(()=>{ this.countbackTimer = window.setTimeout(()=>{
......
...@@ -28,6 +28,6 @@ function renderPage(store) { ...@@ -28,6 +28,6 @@ function renderPage(store) {
let store = activateVendor(); let store = activateVendor();
UTILPATH.socket.getIp1(); UTILPATH.socket.getIp1();
// UTILPATH.socket.getTestIp(182); // UTILPATH.socket.getTestIp(203);
renderPage(store); 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 {emit} from './event'
import myLogger from './logger'
let domainIp = '192.168.10.'; let domainIp = '192.168.10.';
...@@ -10,7 +9,7 @@ let totalCount = 0; ...@@ -10,7 +9,7 @@ let totalCount = 0;
let getIpING = false; //正在获取IP let getIpING = false; //正在获取IP
let currentIpIndex = 255; let currentIpIndex = 255;
let ws = null; let ws = null;
let storeId = 0 let storeId = 0;
socket.getIp1 = ()=>{ socket.getIp1 = ()=>{
if(!getIpING) { if(!getIpING) {
...@@ -80,12 +79,10 @@ socket.getTestIp = (ip) => { ...@@ -80,12 +79,10 @@ socket.getTestIp = (ip) => {
const getError = ()=>{ const getError = ()=>{
console.error("socket error");
getClose(); getClose();
} }
const getClose = ()=>{ const getClose = ()=>{
console.error("socket close ",currentIpIndex);
//如果有currentIp就没有必要再次循环 //如果有currentIp就没有必要再次循环
ws = null; ws = null;
if(!getIpING){ if(!getIpING){
...@@ -111,16 +108,16 @@ const init = (ip,storeid,from = false)=>{ ...@@ -111,16 +108,16 @@ const init = (ip,storeid,from = false)=>{
currentIpIndex = ip; currentIpIndex = ip;
storeId = storeid; storeId = storeid;
getIpING = false; getIpING = false;
myLogger.saveDomain(domainIp+ip);
emit(CONFIG.socketType.GETSTOREINFO,{ip:domainIp+ip,storeId:storeid}) emit(CONFIG.socketType.GETSTOREINFO,{ip:domainIp+ip,storeId:storeid})
}; };
ws.onmessage = function (evt) ws.onmessage = function (evt)
{ {
console.log(evt.data);
if(evt.data === "ping"){ if(evt.data === "ping"){
let o = { let o = {
type : 'PONG' type : 'PONG'
} };
ws.send(JSON.stringify(o)); ws.send(JSON.stringify(o));
}else{ }else{
var received_msg = JSON.parse(evt.data); //String var received_msg = JSON.parse(evt.data); //String
...@@ -132,11 +129,12 @@ const init = (ip,storeid,from = false)=>{ ...@@ -132,11 +129,12 @@ const init = (ip,storeid,from = false)=>{
ws.onclose = function(err) ws.onclose = function(err)
{ {
// 关闭 websocket // 关闭 websocket
myLogger.error("socket close & getIpING",err,getIpING);
emit(CONFIG.socketType.SOCKETERROR,""); emit(CONFIG.socketType.SOCKETERROR,"");
getClose(); getClose();
}; };
ws.onerror = function (err) { ws.onerror = function (err) {
console.error("error : ",err); myLogger.error("socket error & getIpING",err,getIpING);
emit(CONFIG.socketType.SOCKETERROR,""); emit(CONFIG.socketType.SOCKETERROR,"");
getError(); getError();
} }
...@@ -151,7 +149,6 @@ socket.sendMsg = (msg) => { ...@@ -151,7 +149,6 @@ socket.sendMsg = (msg) => {
try{ try{
ws.send(msg); ws.send(msg);
}catch (e) { }catch (e) {
console.error("sendMsg error :",e)
} }
} }
...@@ -163,7 +160,6 @@ const closeSocket = ()=>{ ...@@ -163,7 +160,6 @@ const closeSocket = ()=>{
ws.close(); ws.close();
ws = null; ws = null;
}catch (e) { }catch (e) {
console.error("closeSocket error :",e)
} }
} }
} }
......
import image from './image'; import image from './image';
import socket from './socket'; import socket from './socket';
import myLogger from './logger';
const getRemByPx = (num)=>{ const getRemByPx = (num)=>{
return (num / BASEREM ).toFixed(6) + 'rem'; return (num / BASEREM ).toFixed(6) + 'rem';
}; };
module.exports = {...image,socket,getRemByPx}; module.exports = {...image,socket,getRemByPx,myLogger};
\ No newline at end of file \ 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