diff --git a/api/httpRequest3.js b/api/httpRequest3.js new file mode 100644 index 00000000..51075ab7 --- /dev/null +++ b/api/httpRequest3.js @@ -0,0 +1,56 @@ + +import storage from '@/common/utils/storage' +function service(options = {}) { + var token = storage.getStorage(storage.constant.token) + var tenantId = 1 + if(getApp()!=undefined){ + tenantId = getApp().globalData.tenantId + } + var requestUrl = "" + if(getApp()!=undefined){ + requestUrl = getApp().globalData.request_url + } + options.header = { + "content-type": "application/json", + "Authorization": "Bearer "+token, + "dataType":"json", + "tenant-id":tenantId + }; + options.timeout = 10000 + + options.url = requestUrl+options.url + + return new Promise((resolve, reject) => { + options.success = (res) => { + if (res ) { + if(res.statusCode == 200){ + if(res.data.code==0){ + resolve(res.data); + }else { + reject( res.data.msg) + } + + }else { + reject( res.data.msg) + } + + } else { + reject(res.data.msg) + } + }; + options.fail = (error) => { + var message = error.errMsg + if (message === 'Network Error') { + message = '后端接口连接异常' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } else if (message.includes('Request failed with status code')) { + message = '系统接口' + message.substr(message.length - 3) + '异常' + } + reject(message); + }; + uni.request(options); + }); + } + + export default service; diff --git a/api/request2.js b/api/request2.js index ce8dfdd4..9d9e7066 100644 --- a/api/request2.js +++ b/api/request2.js @@ -1,4 +1,4 @@ -import request from '@/api/httpRequest2.js' +import request from '@/api/httpRequest3.js' // const baseApi = "/api/admin-api" //公司地址 // 本地地址 @@ -608,31 +608,32 @@ export function getPurchaseReturnRequestDetail(id) { }); } - /** - * 采购退货 记录提交 + * 采购退货 申请提交 * @param {*} params */ -export function purchaseReturnRecordSubmit(params) { +export function purchaseReturnRequestSubmit(params) { return request({ - url: baseApi + "/magic-api/pda/job/purchasereturn/createRecord", - method: "put", + url: baseApi + "/wms/purchasereturn-request-main/create", + method: "post", data: params, }); } /** - * 采购退货 申请提交 + * 采购退货 记录提交 * @param {*} params */ -export function purchaseReturnRequestSubmit(params) { +export function purchaseReturnRecordSubmit(params) { return request({ - url: baseApi + "/wms/purchasereturn-request-main/submit", - method: "put", + url: baseApi + "/wms/purchasereturn-record-main/create", + method: "post", data: params, }); } + + /** * 到货检验 任务 * @@ -732,18 +733,6 @@ export function getPutawayJobDetail(id) { }); } -/** - * 原料上架 提交 - * @param {*} params - */ -export function putawayJobSubmit(params) { - return request({ - url: baseApi + "/wms/putaway-job-main/execute", - method: "put", - data: params, - }); -} - /** * 原料上架 承接任务 * @param {*} id @@ -770,6 +759,71 @@ export function cancleTakePutawayJob(id) { }); } +/** + * 原料上架 任务提交 + * @param {*} params + */ +export function putawayJobSubmit(params) { + return request({ + url: baseApi + "/wms/putaway-job-main/execute", + method: "put", + data: params, + }); +} + +/** + * 原料上架申请 获取任务列表 + * 任务状态 + * 开始日期 + * 结束日期 + * 获取日期任务列表 + * @param {*} + */ +export function getPutawayRequestList(params) { + return request({ + url: baseApi + "/wms/putaway-request-main/senior", + method: "post", + data: params, + }); +} + +/** + * 原料上架申请 获取任务明细 + * @param {*} id 任务id + * + */ +export function getPutawayRequestDetail(id) { + return request({ + url: baseApi + "/wms/putaway-request-main/getPutawayRequestById?id=" + id, + method: "get", + data: {}, + }); +} + +/** + * 原料上架申请 提交 + * @param {*} params + */ +export function putawayRequestSubmit(params) { + return request({ + url: baseApi + "/wms/putaway-request-main/create", + method: "post", + data: params, + }); +} + +/** + * 原料上架记录 提交 + * @param {*} params + */ +export function putawayRecordSubmit(params) { + return request({ + url: baseApi + "/wms/putaway-record-main/create", + method: "post", + data: params, + }); +} + /** * 发料任务 列表 * status 任务状态 @@ -1978,60 +2032,6 @@ export function issueRecordSubmit(params) { - -/** - * 原料上架申请 获取任务列表 - * 任务状态 - * 开始日期 - * 结束日期 - * 获取日期任务列表 - * @param {*} - */ -export function getPutawayRequestList(params) { - return request({ - url: baseApi + "/wms/putaway-request-main/senior", - method: "post", - data: params, - }); -} - -/** - * 原料上架申请 获取任务明细 - * @param {*} id 任务id - * - */ -export function getPutawayRequestDetail(id) { - return request({ - url: baseApi + "/wms/putaway-request-main/getPutawayRequestById?id=" + id, - method: "get", - data: {}, - }); -} - -/** - * 原料上架申请 提交 - * @param {*} params - */ -export function putawayRequestSubmit(params) { - return request({ - url: baseApi + "/putaway-request-main/create", - method: "post", - data: params, - }); -} - -/** - * 原料上架记录 提交 - * @param {*} params - */ -export function putawayRecordSubmit(params) { - return request({ - url: baseApi + "/wms/purchasereturn-request-main/submit", - method: "put", - data: params, - }); -} - /** * 生产退料 任务获取任务列表 * 任务状态