CompleteSet.ets 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737
  1. import EquipmentRequest from '../common/util/request/EquipmentRequest'
  2. import JGRequest from '../common/util/request/Request'
  3. import StorageRequest from '../common/util/request/StorageRequest'
  4. import OrderInfo from '../model/OrderInfo'
  5. import { Materialpositionclass, Tasklist } from './IntelligentWarehousingOutbound'
  6. import MaterialInfo from '../viewmodel/MaterialInfo'
  7. import PageModel from '../viewmodel/PageModel'
  8. import ProcessData from '../viewmodel/ProcessData'
  9. import RequestParamModel from '../viewmodel/RequestParamModel'
  10. import RequestParamModel2 from '../viewmodel/RequestParamModel2'
  11. import { stat2 } from './ManualWarehousing'
  12. import { MaterialInformationModel } from '../model/MaterialInformation'
  13. import promptAction from '@ohos.promptAction'
  14. import CommonConstants from '../common/constants/CommonConstants'
  15. import { StationInfoModel } from '../model/StorageSpace'
  16. export interface stat3 {
  17. statNo?: string
  18. //料箱编号
  19. rfid?: string
  20. //料箱检测的io位,1:有,0:没有
  21. io?: string
  22. //0:无锁定,1:锁定,即机器人正在动作,不能进出库动作
  23. lock?: string
  24. ts?: string
  25. }
  26. @Entry
  27. @Component
  28. export struct CompleteSet {
  29. //任务单id
  30. @State orderId: string = ''
  31. //齐套料箱重量
  32. @State BoxWeight: number = 20
  33. // 暂时的料箱编码
  34. @State vehicleCode: string = ''
  35. //物料名称
  36. @State materialName: string = ''
  37. //工序id
  38. @State operationId: string = ''
  39. //扫描料箱获得料箱编码绑定料箱为齐套料箱
  40. @State boxInfo: BoxInfo = {}
  41. //取料箱中物料信息
  42. @State private boxMaterials: Array<MaterialInformationModel> = []
  43. //取出料箱
  44. @State private outBox: Array<outBoxClass> = []
  45. //齐套物料信息
  46. @State private Mposition: Array<MaterialInformationModel> = []
  47. //查询物料存放的所有位置
  48. @State materialPositionArray: Array<Materialpositionclass> = []
  49. //选中取出的物料位置
  50. @State materialPosition: Materialpositionclass = {}
  51. //暂时固定的料箱编码
  52. //todo
  53. @State binCode: string = 'ZJ-JG031'
  54. //点击任务单
  55. @State selectOrder: number = -2
  56. //任务单列表
  57. @State orderArray: OrderInfo[] = [];
  58. //任务单工单单号
  59. @State taskOrderNumber: string = ''
  60. //工单物料切换(1:显示工单列表 2:显示工序下的物料列表)
  61. @State orderMaterialSwitch: number = 1
  62. //任务单id
  63. @State primaryKeyId: string = ''
  64. //齐套料箱状态不可以点击:0,可以点击:1
  65. @State completeSetMaterialState: number = 0
  66. //物料编码
  67. @State materialCode: string = ''
  68. //1:抽屉在料格内 2:抽屉在料格外
  69. @State drawerPositionStatus: number = 1
  70. //出库口料格状态(1:有料箱 0:无料箱)
  71. @State materialGridStatus: number = 0
  72. //是否取空箱子(1:是 2:否)
  73. @State isTakeOutBox: number = 0
  74. // 叫空料箱数量
  75. @State callBoxNum: number = 1
  76. //点击选择任务单变颜色
  77. @State onclick: number = -1
  78. //点击扫描料箱切换成齐套料箱编码
  79. @State clickScan: number = 0
  80. //物料列表
  81. @State scanCodeMIndex: number = 2 //齐套料箱扫码后对应的最左侧的index
  82. @State materialArray: MaterialInfo[] = []
  83. materialController: Scroller = new Scroller()
  84. // 中间输入框绑定的值
  85. @State scanCodeValue: string = ""
  86. //工单分页查询相关参数
  87. private orderPageNo: number = 1
  88. private orderPageSize: number = 10
  89. orderTotalCount?: number = 0
  90. private orderTotalPages: number = 0
  91. //料箱等级(类型)
  92. @State vehicleLevel: string = ''
  93. //料箱编号
  94. @State vehicleNo: string = ''
  95. //工序列表
  96. @State processes: ProcessData[] = [];
  97. @State currentWorkOrderCode: string = ""
  98. // 选择工序
  99. @State selectProcess: ProcessData = {}
  100. // 工序关联物料分页查询相关参数
  101. private pageNo: number = 1
  102. private pageSize: number = 10
  103. totalCount?: number = 0
  104. private totalPages: number = 0
  105. //硬件数据
  106. @State private entranceWaiting: Array<stat3> = []
  107. //左边任务单列表
  108. @State private TasklistoutboundData: Array<Tasklist> = []
  109. //扫码控制器
  110. textController: TextInputController = new TextInputController()
  111. // 通过RFID请求读取料箱的信息
  112. rfidTimer: number = -1
  113. @State preRfid: string = "" //记录上一次的rfid,如果变化了 就清空回库下面的列表
  114. @State private recentlyRecordObject: StationInfoModel = {}
  115. rfidInfoIntervalFun = async () => {
  116. let res: StationInfoModel = await StorageRequest.post("api/v1/wms/common/queryStationInfo", {
  117. stanCode: CommonConstants.STATION_CODE
  118. } as RequestParamModel)
  119. this.recentlyRecordObject = res
  120. // 清空回库下面的数组逻辑
  121. if (this.preRfid && this.preRfid != this.recentlyRecordObject.rfid) {
  122. this.boxMaterials = []
  123. }
  124. this.preRfid = this.recentlyRecordObject.rfid ?? ""
  125. // console.log("jjjj", JSON.stringify(this.recentlyRecordObject))
  126. // 是否有料箱逻辑
  127. this.materialGridStatus = 0
  128. if (this.recentlyRecordObject && this.recentlyRecordObject.rfid) {
  129. this.materialGridStatus = 1
  130. this.BoxWeight = Number(res.weight)
  131. this.recentlyRecordObject.weight = this.recentlyRecordObject.weight + 'Kg'
  132. }
  133. }
  134. //扫码请求
  135. @State private MaterialInformation: Array<MaterialInformationModel> = []
  136. ScanStorageCode = async (itemCode: string) => {
  137. this.scanCodeValue = "BM51264341413217;SL9;PHthi5558;"
  138. let res: MaterialInformationModel = await StorageRequest.post("/api/v1/process/circulation/material", {
  139. label: itemCode //"#gys022#sc022#100#20220929#31"
  140. } as MaterialInformationModel)
  141. //let res = await StorageRequest.get("/api/v3/stock/selectSafeList/1")
  142. // {"batchCode":"BM47111400130447;SL5","codeType":"BATCH","materialCode":"47111400130447","materialName":"穿心电容","num":5,"spec":"G CT52-4-1-2C1-63V-103-M","unitDictLabel":"个","unitDictValue":"个"}
  143. let obj: MaterialInformationModel = JSON.parse(JSON.stringify(res))
  144. // 判断扫描完成后返回的物料码是否是当前需要齐套的物料
  145. let hasCode: boolean = false
  146. for (let i = 0; i < this.materialArray.length; i++) {
  147. if (obj.materialCode == this.materialArray[i].materialCode) {
  148. hasCode = true
  149. this.scanCodeMIndex = i
  150. break
  151. }
  152. }
  153. if (!hasCode) {
  154. promptAction.showToast({
  155. message: "不是当前工序中的物料",
  156. bottom: "50%",
  157. duration: 2000
  158. })
  159. return
  160. }
  161. this.materialController.scrollToIndex(this.scanCodeMIndex)
  162. // 扫码完成之后,如果数组中有对应的值,就添加数量否则就push
  163. let toPushArray: MaterialInformationModel[] = [...this.MaterialInformation]
  164. let has = false
  165. for (let i = 0; i < toPushArray.length; i++) {
  166. let box = toPushArray[i]
  167. if (obj.materialCode == box.materialCode) {
  168. let number = obj.num! + box.num!
  169. box.num = number
  170. has = true
  171. }
  172. }
  173. if (!has) {
  174. toPushArray.push(JSON.parse(JSON.stringify(obj)))
  175. }
  176. this.MaterialInformation = [...toPushArray]
  177. }
  178. async aboutToAppear() {
  179. this.rfidTimer = setInterval(() => {
  180. this.rfidInfoIntervalFun()
  181. }, 1500)
  182. // 查询订单数据
  183. let res = await this.queryOrderPage()
  184. if (res.totalCount === undefined || res.totalCount <= 0 || res.totalPages === undefined || res.totalPages <= 0) {
  185. return
  186. }
  187. this.orderTotalCount = res.totalCount
  188. this.orderTotalPages = res.totalPages
  189. if (res.records) {
  190. this.orderArray = res.records
  191. }
  192. // 设置默认值
  193. if (this.orderArray && this.orderArray.length > 0) {
  194. this.selectOrder = -1
  195. if (this.orderArray[0]?.workOrderCode) {
  196. this.processes = await JGRequest.get('/api/v1/process/vehicleOperation/operation/' + this.orderArray[0]?.workOrderCode, {
  197. }) as ProcessData[]
  198. }
  199. }
  200. }
  201. aboutToDisappear(): void {
  202. clearInterval(this.rfidTimer)
  203. }
  204. // 未齐套订单分页查询
  205. private async queryOrderPage() {
  206. return await JGRequest.post('/api/v1/plan/workOrder/page', {
  207. pageNo: this.orderPageNo,
  208. pageSize: this.orderPageSize,
  209. itemAllotState: '0'
  210. } as RequestParamModel2) as PageModel<OrderInfo>;
  211. }
  212. // 工序物料分页查询
  213. private async queryMaterialPage() {
  214. return await StorageRequest.post('/api/v1/process/vehicleOperation/operationMaterial', {
  215. operationId: this.selectProcess?.operationId!,
  216. pageNo: this.pageNo,
  217. pageSize: this.pageSize,
  218. workOrderCode: this.orderArray[this.selectOrder]?.workOrderCode!
  219. } as RequestParamModel2) as PageModel<MaterialInfo>
  220. }
  221. //查询库存信息
  222. async queryStockList(params: RequestParamModel) {
  223. // todo 删除
  224. if (params.materialNo != undefined && params?.materialNo.length > 0) {
  225. params.materialNo = 'BL00000111188'
  226. }
  227. // todo 删除
  228. if (params.vehicleCode != undefined && params?.vehicleCode.length > 0) {
  229. params.vehicleCode = 'ZJ-JG016'
  230. }
  231. console.log('testTag', JSON.stringify(params))
  232. return await StorageRequest.post('/api/v1/stock/list', params) as Materialpositionclass[]
  233. }
  234. //工序弹窗
  235. selectProcessController: CustomDialogController = new CustomDialogController({
  236. builder: SelectProcessDialog({
  237. selectProcess: this.selectProcess,
  238. processes: this.processes,
  239. orderMaterialSwitch: this.orderMaterialSwitch,
  240. confirm: async () => {
  241. // 查询工序关联的物料信息
  242. let res = await this.queryMaterialPage()
  243. // if (res.totalCount === undefined || res.totalCount <= 0 || res.totalPages === undefined || res.totalPages <= 0) {
  244. // return
  245. // }
  246. this.totalCount = res.totalCount ?? 0
  247. this.totalPages = res.totalPages ?? 0
  248. // if (res.records) {
  249. //
  250. // }
  251. this.scanCodeMIndex = -1
  252. this.materialArray = res.records ?? []
  253. this.textController.stopEditing()
  254. }
  255. }),
  256. alignment: DialogAlignment.Center,
  257. customStyle: true,
  258. autoCancel: true,
  259. })
  260. //料箱绑定工序操作
  261. //后端回库入库操作
  262. Warehousing = async (): Promise<MaterialInformationModel[]> => {
  263. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/wmsOrder/inBox", {
  264. houseNo: '1',
  265. stanCode: CommonConstants.STATION_CODE,
  266. vehicleCode: this.recentlyRecordObject.rfid,
  267. detailsList: this.boxMaterials,
  268. wcsType: "kitting",
  269. } as RequestParamModel)
  270. promptAction.showToast({
  271. message: '请求成功,业务处理中。。。',
  272. duration: 2000,
  273. bottom: 150
  274. });
  275. if (!this.recentlyRecordObject.rfid) {
  276. // 当盒子被小车吊走了才清空
  277. this.boxMaterials = []
  278. }
  279. return res
  280. }
  281. /////请求齐套物料信息
  282. Materialposition = async (item: MaterialInfo) => {
  283. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/process/vehicleMaterial/list", {
  284. materialName: item.materialName,
  285. materialCode: item.materialCode,
  286. operationId: this.selectProcess.operationId
  287. } as RequestParamModel)
  288. this.materialName = item?.materialName ?? ""
  289. console.log("xxxxxxxxxxxxxxxxxx", JSON.stringify(item), JSON.stringify(res))
  290. this.Mposition = res
  291. this.materialLocationController.open()
  292. }
  293. //齐套的物料信息
  294. materialLocationController: CustomDialogController = new CustomDialogController({
  295. builder: MaterialLocationDialog({
  296. materialName: this.materialName,
  297. boxMaterials: this.Mposition,
  298. }),
  299. alignment: DialogAlignment.Center,
  300. customStyle: true,
  301. autoCancel: false,
  302. })
  303. //取空箱子弹窗
  304. emptyBoxController: CustomDialogController = new CustomDialogController({
  305. builder: EmptyBoxDialog({
  306. callBoxNum: this.callBoxNum,
  307. isTakeOutBox: this.isTakeOutBox,
  308. }),
  309. alignment: DialogAlignment.Center,
  310. customStyle: true,
  311. autoCancel: true,
  312. })
  313. //扫描料箱弹窗
  314. scanningMaterialBoxController: CustomDialogController = new CustomDialogController({
  315. builder: scanningMaterialBox({
  316. binCode: this.binCode,
  317. boxInfo: this.boxInfo,
  318. clickScan: this.clickScan,
  319. vehicleCode: this.vehicleCode,
  320. selectOrder: this.selectOrder,
  321. orderArray: this.orderArray,
  322. materialCode: this.materialCode
  323. }),
  324. alignment: DialogAlignment.Center,
  325. customStyle: true,
  326. autoCancel: true,
  327. })
  328. // async materialBoxHTTP(vehicleCode: string) {
  329. // return await StorageRequest.post('/api/v1/process/vehicleOperation/vehicleDetail', {
  330. // workOrderCode: this.orderArray[this.selectOrder]?.workOrderCode!,
  331. // operationId: Number.parseInt(this.selectProcess?.operationId!),
  332. // vehicleCode: vehicleCode,
  333. // } as RequestParamModel) as BoxInfo
  334. // }
  335. //查询取出的料箱里面的物料信息
  336. boxMaterialHttp = async (): Promise<MaterialInformationModel[]> => {
  337. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/stock/list", {
  338. vehicleCode: this.entranceWaiting[0].rfid!
  339. } as RequestParamModel)
  340. console.log('testTag', 'aaaaaaaa2' + JSON.stringify(res));
  341. this.boxMaterials = res
  342. return res
  343. }
  344. //硬件请求回库操作
  345. warehousingHttp = async (): Promise<boxMaterialClass> => {
  346. let res: boxMaterialClass = await StorageRequest.post("/api/v1/wcs/stockin", {
  347. boxNo: this.vehicleNo,
  348. position: "stat3",
  349. mtype: this.vehicleLevel
  350. } as RequestParamModel)
  351. console.log('testTag1', '----------' + JSON.stringify(res));
  352. return res
  353. }
  354. // 点击齐套料箱的时候需要将右侧的数组push到左侧,但是需要先提前掉一个接口
  355. toCompleteSuitFun = async () => {
  356. let result: boxMaterialClass = await StorageRequest.post("api/v1/process/vehicleOperation/add", {
  357. operationId: this.selectProcess.operationId,
  358. workOrderCode: this.currentWorkOrderCode,
  359. vehicleCode: this.recentlyRecordObject.rfid,
  360. processVehicleMaterialList: this.MaterialInformation
  361. } as RequestParamModel)
  362. // =====================
  363. let toPushArray: MaterialInformationModel[] = [...this.boxMaterials]
  364. this.MaterialInformation.forEach((middleBox) => {
  365. let has = false
  366. for (let i = 0; i < toPushArray.length; i++) {
  367. let box = toPushArray[i]
  368. if (middleBox.materialCode == box.materialCode) {
  369. let number = middleBox.num! + box.num!
  370. box.num = number
  371. has = true
  372. }
  373. }
  374. if (!has) {
  375. toPushArray.push(JSON.parse(JSON.stringify(middleBox)))
  376. }
  377. })
  378. this.boxMaterials = [...toPushArray]
  379. this.MaterialInformation = []
  380. // =====================
  381. // 添加完成之后需要更新最左侧已经选择的工序下边的物料列表
  382. let res = await this.queryMaterialPage()
  383. if (res.totalCount === undefined || res.totalCount <= 0 || res.totalPages === undefined || res.totalPages <= 0) {
  384. return
  385. }
  386. this.totalCount = res.totalCount
  387. this.totalPages = res.totalPages
  388. if (res.records) {
  389. this.materialArray = res.records
  390. }
  391. }
  392. build() {
  393. Row({ space: px2vp(24) }) {
  394. if (this.orderMaterialSwitch === 1) {
  395. Column() {
  396. List({ space: px2vp(20) }) {
  397. ForEach(this.orderArray, (item: OrderInfo, index: number) => {
  398. ListItem() {
  399. Column() {
  400. Row() {
  401. Text(item.orderName)
  402. .fontSize($r('app.float.fontSize_24'))
  403. .fontWeight(FontWeight.Medium)
  404. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  405. .opacity(this.selectOrder === index ? $r('app.float.card_font_select_opacity') : 1)
  406. }
  407. .width('100%')
  408. .justifyContent(FlexAlign.Start)
  409. Row() {
  410. Text('产品型号: ' + item?.materialModel ?? "")
  411. .fontWeight(FontWeight.Regular)
  412. .fontSize($r('app.float.fontSize_20'))
  413. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  414. }
  415. .width('100%')
  416. .justifyContent(FlexAlign.Start)
  417. Row() {
  418. Text('计划编号: ')
  419. .fontWeight(FontWeight.Regular)
  420. .fontSize($r('app.float.fontSize_20'))
  421. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  422. Text(item.workOrderCode)
  423. .fontSize($r('app.float.fontSize_20'))
  424. .fontWeight(FontWeight.Medium)
  425. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  426. }
  427. .width('100%')
  428. .justifyContent(FlexAlign.Start)
  429. Row() {
  430. Text('订单编号: ')
  431. .fontWeight(FontWeight.Regular)
  432. .fontSize($r('app.float.fontSize_20'))
  433. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  434. Text(item.orderCode)
  435. .fontSize($r('app.float.fontSize_20'))
  436. .fontWeight(FontWeight.Medium)
  437. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  438. }
  439. .width('100%')
  440. .justifyContent(FlexAlign.Start)
  441. Row() {
  442. Text('下发时间: ')
  443. .fontSize($r('app.float.fontSize_20'))
  444. .fontWeight(FontWeight.Regular)
  445. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  446. Text(item?.planStartWhen && item.planStartWhen.length > 0 ? item.planStartWhen.split(' ')[0] : '')
  447. .fontSize($r('app.float.fontSize_20'))
  448. .fontWeight(FontWeight.Medium)
  449. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  450. }
  451. .width('100%')
  452. .justifyContent(FlexAlign.Start)
  453. }
  454. .justifyContent(FlexAlign.Center)
  455. // .alignItems(HorizontalAlign.Center)
  456. .onClick(async () => {
  457. // 另外选择了工单,则把工序、选择的工序清空
  458. // if (this.selectOrder && this.selectOrder != index) {
  459. // this.selectProcess = {}
  460. // this.processes = []
  461. // }
  462. this.currentWorkOrderCode = item.workOrderCode ?? ""
  463. this.orderId = item.taskId!
  464. if (item?.workOrderCode && item.workOrderCode.length > 0) {
  465. this.selectProcessController.open()
  466. this.selectOrder = index
  467. this.processes = await StorageRequest.get("/api/v1/process/vehicleOperation/operation/" + item.workOrderCode, {
  468. })
  469. }
  470. // else {
  471. // this.selectProcess = {}
  472. // this.processes = []
  473. // }
  474. })
  475. .width(px2vp(608))
  476. .padding(8)
  477. .borderRadius($r('app.float.general_border_radius'))
  478. .backgroundColor(this.selectOrder === index ? $r('app.color.order_select_background') : $r('app.color.general_card_background_color'))
  479. }
  480. })
  481. }
  482. .width(px2vp(608))
  483. .height(px2vp(870))
  484. // 未完成订单大于10条,触底再去查询
  485. .onReachEnd(async () => {
  486. if (!this.orderTotalPages || this.orderTotalPages <= 1) {
  487. return
  488. }
  489. if (this.orderPageNo >= this.orderTotalPages) {
  490. return
  491. }
  492. this.orderPageNo++
  493. let res = await this.queryOrderPage() as PageModel<OrderInfo>
  494. this.orderArray = this.orderArray?.concat(res.records as OrderInfo[])
  495. })
  496. }
  497. .width(px2vp(608))
  498. .height(px2vp(900))
  499. .borderRadius($r('app.float.borderRadius_16'))
  500. }
  501. // 已经选择了工序后 展示的列表和上面的title
  502. else if (this.orderMaterialSwitch === 2) {
  503. Column() {
  504. Row() {
  505. Image($r('app.media.circular_return'))
  506. .width(px2vp(80))
  507. .height(px2vp(80))
  508. .onClick(() => {
  509. this.orderMaterialSwitch = 1
  510. })
  511. Blank()
  512. Row() {
  513. Column({ space: 10 }) {
  514. Text(this.selectProcess?.operationName && this.selectProcess.operationName.length > 0 ? this.selectProcess.operationName! : '')
  515. .fontWeight(FontWeight.Medium)
  516. .fontSize($r('app.float.fontSize_20'))
  517. .fontColor($r('app.color.blue_100'))
  518. .opacity($r('app.float.general_font_opacity'))
  519. Text(this.orderArray[this.selectOrder]?.orderName && (this.orderArray[this.selectOrder]?.orderName?.length!) > 0 ? this.orderArray[this.selectOrder]?.orderName! : '')
  520. .fontSize($r('app.float.fontSize_20'))
  521. .fontWeight(FontWeight.Regular)
  522. .fontColor($r('app.color.blue_100'))
  523. .opacity($r('app.float.general_font_opacity'))
  524. }
  525. .margin({ left: 10 })
  526. .width('80%')
  527. .height('100%')
  528. .padding({ left: 10 })
  529. .borderRadius(px2vp(15))
  530. .alignItems(HorizontalAlign.Start)
  531. .justifyContent(FlexAlign.Center)
  532. Blank()
  533. Image($r('app.media.subscript'))
  534. .width(px2vp(20))
  535. .height(px2vp(20))
  536. }
  537. .alignItems(VerticalAlign.Bottom)
  538. .width('80%')
  539. .borderRadius(px2vp(15))
  540. .backgroundColor('#0f000000')
  541. .height('100%')
  542. .onClick(() => {
  543. this.selectProcessController.open()
  544. })
  545. }
  546. .width('100%')
  547. .height('10%')
  548. .margin({ bottom: "2%" })
  549. Column() {
  550. List({ space: 3, scroller: this.materialController }) {
  551. ForEach(this.materialArray, (item: MaterialInfo, index: number) => {
  552. ListItem() {
  553. Row() {
  554. Column() {
  555. Text(item.materialName)
  556. .fontSize($r('app.float.fontSize_24'))
  557. .fontWeight(FontWeight.Medium)
  558. .fontColor($r('app.color.black_90'))
  559. .width('100%')
  560. Text(item.materialCode)
  561. .fontWeight(FontWeight.Regular)
  562. .fontSize($r('app.float.fontSize_20'))
  563. .fontColor($r('app.color.black_60'))
  564. .width('100%')
  565. Text(item.completeNum?.toString() + '/' + item.totalMaterial?.toString())
  566. .fontSize($r('app.float.fontSize_24'))
  567. .fontColor($r('app.color.black_90'))
  568. .fontWeight(FontWeight.Bold)
  569. .width('100%')
  570. .margin({ top: 8 })
  571. Text('已拣/总需')
  572. .fontSize($r('app.float.fontSize_20'))
  573. .fontColor($r('app.color.black_60'))
  574. .width('100%')
  575. }
  576. .width('70%')
  577. .padding({ left: 20, right: 20 })
  578. .borderRadius(px2vp(16))
  579. .alignItems(HorizontalAlign.Start)
  580. .justifyContent(FlexAlign.Center)
  581. // if (item.completeNum! === item.totalMaterial!) {
  582. // Column() {
  583. // Image($r('app.media.collect_completed'))
  584. // .width(px2vp(80))
  585. // .height(px2vp(80))
  586. // .borderRadius(px2vp(16))
  587. // }
  588. // .justifyContent(FlexAlign.Start)
  589. // .width('30%')
  590. //
  591. // .borderRadius(px2vp(16))
  592. // }
  593. }
  594. .border({ width: this.scanCodeMIndex === index ? 3 : 0, color: $r("app.color.warn_1") })
  595. .padding(8)
  596. .borderRadius(10)
  597. .margin(px2vp(8))
  598. .width('98%')
  599. .onClick(async () => {
  600. this.Materialposition(item)
  601. })
  602. .backgroundColor(item.completeNum! >= item.totalMaterial! ?
  603. $r('app.color.green_100') : $r('app.color.robot_set_card_white'))
  604. }
  605. })
  606. }
  607. .width('100%')
  608. .height('100%')
  609. .onReachEnd(async () => {
  610. if (!this.totalPages || this.totalPages <= 1) {
  611. return
  612. }
  613. if (this.pageNo >= this.totalPages) {
  614. return
  615. }
  616. this.pageNo++
  617. // 查询工序关联的物料信息
  618. let res = await this.queryMaterialPage()
  619. this.materialArray = this.materialArray?.concat(res.records as MaterialInfo[])
  620. })
  621. }
  622. .width('100%')
  623. .height('88%')
  624. .borderRadius($r('app.float.borderRadius_16'))
  625. }
  626. .width(px2vp(608))
  627. .height(px2vp(900))
  628. .borderRadius($r('app.float.borderRadius_16'))
  629. }
  630. Column() {
  631. Stack() {
  632. Image(this.drawerPositionStatus === 1 && this.materialGridStatus === 0 ? $r('app.media.drawer_inside') : (this.drawerPositionStatus === 2 && this.materialGridStatus === 0 ? $r('app.media.drawer_outside') :
  633. (this.drawerPositionStatus === 1 && this.materialGridStatus === 1 ? $r('app.media.D_W_inside') : $r('app.media.D_W_outside'))))
  634. .width(px2vp(608))
  635. .height(px2vp(220))
  636. .borderRadius(px2vp(16))
  637. Column() {
  638. Text('抽屉状态')
  639. .textAlign(TextAlign.End)
  640. .width('48%')
  641. .height('20%')
  642. .fontWeight(FontWeight.Regular)
  643. .fontSize($r('app.float.fontSize_20'))
  644. .fontColor($r('app.color.process_nameplate_grey_color'))
  645. Text(this.recentlyRecordObject.lockStr)
  646. .textAlign(TextAlign.End)
  647. .width('48%')
  648. .height('25%')
  649. .fontWeight(FontWeight.Regular)
  650. .fontSize($r('app.float.fontSize_24'))
  651. .fontColor($r('app.color.black_90'))
  652. Blank()
  653. Text('料箱ID')
  654. .textAlign(TextAlign.End)
  655. .width('48%')
  656. .height('20%')
  657. .fontWeight(FontWeight.Regular)
  658. .fontSize($r('app.float.fontSize_20'))
  659. .fontColor($r('app.color.process_nameplate_grey_color'))
  660. Text(this.recentlyRecordObject.rfid ?? "")
  661. .textAlign(TextAlign.End)
  662. .width('100%')
  663. .height('25%')
  664. .fontWeight(FontWeight.Regular)
  665. .fontSize($r('app.float.fontSize_24'))
  666. .fontColor($r('app.color.black_90'))
  667. }
  668. .width(px2vp(608))
  669. .height(px2vp(220))
  670. .borderRadius(px2vp(16))
  671. .padding({ right: $r('app.float.borderRadius_16') })
  672. .alignItems(HorizontalAlign.End)
  673. }
  674. .width(px2vp(608))
  675. .height(px2vp(220))
  676. .borderRadius(px2vp(16))
  677. .margin({ bottom: px2vp(20) })
  678. Button('回库')
  679. .fontSize($r('app.float.fontSize_24'))
  680. .fontColor($r('app.color.general_font_white_color'))
  681. .width(px2vp(608))
  682. .height(px2vp(80))
  683. .margin({ bottom: px2vp(20) })
  684. .focusable(false)
  685. .backgroundColor(this.materialGridStatus === 1 ? $r('app.color.green_100') : this.materialGridStatus === 0 ? $r('app.color.Green_20') : '')
  686. .onClick(() => {
  687. if (this.materialGridStatus === 1) {
  688. //执行后端入库操作
  689. this.Warehousing()
  690. }
  691. })
  692. List({ space: '2%' }) {
  693. ForEach(this.boxMaterials, (item: MaterialInformationModel, index: number) => {
  694. ListItem() {
  695. Row() {
  696. Column() {
  697. Column() {
  698. Row().height('23%')
  699. Text(item.materialName ? item.materialName! : '')
  700. .fontSize($r('app.float.fontSize_24'))
  701. .fontColor($r('app.color.general_font_color'))
  702. .fontWeight(FontWeight.Medium)
  703. .opacity($r('app.float.general_font_opacity'))
  704. Text(item.materialCode ? item.materialCode : '')
  705. .fontSize($r('app.float.fontSize_20'))
  706. .fontColor($r('app.color.process_nameplate_grey_color'))
  707. .fontWeight(FontWeight.Medium)
  708. }
  709. .height('50%')
  710. .width('90%')
  711. .alignItems(HorizontalAlign.Start)
  712. Column() {
  713. Row() {
  714. Text(item.num?.toString())
  715. .fontSize($r('app.float.fontSize_38'))
  716. .fontColor($r('app.color.general_font_color'))
  717. .fontWeight(FontWeight.Bold)
  718. Text(item.unitDictLabel ?? "个")
  719. .fontSize($r('app.float.fontSize_20'))
  720. .fontColor($r('app.color.process_nameplate_grey_color'))
  721. .fontWeight(FontWeight.Medium)
  722. }
  723. .width('90%')
  724. Blank()
  725. Row() {
  726. Image($r('app.media.subscript_space'))
  727. .height($r('app.float.card_subscript_new_size'))
  728. .width($r('app.float.card_subscript_new_size'))
  729. }
  730. .alignItems(VerticalAlign.Bottom)
  731. .justifyContent(FlexAlign.End)
  732. .width('100%')
  733. }
  734. .height('50%')
  735. .width('100%')
  736. }
  737. .width('100%')
  738. .borderRadius($r('app.float.general_border_radius'))
  739. .alignItems(HorizontalAlign.Center)
  740. .justifyContent(FlexAlign.Center)
  741. .height('100%')
  742. }
  743. .borderRadius(px2vp(16))
  744. .height('30%')
  745. .onClick(() => {
  746. })
  747. .backgroundColor(this.onclick === index ? $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
  748. }
  749. })
  750. }
  751. .width(px2vp(608))
  752. .height(px2vp(525))
  753. }
  754. .width(px2vp(608))
  755. .height(px2vp(900))
  756. .borderRadius($r('app.float.borderRadius_16'))
  757. Column() {
  758. Stack() {
  759. Image(this.BoxWeight === 0 ? $r('app.media.no_material_box') : this.BoxWeight <= 15 && this.BoxWeight !== 0 ? $r('app.media.normal_box') : $r('app.media.overweight_box'))
  760. .width(px2vp(608))
  761. .height(px2vp(220))
  762. .borderRadius(px2vp(16))
  763. Column() {
  764. Text('料箱重量')
  765. .textAlign(TextAlign.End)
  766. .width('48%')
  767. .height('20%')
  768. .fontWeight(FontWeight.Regular)
  769. .fontSize($r('app.float.fontSize_20'))
  770. .fontColor($r('app.color.process_nameplate_grey_color'))
  771. Text(this.recentlyRecordObject.weight)
  772. .textAlign(TextAlign.End)
  773. .width('48%')
  774. .height('25%')
  775. .fontWeight(FontWeight.Regular)
  776. .fontSize($r('app.float.fontSize_24'))
  777. .fontColor(this.BoxWeight <= 15 ? $r('app.color.black_90') : $r('app.color.brown_100'))
  778. Blank()
  779. Text('料箱ID')
  780. .textAlign(TextAlign.End)
  781. .width('48%')
  782. .height('20%')
  783. .fontWeight(FontWeight.Regular)
  784. .fontSize($r('app.float.fontSize_20'))
  785. .fontColor($r('app.color.process_nameplate_grey_color'))
  786. .focusable(true)
  787. .defaultFocus(false)
  788. Text(this.recentlyRecordObject.rfid)
  789. .textAlign(TextAlign.End)
  790. .width('100%')
  791. .height('25%')
  792. .fontWeight(FontWeight.Regular)
  793. .fontSize($r('app.float.fontSize_24'))
  794. .fontColor($r('app.color.black_90'))
  795. }
  796. .width(px2vp(608))
  797. .height(px2vp(220))
  798. .borderRadius(px2vp(16))
  799. .padding({ right: $r('app.float.borderRadius_16') })
  800. .alignItems(HorizontalAlign.End)
  801. }
  802. .width(px2vp(608))
  803. .height(px2vp(220))
  804. Row() {
  805. Image($r('app.media.shaoma'))
  806. .width(px2vp(25))
  807. .height(px2vp(25))
  808. .focusable(true)
  809. .defaultFocus(false)
  810. TextInput({ text: this.scanCodeValue,
  811. placeholder: '点击扫码添加物料',
  812. controller: this.textController })
  813. .width('92%')
  814. .height('100%')
  815. .width('80%')
  816. .defaultFocus(false)
  817. .fontWeight(FontWeight.Medium)
  818. .fontSize('32px')
  819. .backgroundColor("#ffff")
  820. .borderRadius(21)
  821. .onChange((value: string) => {
  822. this.scanCodeValue = value
  823. })
  824. .onSubmit(() => {
  825. this.ScanStorageCode(this.scanCodeValue)
  826. })
  827. Image($r('app.media.search'))
  828. .width(px2vp(32))
  829. .height(px2vp(32))
  830. .onClick(async () => {
  831. this.ScanStorageCode(this.scanCodeValue)
  832. this.textController.stopEditing()
  833. })
  834. }
  835. .width(px2vp(608))
  836. .height(px2vp(80))
  837. .justifyContent(FlexAlign.Center)
  838. .borderRadius(px2vp(100))
  839. .alignItems(VerticalAlign.Center)
  840. .backgroundColor($r('app.color.process_divider_white_color'))
  841. .margin({ top: px2vp(20) })
  842. Column() {
  843. List() {
  844. ForEach(this.MaterialInformation, (item: MaterialInformationModel, index: number) => {
  845. ListItem() {
  846. Row() {
  847. Column() {
  848. Text(item.materialName)
  849. .fontSize($r('app.float.fontSize_24'))
  850. .fontColor($r('app.color.general_font_color'))
  851. .fontWeight(FontWeight.Medium)
  852. .opacity($r('app.float.general_font_opacity'))
  853. Text(item.batchNo)
  854. .fontSize($r('app.float.fontSize_20'))
  855. .fontColor($r('app.color.process_nameplate_grey_color'))
  856. .fontWeight(FontWeight.Medium)
  857. Text(item.materialCode)
  858. .fontSize($r('app.float.fontSize_20'))
  859. .fontColor($r('app.color.process_nameplate_grey_color'))
  860. .fontWeight(FontWeight.Medium)
  861. Text(item.spec)
  862. .fontSize($r('app.float.fontSize_20'))
  863. .fontColor($r('app.color.process_nameplate_grey_color'))
  864. .fontWeight(FontWeight.Medium)
  865. Row() {
  866. // 可以更改数量的输入框
  867. TextInput({ text: item.num?.toString() })
  868. .fontSize(14)
  869. .fontWeight(FontWeight.Bold)
  870. .fontColor($r('app.color.general_font_color'))// .opacity($r('app.float.general_font_opacity'))
  871. .height(30)
  872. .width(120)
  873. .type(InputType.Number)
  874. .defaultFocus(false)
  875. .textAlign(TextAlign.Start)
  876. .borderRadius(0)
  877. .border({ width: 0.4 })
  878. .onChange((value) => {
  879. item.num = Number(value)
  880. })
  881. Text(item.unitDictLabel ?? "个")
  882. .fontSize($r('app.float.fontSize_20'))
  883. .fontColor($r('app.color.process_nameplate_grey_color'))
  884. .fontWeight(FontWeight.Medium)
  885. }
  886. .justifyContent(FlexAlign.End)
  887. .width("100%")
  888. }
  889. .width("100%")
  890. .alignItems(HorizontalAlign.Start)
  891. // 删除按钮
  892. Row() {
  893. Image($r("app.media.reduce")).width(25).height(5)
  894. }
  895. .width(30)
  896. .height(30)
  897. .position({ x: '90%', y: 3 })
  898. .alignItems(VerticalAlign.Center)
  899. .justifyContent(FlexAlign.Center)
  900. .onClick(() => {
  901. this.MaterialInformation.splice(index, 1)
  902. })
  903. }
  904. .width("100%")
  905. .borderRadius(10)
  906. .margin({ top: 5 })
  907. .padding(8)
  908. .backgroundColor($r('app.color.robot_set_card_white'))
  909. }
  910. })
  911. }
  912. .width(px2vp(608))
  913. .height(px2vp(450))
  914. .margin({ bottom: px2vp(20) })
  915. Button('齐套料箱')
  916. .fontSize($r('app.float.fontSize_24'))
  917. .fontColor($r('app.color.general_font_white_color'))
  918. .width(px2vp(608))
  919. .height(px2vp(80))
  920. .backgroundColor(this.selectProcess.operationId && this.MaterialInformation.length > 0 ? $r('app.color.blue_100') : $r('app.color.blue_20'))
  921. .onClick(() => {
  922. if (this.selectProcess.operationId) {
  923. if (this.MaterialInformation.length > 0) {
  924. // 把中间的数据push到左边的数组,如果xx一样就数量相加
  925. this.toCompleteSuitFun()
  926. }
  927. }
  928. else {
  929. promptAction.showToast({
  930. message: '请先选择工单和工序!',
  931. duration: 1700,
  932. bottom: 150
  933. });
  934. }
  935. })
  936. }
  937. .width(px2vp(608))
  938. .height(px2vp(520))
  939. .borderRadius($r('app.float.borderRadius_16'))
  940. }
  941. .width(px2vp(608))
  942. .height(px2vp(900))
  943. .borderRadius($r('app.float.borderRadius_16'))
  944. }
  945. .width(px2vp(1920))
  946. .height(px2vp(900))
  947. .padding({ left: px2vp(24), right: px2vp(24) })
  948. }
  949. }
  950. // 选择工序
  951. @CustomDialog
  952. struct SelectProcessDialog {
  953. @Link selectProcess: ProcessData
  954. @Link processes: ProcessData[]
  955. @Link orderMaterialSwitch: number
  956. controller?: CustomDialogController
  957. cancel: () => void = () => {
  958. }
  959. confirm: () => void = () => {
  960. }
  961. build() {
  962. Column() {
  963. Row() {
  964. Text('选择工序')
  965. .fontSize($r('app.float.fontSize_38'))
  966. .fontWeight(FontWeight.Medium)
  967. .fontColor($r('app.color.general_font_color'))
  968. .opacity($r('app.float.general_font_opacity'))
  969. }
  970. .height('15%')
  971. .alignItems(VerticalAlign.Center)
  972. List({ space: px2vp(20), initialIndex: 0 }) {
  973. ForEach(this.processes, (item: ProcessData) => {
  974. ListItem() {
  975. Row() {
  976. Text(item.operationName)
  977. .fontSize($r('app.float.fontSize_24'))
  978. .fontWeight(FontWeight.Medium)
  979. .fontColor(JSON.stringify(this.selectProcess) != '{}' && item.operationId === this.selectProcess?.operationId ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  980. .textAlign(TextAlign.Center)
  981. .width('71%')
  982. .height('12.5%')
  983. .borderRadius($r('app.float.general_border_radius'))
  984. .onClick(() => {
  985. this.selectProcess = item
  986. this.orderMaterialSwitch = 2
  987. this.confirm()
  988. this.controller?.close()
  989. })
  990. if (item.state === 2) {
  991. Image($r('app.media.collect_completed'))
  992. .width(px2vp(80))
  993. .height(px2vp(80))
  994. .borderRadius($r('app.float.general_border_radius'))
  995. }
  996. Text() {
  997. }
  998. .width(px2vp(80))
  999. .height(px2vp(80))
  1000. .borderRadius($r('app.float.general_border_radius'))
  1001. }
  1002. .borderRadius($r('app.float.general_border_radius'))
  1003. .backgroundColor(JSON.stringify(this.selectProcess) != '{}' && item.operationId === this.selectProcess?.operationId ? $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
  1004. }
  1005. })
  1006. }
  1007. .listDirection(Axis.Vertical) // 排列方向
  1008. // .edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果
  1009. .height('80%')
  1010. .width('100%')
  1011. .alignListItem(ListItemAlign.Center)
  1012. }
  1013. .width('48%')
  1014. .height('74%')
  1015. .backgroundColor($r('app.color.page_general_background'))
  1016. .justifyContent(FlexAlign.SpaceEvenly)
  1017. .borderRadius($r('app.float.general_border_radius'))
  1018. }
  1019. }
  1020. // 物料位置(物料在哪些料箱里面)
  1021. @CustomDialog
  1022. struct MaterialLocationDialog {
  1023. @Link materialName: string
  1024. @Link boxMaterials: MaterialInformationModel[]
  1025. Controller: CustomDialogController
  1026. scroller: Scroller = new Scroller()
  1027. build() {
  1028. Stack() {
  1029. Column() {
  1030. }.width('100%')
  1031. .height('100%')
  1032. .blur(30)
  1033. .backgroundColor('#4d000000')
  1034. Column() {
  1035. Row() {
  1036. Row() {
  1037. Image($r('app.media.back_white'))
  1038. .width(px2vp(64))
  1039. .height(px2vp(64))
  1040. .onClick(() => {
  1041. this.Controller?.close()
  1042. })
  1043. }
  1044. .width('5%')
  1045. .padding({ left: 10 })
  1046. Row() {
  1047. Text(this.materialName && this.materialName.length > 0 ? this.materialName : '')
  1048. .fontSize($r('app.float.fontSize_38'))
  1049. .fontWeight(FontWeight.Medium)
  1050. .fontColor($r('app.color.process_divider_white_color'))
  1051. .width('100%')
  1052. .height('100%')
  1053. .textAlign(TextAlign.Center)
  1054. }
  1055. .width('90%')
  1056. .justifyContent(FlexAlign.Center)
  1057. Row() {
  1058. }.width('5%')
  1059. }
  1060. .width('100%')
  1061. .height('15%')
  1062. .padding({ top: 8 })
  1063. Grid(this.scroller) {
  1064. ForEach(this.boxMaterials, (item: MaterialInformationModel, index: number) => {
  1065. GridItem() {
  1066. Row() {
  1067. Column() {
  1068. Text(item.materialName)
  1069. .fontSize($r('app.float.fontSize_24'))
  1070. .fontWeight(FontWeight.Regular)
  1071. .fontColor($r('app.color.black_60'))
  1072. .height('20%')
  1073. .width('100%')
  1074. Text(item.materialCode)
  1075. .fontSize($r('app.float.fontSize_24'))
  1076. .fontWeight(FontWeight.Regular)
  1077. .fontColor($r('app.color.black_60'))
  1078. .height('20%')
  1079. .width('100%')
  1080. Text(item.spec)
  1081. .fontSize($r('app.float.fontSize_24'))
  1082. .fontWeight(FontWeight.Regular)
  1083. .fontColor($r('app.color.black_60'))
  1084. .height('20%')
  1085. .width('100%')
  1086. Text(item.batchNo)
  1087. .fontSize($r('app.float.fontSize_24'))
  1088. .fontWeight(FontWeight.Regular)
  1089. .fontColor($r('app.color.black_60'))
  1090. .height('20%')
  1091. .width('100%')
  1092. Row() {
  1093. Text(item.num?.toString())
  1094. .fontSize($r('app.float.fontSize_38'))
  1095. .fontWeight(FontWeight.Bold)
  1096. .fontColor($r('app.color.black_90'))
  1097. Text(item.unit ?? item.unitDictLabel)
  1098. .fontSize($r('app.float.fontSize_24'))
  1099. .fontWeight(FontWeight.Regular)
  1100. .fontColor($r('app.color.black_60'))
  1101. }
  1102. .margin({ top: 5 })
  1103. }
  1104. .width('100%')
  1105. .padding(10)
  1106. .borderRadius(10)
  1107. .alignItems(HorizontalAlign.Start)
  1108. .justifyContent(FlexAlign.Center)
  1109. .height('100%')
  1110. }
  1111. .padding(5)
  1112. .borderRadius(10)
  1113. .height('25%')
  1114. .width('100%')
  1115. .backgroundColor(Color.White)
  1116. }
  1117. .padding({ left: 5 })
  1118. })
  1119. }
  1120. .padding(10)
  1121. .columnsTemplate('1fr 1fr 1fr')
  1122. .columnsGap(10)
  1123. .rowsGap(10)
  1124. .width('100%')
  1125. .height('85%')
  1126. }
  1127. .width('100%')
  1128. .height('100%')
  1129. }
  1130. .width('100%')
  1131. .height('100%')
  1132. }
  1133. }
  1134. //取空箱子弹窗
  1135. @CustomDialog
  1136. struct EmptyBoxDialog {
  1137. @Link callBoxNum: number
  1138. @Link isTakeOutBox: number
  1139. controller?: CustomDialogController
  1140. cancel: () => void = () => {
  1141. }
  1142. confirm: () => void = () => {
  1143. }
  1144. build() {
  1145. Column({ space: 10 }) {
  1146. Text('取空箱数量')
  1147. .textAlign(TextAlign.Center)
  1148. .width('80%')
  1149. .height('30%')
  1150. .fontWeight(FontWeight.Regular)
  1151. .fontSize($r('app.float.fontSize_24'))
  1152. .fontColor($r('app.color.black_90'))
  1153. Row() {
  1154. Image($r('app.media.subtract_disabled'))
  1155. .width(px2vp(120))
  1156. .height(px2vp(120))
  1157. .border({ width: 0.8 })
  1158. .borderRadius({ topLeft: px2vp(16), bottomLeft: px2vp(16) })
  1159. .onClick(() => {
  1160. if (this.callBoxNum <= 1) {
  1161. return
  1162. }
  1163. this.callBoxNum--
  1164. })
  1165. TextInput({ text: this.callBoxNum.toString() })
  1166. .fontSize($r('app.float.title_font_size'))
  1167. .fontWeight(FontWeight.Bold)
  1168. .fontColor($r('app.color.general_font_color'))
  1169. .height(px2vp(120))// .opacity($r('app.float.general_font_opacity'))
  1170. //.height('40%')
  1171. .width('50%')
  1172. .type(InputType.Number)
  1173. .textAlign(TextAlign.Center)
  1174. .borderRadius(0)
  1175. .backgroundColor($r('app.color.general_card_background_color'))
  1176. .border({ width: 0.8 })
  1177. .onChange((value: string) => {
  1178. if (!value || value.length === 0) {
  1179. this.callBoxNum = 0
  1180. return
  1181. }
  1182. let num: number = Number.parseInt(value)
  1183. if (num < 1) {
  1184. this.callBoxNum = 1
  1185. }
  1186. })
  1187. Image($r('app.media.add_disabled'))
  1188. .width(px2vp(120))
  1189. .height(px2vp(120))
  1190. .border({ width: 0.8 })
  1191. .borderRadius({ topRight: px2vp(16), bottomRight: px2vp(16) })
  1192. .onClick(() => {
  1193. this.callBoxNum++
  1194. })
  1195. }
  1196. .width('60%')
  1197. .height('40%')
  1198. .justifyContent(FlexAlign.Center)
  1199. Row() {
  1200. Button('取消')
  1201. .fontSize($r('app.float.fontSize_24'))
  1202. .fontColor($r('app.color.blue_100'))
  1203. .width('50%')
  1204. .height('100%')
  1205. .backgroundColor($r('app.color.black_6'))
  1206. .onClick(() => {
  1207. this.isTakeOutBox = 2
  1208. this.callBoxNum = 1
  1209. this.controller?.close()
  1210. })
  1211. Button('确认')
  1212. .fontSize($r('app.float.fontSize_24'))
  1213. .fontColor($r('app.color.general_font_white_color'))
  1214. .width('50%')
  1215. .height('100%')
  1216. .backgroundColor($r('app.color.blue_100'))
  1217. .onClick(() => {
  1218. // todo 调用硬件
  1219. this.isTakeOutBox = 1
  1220. this.controller?.close()
  1221. })
  1222. }
  1223. .width('60%')
  1224. .height('15%')
  1225. }.width('60%')
  1226. .height('50%')
  1227. .borderRadius($r('app.float.borderRadius_16'))
  1228. .backgroundColor($r('app.color.process_divider_white_color'))
  1229. }
  1230. }
  1231. // 扫描齐套料箱弹窗
  1232. @CustomDialog
  1233. struct scanningMaterialBox {
  1234. @Link binCode: string
  1235. @Link boxInfo: BoxInfo
  1236. @Link clickScan: number
  1237. @Link selectOrder: number
  1238. @Link vehicleCode: string
  1239. @Link orderArray: OrderInfo[]
  1240. async materialBoxHTTP(vehicleCode: string) {
  1241. return await StorageRequest.post('/api/v1/process/vehicleOperation/vehicleDetail', {
  1242. workOrderCode: this.orderArray[this.selectOrder]?.workOrderCode!,
  1243. vehicleCode: vehicleCode,
  1244. } as RequestParamModel) as BoxInfo
  1245. }
  1246. @Link materialCode: string
  1247. //扫码控制器
  1248. textController: TextInputController = new TextInputController()
  1249. controller: CustomDialogController
  1250. build() {
  1251. Column() {
  1252. Text('扫描料箱')
  1253. .fontSize($r('app.float.fontSize_38'))
  1254. .fontWeight(FontWeight.Medium)
  1255. .width('100%')
  1256. .height('40%')
  1257. .textAlign(TextAlign.Center)
  1258. Blank()
  1259. Row() {
  1260. Image($r('app.media.shaoma'))
  1261. .width('60px')
  1262. .height('60px')
  1263. TextInput({ text: this.materialCode,
  1264. placeholder: '点击扫码添加编码',
  1265. controller: this.textController })
  1266. .width('92%')
  1267. .height('100%')
  1268. .width('80%')
  1269. .fontWeight(FontWeight.Medium)
  1270. .fontSize('32px')
  1271. .backgroundColor("#ffff")
  1272. .borderRadius(21)
  1273. .onSubmit(() => {
  1274. this.binCode = this.materialCode
  1275. this.clickScan = 1
  1276. this.controller.close()
  1277. //this.boxInfo = await this.materialBoxHTTP(this.binCode)
  1278. })
  1279. Image($r('app.media.search'))
  1280. .width('60px')
  1281. .height('60px')
  1282. .onClick(async () => {
  1283. this.controller.close()
  1284. this.clickScan = 1
  1285. this.boxInfo = await this.materialBoxHTTP(this.binCode)
  1286. })
  1287. }
  1288. .width('60%')
  1289. .height('30%')
  1290. .border({ width: 0.4 })
  1291. .borderRadius(px2vp(100))
  1292. .alignItems(VerticalAlign.Center)
  1293. .backgroundColor($r('app.color.process_divider_white_color'))
  1294. Blank()
  1295. }
  1296. .width('50%')
  1297. .height('40%')
  1298. .padding(10)
  1299. .alignItems(HorizontalAlign.Center)
  1300. .borderRadius($r('app.float.borderRadius_16'))
  1301. .backgroundColor($r('app.color.process_divider_white_color'))
  1302. }
  1303. }
  1304. // 物料详情弹窗(序列号)
  1305. @CustomDialog
  1306. struct MaterialDetailOneDialog {
  1307. @Link material: Materialpositionclass
  1308. scroller: Scroller = new Scroller()
  1309. controller: CustomDialogController
  1310. // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
  1311. build() {
  1312. Column() {
  1313. Row() {
  1314. Text('物料详情')
  1315. .textAlign(TextAlign.Center)
  1316. .width('100%')
  1317. .height('20%')
  1318. .fontSize($r('app.float.fontSize_24'))
  1319. }
  1320. .height('25%')
  1321. Column({ space: 20 }) {
  1322. Column({ space: 10 }) {
  1323. Text(this.material?.materialName && this.material?.materialName.length > 0 ? this.material.materialName! : '')
  1324. .fontSize($r('app.float.fontSize_20'))
  1325. .fontColor($r('app.color.general_font_white_color'))
  1326. .opacity($r('app.float.card_font_default_opacity'))
  1327. .width('100%')
  1328. Text('100*200')
  1329. .fontSize($r('app.float.robot_state_font_size'))
  1330. .textAlign(TextAlign.Start)
  1331. .fontColor('#99000000')
  1332. .width('100%')
  1333. Text('批次号:' + '1223341232123124121')
  1334. .fontSize($r('app.float.robot_state_font_size'))
  1335. .textAlign(TextAlign.Start)
  1336. .fontColor('#99000000')
  1337. .width('100%')
  1338. Text('计划编号:' + '1231231231233')
  1339. .fontSize($r('app.float.robot_state_font_size'))
  1340. .textAlign(TextAlign.Start)
  1341. .fontColor('#99000000')
  1342. .width('100%')
  1343. Text('订单编号:' + '1231231231233')
  1344. .fontSize($r('app.float.robot_state_font_size'))
  1345. .textAlign(TextAlign.Start)
  1346. .fontColor('#99000000')
  1347. .width('100%')
  1348. Text('出库单号:' + '1231231231233')
  1349. .fontSize($r('app.float.robot_state_font_size'))
  1350. .textAlign(TextAlign.Start)
  1351. .fontColor('#99000000')
  1352. .width('100%')
  1353. }.width('40%')
  1354. .height('30%')
  1355. Divider().vertical(false)
  1356. .width('60%')
  1357. Column() {
  1358. Text('录入数量')
  1359. .fontSize($r('app.float.robot_state_font_size'))
  1360. .textAlign(TextAlign.Start)
  1361. .fontColor('#99000000')
  1362. .width('40%')
  1363. Counter() {
  1364. }
  1365. .width('417px')
  1366. .height('107px')
  1367. .onInc(() => {
  1368. })
  1369. .onDec(() => {
  1370. })
  1371. }
  1372. }
  1373. .width('50%')
  1374. .height('100%')
  1375. .backgroundColor('#F1F3F5')
  1376. .borderRadius(20)
  1377. Row() {
  1378. }.width('25%')
  1379. .height('100%')
  1380. .onClick(() => {
  1381. this.controller.close()
  1382. })
  1383. }
  1384. .width('48%')
  1385. .height('74%')
  1386. .backgroundColor($r('app.color.white_f1f3f5'))
  1387. .height('100%')
  1388. .justifyContent(FlexAlign.Center)
  1389. }
  1390. }
  1391. // 物料详情弹窗(批次号)
  1392. @CustomDialog
  1393. struct MaterialDetailTwoDialog {
  1394. @Link value: number
  1395. @Link CunQuHuo: number
  1396. scroller: Scroller = new Scroller()
  1397. @State navigation: number = 0
  1398. @Link textValue: string
  1399. @Link inputValue: string
  1400. controller: CustomDialogController
  1401. // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
  1402. build() {
  1403. Column() {
  1404. Column() {
  1405. }
  1406. .width('100%')
  1407. .height('20%')
  1408. .onClick(() => {
  1409. this.controller.close()
  1410. })
  1411. Row() {
  1412. Row() {
  1413. }
  1414. .width('25%')
  1415. .height('100%')
  1416. .onClick(() => {
  1417. this.controller.close()
  1418. })
  1419. Column({ space: 20 }) {
  1420. Text('物料详情')
  1421. .textAlign(TextAlign.Center)
  1422. .width('100%')
  1423. .height('20%')
  1424. .fontSize('51px')
  1425. Column({ space: 10 }) {
  1426. Text('PCBA-ASSSD电路板')
  1427. .fontSize('32px')
  1428. .width('100%')
  1429. Text('100*200')
  1430. .fontSize($r('app.float.robot_state_font_size'))
  1431. .textAlign(TextAlign.Start)
  1432. .fontColor('#99000000')
  1433. .width('100%')
  1434. Text('批次号:' + '1223341232123124121')
  1435. .fontSize($r('app.float.robot_state_font_size'))
  1436. .textAlign(TextAlign.Start)
  1437. .fontColor('#99000000')
  1438. .width('100%')
  1439. Text('计划编号:' + '1231231231233')
  1440. .fontSize($r('app.float.robot_state_font_size'))
  1441. .textAlign(TextAlign.Start)
  1442. .fontColor('#99000000')
  1443. .width('100%')
  1444. Text('订单编号:' + '1231231231233')
  1445. .fontSize($r('app.float.robot_state_font_size'))
  1446. .textAlign(TextAlign.Start)
  1447. .fontColor('#99000000')
  1448. .width('100%')
  1449. Text('出库单号:' + '1231231231233')
  1450. .fontSize($r('app.float.robot_state_font_size'))
  1451. .textAlign(TextAlign.Start)
  1452. .fontColor('#99000000')
  1453. .width('100%')
  1454. }.width('40%')
  1455. .height('30%')
  1456. Divider().vertical(false)
  1457. .width('60%')
  1458. Column() {
  1459. Text('录入数量')
  1460. .fontSize($r('app.float.robot_state_font_size'))
  1461. .textAlign(TextAlign.Start)
  1462. .fontColor('#99000000')
  1463. .width('40%')
  1464. Counter() {
  1465. Text(this.value.toString())
  1466. }
  1467. .width('417px')
  1468. .height('107px')
  1469. .onInc(() => {
  1470. this.value++
  1471. })
  1472. .onDec(() => {
  1473. this.value--
  1474. })
  1475. }
  1476. }.width('50%')
  1477. .height('100%')
  1478. .backgroundColor('#F1F3F5')
  1479. .borderRadius(20)
  1480. Row() {
  1481. }.width('25%')
  1482. .height('100%')
  1483. .onClick(() => {
  1484. this.controller.close()
  1485. })
  1486. }.width('100%')
  1487. .height('60%')
  1488. Column() {
  1489. }.width('100%')
  1490. .height('20%')
  1491. .onClick(() => {
  1492. this.controller.close()
  1493. })
  1494. }.width('100%')
  1495. .backgroundColor('#4d000000')
  1496. .height('100%')
  1497. .justifyContent(FlexAlign.Center)
  1498. // dialog默认的borderRadius为24vp,如果需要使用border属性,请和borderRadius属性一起使用。
  1499. }
  1500. }
  1501. function getMaterialPositionStr(locationNo: string): string {
  1502. if (!locationNo || locationNo.length <= 0 || locationNo.split('-').length != 3) {
  1503. return ''
  1504. }
  1505. let resultStr: string = 'X:'
  1506. let strArray: string[] = locationNo.split('-')
  1507. resultStr += strArray[0]
  1508. resultStr += ' Y:' + strArray[1]
  1509. resultStr += ' ' + strArray[2] + '层'
  1510. return resultStr
  1511. }
  1512. class BoxInfo {
  1513. // 是否可绑定0-否 1-是
  1514. isEnable?: number
  1515. // 物料信息
  1516. list?: MaterialInfo[]
  1517. // 料箱id
  1518. vehicleId?: string
  1519. // 料箱名称
  1520. vehicleName?: string
  1521. // 料箱编号
  1522. vehicleNo?: string
  1523. }
  1524. export interface boxMaterialClass {
  1525. //料箱等级
  1526. vehicleLevel?: string
  1527. materialCode?: string
  1528. //载具编号
  1529. vehicleCode?: string
  1530. //产品规格
  1531. spec?: string
  1532. //批次号
  1533. batchCode?: string;
  1534. ///完成数量
  1535. completedNum?: number
  1536. //已经占用箱数
  1537. useNum?: number
  1538. //空箱数
  1539. emptyBoxNum?: string
  1540. //可用箱数
  1541. canUsedNum?: string
  1542. //总容量箱数
  1543. allNum?: number
  1544. //仓储类型
  1545. type?: string
  1546. //储位坐标
  1547. coordinate?: string
  1548. //储位位置
  1549. position?: string
  1550. //创建时间
  1551. created?: string
  1552. //
  1553. creator?: string
  1554. //仓库编码
  1555. houseNo?: string
  1556. deptId?: string
  1557. houseType?: string
  1558. //主键
  1559. id?: string
  1560. locationNo?: string
  1561. // 物料名称
  1562. materialName?: string
  1563. //物料编码
  1564. materialNo?: string
  1565. //出入库数量
  1566. num?: number
  1567. orgId?: string
  1568. planNo?: string
  1569. // 序列号
  1570. seqNo?: string
  1571. // 状态;1-待处理;2-处理中;3-处理异常;4-已完成
  1572. state?: number
  1573. // 库存数量
  1574. stockNum?: string
  1575. //出入库任务单号
  1576. taskNo?: string
  1577. unit?: string
  1578. updated?: string
  1579. //任务名称
  1580. taskName?: string
  1581. updator?: string
  1582. vehicleNo?: string
  1583. pageNo?: number
  1584. pageSize?: number
  1585. }
  1586. export interface outBoxClass {
  1587. orderId?: string
  1588. orderType?: string
  1589. }
  1590. export interface outboundClass {
  1591. cmdId?: string
  1592. code?: string
  1593. msg?: string
  1594. }
  1595. export class controlClass {
  1596. houseNo?: string
  1597. orderId?: string
  1598. type?: number
  1599. vehicleNo?: string
  1600. }