Commit 89ede70f by huangqy

单据上报

parent 8fb5c5a5
......@@ -31,7 +31,8 @@ export class ViewdrdcDao extends BaseTable<Viewdrdc> {
pmdmcode: cursor.getString(cursor.getColumnIndex('pmdmcode')),
pzsl: cursor.getLong(cursor.getColumnIndex('pzsl')),
crksl: cursor.getLong(cursor.getColumnIndex('crksl')),
wzdm: cursor.getString(cursor.getColumnIndex('wzdm'))
wzdm: cursor.getString(cursor.getColumnIndex('wzdm')),
wczt: cursor.getString(cursor.getColumnIndex('wczt')),
};
return info;
}
......@@ -45,7 +46,7 @@ export class ViewdrdcDao extends BaseTable<Viewdrdc> {
}
getTableColumns(): string[] {
return ['guid', 'jhguid', 'gznd', 'sfdw', 'ydh', 'fwgldwdm', 'swgldwdm', 'fwgldwguid', 'swgldwguid', 'zmlx', 'dec', 'pzh', 'pzlx', 'ckdwguid', 'kfdm', 'jhmxguid', 'hwh', 'pmdmcode', 'pzsl', 'crksl', 'wzdm'];
return ['guid', 'jhguid', 'gznd', 'sfdw', 'ydh', 'fwgldwdm', 'swgldwdm', 'fwgldwguid', 'swgldwguid', 'zmlx', 'dec', 'pzh', 'pzlx', 'ckdwguid', 'kfdm', 'jhmxguid', 'hwh', 'pmdmcode', 'pzsl', 'crksl', 'wzdm','wczt'];
}
getCreateTableSql(): string {
......
......@@ -394,6 +394,7 @@ export class NativeSql {
crk.pzlx pzlx,
crk.ckdwguid ckdwguid,
crk.kfdm kfdm,
crk.wczt wczt,
mx.pzmxguid jhmxguid,
mx.hwh hwh,
mx.PMDMCODE pmdmcode,
......
......@@ -22,5 +22,6 @@ export interface Viewdrdc {
pmdmcode: string,
pzsl: number,
crksl: number,
wzdm: string
wzdm: string,
wczt: string
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ import type { AxiosInstance } from '@ohos/axios'
import type { AxiosRequestConfig } from '@ohos/axios'
import CommonConstant from '../constants/CommonConstants'
import promptAction from '@ohos.promptAction'
import { Logger } from './Logger'
class Request {
instance: AxiosInstance
......@@ -27,6 +28,7 @@ class Request {
return res.data.data
},
(err) => {
Logger.info('err...........+' + err)
promptAction.showToast({
message: $r('app.string.http_response_error')
})
......
......@@ -11,6 +11,11 @@ class ViewdrdcModel {
return res;
}
async queryAll(): Promise<Viewdrdc[]> {
let res = await SQLiteContext.with(ViewdrdcDao).queryAll()
return res;
}
}
const drModel = new ViewdrdcModel()
......
......@@ -15,15 +15,15 @@ class WzcrkModel {
// 获取子单数量总和赋给主单
// @ts-ignore
const pzsl = data[index].jhmx.map(v =>Number(v.pmsl)).reduce((a,b) => a+b, 0)
const pzsl = data[index].jhmx.map(v => Number(v.pmsl)).reduce((a, b) => a + b, 0)
// @ts-ignore
const crksl = data[index].jhmx.map(v =>Number(v.crksl)).reduce((a,b) => a+b, 0)
const crksl = data[index].jhmx.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0)
wzcrk.guid = uid
wzcrk.pzsl = pzsl
wzcrk.crksl = crksl
// @ts-ignore
const wzcrkmx = data[index].jhmx.map((v =>{
const wzcrkmx = data[index].jhmx.map((v => {
return {
...v,
guid: uuid(),
......@@ -36,6 +36,7 @@ class WzcrkModel {
}
}));
Logger.info(this, '输出插入数据:'+ index + '_' + wzcrk.kfdm);
await SQLiteContext.with(WzcrkDao).insert(wzcrk)
await wzcrkmxModel.set(wzcrkmx)
}
......@@ -43,7 +44,7 @@ class WzcrkModel {
}
// 查询
async query(data:Partial<Wzcrk>): Promise<Wzcrk[]> {
async query(data: Partial<Wzcrk>): Promise<Wzcrk[]> {
let res = await SQLiteContext.with(WzcrkDao).getWzcrk(data)
return res;
}
......@@ -55,18 +56,18 @@ class WzcrkModel {
/*获取物资出入库*/
async queryWzcrklist(sql?: string):Promise<Wzcrk[]> {
async queryWzcrklist(sql?: string): Promise<Wzcrk[]> {
let res = await SQLiteContext.with(WzcrkDao).selectWzcrkList(sql);
return res;
}
async updateWzcrkWczt(guid: string, wczt: string):Promise<number> {
async updateWzcrkWczt(guid: string, wczt: string): Promise<number> {
let res = await SQLiteContext.with(WzcrkDao).updateWczt(guid, wczt)
return res;
}
// 更新单据信息
async updateWcztByData(guid: string, data: Partial<Wzcrk>):Promise<number> {
async updateWcztByData(guid: string, data: Partial<Wzcrk>): Promise<number> {
let res = await SQLiteContext.with(WzcrkDao).updateWcztByData(guid, data)
return res;
}
......@@ -76,6 +77,7 @@ class WzcrkModel {
await SQLiteContext.with(WzcrkDao).clearTable()
}
}
const wzcrkModel = new WzcrkModel()
export default wzcrkModel
\ No newline at end of file
......@@ -9,6 +9,8 @@ import { SetStatusDialog } from '../../../view/SetStatusDialog/SetStatusDialog';
import { ExportOrderDialog } from '../../../view/ExportOrderDialog/ExportOrderDialog';
import ViewdrdcModel from '../../../model/ViewdrdcModel';
import { ViewdrdcDao } from '@ohos/common/src/main/ets/db/dao/ViewdrdcDao';
import defHttp from '@ohos/common/src/main/ets/utils/HttpUtil';
import { importData } from './wzIn.api';
@Extend(Button) function bottomBtnSty() {
.borderWidth(1)
......@@ -161,13 +163,58 @@ export struct WzInPage {
}
onExportSubmit() {
this.checkedList.forEach(element => {
// let data = new ViewdrdcDao()
// ViewdrdcModel.queryExport()
this.checkedList.forEach(async element => {
let res = await ViewdrdcModel.queryExport({guid: element, wczt: '已完成', pzlx: '14'})
const jhguidArr = res.map((item) => item.guid)
Logger.info('导出数据0:', JSON.stringify(jhguidArr))
if (jhguidArr && jhguidArr.length > 0) {
const newArr = [...new Set(jhguidArr)]
Logger.info('导出数据1:', JSON.stringify(newArr))
const exportData = newArr.map((item) => {
let newObj = {}
let ItemData = []
res.forEach((Item) => {
if (item == Item.guid) {
ItemData.push({
jhmxguid: Item.jhmxguid,
hwh: Item.hwh,
pmdmcode: Item.pmdmcode,
wzdm: Item.wzdm,
pzsl: Item.pzsl || 0,
sjsl: Item.crksl || 0
})
}
})
Logger.info('导出数据2:', JSON.stringify(ItemData))
const [filterData] = res.filter((fItem) => fItem
.guid == item)
Logger.info('>>>>>>>kkkll:' + JSON.stringify(filterData))
if (filterData) {
newObj = {
cbdwdm: filterData.ckdwguid,
ckkfdm: filterData.kfdm,
...filterData,
scjid: "863576927543400,863576927543400",
cjmc: "普华",
imei: "863576927543400,863576927543400",
model: "ax6737_65_n",
vendor: "alps",
dcsj: "2024年01月20日",
pzmx: ItemData
}
}
return newObj
})
Logger.info('导出数据3:', JSON.stringify(exportData))
const kkkk = {
pzzbJson: exportData,
crklx: '11111CRKLX2',
gznd: '2023',
jsdwguid: 1,
}
await importData(kkkk)
}
})
Logger.info('--------覆盖合并-------:' + JSON.stringify(this.dataSource), JSON.stringify(this.checkedList))
promptAction.showToast({
message: '导出'
})
......
import defHttp from "@ohos/common/src/main/ets/utils/HttpUtil"
enum Api {
importData = '/api/integrate/knzy/importData'
}
// 导出出入库单据
export const importData = (data) => defHttp.post({url: Api.importData, data})
\ No newline at end of file
......@@ -159,6 +159,9 @@ export struct Pmhx {
// 在这里执行对每个元素的操作
return {
...row,
pzzbguid: row.jhguid,
ckdwguid: row.cbdwdm,
kfdm: row.ckkfdm,
sjlx: "导入",
wczt: "未完成",
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论