Commit 5b4940dd by 毛勇泽

Merge remote-tracking branch 'origin/master'

parents fa0b57c8 c8b9d353
......@@ -50,3 +50,15 @@ export interface CommonHxPzMxDto {
mxguid: string,
pzmxguid: string
}
export interface PzMxDto {
wzpm: string,
pmdmsix: string,
pmdmcode: string,
hxmc: string,
pzsl: number,
crksl: number,
hwh: string,
mxguid: string,
pzmxguid: string
}
\ No newline at end of file
import relationalStore from '@ohos.data.relationalStore';
import { PzMxDto } from '../../bean/dto/RecommendHwDto.ts';
import { WzcrkDetailDto } from '../../bean/dto/WzcrkMxRefWzDto';
import { Wzcrk } from '../../entity/Wzcrk';
import { Wzcrkmx } from '../../entity/Wzcrkmx';
......@@ -202,4 +203,39 @@ export class WzcrkDao extends BaseTable<Wzcrk> {
}
return items;
}
async getPzMx(params): Promise<PzMxDto[]> {
try {
let val_sql = NativeSql.getPzMxSql(params);
Logger.info(this, '---getPzMx---' + val_sql)
let db = await this.futureDb;
let rs = await db.querySql(val_sql);
let items = []
if (rs.goToFirstRow()) {
do {
items.push(this.toPzMx(rs))
} while (rs.goToNextRow())
}
Logger.info(this, 'queryAll items22=' + JSON.stringify(items))
return items;
} catch (e) {
throw new Error('[查询异常]|' + e)
}
}
toPzMx(cursor: relationalStore.ResultSet): PzMxDto {
let info: PzMxDto = {
wzpm: cursor.getString(cursor.getColumnIndex('wzpm')),
pmdmsix: cursor.getString(cursor.getColumnIndex('pmdmsix')),
pmdmcode: cursor.getString(cursor.getColumnIndex('pmdmcode')),
hxmc: cursor.getString(cursor.getColumnIndex('hxmc')),
pzsl: cursor.getLong(cursor.getColumnIndex('pzsl')),
crksl: cursor.getLong(cursor.getColumnIndex('crksl')),
hwh: cursor.getString(cursor.getColumnIndex('hwh')),
mxguid: cursor.getString(cursor.getColumnIndex('mxguid')),
pzmxguid: cursor.getString(cursor.getColumnIndex('pzmxguid'))
};
return info;
}
}
\ No newline at end of file
......@@ -5,7 +5,7 @@ import { Table } from '../decorator/Decorators';
import { Logger } from '../../utils/Logger';
import { NativeSql } from '../sql/NativeSql';
import { WzcrkDetailDto, WzcrkMxRefWzDto } from '../../bean/dto/WzcrkMxRefWzDto';
import { CommonHxPzMxDto, PzMxItemDto, RecommendHwDto, TestHwWzDto } from '../../bean/dto/RecommendHwDto.ts';
import { CommonHxPzMxDto, PzMxDto, PzMxItemDto, RecommendHwDto, TestHwWzDto } from '../../bean/dto/RecommendHwDto.ts';
/**
......
......@@ -106,6 +106,11 @@ WHERE
`insert into tab_bzgl_knzy_app_hwb (guid, hwh, pmdmcode, hwsl, hjguid, hwzt) values ('${params.guid}', '${params.hwh}', '${params.pmdmcode}', '${params.hwsl}', '${params.hjguid}','11111111SF1')`
return sql
}
// -- -- - 物资列表详情
static getPzMxSql(params): string {
const sql = `select * from (select hx.wzpm wzpm, hx.pmdmsix pmdmsix,hx.pmdmten pmdmcode, hx.hxmc hxmc, mx.pzsl pzsl, mx.crksl crksl, mx.hwh hwh, mx.guid mxguid ,mx.pzmxguid from tab_bzgl_knzy_app_wzcrk crk left join tab_bzgl_knzy_app_wzcrkmx mx on crk.GUID = mx.wzcrkguid left join tab_xtwh_jcsj_bzhx hx on mx.pmdmcode = hx.pmdmten where crk.guid = '${params.guid}' order by hx.PMDMSIX, hx.XH)`
return sql
}
/**
* 包裹管理表
......
......@@ -83,6 +83,13 @@ class WzcrkModel {
return res;
}
// 物资列表详情
async getPzMx(params) {
let res = await SQLiteContext.with(WzcrkDao).getPzMx(params)
Logger.info(this, JSON.stringify(res))
return res
}
// 清空表
async clear() {
......
......@@ -3,7 +3,7 @@ import { Logger } from '@ohos/common';
import gldwModel from '../../../model/GldwModel';
import kfModel from '../../../model/KfModel';
import { DividerTitle } from '../../../view/DividerTitle/DividerTitle';
import { PzFormClass, ScanWzClass, WzClass, WzmxClass } from './Wzcrk.data';
import { historicalInformationClass, PzFormClass, ScanWzClass, WzClass, WzmxClass } from './Wzcrk.data';
import { WzList } from '../WzInPage/WzinDetail/WzList';
import { WzScanInfoDialog } from './Dialog/WzScanInfoDialog';
import { analysisQrCode } from '../../../identify/analysis/analysis_QR_code'
......@@ -11,6 +11,8 @@ import emitter from '@ohos.events.emitter';
import Prompt from '@system.prompt';
import wzcrkmxModel from '../../../model/WzcrkmxModel';
import { dateUtils, uuid } from '@ohos/common/src/main/ets/utils/util';
import { PzMxDto } from '@ohos/common/src/main/ets/bean/dto/RecommendHwDto.ts';
import wzcrkModel from '../../../model/WzcrkModel';
@Extend(Button) function CommonButtonStyle() {
......@@ -35,14 +37,13 @@ export struct WzInfo {
@State isHaveButton: boolean = false // 完成状态, 未完成是true, 其他false
@State isAutomation: boolean = true //控制扫描提示显示隐藏
@State pzxqGuild: string = '' //当前凭证guid
@State historicalInformation: Array<any> = [] //物资数据
@State historicalInformation: historicalInformationClass[] = [] //物资数据
@State currentPmdmcode: string = '' //当前扫描pmdm10位
@State defaultHwh: string = this.convertionDefaultHwh()
@Link pzForm: PzFormClass
@State currentDw: string = ''
@State kfmc: string = ''
@State wzmx: WzmxClass[] = []
@ObjectLink wzcrk: WzClass
getDetail: (wzpm?: string) => void
scanInfoDialog: CustomDialogController = new CustomDialogController({
......@@ -59,11 +60,6 @@ export struct WzInfo {
})
private searchcontroller: SearchController = new SearchController()
// 在自定义组件即将析构销毁时将dialogController置空
aboutToDisappear() {
this.scanInfoDialog = undefined // 将dialogController置空
}
@Builder container() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
......@@ -138,6 +134,12 @@ export struct WzInfo {
this.scanCodeListen();
}
// 在自定义组件即将析构销毁时将dialogController置空
aboutToDisappear() {
this.scanInfoDialog = undefined // 将dialogController置空
Logger.info('Aaaaa>>', JSON.stringify(this.historicalInformation))
}
scanCodeListen() {
var innerEvent = { eventId: 3 }
emitter.on(innerEvent, (eventQRData) => {
......@@ -150,7 +152,6 @@ export struct WzInfo {
}
async getData() {
Logger.info(">>>>>>>>>>>>>>>PAGETYPE:", this.pageType)
// 获取收物单位
const res1 = await gldwModel.queryByData({ dwdm: this.wzcrk.sfdw })
this.currentDw = res1[0].dwfh ?? ''
......@@ -264,6 +265,19 @@ export struct WzInfo {
}
// 扫描物资
if (res.data && res.data.length > 0) {
console.log(">>>>>>>>扫描物资>>>>>>>" + JSON.stringify(res.data))
let isNumber = false
res.data.forEach(element => {
if (/^\d+$/.test(element.srsl)) { // 判断扫描的物资的srsl一定是数字才会通过校验不是就报错
isNumber = true
}
});
if (!isNumber) {
Prompt.showToast({
message: '当前扫描的物资信息不完整',
})
return
}
res.data.forEach(async (ITEM) => {
if (this.dataType) {
// 单据导入
......@@ -275,7 +289,7 @@ export struct WzInfo {
pmdmcode: ITEM.pmdmcode.slice(0, 6)
}
const pzData = await wzcrkmxModel.getPzMxItem(params, true)
console.log('pzData', pzData)
console.log('pzData', JSON.stringify(pzData))
if (pzData.length == 0) {
Prompt.showToast({
// title: this.pageType + '导入的凭证中无扫描品种,不容许添加!',
......@@ -369,6 +383,7 @@ export struct WzInfo {
// 2.换出和换入的品种号型必须一样
}
console.log('---historicalInformation---', JSON.stringify(this.historicalInformation))
const [data] = this.historicalInformation.filter((item, index) => item
.pmdmcode == ITEM.pmdmcode && item.hwh == this.pzForm.hwh)
console.log('---过滤后的data---', JSON.stringify(data))
......@@ -397,7 +412,6 @@ export struct WzInfo {
})
}
})
console.log('this.historicalInformation', this.historicalInformation)
}
}
}
......@@ -418,6 +432,7 @@ export struct WzInfo {
})
}
this.currentPmdmcode = ITEM.pmdmcode
// @ts-ignore
this.historicalInformation = res
this.setDefaultActive()
callback && callback()
......@@ -459,7 +474,7 @@ export struct WzInfo {
testPmdmCodeSql = this.historicalInformation.filter((item) => item.pmdmcode ==
filterInsrtData.pmdmcode && (item.hwh == '' || item.hwh == this.pzForm.hwh))
}
console.log('testPmdmCodeSql', testPmdmCodeSql, this.currentModel)
console.log('testPmdmCodeSql', JSON.stringify(testPmdmCodeSql), this.currentModel)
if (testPmdmCodeSql && testPmdmCodeSql.length > 0) {
var update_crksl = 0
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
......@@ -485,7 +500,7 @@ export struct WzInfo {
}
console.log("updateParams", JSON.stringify(updateParams))
let s = await wzcrkmxModel.updateWzmx(updateParams)
console.log("updateParams执行成功或者失败:" + s)
console.log("updateParams执行成功或者失败:" + JSON.stringify(this.historicalInformation))
} else {
var insert_crksl = 0
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
......@@ -776,7 +791,7 @@ export struct WzInfo {
.pmdmcode == data
.pmdmcode && item.currentModel == newCurrentModel)
console.log('没有货位====================')
console.log(newIsDk)
//console.log(newIsDk)
if (newIsDk) {
// console.log('==========================存在===============1')
// 如果没有货位号,则覆盖这条数据货位并合计
......
......@@ -248,6 +248,51 @@ export class WzmxClass {
}
}
// 物资明细
@Observed
export class historicalInformationClass {
wzpm: string
pmdmsix: string
pmdmcode: string
hxmc: string
pzsl: number
crksl: number
hwh: string
mxguid: string
pzmxguid: string
currentModel?: boolean
constructor(data: {
wzpm: string
pmdmsix: string
pmdmcode: string
hxmc: string
pzsl: number
crksl: number
hwh: string
mxguid: string
pzmxguid: string
currentModel?: boolean
}) {
this.wzpm = data.wzpm
this.pmdmsix = data.pmdmsix
this.pmdmcode = data.pmdmcode
this.hxmc = data.hxmc
this.pzsl = data.pzsl
this.crksl = data.crksl
this.hwh = data.hwh
this.mxguid = data.mxguid
this.pzmxguid = data.pzmxguid
this.currentModel = data.currentModel || false
}
}
// 物资表单详情
@Observed
......
import { WzmxClass } from '../../Common/Wzcrk.data'
import { historicalInformationClass, WzmxClass } from '../../Common/Wzcrk.data'
@Component
export struct WzList {
@ObjectLink wzmx: WzmxClass
@ObjectLink wzmx: historicalInformationClass
build() {
Column() {
......
......@@ -5,7 +5,7 @@ import { Wzcrk } from '@ohos/common/src/main/ets/entity/Wzcrk';
import { WzInfo } from '../../Common/WzInfo'
import { PzInfo } from './PzInfo'
import wzcrkmxModel from '../../../../model/WzcrkmxModel';
import { PzFormClass, WzClass, WzmxClass } from '../../Common/Wzcrk.data';
import { historicalInformationClass, PzFormClass, WzClass, WzmxClass } from '../../Common/Wzcrk.data';
import promptAction from '@ohos.promptAction';
import wzcrkModel from '../../../../model/WzcrkModel';
import { AddWzin } from './AddWzin'
......@@ -37,7 +37,7 @@ struct WzinDetail {
@State currentIndex: number = 0
@State isUpdate: boolean = false
@State wzcrk: WzClass = null // 物资出入库单据信息
@State wzmx: WzmxClass[] = [] // 物资出入库明细
@State historicalInformation: historicalInformationClass[] = [] // 物资出入库明细
@State pzForm: PzFormClass = null // 物资出入库表单详情
private controller: TabsController = new TabsController()
......@@ -62,13 +62,11 @@ struct WzinDetail {
// 获取物资列表详情信息
async getWzmxList(wzpm?) {
this.wzmx = []
const res = await wzcrkmxModel.query(this.wzcrk.guid, wzpm)
res.forEach(i => {
// @ts-ignore
this.wzmx.push(new WzmxClass(i))
const pzmxRes = await wzcrkModel.getPzMx({ guid: this.wzcrk.guid })
pzmxRes.forEach((element) => {
this.historicalInformation.push(new historicalInformationClass(element))
})
Logger.info('接收到出入库物资明细信息>>', JSON.stringify(res))
Logger.info('接收到出入库物资明细信息>>', JSON.stringify(pzmxRes))
}
@Builder TabBuilder(index: number, name: string) {
......@@ -108,8 +106,15 @@ struct WzinDetail {
// pageType必传 入库 出库 盘库 调号 倒库 换位
// dataType必传 导入是true, 其他为false
// isHaveButton 必传 完成状态 未完成是true, 其他为false
WzInfo({ historicalInformation: this.wzmx, wzcrk: this.wzcrk, getDetail: this.getWzmxList,
pageType: "入库", pzForm: this.pzForm, dataType: this.isUpdate ? true : false, isHaveButton: this.wzcrk.wczt == '未完成' ? true : false})
WzInfo({
wzcrk: this.wzcrk,
getDetail: this.getWzmxList,
pageType: "入库",
pzForm: this.pzForm,
historicalInformation: this.historicalInformation,
dataType: this.isUpdate ? true : false,
isHaveButton: this.wzcrk.wczt == '未完成' ? true : false
})
}.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息'))
}
......@@ -128,20 +133,20 @@ struct WzinDetail {
Button("保存").CommonButtonStyle().width("50%")
.onClick(async () => {
try {
Logger.info('保存的入库明细数据>>', JSON.stringify(this.wzmx))
Logger.info('保存的入库明细数据>>', JSON.stringify(this.historicalInformation))
if (this.isUpdate) {
const crksl = this.wzmx.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0)
const crksl = this.historicalInformation.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0)
await wzcrkModel.updateWcztByData(this.wzcrk.guid, {
dec: this.wzcrk.dec,
ydh: this.wzcrk.ydh,
crksl
})
for (let index = 0; index < this.wzmx.length; index++) {
const element = this.wzmx[index];
for (let index = 0; index < this.historicalInformation.length; index++) {
const element = this.historicalInformation[index];
try {
let val1 = await wzcrkmxModel.updateWcztmxByData(element.guid, { crksl: element.crksl })
let val1 = await wzcrkmxModel.updateWcztmxByData(element.mxguid, { crksl: element.crksl })
} catch (e) {
Logger.error(this, '保存失败了>>' + JSON.stringify(e))
}
......
......@@ -85,7 +85,7 @@ struct WzInvDetail{
TabContent() {
Column() {
WzInfo({ historicalInformation: this.wzmx, wzcrk: this.wzcrk, getDetail: this.getDetail })
WzInfo({ wzcrk: this.wzcrk, getDetail: this.getDetail })
}.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息'))
}
......
......@@ -92,7 +92,7 @@ struct WzOutDetail {
TabContent() {
Column() {
WzInfo({ historicalInformation: this.wzmx, wzcrk: this.wzcrk, getDetail: this.getDetail, pageType: "出库" })
WzInfo({ wzcrk: this.wzcrk, getDetail: this.getDetail, pageType: "出库" })
}.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息'))
}
......
......@@ -97,7 +97,9 @@ export struct Pack {
this.ddh = value
this.getPackList()
})
Button("接收").CommonButtonStyle()
Button("接收").CommonButtonStyle().onClick(() => {
router.pushUrl({ url: 'pages/package/ReceivePack' })
})
Button("上架").CommonButtonStyle()
}
......
import { TitleBar } from '../../view/title/TitleBar'
@Entry
@Component
export struct ReceivePack {
build() {
Column() {
TitleBar({ title: "新增包裹" })
Column() {
Text("请扫描包裹").fontColor('#fff').fontSize(26).margin({ top: 300 })
}
.alignItems(HorizontalAlign.Center)
.flexGrow(1)
.width('88%')
.borderWidth(3)
.border({ style: BorderStyle.Dotted })
.borderColor('#fff')
}.height('100%')
.width('100%')
.linearGradient({
direction: GradientDirection.Right, // 渐变方向
repeating: true, // 渐变颜色是否重复
colors: [[0x36a3c0, 0.0], [0x97c6a6, 1], [0xc7d799, 0.0]] // 数组末尾元素占比小于1时满足重复着色效果
}).padding({ bottom: 20 })
}
}
\ No newline at end of file
......@@ -4,12 +4,24 @@ import kfModel from '../../../model/KfModel'
@Component
export struct HouseList {
@Link dataSource: KfInfo[]
@Link searchValue: string
@Styles commonPadding() {
.padding({ top: 4, bottom: 4 })
.alignSelf(ItemAlign.Start)
}
async handleChange(record) {
await kfModel.update(record.guid)
this.getWarehouseList()
}
// 获取库房数据
async getWarehouseList() {
const res = await kfModel.query({ kfmc: this.searchValue })
this.dataSource = res
}
@Builder renderList() {
Column() {
List() {
......@@ -38,7 +50,7 @@ export struct HouseList {
Text("优先级:").commonPadding()
Text(item.yxj + '').commonPadding()
}
}.width('40%')
}.width('35%')
Column() {
Radio({ value: item.guid, group: 'radioGroup' })
......@@ -47,13 +59,13 @@ export struct HouseList {
.width(18)
.onChange((isChecked: boolean) => {
if (isChecked) {
kfModel.update(item.guid)
this.handleChange(item)
}
})
if (item.isdefault == '1') {
Text('默认库房').fontColor('#3672cf')
Text('默认库房').fontColor('#3672cf').fontSize(12)
}
}.width('10%')
}.width('20%')
}.commonPadding()
}
})
......
import { HouseList } from './HouseList'
import { TitleBar } from '../../../view/title/TitleBar'
import kfModel from '../../../model/KfModel'
import { Logger } from '@ohos/common'
import { KfInfo } from '@ohos/common'
import { KfInfo, Logger } from '@ohos/common'
@Entry
@Component
export struct Warehouse {
......@@ -10,13 +10,13 @@ export struct Warehouse {
controller: SearchController = new SearchController()
@State dataSource: KfInfo[] = []
aboutToAppear(){
aboutToAppear() {
this.getWarehouseList()
}
// 获取库房数据
async getWarehouseList(kfmc?: string ) {
const res = await kfModel.query({kfmc})
async getWarehouseList(kfmc?: string) {
const res = await kfModel.query({ kfmc })
this.dataSource = res
Logger.info(this, "库房数据>" + JSON.stringify(res));
}
......@@ -32,18 +32,21 @@ export struct Warehouse {
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.onChange((value) => this.getWarehouseList(value))
.onChange((value) => {
this.searchValue = value
this.getWarehouseList(value)
})
.borderRadius(5)
}.width('100%')
Column() {
HouseList({ dataSource: $dataSource })
}.margin({top:20}).borderRadius(2)
HouseList({ dataSource: $dataSource,searchValue:$searchValue })
}.margin({ top: 20 }).borderRadius(2)
}
}.linearGradient({
direction: GradientDirection.RightBottom,
repeating: true,
colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]]
}).padding({bottom:40,left:20,right:20})
}).padding({ bottom: 40, left: 20, right: 20 })
}
}
\ No newline at end of file
......@@ -52,6 +52,7 @@
"identify/demo_page/ScanDemo",
"pages/metailmange/GoodsSelectHwPage",
"pages/metailmange/GoodsSelectRfidTools",
"pages/metailmange/WzOutPage/WzOutDetail/WzOutDetail"
"pages/metailmange/WzOutPage/WzOutDetail/WzOutDetail",
"pages/package/ReceivePack"
]
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论