فهرست منبع

Merge branch 'master' of http://106.14.142.95:3000/wangyuanbo/bt

wangyuanbo 2 سال پیش
والد
کامیت
d52ab9b3c8

+ 6 - 1
imcs-bt-be/imcs-authority-server/src/main/java/com/github/zuihou/api/OpsAppApi.java

@@ -412,5 +412,10 @@ public class OpsAppApi {
         return R.success(resultMap);
     }
 
-
+    @GetMapping("/getDevStatusMap")
+    public R<Map<String, String>> getDevStatusMap(@RequestParam(name = "equId", required = true) Long equId) {
+        BaseContextHandler.setTenant("0000");
+        Map<String, String> resultMap = productionTenantResourceService.getDevStatusMap(equId);
+        return R.success(resultMap);
+    }
 }

+ 14 - 7
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/barrel/service/impl/EquBarrelServiceImpl.java

@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 
 import static java.util.stream.Collectors.toList;
@@ -63,7 +64,7 @@ public class EquBarrelServiceImpl extends SuperServiceImpl<EquBarrelMapper, EquB
         equBarrelQueryWrap.eq("equ_id", equId);
         Page<EquBarrel> page = new Page<>(1L, 10);
         IPage<EquBarrel> list = this.pageList(page, equBarrelQueryWrap);
-        List<EquBarrel> barrelList = list.getRecords();
+        List<EquBarrel> barrelList = (list!=null)? list.getRecords() : new ArrayList<EquBarrel>();
         System.out.println("查询到的料筒" + JSON.toJSONString(barrelList));
 
 //        查询该设备上的所有商品
@@ -76,7 +77,7 @@ public class EquBarrelServiceImpl extends SuperServiceImpl<EquBarrelMapper, EquB
         List<Formula> formulaList = formulaService.list(formulaQueryWrap);
         System.out.println("查询到的配方" + JSON.toJSONString(formulaList));
 
-        if (barrelList != null && formulaList != null){
+        if (formulaList != null && formulaList.size()>0 && barrelList.size()>0){
             formulaList.forEach(formula -> {
                 Long formulaMtId = formula.getFormulaMtId();
                 BigDecimal formulaMtQuantity = formula.getFormulaMtQuantity();
@@ -87,13 +88,19 @@ public class EquBarrelServiceImpl extends SuperServiceImpl<EquBarrelMapper, EquB
                         LambdaUpdateWrapper<EquBarrel> equBarrelUpdateWrapper = new LambdaUpdateWrapper<>();
                         equBarrelUpdateWrapper.set(EquBarrel::getMtrResidue, subtract).eq(EquBarrel::getId, equBarrel.getId());
                         this.update(null, equBarrelUpdateWrapper);
+
+                        //缺料状态判断处理
+                        Spe spe = speService.getById(speId);
+                        Long goodsId = spe.getGoodsId();
+                        LambdaUpdateWrapper<EquAndGoods> equAndGoodsUpdateWrapper = new LambdaUpdateWrapper<>();
+                        equAndGoodsUpdateWrapper.eq(EquAndGoods::getEquId, equId).eq(EquAndGoods::getGoodsId, goodsId);
+                        //余量与余料警告比较
                         if (subtract.compareTo(equBarrel.getResidueWarn()) != 1) {
-                            Spe spe = speService.getById(speId);
-                            Long goodsId = spe.getGoodsId();
-                            LambdaUpdateWrapper<EquAndGoods> equAndGoodsUpdateWrapper = new LambdaUpdateWrapper<>();
-                            equAndGoodsUpdateWrapper.eq(EquAndGoods::getEquId, equId).eq(EquAndGoods::getGoodsId, goodsId).set(EquAndGoods::getIsStarving, "0");
-                            equAndGoodsService.update(null, equAndGoodsUpdateWrapper);
+                            equAndGoodsUpdateWrapper.set(EquAndGoods::getIsStarving, "0");
+                        }else {
+                            equAndGoodsUpdateWrapper.set(EquAndGoods::getIsStarving, "1");
                         }
+                        equAndGoodsService.update(null, equAndGoodsUpdateWrapper);
                     }
                 });
             });

+ 3 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/dao/ProductionTenantResourceMapper.java

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Repository;
 import com.github.zuihou.business.productionresource.entity.ProductionResource;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -30,4 +31,6 @@ public interface ProductionTenantResourceMapper extends SuperMapper<ProductionRe
     List<EquGoodsDto> getEquGoods(@Param("equId") Long equId);
 
     Integer getEquLockCount(Long equId);
+
+    Map getDevStatusMap(@Param("id")Long equId);
 }

+ 3 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/service/ProductionTenantResourceService.java

@@ -8,6 +8,7 @@ import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -29,4 +30,6 @@ public interface ProductionTenantResourceService extends SuperService<Production
     List<String> getEquStatusIds(String onlineStatus);
 
     Integer getEquLockCount(Long equId);
+
+    Map getDevStatusMap(Long equId);
 }

+ 6 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/productionresource/service/impl/ProductionTenantResourceServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -77,4 +78,9 @@ public class ProductionTenantResourceServiceImpl extends SuperServiceImpl<Produc
     public Integer getEquLockCount(Long equId) {
         return baseMapper.getEquLockCount(equId);
     }
+
+    @Override
+    public Map getDevStatusMap(Long equId) {
+        return baseMapper.getDevStatusMap(equId);
+    }
 }

+ 32 - 0
imcs-bt-be/imcs-business-biz/src/main/resources/mapper_business/base/productionresource/ProductionresourceMapper.xml

@@ -118,4 +118,36 @@
         </if>
     </select>
 
+    <select id="getDevStatusMap" parameterType="hashMap" resultType="java.util.Map">
+        select sum(num1) as barrelLackNum,
+               sum(num2) as barrelExprNum,
+               sum(num3) as cupLackNum,
+               sum(num4) as cupExprNum
+        from (
+                select count(distinct p.id) as num1 ,0 as num2,0 as num3,0 as num4 from imcs_tenant_productionresource p left join bt_equ_barrel b on b.equ_id = p.id
+                where p.status = '1' and b.residue_warn>=b.mtr_residue and b.barrel_type <![CDATA[ <= ]]> '3'
+                <if test="id != null">
+                    and p.id = #{id}
+                </if>
+                union
+                select 0 as num1 , count(distinct p.id) as num2,0 as num3,0 as num4 from imcs_tenant_productionresource p left join bt_equ_barrel b on b.equ_id = p.id
+                where p.status = '1' and  b.barrel_type <![CDATA[ <= ]]> '3' and  TIMESTAMPDIFF(DAY, now(), b.expr_time) <![CDATA[ < ]]> 0
+                <if test="id != null">
+                    and p.id = #{id}
+                </if>
+                union
+                select 0 as num1 ,0 as num2, count(distinct p.id) as num3,0 as num4 from imcs_tenant_productionresource p left join bt_equ_barrel b on b.equ_id = p.id
+                where p.status = '1' and b.residue_warn>=b.mtr_residue and b.barrel_type>'3'
+                <if test="id != null">
+                    and p.id = #{id}
+                </if>
+                union
+                select 0 as num1 ,0 as num2,  0 as num3, count(distinct p.id) as num4 from imcs_tenant_productionresource p left join bt_equ_barrel b on b.equ_id = p.id
+                where p.status = '1' and TIMESTAMPDIFF(DAY, now(), b.expr_time) <![CDATA[ < ]]> 0  and b.barrel_type>'3'
+                <if test="id != null">
+                    and p.id = #{id}
+                </if>
+             )s
+    </select>
+
 </mapper>

+ 2 - 2
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/device/device.vue

@@ -163,12 +163,12 @@
 	}
 	
 	.device-list .status .exception {
-		color: #ff0000;
+		color: #666;
 		font-size: 40rpx;
 	}
 	
 	.device-list .status .lack {
-		color: #ffff00;
+		color: #ff0000;
 		font-size: 40rpx;
 	}
 	

+ 18 - 5
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/device/deviceDetail.vue

@@ -48,7 +48,8 @@
 				<view class="h">
 					<view class="l">料筒物料</view>
 					<view class="r">
-						<text class="tip">缺料、过期</text>
+						<text class="tip">{{statusMap.barrelLackNum && statusMap.barrelLackNum>0? '缺料':''}} {{statusMap.barrelExprNum && statusMap.barrelExprNum>0? '过期':''}}
+						</text>
 						<image class="icon" src="/static/images/go.png" />
 					</view>
 				</view>
@@ -57,7 +58,7 @@
 				<view class="h">
 					<view class="l">杯子物料</view>
 					<view class="r">
-						<text class="tip">缺料</text>
+						<text class="tip">{{statusMap.cupLackNum && statusMap.cupLackNum>0? '缺料':''}} {{statusMap.cupExprNum && statusMap.cupExprNum>0? '过期':''}}</text>
 						<image class="icon" src="/static/images/go.png" />
 					</view>
 				</view>
@@ -96,7 +97,8 @@
 					"todayNum": "0",
 					"todayAmount": "0.00",
 					"errMsgNum": "0"
-				}
+				},
+				statusMap: {}
 			}
 		},
 		methods: {
@@ -120,11 +122,22 @@
 					}
 				});
 			},
+			getDevStatus(equId) {
+				let that = this;
+				util.request(api.DevStatusMap, {
+					equId: equId
+				}, 'GET', 'application/json').then(function(res) {
+					if (res.code === 0) {
+						that.statusMap = res.data;
+					}
+				});
+			},
 			onLoad: function(option) {
 				let equId = option.id? option.id : ""
 				if(equId){
 					this.getDeviceDetail(equId);
 					this.getStatistics(equId);
+					this.getDevStatus(equId);
 				}else{
 					util.toast("传参为空");
 					uni.redirectTo({
@@ -213,11 +226,11 @@
 	}
 
 	.a-popular .b .status.exception {
-		color: #ff0000;
+		color: #666;
 	}
 
 	.a-popular .b .status.lack {
-		color: #ffff00;
+		color: #ff0000;
 	}
 
 	.m-menu {

+ 2 - 2
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/index/index.vue

@@ -621,11 +621,11 @@
 	}
 
 	.a-popular .b .status.exception {
-		color: #ff0000;
+		color: #666;
 	}
 
 	.a-popular .b .status.lack {
-		color: #ffff00;
+		color: #ff0000;
 	}
 
 	.a-topic .b {

+ 1 - 1
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/material/cup.vue

@@ -43,7 +43,7 @@
 					<uni-th align="center">到期日期</uni-th>
 				</uni-tr>
 				<uni-tr v-for="(item, index) in records" :key="item.id">
-					<uni-td align="center">{{item.barrelCode}}</uni-td>
+					<uni-td align="center">{{item.barrelCode||''}}</uni-td>
 					<uni-td align="center">{{item.mtName||'空'}}</uni-td>
 					<uni-td align="center">{{item.surplus||'0'}}</uni-td>
 					<uni-td align="center">{{item.mtrName||'空'}}</uni-td>

+ 1 - 1
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/material/material.vue

@@ -43,7 +43,7 @@
 					<uni-th align="center">到期日期</uni-th>
 				</uni-tr>
 				<uni-tr v-for="(item, index) in records" :key="item.id">
-					<uni-td align="center">{{item.barrelCode}}</uni-td>
+					<uni-td align="center">{{item.barrelCode||''}}</uni-td>
 					<uni-td align="center">{{item.mtName||'空'}}</uni-td>
 					<uni-td align="center">{{item.surplus|| '0'}}</uni-td>
 					<uni-td align="center">{{item.mtrName||'空'}}</uni-td>

+ 1 - 1
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/ucenter/index/index.vue

@@ -62,7 +62,7 @@
 					<text class="txt">意见反馈</text>
 				</navigator>
 			</view>
-			<view class="item item-bottom" v-if="!hasMobile">
+			<view class="item item-bottom" v-if="!hasMobile" v-show="false">
 				<navigator url="/pages/auth/mobile/mobile" class="a">
 					<text class="icon phone"></text>
 					<text class="txt">绑定手机</text>

+ 3 - 3
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/ucenter/order/order.vue

@@ -105,7 +105,7 @@
 				array: [{
 					id: "",
 					name: '全部'
-				},{id:"0", name: '未支付'},{id:"1", name: '已支付'},{id:"2", name:'已取消'},{id:"3", name:'生产完成'},{id:"4", name: '异常'},{id:"5", name: '转入退款'},],
+				},{id:"0", name: '未支付'},{id:"1", name: '已支付'},{id:"2", name:'已取消'},{id:"3", name:'生产完成'},{id:"4", name: '异常'},{id:"5", name: '转入退款'},{id:"6", name: '其它'}],
 				orderList: [
 					/*{
 					name: '美式咖啡',
@@ -238,13 +238,12 @@
 				}else if(that.index==''){
 					that.queryParams.model.orderStatus =''
 				}
-				console.log(that.range)
 				if (that.range.length > 0) {
 					that.queryParams.map.createTime_st = that.range[0];
 					that.queryParams.map.createTime_ed = that.range[1];
 				}
 				util.request(api.OrderList, that.queryParams, 'post', 'application/json').then(function(res) {
-					if (res.code === 0) {						
+					if (res.code === 0) {
 						res.data.records = res.data.records.filter(item=>{
 							if(item.id==null){							   
 							   that.orderSum = item.orderSum;
@@ -253,6 +252,7 @@
 							return true;
 						})						
 						that.orderList = that.orderList.concat(res.data.records);
+						console.log(that.orderList)
 						//that.page = res.data.currentPage + 1
 						that.totalPages = res.data.pages
 						that.orderCount = res.data.total

+ 1 - 0
imcs-bt-fe/imcs-bt-fe/uni-mall/utils/api.js

@@ -25,6 +25,7 @@ module.exports = {
 	
 	DeviceList: 'getEquList', //设备列表
 	DeviceDetail: 'equDetails', //设备详情
+	DevStatusMap: 'getDevStatusMap', //设备状态
 
 	CartList: 'cart/index', //获取购物车的数据
 	CartAdd: 'cart/add', // 添加商品到购物车