소스 검색

5-24更新,添加其他业务顺序限制

qzyReal 3 년 전
부모
커밋
15a3dffb25

+ 3 - 0
app/apis/api.js

@@ -204,6 +204,9 @@ export default {
 	},
 	getItemTypeEnum(){
 		return ajax.get('/TbItem/getItemType')
+	},
+	searchCar(data){
+		return ajax.get('/TbBusinessCar/searchInNotOutCar',data)
 	}
 	
 }

+ 55 - 10
app/pages/onely-disinfect/type-business-edit.vue

@@ -20,9 +20,16 @@
 			<view class="item">
 				<view class="l"><text style="color: red;">*</text>车牌号:</view>
 				<view class="r">
-					<u-input placeholder="请填写车牌号" v-model="form.carNo" />
+					<u-input @input="carInputFn" placeholder="请填写车牌号" v-model="form.carNo" />
 				</view>
 			</view>
+			<view class="list" v-show="carList.length>0&&showSelect">
+				<u-radio-group v-model="form.carNo" placement="column" @change="groupChange">
+					<u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in carList" :key="index"
+						:label="item.carNo" :name="item.carNo">
+					</u-radio>
+				</u-radio-group>
+			</view>
 			<view class="item">
 				<view class="l">车辆类型:</view>
 				<view class="r">
@@ -130,7 +137,10 @@
 					id: '',
 					name: '',
 					items: []
-				}
+				},
+				checkList: [],
+				showSelect: false,
+				carList: []
 			}
 		},
 		computed: {
@@ -148,7 +158,6 @@
 		},
 		onLoad(options) {
 			this.form.id = options.id;
-			this.getOtherBusinessById();
 			this.customerId = uni.getStorageSync('customerId');
 			let that = this;
 			uni.$on('getRemark', data => {
@@ -157,12 +166,41 @@
 					items.filter(obj => obj.id == data.itemId)[0].remark = data.remark;
 				})
 			})
+			setTimeout(() => {
+				this.showSelect = false;
+			}, 1000)
+		},
+		onShow() {
+			this.getOtherBusinessById();
 		},
 		onBackPress() {
 			this.$common.to('/pages/onely-disinfect/Index');
 			return true;
 		},
 		methods: {
+			carInputFn() {
+				this.$api.searchCar({
+					carNo: this.form.carNo
+				}).then(resp => {
+					this.carList = resp.data;
+					if (this.carList.length > 0) {
+						this.showSelect = true;
+					}
+				})
+			},
+			showWin() {
+				this.$refs.popup.open('bottom')
+			},
+			groupChange(carNo) {
+				let list = this.carList;
+				let data = list.filter(obj => obj.carNo == carNo).pop();
+				this.form.carNo = carNo;
+				this.form.carSize = data.carSize;
+				this.list = [];
+				setTimeout(() => {
+					this.showSelect = false;
+				}, 1200)
+			},
 			getItemTypeEnum() {
 				this.$api.getItemTypeEnum().then(resp => {
 					this.type.list = resp.data;
@@ -213,7 +251,7 @@
 				})
 			},
 			bindPickerChange(e) {
-				this.checkList=[];
+				this.checkList = [];
 				let index = e.detail.value;
 				this.type.index = index //当前picker选中的值
 				this.getItemType();
@@ -227,12 +265,8 @@
 					this.$common.toast('请输入车牌号')
 					return;
 				}
-				if (!this.$common.isNum(this.form.carSize)) {
-					this.$common.toast('请输入正确的规格')
-					return;
-				}
-				if (this.type.index == 1 && !this.$common.isNum(this.form.carWeight)) {
-					this.$common.toast('请输正确的载重')
+				if (!this.form.operateTime) {
+					this.$common.toast('请选择作业时间')
 					return;
 				}
 				let itemList = this.itemType.items;
@@ -292,6 +326,17 @@
 		background-color: #fff;
 	}
 
+	.list {
+		position: absolute;
+		left: 34%;
+		z-index: 999;
+		background: #e5e5e5;
+		padding: 10rpx 200rpx 10rpx 40rpx;
+		border-radius: 10rpx;
+		height: 120rpx;
+		overflow-y: auto;
+	}
+
 	.hs-item {
 		text-align: center;
 	}

+ 22 - 28
app/pages/onely-disinfect/type-business.vue

@@ -24,7 +24,7 @@
 					<u-input @input="carInputFn" placeholder="请填写车牌号" v-model="form.carNo" />
 				</view>
 			</view>
-			<view class="list" v-show="carList.length>0">
+			<view class="list" v-show="carList.length>0&&showSelect">
 				<u-radio-group v-model="form.carNo" placement="column" @change="groupChange">
 					<u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in carList" :key="index"
 						:label="item.carNo" :name="item.carNo">
@@ -143,31 +143,8 @@
 					name: '',
 					items: []
 				},
-				carList: [{
-						id: '1234',
-						carNo: '桂a09345'
-					},
-					{
-						id: '342',
-						carNo: '桂a09343'
-					},
-					{
-						id: '5431',
-						carNo: '桂a09645'
-					},
-					{
-						id: '5431',
-						carNo: '桂a09645'
-					},
-					{
-						id: '5431',
-						carNo: '桂a09645'
-					},
-					{
-						id: '5431',
-						carNo: '桂a09645'
-					},
-				]
+				showSelect:false,
+				carList: []
 			}
 		},
 		computed: {
@@ -204,12 +181,25 @@
 
 		methods: {
 			carInputFn() {
+				this.$api.searchCar({carNo:this.form.carNo}).then(resp=>{
+					this.carList=resp.data;
+					if(this.carList.length>0){
+						this.showSelect=true;
+					}
+				})
 			},
 			showWin() {
 				this.$refs.popup.open('bottom')
 			},
-			groupChange() {
-				console.log(11)
+			groupChange(carNo) {
+				let list=this.carList;
+				let data=list.filter(obj=>obj.carNo==carNo).pop();
+				this.form.carNo=carNo;
+				this.form.carSize=data.carSize;
+				this.list=[];
+				setTimeout(()=>{
+					this.showSelect=false;
+				},1200)
 			},
 			getItemTypeEnum() {
 				this.$api.getItemTypeEnum().then(resp => {
@@ -263,6 +253,10 @@
 					this.$common.toast('请输入车牌号')
 					return;
 				}
+				if (!this.form.operateTime) {
+					this.$common.toast('请选择作业时间')
+					return;
+				}
 				let itemList = this.itemType.items;
 				let checkList = this.checkList;
 				let list = itemList.filter(obj => checkList.indexOf(obj.id) !== -1);

+ 2 - 2
app/utils/request.js

@@ -1,6 +1,6 @@
-const server = 'http://127.0.0.1:8099/pro';
+// const server = 'http://127.0.0.1:8099/pro';
 // const server = 'https://pco.aseanbusiness.cn/pro';
-// const server = 'https://dxkaa1.bgigc.com/pro';
+const server = 'https://dxkaa1.bgigc.com/pro';
 
 import common from '../common/js/common.js';
 

+ 16 - 4
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -331,6 +331,7 @@ public class ApiService {
                 .setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
         tbBusinessCarService.saveOrUpdate(db);
         TbBusiness tbBusiness = new TbBusiness();
+        tbBusiness.setCreateBy(StpUserUtil.getAdmin().getName());
         tbBusiness.setBusinessCarId(db.getId()).setPayStep(tbItemType.getPayStep());
         TbCostomer tbCostomer = tbCostomerService.getById(customerId);
         if (tbCostomer != null) {
@@ -411,9 +412,20 @@ public class ApiService {
         }
         String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4);
         TbBusinessCar tbBusinessCar = tbBusinessCarService.getById(tbBusiness.getBusinessCarId());
-        tbBusinessCar.setCarSize(otherBusinessBO.getCarSize()).setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode())
-                .setCustomerId(otherBusinessBO.getCustomerId()).setCarNo(carNo)
-                .setTimeUpdate(new Date());
+        TbBusinessCar otherCar=  tbBusinessCarService.searchOtherBusinessCarNotOut(carNo);
+        if (otherCar!=null){
+            List<TbBusiness>checkList=tbBusinessService.findOtherBusinessByCarId(tbBusiness.getBusinessCarId());
+            if (checkList.size()==1){
+                tbBusinessCarService.removeById(tbBusiness.getBusinessCarId());
+            }
+            tbBusiness.setBusinessCarId(otherCar.getId());
+        }else {
+            tbBusinessCar.setCarSize(otherBusinessBO.getCarSize()).setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode())
+                    .setCustomerId(otherBusinessBO.getCustomerId()).setCarNo(carNo)
+                    .setTimeUpdate(new Date());
+            tbBusinessCarService.updateById(tbBusinessCar);
+        }
+
         int index = 1;
         BigDecimal price = new BigDecimal("0");
         List<TbBusinessItem> itemList = new ArrayList<>();
@@ -439,7 +451,7 @@ public class ApiService {
         }
         tbBusinessItemService.saveBatch(itemList);
         tbBusinessService.updateById(tbBusiness);
-        tbBusinessCarService.updateById(tbBusinessCar);
+
 
     }
 

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java

@@ -231,6 +231,7 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
 
     private String itemTypeName;
 
+
     private Integer payStep=2;
 
     private transient String itemJson;

+ 3 - 44
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -140,12 +140,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
 
-    public TbBusiness checkCarNo(String carNo) {
-        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
-        ew.eq("card_no", carNo)
-                .eq("admin_confirm_out", 0);
-        return this.getOne(ew);
-    }
 
     /**
      * 增
@@ -422,16 +416,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         });
     }
 
-    public TbBusiness findCarTheNewRecord(String carNo, int inOrOut) {
-        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
-        ew.eq("card_no", carNo);
-        if (inOrOut == 1) {
-            ew.eq("admin_confirm_in", 0).isNull("in_channel");
-        } else {
-            ew.eq("admin_confirm_out", 0).isNull("out_channel").isNotNull("real_in_time");
-        }
-        return getOne(ew);
-    }
+
 
     @Deprecated
     public void adminConfirmIn(String id, String inChannel) {
@@ -503,30 +488,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     }
 
 
-    /**
-     * @param carNo
-     * @param inOrOut 1入 2出
-     * @return
-     */
-    public TbBusiness findByChinaCarNo(String carNo, int inOrOut) {
-        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
-        ew.like("china_car_no", carNo);
-        if (inOrOut == 1) {
-            ew.eq("admin_confirm_in", 0).isNull("china_car_in_channel");
-        } else {
-            ew.eq("admin_confirm_out", 0)
-                    .isNull("china_car_out_channel")
-                    .isNotNull("china_car_in_time");
-        }
-        return this.getOne(ew);
-    }
 
 
-    public TbBusiness finByNo(String no) {
-        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
-        ew.eq("no", no);
-        return getOne(ew);
-    }
+
 
     public Map<String, Object> getBusinessMoney(String carId, String state) {
         Map<String, Object> result = new HashMap<>();
@@ -625,12 +589,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusinessCarService.updateBatchById(cars);
     }
 
-    public TbBusiness checkCar(String carNo) {
-        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
-        ew.eq("car_no", carNo);
-        ew.eq("admin_confirm_input", 0);
-        return this.getOne(ew);
-    }
+
 
     public List<CarDisincle> getCarDisincleList(SoMap soMap) {
         return tbBusinessMapper.getCarDisincleList(soMap);

+ 36 - 35
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -129,14 +129,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         return getOne(ew);
     }
 
-    public TbBusinessCar findInAndHasBusinessCar(String carNo) {
-        QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
-        ew.eq("car_no", carNo.toUpperCase())
-                .isNotNull("real_in_time")
-                .isNotNull("business_id")
-                .isNull("real_out_time");
-        return getOne(ew);
-    }
 
     public List<TbBusinessCar> findInAndNoBusinessCar() {
         QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
@@ -165,8 +157,10 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
 
     public TbBusinessCar findNotInCar(String carNo) {
         QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
-        ew.eq("car_no", carNo.toUpperCase()).isNull("real_in_time");
-        return this.getOne(ew);
+        ew.eq("car_no", carNo.toUpperCase())
+                .isNull("real_in_time").orderByDesc("id");
+        List<TbBusinessCar> list = list(ew);
+        return list.isEmpty() ? null : list.get(0);
     }
 
     public TbBusinessCar findNotOutCar(String carNo) {
@@ -176,7 +170,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
                 .isNotNull("real_in_time");
         List<TbBusinessCar> list = list(ew);
         if (list.size() > 1) {
-            throw new BusinessException("该车有多个未出场记录");
+            throw new BusinessException("该车" + carNo + "有多个未出场记录");
         }
         return getOne(ew);
     }
@@ -235,13 +229,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         this.updateById(car);
     }
 
-    public TbBusinessCar findInBuNoOutAndNotPay(String carNo) {
-        QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
-        ew.eq("car_no", carNo.toUpperCase())
-                .isNull("real_out_time")
-                .isNotNull("real_in_time").eq("pay", "0");
-        return getOne(ew);
-    }
 
     public AjaxJson deleteCar(String id) {
         TbBusinessCar db = this.getById(id);
@@ -253,12 +240,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         return AjaxJson.getSuccess();
     }
 
-    public TbBusinessCar checkCar(String carNo) {
-        QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
-        ew.eq("car_no", carNo);
-        ew.eq("pay", 0);
-        return this.getOne(ew);
-    }
 
     public TbBusinessCar findTheLastRecord(String carNo) {
         QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
@@ -280,20 +261,25 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     }
 
     public void updateCarRecord(TbBusinessCar t) throws Exception {
-        if (StrUtil.isEmpty(t.getBusinessId())) {
-            t.setBusinessId(null);
-        }
-        if (StrUtil.isEmpty(t.getCustomerId())) {
-            t.setCustomerId(null);
+        TbBusinessCar db = this.getById(t.getId());
+        if (StrUtil.equals(db.getCarNo().toUpperCase().trim(), t.getCarNo().toUpperCase().trim())) {
+            db.setRealInTime(t.getRealInTime()).setColor(t.getColor())
+                    .setRealOutTime(t.getRealOutTime()).setInImage(t.getInImage())
+                    .setOutImage(t.getOutImage())
+                    .setCarSize(t.getCarSize())
+                    .setDriverName(t.getDriverName())
+                    .setDriverPhone(t.getDriverPhone()).setTimeUpdate(new Date());
+            this.updateById(db);
+            return;
         }
         String carNo = t.getCarNo().toUpperCase();
         TbBusinessCar old = this.getById(t.getId());
         String oldCarNo = old.getCarNo();
-        TbBusinessCar db = this.check(carNo);
-        String businessId = t.getBusinessId();
-        if (db != null && !StrUtil.equals(t.getId(), db.getId())) {
-            throw new Exception("该车有未完成业务");
+        TbBusinessCar notOutCar = findNotOutCar(carNo);
+        if (notOutCar != null && !notOutCar.getId().equals(t.getId())) {
+            throw new Exception("该车" + carNo + "已进场但未出场");
         }
+        String businessId = t.getBusinessId();
         TbBusinessCar businessCar = this.findByBusinessIdAndCarNo(businessId, carNo);
         if (businessCar != null && !StrUtil.equals(t.getId(), businessCar.getId())) {
             throw new Exception("车辆已存在");
@@ -403,10 +389,25 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     }
 
     public List<TbBusinessCar> findNotOutCarLike(String carNo) {
+        if (StrUtil.isEmpty(carNo) || StrUtil.length(carNo) < 3) {
+            return Collections.emptyList();
+        }
         QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
         ew.select("car_no,car_size");
-        ew.like("car_no", carNo.toUpperCase());
-        List<TbBusinessCar>list=list(ew);
+        ew.like("car_no", carNo.trim().toUpperCase());
+        ew.isNull("real_out_time")
+                .isNotNull("real_in_time");
+        List<TbBusinessCar> list = list(ew);
         return list.stream().distinct().collect(Collectors.toList());
     }
+
+    public TbBusinessCar searchOtherBusinessCarNotOut(String carNo) {
+        QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
+        ew.isNull("real_out_time")
+                .isNull("business_id")
+                .eq("car_no", carNo.trim().toUpperCase())
+                .orderByDesc("time_update");
+        List<TbBusinessCar> list = list(ew);
+        return list.isEmpty() ? null : list.get(0);
+    }
 }

+ 1 - 6
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java

@@ -111,12 +111,7 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbB
         return list(ew);
     }
 
-    public TbBusinessItem findByBusinessIdAndTypeName(String businessId, String itemTypeName) {
-        QueryWrapper<TbBusinessItem> ew = new QueryWrapper<>();
-        ew.eq("business_id", businessId);
-        ew.eq("item_type_name", itemTypeName);
-        return getOne(ew);
-    }
+
 
     public void confirmBusinessItem(long id) {
         TbBusinessItem tbBusinessItem = this.getById(id);

+ 2 - 10
sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareService.java

@@ -54,11 +54,7 @@ public class TbDeclareService extends ServiceImpl<TbDeclareMapper, TbDeclare> im
 	}
 
 
-	public TbDeclare findByProductionCode(String productionCode) {
-		QueryWrapper<TbDeclare>ew=new QueryWrapper<>();
-		ew.eq("production_code",productionCode);
-		return getOne(ew);
-	}
+
 
 	public TbDeclare findByDeclareNo(String declareNo) {
 		QueryWrapper<TbDeclare>ew=new QueryWrapper<>();
@@ -66,11 +62,7 @@ public class TbDeclareService extends ServiceImpl<TbDeclareMapper, TbDeclare> im
 		return getOne(ew);
 	}
 
-	public TbDeclare findByBusinessId(String businessId) {
-		QueryWrapper<TbDeclare>ew=new QueryWrapper<>();
-		ew.eq("business_id",businessId);
-		return this.getOne(ew);
-	}
+
 
 	public void removeBusinessId(String businessId) {
 		tbDeclareMapper.removeBusinessId(businessId);

+ 0 - 5
sp-server/src/main/java/com/pj/project/tb_goods/TbGoodsService.java

@@ -48,9 +48,4 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper,TbGoods> implement
 	}
 
 
-	public TbGoods findByName(String goodsName) {
-		QueryWrapper<TbGoods>ew=new QueryWrapper<>();
-		ew.eq("name",goodsName);
-		return getOne(ew);
-	}
 }