|
@@ -125,6 +125,106 @@ export class UserData {
|
|
|
return this.storage.clear();
|
|
|
}
|
|
|
|
|
|
+ // 开单号扫描
|
|
|
+ async ssfCodeScan(data: object): Promise<any> {
|
|
|
+ const token = await this.getToken();
|
|
|
+ const loading = await this.loadingCtrl.create();
|
|
|
+ await loading.present();
|
|
|
+ this.nativeHttp.setDataSerializer('json');
|
|
|
+ const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
+ from(this.nativeHttp.post(`http://dev.sgsino.cn/production/sample/factory/`,
|
|
|
+ data,
|
|
|
+ headers)).pipe(
|
|
|
+ finalize(() => { })
|
|
|
+ ).subscribe(data => {
|
|
|
+ this.storage.set('ssfId', JSON.parse(data.data).data.ssfId)
|
|
|
+ }, async err => {
|
|
|
+ console.log(err)
|
|
|
+ let toast = await this.toastCtrl.create({
|
|
|
+ message: '获取数据失败',
|
|
|
+ duration: 1000,
|
|
|
+ position: 'top'
|
|
|
+ });
|
|
|
+ await toast.present();
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 货号扫描
|
|
|
+ async pCodeScan(data: object): Promise<any> {
|
|
|
+ const token = await this.getToken();
|
|
|
+ const loading = await this.loadingCtrl.create();
|
|
|
+ await loading.present();
|
|
|
+ this.nativeHttp.setDataSerializer('json');
|
|
|
+ const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ from(this.nativeHttp.post('http://dev.sgsino.cn/production/sample/factory/pCode',
|
|
|
+ data,
|
|
|
+ headers)).pipe(
|
|
|
+ finalize(() => { })
|
|
|
+ ).subscribe(async data => {
|
|
|
+ if (JSON.parse(data.data).code == 1) {
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
+ message: JSON.parse(data.data).msg,
|
|
|
+ duration: 1000,
|
|
|
+ position: 'top'
|
|
|
+ });
|
|
|
+ await toast.present();
|
|
|
+ resolve([]);
|
|
|
+ } else if (JSON.parse(data.data).code == 0) {
|
|
|
+ resolve(JSON.parse(data.data).data)
|
|
|
+ }
|
|
|
+ }, async err => {
|
|
|
+ console.log(err)
|
|
|
+ let toast = await this.toastCtrl.create({
|
|
|
+ message: '获取数据失败',
|
|
|
+ duration: 1000,
|
|
|
+ position: 'top'
|
|
|
+ });
|
|
|
+ await toast.present();
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增样品工厂详细
|
|
|
+ async saveFactoryDetails(data: object): Promise<any> {
|
|
|
+ const token = await this.getToken();
|
|
|
+ const loading = await this.loadingCtrl.create();
|
|
|
+ await loading.present();
|
|
|
+ this.nativeHttp.setDataSerializer('json');
|
|
|
+ const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ from(this.nativeHttp.post('http://dev.sgsino.cn/production/sample/factory/details/',
|
|
|
+ data,
|
|
|
+ headers)).pipe(
|
|
|
+ finalize(() => { })
|
|
|
+ ).subscribe(async data => {
|
|
|
+ let message = ''
|
|
|
+ if (JSON.parse(data.data).code == 1) {
|
|
|
+ message = JSON.parse(data.data).msg
|
|
|
+ resolve([]);
|
|
|
+ } else if (JSON.parse(data.data).code == 0) {
|
|
|
+ message = '保存成功'
|
|
|
+ resolve(JSON.parse(data.data).data)
|
|
|
+ }
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
+ message: message,
|
|
|
+ duration: 1000,
|
|
|
+ position: 'top'
|
|
|
+ });
|
|
|
+ await toast.present();
|
|
|
+ }, async err => {
|
|
|
+ console.log(err)
|
|
|
+ let toast = await this.toastCtrl.create({
|
|
|
+ message: '保存失败',
|
|
|
+ duration: 1000,
|
|
|
+ position: 'top'
|
|
|
+ });
|
|
|
+ await toast.present();
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
// 获取样品单列表
|
|
|
async getSampleTableData(form: object): Promise<any> {
|
|
|
const token = await this.getToken();
|
|
@@ -253,7 +353,7 @@ export class UserData {
|
|
|
resolve(data.data);
|
|
|
}
|
|
|
const toast = await this.toastCtrl.create({
|
|
|
- message,
|
|
|
+ message: message,
|
|
|
duration: 1000,
|
|
|
position: 'top'
|
|
|
});
|
|
@@ -753,30 +853,30 @@ export class UserData {
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/warehouse/mobile/pending?${current}&${size}`, {},
|
|
|
- headers)).pipe(
|
|
|
+ headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
- ).subscribe(async data => {
|
|
|
- console.log(data)
|
|
|
- if (data.data === null || JSON.parse(data.data).data.records == null) {
|
|
|
+ ).subscribe(async data => {
|
|
|
+ console.log(data)
|
|
|
+ if (data.data === null || JSON.parse(data.data).data.records == null) {
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
+ message: '无数据',
|
|
|
+ duration: 1000,
|
|
|
+ position: 'top'
|
|
|
+ });
|
|
|
+ await toast.present();
|
|
|
+ resolve([]);
|
|
|
+ } else {
|
|
|
+ resolve(JSON.parse(data.data).data.records);
|
|
|
+ }
|
|
|
+ }, async err => {
|
|
|
+ console.log(err);
|
|
|
const toast = await this.toastCtrl.create({
|
|
|
- message: '无数据',
|
|
|
+ message: '查询失败',
|
|
|
duration: 1000,
|
|
|
position: 'top'
|
|
|
});
|
|
|
await toast.present();
|
|
|
- resolve([]);
|
|
|
- } else {
|
|
|
- resolve(JSON.parse(data.data).data.records);
|
|
|
- }
|
|
|
- }, async err => {
|
|
|
- console.log(err);
|
|
|
- const toast = await this.toastCtrl.create({
|
|
|
- message: '查询失败',
|
|
|
- duration: 1000,
|
|
|
- position: 'top'
|
|
|
});
|
|
|
- await toast.present();
|
|
|
- });
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -789,39 +889,39 @@ export class UserData {
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
from(this.nativeHttp.put(`http://dev.sgsino.cn/inventory/warehouse/mobile/prepare?sscId=${sscId}&pId=${pId}`, {},
|
|
|
- headers)).pipe(
|
|
|
+ headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
- ).subscribe(async data => {
|
|
|
- let message = '';
|
|
|
- if (JSON.parse(data.data).code === 0) {
|
|
|
- message = `备货完成`;
|
|
|
- } else if (JSON.parse(data.data).code === 1) {
|
|
|
- message = JSON.parse(data.data).msg;
|
|
|
- }
|
|
|
- const alert = await this.alertController.create({
|
|
|
- // header: 'Confirm!',
|
|
|
- message:message,
|
|
|
- buttons: [
|
|
|
- {
|
|
|
- text: '确定',
|
|
|
- role: 'cancel',
|
|
|
- cssClass: 'secondary',
|
|
|
- handler: (blah) => {
|
|
|
+ ).subscribe(async data => {
|
|
|
+ let message = '';
|
|
|
+ if (JSON.parse(data.data).code === 0) {
|
|
|
+ message = `备货完成`;
|
|
|
+ } else if (JSON.parse(data.data).code === 1) {
|
|
|
+ message = JSON.parse(data.data).msg;
|
|
|
+ }
|
|
|
+ const alert = await this.alertController.create({
|
|
|
+ // header: 'Confirm!',
|
|
|
+ message: message,
|
|
|
+ buttons: [
|
|
|
+ {
|
|
|
+ text: '确定',
|
|
|
+ role: 'cancel',
|
|
|
+ cssClass: 'secondary',
|
|
|
+ handler: (blah) => {
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- ]
|
|
|
- });
|
|
|
- await alert.present();
|
|
|
- resolve(data.data);
|
|
|
- }, async err => {
|
|
|
- console.log(err);
|
|
|
- const toast = await this.toastCtrl.create({
|
|
|
- message: '保存失败',
|
|
|
- duration: 1000,
|
|
|
- position: 'top'
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ await alert.present();
|
|
|
+ resolve(data.data);
|
|
|
+ }, async err => {
|
|
|
+ console.log(err);
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
+ message: '保存失败',
|
|
|
+ duration: 1000,
|
|
|
+ position: 'top'
|
|
|
+ });
|
|
|
+ await toast.present();
|
|
|
});
|
|
|
- await toast.present();
|
|
|
- });
|
|
|
});
|
|
|
}
|
|
|
|