From 4162bc5d79a97971522615d8aca811034374d48e Mon Sep 17 00:00:00 2001 From: cl <418351270@qq.com> Date: 星期五, 16 八月 2024 10:29:15 +0800 Subject: [PATCH] 修改1P1S --- jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java | 79 +++++++++++++++++++ jcdm-ui/src/views/main/da/psConf/index.vue | 68 ++++++++-------- jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java | 61 ++++++++++++++ jcdm-main/src/main/java/com/jcdm/main/constant/Constants.java | 3 4 files changed, 174 insertions(+), 37 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/constant/Constants.java b/jcdm-main/src/main/java/com/jcdm/main/constant/Constants.java index 48b61dd..4ea37d3 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/constant/Constants.java +++ b/jcdm-main/src/main/java/com/jcdm/main/constant/Constants.java @@ -18,6 +18,9 @@ public static final List<String> ModuleList = new ArrayList<>();//妯$粍宸ヤ綅锛岀敤浜庢牎楠屾槸鍚︿紶鍏ユā缁勭爜 public static final Map<String,String> materialMap = new HashMap();//浜哄伐宸ヤ綅 + public static final Map<Integer,String> YEARSMAP = new HashMap();//骞撮泦鍚� + public static final Map<Integer,String> MONTHSMAP = new HashMap();//鏈堥泦鍚� + public static final Map<Integer,String> DAYMAP = new HashMap();//鏃ラ泦鍚� public static final String NG = "2"; public static final String UN_PASS= "涓嶅悎鏍�"; diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java index 604b00f..66f6003 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java +++ b/jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java @@ -9,6 +9,7 @@ import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService; import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; +import com.jcdm.main.da.psConf.service.IDaPsConfService; import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService; import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService; import com.jcdm.main.plcserver.sub.OPCUaSubscription; @@ -49,7 +50,8 @@ @Autowired private IDaCellDataService daCellDataService; - + @Autowired + private IDaPsConfService daPsConfService; @Override public void run(ApplicationArguments args) throws Exception { @@ -89,7 +91,8 @@ daParamCollectionService, omProductionOrdeInfoService, daTestDeviceInterfaceTempService, - daCellDataService); + daCellDataService, + daPsConfService); List<String> lists = getSubList(); System.out.println("璁㈤槄鍐呭锛�"+lists); @@ -106,5 +109,77 @@ .stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList()); return lists; } + + /** + * 灏嗘棩鏈熸斁鍏AP闆嗗悎锛�1P1S鐢� + */ + public static void getDate(){ + //骞� + Constants.YEARSMAP.put(2024,"E"); + Constants.YEARSMAP.put(2025,"F"); + Constants.YEARSMAP.put(2026,"G"); + Constants.YEARSMAP.put(2027,"H"); + Constants.YEARSMAP.put(2028,"J"); + Constants.YEARSMAP.put(2029,"K"); + Constants.YEARSMAP.put(2030,"L"); + Constants.YEARSMAP.put(2031,"M"); + Constants.YEARSMAP.put(2032,"N"); + Constants.YEARSMAP.put(2033,"P"); + Constants.YEARSMAP.put(2034,"R"); + Constants.YEARSMAP.put(2035,"S"); + Constants.YEARSMAP.put(2036,"T"); + Constants.YEARSMAP.put(2037,"V"); + Constants.YEARSMAP.put(2038,"W"); + Constants.YEARSMAP.put(2039,"X"); + Constants.YEARSMAP.put(2040,"Y"); + + //鏈� + Constants.MONTHSMAP.put(1,"1"); + Constants.MONTHSMAP.put(2,"2"); + Constants.MONTHSMAP.put(3,"3"); + Constants.MONTHSMAP.put(4,"4"); + Constants.MONTHSMAP.put(5,"5"); + Constants.MONTHSMAP.put(6,"6"); + Constants.MONTHSMAP.put(7,"7"); + Constants.MONTHSMAP.put(8,"8"); + Constants.MONTHSMAP.put(9,"9"); + Constants.MONTHSMAP.put(10,"A"); + Constants.MONTHSMAP.put(11,"B"); + Constants.MONTHSMAP.put(12,"C"); + + //鏃� + Constants.DAYMAP.put(1,"1"); + Constants.DAYMAP.put(2,"2"); + Constants.DAYMAP.put(3,"3"); + Constants.DAYMAP.put(4,"4"); + Constants.DAYMAP.put(5,"5"); + Constants.DAYMAP.put(6,"6"); + Constants.DAYMAP.put(7,"7"); + Constants.DAYMAP.put(8,"8"); + Constants.DAYMAP.put(9,"9"); + Constants.DAYMAP.put(10,"A"); + Constants.DAYMAP.put(11,"B"); + Constants.DAYMAP.put(12,"C"); + Constants.DAYMAP.put(13,"D"); + Constants.DAYMAP.put(14,"E"); + Constants.DAYMAP.put(15,"F"); + Constants.DAYMAP.put(16,"G"); + Constants.DAYMAP.put(17,"H"); + Constants.DAYMAP.put(18,"J"); + Constants.DAYMAP.put(19,"K"); + Constants.DAYMAP.put(20,"L"); + Constants.DAYMAP.put(21,"M"); + Constants.DAYMAP.put(22,"N"); + Constants.DAYMAP.put(23,"P"); + Constants.DAYMAP.put(24,"R"); + Constants.DAYMAP.put(25,"S"); + Constants.DAYMAP.put(26,"T"); + Constants.DAYMAP.put(27,"V"); + Constants.DAYMAP.put(28,"W"); + Constants.DAYMAP.put(29,"X"); + Constants.DAYMAP.put(30,"Y"); + Constants.DAYMAP.put(31,"0"); + + } } diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java index 9001f14..3852bd2 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java +++ b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java @@ -9,6 +9,7 @@ import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.jcdm.common.core.domain.AjaxResult; import com.jcdm.framework.websocket.WebSocketUsers; import com.jcdm.main.constant.Constants; @@ -20,6 +21,8 @@ import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; +import com.jcdm.main.da.psConf.domain.DaPsConf; +import com.jcdm.main.da.psConf.service.IDaPsConfService; import com.jcdm.main.da.testDeviceInterfaceTemp.domain.DaTestDeviceInterfaceTemp; import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService; import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo; @@ -32,12 +35,14 @@ import com.kangaroohy.milo.runner.subscription.SubscriptionCallback; import com.kangaroohy.milo.service.MiloService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.GetMapping; import javax.websocket.Session; import java.text.SimpleDateFormat; +import java.time.LocalDate; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -65,7 +70,7 @@ public static IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService; public static IDaCellDataService daCellDataService; - + public static IDaPsConfService daPsConfService; /* @Value("${orderLineUrl}") private static String orderLineUrl;*/ @@ -75,7 +80,8 @@ IDaParamCollectionService daParamCollectionService, IOmProductionOrdeInfoService omProductionOrdeInfoService, IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService, - IDaCellDataService daCellDataService) { + IDaCellDataService daCellDataService, + IDaPsConfService daPsConfService) { OPCUaSubscription.miloService = miloService; OPCUaSubscription.daPassingStationCollectionService = daPassingStationCollectionService; OPCUaSubscription.collectionParamConfService = collectionParamConfService; @@ -83,6 +89,7 @@ OPCUaSubscription.omProductionOrdeInfoService = omProductionOrdeInfoService; OPCUaSubscription.daTestDeviceInterfaceTempService = daTestDeviceInterfaceTempService; OPCUaSubscription.daCellDataService = daCellDataService; + OPCUaSubscription.daPsConfService = daPsConfService; } @@ -1070,6 +1077,11 @@ ); if (CollUtil.isNotEmpty(list)){ for(DaCollectionParamConf conf:list){ + //1P1S鐢熸垚 + if(conf.getCollectParameterId().equals("1P1S")){ + String result = get1P1S(sfcCode); + conf.setParamCentral(result); + } ChildVO childVO = new ChildVO(); childVO.setItemCode(conf.getCollectParameterId());//鍙傛暟 childVO.setItemType(conf.getItemType()); @@ -1096,7 +1108,52 @@ throw new RuntimeException(e); } } + /** + * 鐢熸垚1P1S鐮� + * @param sfcCode + * @return list + */ + public static String get1P1S(String sfcCode) { + String result = ""; + LocalDate now = LocalDate.now(); + String supplierCode = sfcCode.substring(0,3); + try { + List<DaPsConf> list = daPsConfService.list(new LambdaQueryWrapper<DaPsConf>() + .eq(DaPsConf::getSpareField1, supplierCode)//渚涘簲鍟嗚瘑鍒爜 + .eq(DaPsConf::getState,"1"));//鐘舵�� + if(!list.isEmpty()){ + String mfCode = list.get(0).getMfCode();//鍘傚晢浠g爜 + String proTypeCode = list.get(0).getProTypeCode();//浜у搧绫诲瀷浠g爜 + String batteryTypeCode = list.get(0).getBatteryTypeCode();//鐢垫睜绫诲瀷浠g爜 + String specificationsCode = list.get(0).getSpecificationsCode();//瑙勬牸浠g爜 + String traceInfoCode = list.get(0).getTraceInfoCode();//杩芥函淇℃伅浠g爜 + String proDateCode = Constants.YEARSMAP.get(now.getYear()) + + Constants.MONTHSMAP.get(now.getMonthValue()) + + Constants.DAYMAP.get(now.getDayOfMonth());//鐢熶骇鏃ユ湡 + + String code = list.get(0).getSfcCode();//搴忓垪鍙� + code = StringUtils.leftPad(String.valueOf(Integer.valueOf(code)+1),7, "0");;//搴忓垪鍙� + result = mfCode+proTypeCode+batteryTypeCode+specificationsCode+traceInfoCode+proDateCode+code; + + log.info("璇诲彇鍒扮數鑺爜涓猴細{},1P1S鐮佷负锛歿}",sfcCode,result); + + //鏇存柊鏃ユ湡鍜屽簭鍒楀彿 + LambdaUpdateWrapper<DaPsConf> lambdaUpdateWrapper = new LambdaUpdateWrapper<DaPsConf>(); + lambdaUpdateWrapper.set(DaPsConf::getProDateCode,proDateCode);//鐢熶骇鏃ユ湡 + lambdaUpdateWrapper.set(DaPsConf::getSfcCode,code);//搴忓垪鍙� + lambdaUpdateWrapper.eq(DaPsConf::getSpareField1,supplierCode);//渚涘簲鍟嗚瘑鍒爜 + lambdaUpdateWrapper.eq(DaPsConf::getState,"1");//鐘舵�� + daPsConfService.update(lambdaUpdateWrapper); + + }else{ + log.info("璇峰厛鍘�1P1S閰嶇疆椤甸潰閰嶇疆瑙勫垯!"); + } + return result; + }catch (Exception e) { + throw new RuntimeException(e); + } + } } diff --git a/jcdm-ui/src/views/main/da/psConf/index.vue b/jcdm-ui/src/views/main/da/psConf/index.vue index ed42a39..35b950d 100644 --- a/jcdm-ui/src/views/main/da/psConf/index.vue +++ b/jcdm-ui/src/views/main/da/psConf/index.vue @@ -74,6 +74,10 @@ <el-table border v-loading="loading" :data="psConfList" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="渚涘簲鍟嗚瘑鍒爜" align="center" prop="spareField1"> + </el-table-column> + <el-table-column label="渚涘簲鍟嗗悕绉�" align="center" prop="remarks"> + </el-table-column> <el-table-column label="鍘傚晢浠g爜" align="center" prop="mfCode"> </el-table-column> <el-table-column label="浜у搧绫诲瀷浠g爜" align="center" prop="proTypeCode"> @@ -88,18 +92,15 @@ </el-table-column> <el-table-column label="搴忓垪鍙�" align="center" prop="sfcCode"> </el-table-column> - <el-table-column label="鐘舵�� (鍚敤enable锛岀鐢╠isable锛�" align="center" prop="state"> + <el-table-column label="鐘舵�� (鍚敤1锛岀鐢�0锛�" align="center" prop="state"> </el-table-column> - <el-table-column label="澶囨敞" align="center" prop="remarks"> - </el-table-column> - <el-table-column label="棰勭暀瀛楁1" align="center" prop="spareField1"> - </el-table-column> - <el-table-column label="棰勭暀瀛楁2" align="center" prop="spareField2"> - </el-table-column> - <el-table-column label="鍒涘缓鐢ㄦ埛" align="center" prop="createUser"> - </el-table-column> - <el-table-column label="鏇存敼鐢ㄦ埛" align="center" prop="updateUser"> - </el-table-column> + + <!-- <el-table-column label="棰勭暀瀛楁2" align="center" prop="spareField2"> + </el-table-column> + <el-table-column label="鍒涘缓鐢ㄦ埛" align="center" prop="createUser"> + </el-table-column> + <el-table-column label="鏇存敼鐢ㄦ埛" align="center" prop="updateUser"> + </el-table-column>--> <el-table-column fixed="right" width="200" label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button @@ -139,7 +140,13 @@ <i class="el-icon-s-order"></i> {{titleName}} </span> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> + <el-form-item label="渚涘簲鍟嗚瘑鍒爜" prop="spareField1"> + <el-input v-model="form.spareField1" placeholder="璇疯緭鍏ヤ緵搴斿晢璇嗗埆鐮�" /> + </el-form-item> + <el-form-item label="渚涘簲鍟嗗悕绉�" prop="remarks"> + <el-input v-model="form.remarks" placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О" /> + </el-form-item> <el-form-item label="鍘傚晢浠g爜" prop="mfCode"> <el-input v-model="form.mfCode" placeholder="璇疯緭鍏ュ巶鍟嗕唬鐮�" /> </el-form-item> @@ -155,30 +162,25 @@ <el-form-item label="杩芥函淇℃伅浠g爜" prop="traceInfoCode"> <el-input v-model="form.traceInfoCode" placeholder="璇疯緭鍏ヨ拷婧俊鎭唬鐮�" /> </el-form-item> - <el-form-item label="鐢熶骇鏃ユ湡浠g爜" prop="proDateCode"> - <el-input v-model="form.proDateCode" placeholder="璇疯緭鍏ョ敓浜ф棩鏈熶唬鐮�" /> - </el-form-item> + <!-- <el-form-item label="鐢熶骇鏃ユ湡浠g爜" prop="proDateCode"> + <el-input v-model="form.proDateCode" placeholder="璇疯緭鍏ョ敓浜ф棩鏈熶唬鐮侊紙涓嶅~锛�" /> + </el-form-item>--> <el-form-item label="搴忓垪鍙�" prop="sfcCode"> - <el-input v-model="form.sfcCode" placeholder="璇疯緭鍏ュ簭鍒楀彿" /> + <el-input v-model="form.sfcCode" placeholder="璇疯緭鍏ュ簭鍒楀彿"/> </el-form-item> - <el-form-item label="鐘舵�� (鍚敤enable锛岀鐢╠isable锛�" prop="state"> - <el-input v-model="form.state" placeholder="璇疯緭鍏ョ姸鎬� (鍚敤enable锛岀鐢╠isable锛�" /> + <el-form-item label="鐘舵��" prop="state"> + <el-input v-model="form.state" placeholder="璇疯緭鍏ョ姸鎬� (鍚敤1锛岀鐢�0锛�" /> </el-form-item> - <el-form-item label="澶囨敞" prop="remarks"> - <el-input v-model="form.remarks" placeholder="璇疯緭鍏ュ娉�" /> - </el-form-item> - <el-form-item label="棰勭暀瀛楁1" prop="spareField1"> - <el-input v-model="form.spareField1" placeholder="璇疯緭鍏ラ鐣欏瓧娈�1" /> - </el-form-item> - <el-form-item label="棰勭暀瀛楁2" prop="spareField2"> - <el-input v-model="form.spareField2" placeholder="璇疯緭鍏ラ鐣欏瓧娈�2" /> - </el-form-item> - <el-form-item label="鍒涘缓鐢ㄦ埛" prop="createUser"> - <el-input v-model="form.createUser" placeholder="璇疯緭鍏ュ垱寤虹敤鎴�" /> - </el-form-item> - <el-form-item label="鏇存敼鐢ㄦ埛" prop="updateUser"> - <el-input v-model="form.updateUser" placeholder="璇疯緭鍏ユ洿鏀圭敤鎴�" /> - </el-form-item> + + <!-- <el-form-item label="棰勭暀瀛楁2" prop="spareField2"> + <el-input v-model="form.spareField2" placeholder="璇疯緭鍏ラ鐣欏瓧娈�2" /> + </el-form-item> + <el-form-item label="鍒涘缓鐢ㄦ埛" prop="createUser"> + <el-input v-model="form.createUser" placeholder="璇疯緭鍏ュ垱寤虹敤鎴�" /> + </el-form-item> + <el-form-item label="鏇存敼鐢ㄦ埛" prop="updateUser"> + <el-input v-model="form.updateUser" placeholder="璇疯緭鍏ユ洿鏀圭敤鎴�" /> + </el-form-item>--> </el-form> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> -- Gitblit v1.9.3