getDateformat百度百科

本文详细介绍了 GetDateFormat 函数的使用方法,包括如何针对指定的本地格式对系统日期进行格式化,以及各参数的具体含义。此外,还提供了错误处理指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

GetDateFormat  
[声明]   Declare Function GetDateFormat Lib "kernel32" Alias "GetDateFormatA" (ByVal Locale As Long, ByVal dwFlags As Long, lpDate As SYSTEMTIME, ByVal lpFormat As String, ByVal lpDateStr As String, ByVal cchDate As Long) As Long   [说明]   针对指定的“当地”格式,对一个系统日期进行格式化   [参数表]   Locale --------- Long,用于决定格式的地方ID。lpFormat参数中指定的任何信息(倘若不是NULL)都优先于特定于地方的信息   dwFlags -------- Long,如指定了lpFormat,那么该参数应该为零。否则,可设为LOCALE_NOUSEROVERRIDE,强制使用系统地方参数——即使它们已由用户取代。用DATE_SHORTDATE   或 DATE_LONGDATE选择不同的日期格式   lpDate --------- SYSTEMTIME,包含了一个系统日期的结构   lpFormat ------- String,可设为NULL,使用特定于不同地方的值(用vbNullString传递一个NULL)。否则包含一个日期格式字串。对d,dd,ddd,dddd,m,mm,mmm,mmmm,y,yy,yyyy这样的代码,它们的用法与在vb格式命令中的用法是相同的。注意用gg指定一个“纪元”   lpDateStr ------ String,指定一个缓冲区,用于容纳格式化过后的字串。注意事先对字串进行初始化   cchDate -------- Long,lpDateStr缓冲区的长度。如为零,表示函数会返回需要缓冲区的大小   [返回值]   Long,格式化过后的字串的长度。零表示出错,会将GetLastError设置为下述值之一:ERROR_INSUFFICIENT_BUFFER,ERROR_INVALID_FLAGS,ERROR_INVALID_PARAMETER
private synchronized void execute(ProduceUploadForm form, ProduceOrderEntity orderEntity) { log.info("采集队列:开始写入生产工单{}的关联码信息", orderEntity.getOrderCode()); long startTime = System.currentTimeMillis(); // 获取物料包装转换关系 List<SysSimpleConvertVo> unitConvertVos = new Gson() .fromJson(orderEntity.getPackingJson(), TypeToken.getParameterized(List.class, SysSimpleConvertVo.class).getType()); unitConvertVos.removeIf(convertVo -> Objects.equals(convertVo.getActualPackingLevel(), -1)); SysSimpleConvertVo palletConvertVo = unitConvertVos.stream() .filter(convertVo -> produceOrderCodeService.isPallet(convertVo.getMaterialUnitName())) .findFirst() .orElse(null); Map<Integer, List<SysSimpleConvertVo>> unitConvertMap = unitConvertVos.stream() .collect(Collectors.groupingBy(SysSimpleConvertVo::getActualPackingLevel)); // 遍历上传的码信息 List<ProduceOrderCodeEntity> codeEntities = new ArrayList<>(); AtomicInteger palletCount = new AtomicInteger(0); for (ProduceCodeUploadForm codeForm : form.getCodeForms()) { try { if (Objects.nonNull(palletConvertVo) && Objects.equals(codeForm.getPackageLevel(), palletConvertVo.getActualPackingLevel())) { // 将托盘码信息插入周转托盘表中 processTurnoverContainer(orderEntity, codeForm, unitConvertVos); palletCount.incrementAndGet(); if (CollUtil.isNotEmpty(codeForm.getCodeForms())) { assembleCodeEntity(orderEntity, unitConvertMap, codeEntities, codeForm, codeForm.getCodeForms()); } } else { // 不含托盘数据,则将码信息插入生产采集码表中 assembleCodeEntity(orderEntity, unitConvertMap, codeEntities, codeForm, form.getCodeForms()); } } catch (Exception e) { ProduceOrderErrorLogForm errorLogForm = new ProduceOrderErrorLogForm(); errorLogForm.setOrderEntity(orderEntity); errorLogForm.setErrorCodeForms(Collections.singletonList(codeForm)); errorLogForm.setErrorType(3); errorLogForm.setErrorFilePath(""); errorLogForm.setErrorMsg(e.getMessage()); produceOrderErrorLogService.addLogs(errorLogForm); } } if (palletCount.get() > 0) { log.info("采集队列:写入工单[{}][托盘码]信息完成,数量:{}", orderEntity.getOrderCode(), palletCount.get()); } // 保存码信息 saveProduceCodeEntities(form, orderEntity, codeEntities); log.info("采集队列:生产工单[{}]的关联码数据写入完成,耗时:{} 秒", orderEntity.getOrderCode(), DateUtil.getDateFormat(System.currentTimeMillis() - startTime, "ss.SSS")); // 统计码数量 MessageDTO message = new MessageDTO(); message.setId(UUID.randomUUID().toString()); message.setProduceOrderEntity(new AtomicReference<>(orderEntity)); message.setTimestamp(System.currentTimeMillis()); message.setType(new AtomicInteger(3)); // messageProducer.delaySend(message, 3); message.setQueue(queueConfigure.getProduceCodeQueue()); message.setDelayLevel(3); mqProducerSet.sendMessageSet(message,"delay"); } 将这个方法改成支持多线程
最新发布
07-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值