From 5f5f07db32be63e6112ddff7722c1ada10472da5 Mon Sep 17 00:00:00 2001 From: Mr.Shi <1878285526@qq.com> Date: 星期一, 14 八月 2023 18:43:41 +0800 Subject: [PATCH] Merge branch 'master' of ssh://139.186.142.91:29418/productDev/dmMes --- server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java | 100 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 93 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java b/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java index 8ae95e2..8ec0cff 100644 --- a/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java +++ b/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java @@ -16,7 +16,9 @@ import doumeemes.core.utils.redis.RedisUtil; import doumeemes.dao.business.BackOrderDetailMapper; import doumeemes.dao.business.BackorderMapper; +import doumeemes.dao.business.SalaryParamMapper; import doumeemes.dao.business.dto.CreateMaterialDTO; +import doumeemes.dao.business.dto.CreateWorkorderRecordDTO; import doumeemes.dao.business.dto.DealWorkorderRecordDTO; import doumeemes.dao.business.dto.MaterialListDTO; import doumeemes.dao.business.model.*; @@ -79,6 +81,8 @@ private WOutboundRecordExtMapper wOutboundRecordExtMapper; @Autowired private MaterialExtMapper materialExtMapper; + @Autowired + private SalaryParamMapper salaryParamMapper; @Transactional(rollbackFor = {BusinessException.class,Exception.class}) @Override @@ -142,9 +146,10 @@ recordList.add(getWorkrecordModel(user,wStock,mp,materialListDTO.getNum())); } } + //鎵归噺鎻掑叆鎶曟枡璁板綍 workorderRecordExtMapper.insertBatch(recordList); - //鍗曟坊鍔犲巻鍙茶褰曪紙涓嶆洿鏂扮姸鎬侊級 + //鍗曟坊鍔犲巻鍙茶褰曪紙鍒ゆ柇鏇存柊涓虹敓浜т腑锛� updateOrderInfo(user,mp,Constants.WORKORDER_HISTORY_STATUS.material); return param.getId(); } @@ -294,6 +299,13 @@ order.setStatus(Constants.WORKORDER_STATUS.material); }else if(status ==Constants.WORKORDER_HISTORY_STATUS.done){ order.setStatus(Constants.WORKORDER_STATUS.done); + }else if(status ==Constants.WORKORDER_HISTORY_STATUS.material){ + //鎶曟枡鎿嶄綔 + if(Constants.equalsInteger(mp.getStatus(),Constants.WORKORDER_STATUS.create) + ||Constants.equalsInteger(mp.getStatus(),Constants.WORKORDER_STATUS.material)){ + //濡傛灉鏄凡鍒涘缓鎴栬�呭凡澶囨枡鐘舵�佺殑宸ュ崟锛屼慨鏀瑰叾鐘舵�佷负銆愮敓浜т腑銆� + order.setStatus(Constants.WORKORDER_STATUS.producing); + } } workorderExtMapper.updateById(order); workorderHistoryExtMapper.insertBatch(whList); @@ -381,9 +393,6 @@ dealAppliancePro(mp,user,allRecordList,updateApplianceList,updateApplianceProList, outboundDetailList,stockList); } - if(1==1){ - throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"123"); - } //濡傛灉鏈夋病bom閰嶇疆,妫�鏌ヤ骇鍑猴紙鍖呭惈妫�楠岀殑涓嶈壇鍜屾姤搴熷搧锛夊拰鎶曟枡鏁伴噺鏄惁鐩哥瓑鍖归厤锛屼笉涓�鑷存彁绀洪敊璇� if(bdparam==null){ @@ -504,6 +513,7 @@ //濡傛灉闇�瑕佹姇鏂欑殑鐗╂枡闆嗗悎锛屽湪搴撳瓨涓鎵炬姇鏂欐潵婧� for(WStock model : materialList){ for(WStock ts : allList){ + if(Constants.equalsInteger(model.getMaterialId(),ts.getMaterialId())){ //杩橀渶瑕佹姇鏂欐暟閲� BigDecimal actNum = Constants.formatBigdecimal(model.getNum()).subtract(Constants.formatBigdecimal(model.getTNum())); @@ -519,6 +529,10 @@ //濡傛灉宸茬粡婊¤冻鍓╀綑闇�姹傞噺 isfull =true; } + + //娣诲姞鎶曟枡璁板綍 + workorderRecordExtMapper.insert(getWorkrecordModel(user,ts,mp,actNum)); + //鏇存柊宸茬粡鎶曟枡鏁伴噺 model.setTNum(Constants.formatBigdecimal(model.getTNum()).add(actNum)); WOutbound outbound = getFromOutboundList(ts.getWarehouseId(),outboundList); @@ -971,15 +985,15 @@ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝璇ュ伐鍗曚俊鎭紒"); } if(Objects.isNull(dealWorkorderRecordDTO.getDownType()) - ||Objects.isNull(dealWorkorderRecordDTO.getWorkorderId()) - ||Objects.isNull(dealWorkorderRecordDTO.getNum()) + ||Objects.isNull(dealWorkorderRecordDTO.getWorkorderId()) + ||Objects.isNull(dealWorkorderRecordDTO.getNum()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } WorkorderRecord workorderRecord = new WorkorderRecord(); if(Objects.isNull(dealWorkorderRecordDTO.getRecordId())){ //鏌ヨ宸ュ崟涓嬫槸鍚﹀瓨鍦ㄥ搴旇褰� - workorderRecord = workorderRecordExtMapper.selectOne(new QueryWrapper<WorkorderRecord>() + workorderRecord = workorderRecordExtMapper.selectOne(new QueryWrapper<WorkorderRecord>() .eq("WORKORDER_ID",dealWorkorderRecordDTO.getWorkorderId()) .eq("DONE_TYPE",dealWorkorderRecordDTO.getDownType()) .eq("TYPE",Constants.ONE) @@ -1098,4 +1112,76 @@ } + + @Override + @Transactional(rollbackFor = {BusinessException.class,Exception.class}) + public WorkorderRecord createWorkorderRecord(CreateWorkorderRecordDTO createWorkorderRecordDTO, LoginUserInfo loginUserInfo){ + Workorder workorder = workorderExtMapper.selectById(createWorkorderRecordDTO.getWorkorderId()); + if(Objects.isNull(workorder)){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝鏈煡璇㈠埌璇ュ伐鍗曚俊鎭紒"); + } + if(Objects.isNull(createWorkorderRecordDTO.getUnQualifiedNum()) + ||Objects.isNull(createWorkorderRecordDTO.getUnQualifiedNum()) + ||Objects.isNull(createWorkorderRecordDTO.getWorkorderId()) + ){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + BigDecimal num = createWorkorderRecordDTO.getQualifiedNum().add(createWorkorderRecordDTO.getUnQualifiedNum()); + WorkorderRecord workorderRecord = new WorkorderRecord(); + //鏌ヨ宸ュ崟涓嬫槸鍚﹀瓨鍦ㄥ搴旇褰� + workorderRecord = workorderRecordExtMapper.selectOne(new QueryWrapper<WorkorderRecord>() + .eq("WORKORDER_ID",createWorkorderRecordDTO.getWorkorderId()) + .eq("TYPE",Constants.ONE) + .eq("DELETED",Constants.ZERO) + .last(" limit 1 ") + ); + if(!Objects.isNull(workorderRecord)){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝璇ュ伐鍗曠殑璇ョ被浜у嚭璁板綍宸插瓨鍦紒"); + } + if(num.compareTo(BigDecimal.valueOf(workorder.getPlanNum()))>Constants.ZERO){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝璇ュ伐鍗曠殑浜у嚭鏁伴噺涓嶈兘澶т簬宸ュ崟璁″垝鏁伴噺锛�"); + } + //鏁版嵁瀛樺偍 + workorderRecord = new WorkorderRecord(); + workorderRecord.setDeleted(Constants.ZERO); + workorderRecord.setCreateUser(loginUserInfo.getId()); + workorderRecord.setCreateTime(new Date()); + workorderRecord.setNum(num); + workorderRecord.setRootDepartId(loginUserInfo.getRootDepartment().getId()); + workorderRecord.setDepartId(loginUserInfo.getCurComDepartment().getId()); + workorderRecord.setPlanId(workorder.getPlanId()); + workorderRecord.setWorkorderId(createWorkorderRecordDTO.getWorkorderId()); + workorderRecord.setBatch(workorder.getBatch()); + workorderRecord.setFactoryId(workorder.getFactoryId()); + workorderRecord.setProcedureId(workorder.getProcedureId()); + workorderRecord.setProDate(new Date()); + workorderRecord.setType(Constants.ONE); + workorderRecord.setMaterialId(workorder.getMaterialId()); + workorderRecord.setUnitId(workorder.getUnitId()); + workorderRecord.setMaterialBatch(workorder.getBatch()); + workorderRecord.setUnqualifiedNum(createWorkorderRecordDTO.getUnQualifiedNum()); + workorderRecord.setQualifiedNum(createWorkorderRecordDTO.getQualifiedNum()); + //璁$畻宸ヨ祫淇℃伅 + SalaryParam salaryParam = salaryParamMapper.selectOne(new QueryWrapper<SalaryParam>().eq("DELETED",Constants.ZERO).eq("MATERIAL_ID",workorderRecord.getMaterialId()) + .eq("DEPART_ID",workorderRecord.getFactoryId()).eq("PROCEDURE_ID",workorderRecord.getProcedureId()).last(" limit 1 ")); + if(Objects.isNull(salaryParam)){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈厤缃伐璧勭哗鏁堥厤缃紒"); + } + workorderRecord.setSalaryPrice(salaryParam.getSalary()); + workorderRecord.setSalaryType(salaryParam.getType()); + workorderRecord.setSalaryUnqualified(salaryParam.getUnqualified()); + + //璁′欢宸ヨ祫 + if(salaryParam.getType().equals(Constants.ZERO)){ + workorderRecord.setSalaryNum(salaryParam.getNum()); + workorderRecord.setSalary(salaryParam.getSalary().multiply(salaryParam.getUnqualified()==Constants.ZERO?num:createWorkorderRecordDTO.getUnQualifiedNum())); + }else{ + workorderRecord.setDuration(createWorkorderRecordDTO.getDuration()); + workorderRecord.setSalary(BigDecimal.valueOf(createWorkorderRecordDTO.getDuration()).multiply(salaryParam.getSalary()).divide(new BigDecimal(3600))); + } + + workorderRecordExtMapper.insert(workorderRecord); + return workorderRecord; + } + } -- Gitblit v1.9.3