1313 lines
43 KiB
JavaScript
1313 lines
43 KiB
JavaScript
|
|
// logs.js
|
|||
|
|
const app = getApp()
|
|||
|
|
import {
|
|||
|
|
CheckOut,
|
|||
|
|
GetdingdanbyIDs,
|
|||
|
|
AddAdd,
|
|||
|
|
EditEdit,
|
|||
|
|
QrderInformation
|
|||
|
|
} from '../../lib/RequestingCenter.js'
|
|||
|
|
|
|||
|
|
var scodes = 0
|
|||
|
|
let SCREEN_WIDTH = 750
|
|||
|
|
let RATE = wx.getSystemInfoSync().screenHeight / wx.getSystemInfoSync().screenWidth
|
|||
|
|
var garrUi = []; // 全局变量,进出页面时使用。
|
|||
|
|
var gDicListRecs = {};
|
|||
|
|
var sqlids = 0;
|
|||
|
|
Page({
|
|||
|
|
data: {
|
|||
|
|
//timerID
|
|||
|
|
autoCallApiID: 0,
|
|||
|
|
//扫码记录
|
|||
|
|
arrScannedCodes: [],
|
|||
|
|
isCopyingTextDomID: "",
|
|||
|
|
//UI页面渲染使用的数据列表。渲染时copy到OutBoxCodeList上让页面去渲染。
|
|||
|
|
arrUIItems: [],
|
|||
|
|
ScreenTotalW: SCREEN_WIDTH,
|
|||
|
|
ScreenTotalH: SCREEN_WIDTH * RATE,
|
|||
|
|
listers: [],
|
|||
|
|
chemaList: [],
|
|||
|
|
//结单是否可以使用
|
|||
|
|
isok: true,
|
|||
|
|
//彩箱信息是否显示
|
|||
|
|
show: 0,
|
|||
|
|
//结单后所以有按钮是否显示
|
|||
|
|
shows: false,
|
|||
|
|
//人工录入弹框是否显示
|
|||
|
|
showrgluru: false,
|
|||
|
|
//人工录入的外箱码
|
|||
|
|
rglurOutBoxCode: "",
|
|||
|
|
wxma: "",
|
|||
|
|
dingdanbianh: "",
|
|||
|
|
ColorBox_BarCodeList: [],
|
|||
|
|
selectedoutboxlist: [],
|
|||
|
|
ProjectList: [],
|
|||
|
|
OutBoxCodeList: [],
|
|||
|
|
//绑定数量
|
|||
|
|
gdu: "",
|
|||
|
|
ShippingCode: "",
|
|||
|
|
scrollTop: 0
|
|||
|
|
},
|
|||
|
|
onLoad: function (option) {
|
|||
|
|
wx.hideLoading();
|
|||
|
|
wx.showLoading({
|
|||
|
|
title: '请稍后....',
|
|||
|
|
});
|
|||
|
|
var that = this;
|
|||
|
|
console.log(garrUi)
|
|||
|
|
sqlids = option.sqlid
|
|||
|
|
if (sqlids == 1) {
|
|||
|
|
that.setData({
|
|||
|
|
DBname: "uts_zongqing"
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
that.setData({
|
|||
|
|
DBname: "uts_johao"
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
//2秒开启一次定时器
|
|||
|
|
this.data.autoCallApiID = setInterval(this.autoCallApiFunc, 2000, this);
|
|||
|
|
scodes = option.ShippingCode
|
|||
|
|
|
|||
|
|
that.setData({
|
|||
|
|
ShippingCode: option.ShippingCode,
|
|||
|
|
})
|
|||
|
|
QrderInformation({
|
|||
|
|
ShippingCode: scodes,
|
|||
|
|
sqlid: sqlids
|
|||
|
|
}).then(res => {
|
|||
|
|
if (res) {
|
|||
|
|
if (res.Data.shippingByProject.QTY == res.Data.shippingByProject.bandingnum) {
|
|||
|
|
that.setData({
|
|||
|
|
isok: false,
|
|||
|
|
listers: res.Data.shippingByProject
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
that.setData({
|
|||
|
|
isok: true,
|
|||
|
|
listers: res.Data.shippingByProject
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
GetdingdanbyIDs({
|
|||
|
|
ShippingCode: scodes,
|
|||
|
|
sqlid: sqlids
|
|||
|
|
}).then(res => {
|
|||
|
|
console.log(res)
|
|||
|
|
if (res) {
|
|||
|
|
var tmpObj = null;
|
|||
|
|
var currentOperateRec = null;
|
|||
|
|
//copy UI 历史记录从全局变量
|
|||
|
|
if (typeof (gDicListRecs[option.ShippingCode]) == 'undefined')
|
|||
|
|
gDicListRecs[option.ShippingCode] = [];
|
|||
|
|
garrUi = gDicListRecs[option.ShippingCode];
|
|||
|
|
that.data.arrUIItems = garrUi;
|
|||
|
|
var arrUIItems = this.data.arrUIItems;
|
|||
|
|
//状态是-1的数组
|
|||
|
|
var isstatusnegativeone = []
|
|||
|
|
//状态是0的数组
|
|||
|
|
var isstatuszero = []
|
|||
|
|
//状态是1的数组
|
|||
|
|
var isstatusone = []
|
|||
|
|
for (var i = 0; i < res.length; i++) {
|
|||
|
|
currentOperateRec = res[i];
|
|||
|
|
var findPos = -1;
|
|||
|
|
for (var j = 0; j < arrUIItems.length; j++) {
|
|||
|
|
//找到跟当前ui 记录匹配的数据表里面的记录的下标。
|
|||
|
|
if (arrUIItems[j].id == res[i].OutBoxCode) {
|
|||
|
|
tmpObj = arrUIItems[j];
|
|||
|
|
findPos = i;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (findPos >= 0) //当前ui记录,在数据表里面有。那么以数据表的信息为准,更新ui记录
|
|||
|
|
{
|
|||
|
|
tmpObj.id = currentOperateRec.OutBoxCode;
|
|||
|
|
tmpObj.status = 1; //要判断老的状态,老决定新的怎么更新。因为返回数据肯定是正确的,所以始终直接更新
|
|||
|
|
tmpObj.errmsg = "";
|
|||
|
|
tmpObj.ProjectName = currentOperateRec.ProjectName;
|
|||
|
|
tmpObj.operator = currentOperateRec.Operator;
|
|||
|
|
tmpObj.operatetime = currentOperateRec.ShippingDateTime;
|
|||
|
|
tmpObj.bclist = currentOperateRec.CCodeBCodeList;
|
|||
|
|
tmpObj.ismergedformdatabase = true;
|
|||
|
|
} else // 当前ui记录没有在数据表里面找到
|
|||
|
|
{
|
|||
|
|
tmpObj = {
|
|||
|
|
id: currentOperateRec.OutBoxCode,
|
|||
|
|
status: 1, //要判断老的状态,老决定新的怎么更新。因为返回数据肯定是正确的,所以始终直接更新
|
|||
|
|
errmsg: "",
|
|||
|
|
ProjectName: currentOperateRec.ProjectName,
|
|||
|
|
operator: currentOperateRec.Operator,
|
|||
|
|
operatetime: currentOperateRec.ShippingDateTime,
|
|||
|
|
bclist: currentOperateRec.CCodeBCodeList,
|
|||
|
|
ismergedformdatabase: true
|
|||
|
|
}
|
|||
|
|
arrUIItems.push(tmpObj);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
for (var i = 0; i < arrUIItems.length; i++) {
|
|||
|
|
if (arrUIItems[i].status == 1 && arrUIItems[i].ismergedformdatabase == false) {
|
|||
|
|
arrUIItems.splice(i, 1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
for (var i = 0; i < arrUIItems.length; i++) {
|
|||
|
|
arrUIItems[i].ismergedformdatabase = false;
|
|||
|
|
}
|
|||
|
|
//处理顺序问题开始
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
for (var i = 0; i < arrUIItems.length; i++) {
|
|||
|
|
if (arrUIItems[i].status == -1) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: -1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
ProjectName: arrUIItems[i].ProjectName,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusnegativeone.push(tmpObj);
|
|||
|
|
} else if (arrUIItems[i].status == 0) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 0,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
ProjectName: arrUIItems[i].ProjectName,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatuszero.push(tmpObj)
|
|||
|
|
} else {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
ProjectName: arrUIItems[i].ProjectName,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusone.push(tmpObj)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
arrUIItems = [];
|
|||
|
|
}
|
|||
|
|
if (isstatuszero.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatuszero.length; i++) {
|
|||
|
|
arrUIItems.push(isstatuszero[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (isstatusnegativeone.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatusnegativeone.length; i++) {
|
|||
|
|
arrUIItems.push(isstatusnegativeone[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (isstatusone.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatusone.length; i++) {
|
|||
|
|
arrUIItems.push(isstatusone[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.data.arrUIItems = arrUIItems
|
|||
|
|
//处理顺序问题结束
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems,
|
|||
|
|
// isok: false,
|
|||
|
|
arrScannedCodes: []
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
var tmpArrRef = arrUIItems;
|
|||
|
|
for (var i = 0; i < tmpArrRef.length; i++) {
|
|||
|
|
if (tmpArrRef[i].id === res.OutBoxCode) {
|
|||
|
|
tmpArrRef[i].status = -1;
|
|||
|
|
tmpArrRef[i].errmsg = res.Message;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems,
|
|||
|
|
isok: true,
|
|||
|
|
arrScannedCodes: []
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
wx.hideLoading();
|
|||
|
|
}, err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "网络繁忙" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}).catch(
|
|||
|
|
err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "异常" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
} else {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "返回的数据空的",
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}, err => {
|
|||
|
|
app.toast(2, "网络繁忙")
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "网络繁忙" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}).catch(
|
|||
|
|
err => {
|
|||
|
|
console.log(err)
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "异常" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
},
|
|||
|
|
//页面关闭
|
|||
|
|
onUnload: function () {
|
|||
|
|
//clrea timer
|
|||
|
|
var that = this
|
|||
|
|
garrUi = that.data.arrUIItems;
|
|||
|
|
gDicListRecs[scodes] = garrUi;
|
|||
|
|
clearInterval(this.data.autoCallApiID);
|
|||
|
|
},
|
|||
|
|
//绑定处理
|
|||
|
|
autoCallApiFunc: function (thatRef) {
|
|||
|
|
var that = thatRef;
|
|||
|
|
if (that.data.arrScannedCodes.length < 0)
|
|||
|
|
return;
|
|||
|
|
//发送
|
|||
|
|
that.data.arrScannedCodes.forEach(function (x) {
|
|||
|
|
AddAdd({
|
|||
|
|
ShippingCode: scodes,
|
|||
|
|
outid: x,
|
|||
|
|
sqlid: sqlids
|
|||
|
|
}).then(res => {
|
|||
|
|
if (res.Status) {
|
|||
|
|
var arrUIItems = that.data.arrUIItems;
|
|||
|
|
var tmpObj = null;
|
|||
|
|
//状态是-1的数组
|
|||
|
|
var isstatusnegativeone = []
|
|||
|
|
//状态是0的数组
|
|||
|
|
var isstatuszero = []
|
|||
|
|
//状态是1的数组
|
|||
|
|
var isstatusone = []
|
|||
|
|
for (var i = 0; i < arrUIItems.length; i++) {
|
|||
|
|
if (arrUIItems[i].id === res.OutBoxCode) {
|
|||
|
|
arrUIItems[i].status = 1;
|
|||
|
|
arrUIItems[i].ProjectName = res.ProjectName;
|
|||
|
|
arrUIItems[i].operator = res.Operator;
|
|||
|
|
arrUIItems[i].operatetime = res.ShippingDateTime;
|
|||
|
|
arrUIItems[i].ismergedformdatabase = false;
|
|||
|
|
var bcListRef = res.CCodeBCodeList;
|
|||
|
|
for (var j = 0; j < bcListRef.length; j++) {
|
|||
|
|
arrUIItems[i].bclist.push(bcListRef[j]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//处理顺序问题开始
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
for (var i = 0; i < arrUIItems.length; i++) {
|
|||
|
|
if (arrUIItems[i].status == -1) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: -1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
ProjectName: arrUIItems[i].ProjectName,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusnegativeone.push(tmpObj);
|
|||
|
|
} else if (arrUIItems[i].status == 0) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 0,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
ProjectName: arrUIItems[i].ProjectName,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatuszero.push(tmpObj)
|
|||
|
|
} else {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
ProjectName: arrUIItems[i].ProjectName,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusone.push(tmpObj)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
arrUIItems = [];
|
|||
|
|
}
|
|||
|
|
if (isstatuszero.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatuszero.length; i++) {
|
|||
|
|
arrUIItems.push(isstatuszero[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (isstatusnegativeone.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatusnegativeone.length; i++) {
|
|||
|
|
arrUIItems.push(isstatusnegativeone[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (isstatusone.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatusone.length; i++) {
|
|||
|
|
arrUIItems.push(isstatusone[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.data.arrUIItems = arrUIItems
|
|||
|
|
//处理顺序问题结束
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems,
|
|||
|
|
arrScannedCodes: []
|
|||
|
|
});
|
|||
|
|
QrderInformation({
|
|||
|
|
ShippingCode: scodes,
|
|||
|
|
sqlid: sqlids
|
|||
|
|
}).then(res => {
|
|||
|
|
console.log(res)
|
|||
|
|
if (res) {
|
|||
|
|
if (res.Data.shippingByProject.QTY == res.Data.shippingByProject.bandingnum) {
|
|||
|
|
that.setData({
|
|||
|
|
isok: false,
|
|||
|
|
listers: res.Data.shippingByProject
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
that.setData({
|
|||
|
|
isok: true,
|
|||
|
|
listers: res.Data.shippingByProject
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "返回数据为空值",
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}, err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "网络繁忙" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}).catch(
|
|||
|
|
err => {
|
|||
|
|
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "异常" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
} else {
|
|||
|
|
var tmpArrRef = that.data.arrUIItems;
|
|||
|
|
for (var i = 0; i < tmpArrRef.length; i++) {
|
|||
|
|
if (tmpArrRef[i].id === res.OutBoxCode) {
|
|||
|
|
tmpArrRef[i].status = -1;
|
|||
|
|
tmpArrRef[i].errmsg = res.Message;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems,
|
|||
|
|
arrScannedCodes: []
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}, err => {
|
|||
|
|
app.toast(2, "网络繁忙")
|
|||
|
|
}).catch(
|
|||
|
|
err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "异常" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
});
|
|||
|
|
//清空
|
|||
|
|
this.data.arrScannedCodes = [];
|
|||
|
|
},
|
|||
|
|
//人工录入方法
|
|||
|
|
rgluru: function () {
|
|||
|
|
var that = this
|
|||
|
|
that.setData({
|
|||
|
|
showrgluru: true,
|
|||
|
|
rglurOutBoxCode: ""
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
//关闭人工录入方法
|
|||
|
|
qux: function () {
|
|||
|
|
var that = this
|
|||
|
|
that.setData({
|
|||
|
|
showrgluru: false,
|
|||
|
|
rglurOutBoxCode: ""
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
//人工录入确认按钮
|
|||
|
|
qr: function () {
|
|||
|
|
var that = this
|
|||
|
|
let rglurOutBoxCode = that.data.rglurOutBoxCode;
|
|||
|
|
console.log(that.data.rglurOutBoxCode)
|
|||
|
|
if (rglurOutBoxCode != null && rglurOutBoxCode != "") {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '绑定',
|
|||
|
|
content: '您确认绑定您选择的' + that.data.rglurOutBoxCode,
|
|||
|
|
success(res) {
|
|||
|
|
var outids = that.data.rglurOutBoxCode
|
|||
|
|
console.log(res)
|
|||
|
|
console.log(outids)
|
|||
|
|
if (res.confirm) {
|
|||
|
|
var arrUIItems = that.data.arrUIItems
|
|||
|
|
var tmpObj = null;
|
|||
|
|
//状态是-1的数组
|
|||
|
|
var isstatusnegativeone = []
|
|||
|
|
//状态是0的数组
|
|||
|
|
var isstatuszero = []
|
|||
|
|
//状态是1的数组
|
|||
|
|
var isstatusone = []
|
|||
|
|
that.data.arrScannedCodes.push(outids);
|
|||
|
|
arrUIItems.push({
|
|||
|
|
id: outids,
|
|||
|
|
status: 0,
|
|||
|
|
errmsg: "",
|
|||
|
|
bclist: [],
|
|||
|
|
projectid: 0,
|
|||
|
|
operator: "",
|
|||
|
|
operatetime: "",
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
});
|
|||
|
|
console.log(that.data.arrScannedCodes)
|
|||
|
|
|
|||
|
|
//处理顺序问题开始
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
for (var i = 0; i < arrUIItems.length; i++) {
|
|||
|
|
if (arrUIItems[i].status == -1) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: -1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
projectid: arrUIItems[i].projectid,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusnegativeone.push(tmpObj);
|
|||
|
|
} else if (arrUIItems[i].status == 0) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 0,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
projectid: arrUIItems[i].projectid,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatuszero.push(tmpObj)
|
|||
|
|
} else {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
projectid: arrUIItems[i].projectid,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusone.push(tmpObj)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
arrUIItems = [];
|
|||
|
|
}
|
|||
|
|
if (isstatuszero.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatuszero.length; i++) {
|
|||
|
|
arrUIItems.push(isstatuszero[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (isstatusnegativeone.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatusnegativeone.length; i++) {
|
|||
|
|
arrUIItems.push(isstatusnegativeone[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (isstatusone.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatusone.length; i++) {
|
|||
|
|
arrUIItems.push(isstatusone[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.data.arrUIItems = arrUIItems
|
|||
|
|
//处理顺序问题结束
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems,
|
|||
|
|
rglurOutBoxCode: ""
|
|||
|
|
})
|
|||
|
|
console.log('用户点击确认')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
app.toast(2, "请输入外箱码")
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
//扫码的方法
|
|||
|
|
scanCodeEvent: function () {
|
|||
|
|
var that = this;
|
|||
|
|
console.log(scodes)
|
|||
|
|
wx.scanCode({
|
|||
|
|
onlyFromCamera: true, // 只允许从相机扫码
|
|||
|
|
success(res) {
|
|||
|
|
console.log("扫码成功:" + JSON.stringify(res))
|
|||
|
|
var outid = res.result
|
|||
|
|
var out = that.data.arrUIItems
|
|||
|
|
var isexist = false
|
|||
|
|
for (var i = 0; i < out.length; i++) {
|
|||
|
|
if (out[i].id == outid) {
|
|||
|
|
isexist = true
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (isexist) {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示信息',
|
|||
|
|
content: '您选择的' + outid + '已经扫过了',
|
|||
|
|
success(res) {
|
|||
|
|
var outids = outid
|
|||
|
|
console.log(res)
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确认')
|
|||
|
|
return;
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '绑定',
|
|||
|
|
content: '您确认绑定您选择的' + res.result,
|
|||
|
|
success(res) {
|
|||
|
|
var outids = outid
|
|||
|
|
console.log(res)
|
|||
|
|
if (res.confirm) {
|
|||
|
|
if (typeof (gDicListRecs[scodes]) == 'undefined')
|
|||
|
|
gDicListRecs[scodes] = [];
|
|||
|
|
var arrUIItems = that.data.arrUIItems
|
|||
|
|
var tmpObj = null;
|
|||
|
|
//状态是-1的数组
|
|||
|
|
var isstatusnegativeone = []
|
|||
|
|
//状态是0的数组
|
|||
|
|
var isstatuszero = []
|
|||
|
|
//状态是1的数组
|
|||
|
|
var isstatusone = []
|
|||
|
|
that.data.arrScannedCodes.push(outids);
|
|||
|
|
that.data.arrUIItems.push({
|
|||
|
|
id: outids,
|
|||
|
|
status: 0,
|
|||
|
|
errmsg: "",
|
|||
|
|
bclist: [],
|
|||
|
|
projectid: 0,
|
|||
|
|
operator: "",
|
|||
|
|
operatetime: "",
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
});
|
|||
|
|
console.log(that.data.arrScannedCodes)
|
|||
|
|
//处理顺序问题开始
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
for (var i = 0; i < arrUIItems.length; i++) {
|
|||
|
|
if (arrUIItems[i].status == -1) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: -1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
projectid: arrUIItems[i].projectid,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusnegativeone.push(tmpObj);
|
|||
|
|
} else if (arrUIItems[i].status == 0) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 0,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
projectid: arrUIItems[i].projectid,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatuszero.push(tmpObj)
|
|||
|
|
} else {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
projectid: arrUIItems[i].projectid,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusone.push(tmpObj)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
arrUIItems = [];
|
|||
|
|
}
|
|||
|
|
//没有处理的外箱信息
|
|||
|
|
if (isstatuszero.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatuszero.length; i++) {
|
|||
|
|
arrUIItems.push(isstatuszero[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//处理后错误的外箱信息
|
|||
|
|
if (isstatusnegativeone.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatusnegativeone.length; i++) {
|
|||
|
|
arrUIItems.push(isstatusnegativeone[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//处理的成功的外箱信息
|
|||
|
|
if (isstatusone.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatusone.length; i++) {
|
|||
|
|
arrUIItems.push(isstatusone[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.data.arrUIItems = arrUIItems
|
|||
|
|
//处理顺序问题结束
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems
|
|||
|
|
})
|
|||
|
|
console.log('用户点击确认')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
// 外箱码信息查询
|
|||
|
|
ColorBox_BarCode: function (e) {
|
|||
|
|
var that = this;
|
|||
|
|
var xx = this.data.OutBoxCodeList.find(ee => {
|
|||
|
|
return ee.id == e.currentTarget.id
|
|||
|
|
})
|
|||
|
|
console.log(xx)
|
|||
|
|
if (that.data.show == e.currentTarget.id) {
|
|||
|
|
that.setData({
|
|||
|
|
show: 0,
|
|||
|
|
ColorBox_BarCodeList: xx.bclist
|
|||
|
|
})
|
|||
|
|
console.log(that.data.show)
|
|||
|
|
} else {
|
|||
|
|
that.setData({
|
|||
|
|
show: e.currentTarget.id,
|
|||
|
|
ColorBox_BarCodeList: xx.bclist
|
|||
|
|
})
|
|||
|
|
console.log(that.data.ColorBox_BarCodeList)
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
//更新数据
|
|||
|
|
CheckGxing: function () {
|
|||
|
|
var that = this;
|
|||
|
|
GetdingdanbyIDs({
|
|||
|
|
ShippingCode: scodes,
|
|||
|
|
sqlid: sqlids
|
|||
|
|
}).then(res => {
|
|||
|
|
if (res) {
|
|||
|
|
if (typeof (gDicListRecs[scodes]) == 'undefined')
|
|||
|
|
gDicListRecs[scodes] = [];
|
|||
|
|
garrUi = gDicListRecs[scodes];
|
|||
|
|
var currentOperateRec = null;
|
|||
|
|
var arrUIItems = that.data.arrUIItems;
|
|||
|
|
var tmpObj = null;
|
|||
|
|
//状态是-1的数组
|
|||
|
|
var isstatusnegativeone = []
|
|||
|
|
//状态是0的数组
|
|||
|
|
var isstatuszero = []
|
|||
|
|
//状态是1的数组
|
|||
|
|
var isstatusone = []
|
|||
|
|
for (var i = 0; i < res.length; i++) {
|
|||
|
|
currentOperateRec = res[i];
|
|||
|
|
var findPos = -1;
|
|||
|
|
for (var j = 0; j < arrUIItems.length; j++) {
|
|||
|
|
//找到跟当前ui 记录匹配的数据表里面的记录的下标。
|
|||
|
|
if (arrUIItems[j].id == res[i].OutBoxCode) {
|
|||
|
|
tmpObj = arrUIItems[j];
|
|||
|
|
findPos = i;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (findPos >= 0) //当前ui记录,在数据表里面有。那么以数据表的信息为准,更新ui记录
|
|||
|
|
{
|
|||
|
|
tmpObj.id = currentOperateRec.OutBoxCode;
|
|||
|
|
tmpObj.status = 1; //要判断老的状态,老决定新的怎么更新。因为返回数据肯定是正确的,所以始终直接更新
|
|||
|
|
tmpObj.errmsg = "";
|
|||
|
|
tmpObj.ProjectName = currentOperateRec.ProjectName;
|
|||
|
|
tmpObj.operator = currentOperateRec.Operator;
|
|||
|
|
tmpObj.operatetime = currentOperateRec.ShippingDateTime;
|
|||
|
|
tmpObj.bclist = currentOperateRec.CCodeBCodeList;
|
|||
|
|
tmpObj.ismergedformdatabase = true;
|
|||
|
|
} else // 当前ui记录没有在数据表里面找到
|
|||
|
|
{
|
|||
|
|
tmpObj = {
|
|||
|
|
id: currentOperateRec.OutBoxCode,
|
|||
|
|
status: 1, //要判断老的状态,老决定新的怎么更新。因为返回数据肯定是正确的,所以始终直接更新
|
|||
|
|
errmsg: "",
|
|||
|
|
ProjectName: currentOperateRec.ProjectName,
|
|||
|
|
operator: currentOperateRec.Operator,
|
|||
|
|
operatetime: currentOperateRec.ShippingDateTime,
|
|||
|
|
bclist: currentOperateRec.CCodeBCodeList,
|
|||
|
|
ismergedformdatabase: true
|
|||
|
|
}
|
|||
|
|
that.data.arrUIItems.push(tmpObj);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var tmpLen = arrUIItems.length;
|
|||
|
|
for (var i = tmpLen - 1; i >= 0; i--) {
|
|||
|
|
if (arrUIItems[i].status == 1 && arrUIItems[i].ismergedformdatabase == false) {
|
|||
|
|
that.data.arrUIItems.splice(i, 1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
for (var i = 0; i < arrUIItems.length; i++) {
|
|||
|
|
arrUIItems[i].ismergedformdatabase = false;
|
|||
|
|
}
|
|||
|
|
//处理顺序问题开始
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
for (var i = 0; i < arrUIItems.length; i++) {
|
|||
|
|
if (arrUIItems[i].status == -1) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: -1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
ProjectName: arrUIItems[i].ProjectName,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusnegativeone.push(tmpObj);
|
|||
|
|
} else if (arrUIItems[i].status == 0) {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 0,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
ProjectName: arrUIItems[i].ProjectName,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatuszero.push(tmpObj)
|
|||
|
|
} else {
|
|||
|
|
tmpObj = {
|
|||
|
|
id: arrUIItems[i].id,
|
|||
|
|
status: 1,
|
|||
|
|
errmsg: arrUIItems[i].errmsg,
|
|||
|
|
ProjectName: arrUIItems[i].ProjectName,
|
|||
|
|
operator: arrUIItems[i].operator,
|
|||
|
|
operatetime: arrUIItems[i].operatetime,
|
|||
|
|
bclist: arrUIItems[i].bclist,
|
|||
|
|
ismergedformdatabase: false
|
|||
|
|
}
|
|||
|
|
isstatusone.push(tmpObj)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (arrUIItems.length > 0) {
|
|||
|
|
arrUIItems = [];
|
|||
|
|
}
|
|||
|
|
//没有处理的外箱信息
|
|||
|
|
if (isstatuszero.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatuszero.length; i++) {
|
|||
|
|
arrUIItems.push(isstatuszero[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//处理的成功的外箱信息
|
|||
|
|
if (isstatusone.length > 0) {
|
|||
|
|
for (var i = 0; i < isstatusone.length; i++) {
|
|||
|
|
arrUIItems.push(isstatusone[i])
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.data.arrUIItems = arrUIItems
|
|||
|
|
//处理顺序问题结束
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems,
|
|||
|
|
arrScannedCodes: []
|
|||
|
|
});
|
|||
|
|
garrUi = [];
|
|||
|
|
gDicListRecs = {}
|
|||
|
|
QrderInformation({
|
|||
|
|
ShippingCode: scodes,
|
|||
|
|
sqlid: sqlids
|
|||
|
|
}).then(res => {
|
|||
|
|
console.log(res)
|
|||
|
|
if (res) {
|
|||
|
|
if (res.Data.shippingByProject.QTY == res.Data.shippingByProject.bandingnum) {
|
|||
|
|
that.setData({
|
|||
|
|
isok: false,
|
|||
|
|
shows: false,
|
|||
|
|
listers: res.Data.shippingByProject
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
that.setData({
|
|||
|
|
isok: true,
|
|||
|
|
shows: false,
|
|||
|
|
listers: res.Data.shippingByProject
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
if (res.Data.shippingByProject.Status == 3) {
|
|||
|
|
that.setData({
|
|||
|
|
shows: true,
|
|||
|
|
listers: res.Data.shippingByProject
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}, err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: '网络繁忙' + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}).catch(
|
|||
|
|
err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: '错误信息' + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
console.log(res)
|
|||
|
|
} else {
|
|||
|
|
var tmpArrRef = that.data.arrUIItems;
|
|||
|
|
for (var i = 0; i < tmpArrRef.length; i++) {
|
|||
|
|
if (tmpArrRef[i].id === res.OutBoxCode) {
|
|||
|
|
tmpArrRef[i].status = -1;
|
|||
|
|
tmpArrRef[i].errmsg = res.Message;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems,
|
|||
|
|
arrScannedCodes: []
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}, err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: '网络繁忙' + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}).catch(
|
|||
|
|
err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: '异常' + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
},
|
|||
|
|
//修改
|
|||
|
|
Edit: function (e) {
|
|||
|
|
var that = this
|
|||
|
|
console.log(scodes)
|
|||
|
|
console.log(e)
|
|||
|
|
that.setData({
|
|||
|
|
show: e.currentTarget.id
|
|||
|
|
});
|
|||
|
|
var index = -1;
|
|||
|
|
var list = that.data.arrUIItems
|
|||
|
|
for (var i = 0; i < list.length; i++) {
|
|||
|
|
if (list[i].id == e.currentTarget.id) {
|
|||
|
|
index = i;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var inMsg = "您确认解绑您选择的";
|
|||
|
|
if (list[index].status != 1) {
|
|||
|
|
inMsg = "您确认删除您选择的";
|
|||
|
|
}
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '解绑',
|
|||
|
|
content: inMsg + e.currentTarget.id,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log(e)
|
|||
|
|
if (list[index].status == -1) {
|
|||
|
|
that.data.arrUIItems.splice(index, 1);
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems
|
|||
|
|
})
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (list[index].status == 0) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (list[index].status == 1) {
|
|||
|
|
EditEdit({
|
|||
|
|
ShippingCode: scodes,
|
|||
|
|
OutBoxCodeList: list[index].id,
|
|||
|
|
sqlid: sqlids
|
|||
|
|
}).then(res => {
|
|||
|
|
if (res) {
|
|||
|
|
var tmpArrRef = that.data.arrUIItems;
|
|||
|
|
var index = 0;
|
|||
|
|
for (var i = 0; i < tmpArrRef.length; i++) {
|
|||
|
|
if (tmpArrRef[i].id == res.OutBoxCode) {
|
|||
|
|
index = i;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.data.arrUIItems.splice(index, 1);
|
|||
|
|
that.setData({
|
|||
|
|
OutBoxCodeList: that.data.arrUIItems,
|
|||
|
|
arrScannedCodes: []
|
|||
|
|
});
|
|||
|
|
QrderInformation({
|
|||
|
|
ShippingCode: scodes,
|
|||
|
|
sqlid: sqlids
|
|||
|
|
}).then(res => {
|
|||
|
|
console.log(res)
|
|||
|
|
if (res) {
|
|||
|
|
if (res.Data.shippingByProject.QTY == res.Data.shippingByProject.bandingnum) {
|
|||
|
|
that.setData({
|
|||
|
|
isok: false,
|
|||
|
|
listers: res.Data.shippingByProject
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
that.setData({
|
|||
|
|
isok: true,
|
|||
|
|
listers: res.Data.shippingByProject
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "返回数据为空值",
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}, err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "网络繁忙" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}).catch(
|
|||
|
|
err => {
|
|||
|
|
console.log(err)
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "异常" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
console.log(res)
|
|||
|
|
} else {
|
|||
|
|
that.data.arrScannedCodes = [];
|
|||
|
|
}
|
|||
|
|
}, err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "网络繁忙" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}).catch(
|
|||
|
|
err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "异常" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
that.setData({
|
|||
|
|
show: 0
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
//结单
|
|||
|
|
CheckOut: function () {
|
|||
|
|
var that = this
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '结单',
|
|||
|
|
content: '您确认结单您选择的' + scodes,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
var ischulizhuang = true;
|
|||
|
|
var yiemianglist = that.data.arrUIItems;
|
|||
|
|
for (var i = 0; i < yiemianglist.length; i++) {
|
|||
|
|
if (yiemianglist[i].status != 1) {
|
|||
|
|
ischulizhuang = false;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (ischulizhuang) {
|
|||
|
|
CheckOut({
|
|||
|
|
ShippingCode: scodes, //
|
|||
|
|
sqlid: sqlids
|
|||
|
|
}).then(res => {
|
|||
|
|
if (res.Status == 200) {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: '结单成功',
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
that.setData({
|
|||
|
|
shows:true
|
|||
|
|
})
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
that.setData({
|
|||
|
|
shows:true
|
|||
|
|
})
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "结单失败" + res.Message,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}, err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "结单失败" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}).catch(
|
|||
|
|
err => {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: "异常" + err,
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
} else {
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '提示',
|
|||
|
|
content: '页面数据有错误,请点击更新按钮后结单',
|
|||
|
|
success(res) {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
console.log('用户点击确定')
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
console.log('用户点击取消')
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
onHide: function () {},
|
|||
|
|
//长按复制
|
|||
|
|
copyText: function (e) {
|
|||
|
|
console.log(e)
|
|||
|
|
var that = this
|
|||
|
|
//const text = e.currentTarget.id;
|
|||
|
|
|
|||
|
|
var strID = e.currentTarget.id;
|
|||
|
|
var arrSplit = strID.split("_");
|
|||
|
|
const text = arrSplit[1];
|
|||
|
|
|
|||
|
|
//开始蓝底白字
|
|||
|
|
that.setData({
|
|||
|
|
isCopyingTextDomID: strID
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
wx.setClipboardData({
|
|||
|
|
data: text,
|
|||
|
|
success: function () {
|
|||
|
|
wx.showToast({
|
|||
|
|
title: '复制成功',
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//已经copy成功,但是依然显示蓝底白字状态1秒钟,然后提示用户拷贝成功,取消蓝底白字状态。
|
|||
|
|
setTimeout(function () {
|
|||
|
|
that.setData({
|
|||
|
|
isCopyingTextDomID: ''
|
|||
|
|
});
|
|||
|
|
}, 3000);
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
fail: function () {
|
|||
|
|
wx.showToast({
|
|||
|
|
title: '复制失败',
|
|||
|
|
icon: 'none',
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
})
|