Quellcode durchsuchen

卸货重量优化

fanzherong_v vor 2 Wochen
Ursprung
Commit
106c984a5e

+ 1 - 1
snowy-admin-web/src/views/biz/bizappointmentrecord/index.vue

@@ -176,7 +176,7 @@
 									<a-menu-item v-if="hasPerm('bizAppointmentAudit') && (record.status == '1')">
 										<a style="color: #ffaa00" @click="reviewRef.showModal(record.id)">审核</a>
 									</a-menu-item>
-									<a-menu-item v-if="hasPerm('bizAppointmentRecordEdit') && (record.status == '2')">
+									<a-menu-item v-if="hasPerm('bizAppointmentRecordEdit') && (record.status == '2' || record.status == '4')">
 										<a style="color:blue" @click="formRef.onOpen(record)" >编辑</a>
 									</a-menu-item>
 									<a-menu-item v-if="hasPerm('bizAppointmentRecordDelete') && (record.status == '2' || record.status == '4')">

+ 3 - 1
snowy-admin-web/src/views/biz/bizsendrecord/index.vue

@@ -287,7 +287,9 @@
 		}
 		console.log("userInfo:"+JSON.stringify(userInfo.roleCodeList))
 		if(userInfo.roleCodeList.includes('send')){
-			searchFormParam.sendRecordStatus = '3'
+			if(searchFormParam.sendRecordStatus == null || searchFormParam.sendRecordStatus==''){
+				searchFormParam.sendRecordStatus = '3'
+			}
 		}
 		return bizRecordApi.bizRecordPage(Object.assign(parameter, searchFormParam)).then((data) => {
 			return data

+ 17 - 23
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/record/service/impl/BizRecordServiceImpl.java

@@ -167,9 +167,10 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
                 queryWrapper.isNotNull("br.confirm_user");
             }
 
-            //if(StringUtils.equals(StpLoginUserUtil.getLoginUser().getRoleCodeList())){}
-            //查询装卸地点
-            queryWrapper.eq("blu.user_id",StpLoginUserUtil.getLoginUser().getId());
+            if(StpLoginUserUtil.getLoginUser().getRoleCodeList().contains("send")){
+                //查询装卸地点
+                queryWrapper.eq("blu.user_id",StpLoginUserUtil.getLoginUser().getId());
+            }
         }
         if (ObjectUtil.isNotEmpty(bizRecordPageParam.getOrderName())){
             queryWrapper.like("bo.order_name",bizRecordPageParam.getOrderName());
@@ -653,32 +654,25 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
         this.updateById(bizRecord);
 
         //净重和卸货重量进行对比
-        BigDecimal weight = new BigDecimal(0);
-        if(bizRecord.getNetWeight().compareTo(bizRecordEditParam.getUnloadWeight()) >= 0){
-            weight = bizRecord.getNetWeight().subtract(bizRecordEditParam.getUnloadWeight().multiply(new BigDecimal(1000)));
-        }else{
-            weight = bizRecord.getNetWeight().subtract(bizRecordEditParam.getUnloadWeight().multiply(new BigDecimal(1000))).negate();
-        }
-
+        BizConfig bizConfig = bizConfigService.getOne(new QueryWrapper<BizConfig>().lambda().last("limit 1"));
+        BigDecimal weight = bizRecord.getNetWeight().multiply(bizConfig.getLossWarn()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
+        //上限
+        BigDecimal upWeight = bizRecord.getNetWeight().add(weight);
+        //下限
+        BigDecimal downWeight = bizRecord.getNetWeight().subtract(weight);
+        log.info("司机回签,车牌号:"+bizRecord.getLicensePlate()+"卸货重量的范围:"+downWeight+"~"+upWeight);
         //如果差值等于0说明没有误差,预约状态修改为11,已签收
         //查询预约记录run
         BizAppointmentRecord appointmentRecord = bizAppointmentRecordService.getById(bizRecord.getAppointmentId());
         if(ObjectUtil.isNotNull(appointmentRecord)){
-            if(weight.compareTo(BigDecimal.ZERO) == 0){
-                appointmentRecord.setStatus("11");
-            }else if(bizRecord.getNetWeight().compareTo(BigDecimal.ZERO) == 0){
+            if(bizRecord.getUnloadWeight().compareTo(upWeight) > 0){
+                log.info("车牌号:"+bizRecord.getLicensePlate()+"卸货重量:"+bizRecord.getUnloadWeight()+"超出百分之二");
+                throw new CommonException("卸货重量已经超出百分之二,不可填写!");
+            }else if(bizRecord.getUnloadWeight().compareTo(downWeight) < 0){
                 appointmentRecord.setStatus("12");
+                log.info("车牌号:"+bizRecord.getLicensePlate()+"卸货重量:"+bizRecord.getUnloadWeight()+"低于百分之二");
             }else{
-                //计算差值百分比
-                BigDecimal decimal = weight.divide(bizRecord.getNetWeight(),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
-                log.info("司机回签卸货百分比:"+decimal);
-                BizConfig bizConfig = bizConfigService.getOne(new QueryWrapper<BizConfig>().lambda().last("limit 1"));
-                log.info("配置卸货百分比:"+bizConfig.getLossWarn());
-                if(decimal.compareTo(bizConfig.getLossWarn()) > 0){
-                    appointmentRecord.setStatus("12");
-                }else{
-                    appointmentRecord.setStatus("11");
-                }
+                appointmentRecord.setStatus("11");
             }
             bizAppointmentRecordService.updateById(appointmentRecord);
         }