From 8fe37f0f7af3667b60e0f29a1ce8188c08c35bb1 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Tue, 09 Mar 2021 15:33:34 +0800 Subject: [PATCH] modify --- zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java | 52 +++++++++++++++++++--------------------------------- 1 files changed, 19 insertions(+), 33 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java index d1aeb5f..a3c5a75 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java @@ -1,12 +1,14 @@ package com.matrix.system.hive.service.imp; -import com.alibaba.fastjson.JSONObject; import com.matrix.component.rabbitmq.RabiitMqTemplate; import com.matrix.core.constance.MatrixConstance; import com.matrix.core.exception.GlobleException; import com.matrix.core.pojo.PaginationVO; import com.matrix.core.pojo.VerifyResult; -import com.matrix.core.tools.*; +import com.matrix.core.tools.DateUtil; +import com.matrix.core.tools.LogUtil; +import com.matrix.core.tools.StringUtils; +import com.matrix.core.tools.WebUtil; import com.matrix.system.app.dto.ServiceOrderListDto; import com.matrix.system.app.vo.ServiceOrderListVo; import com.matrix.system.common.bean.SysUsers; @@ -14,11 +16,10 @@ import com.matrix.system.constance.Dictionary; import com.matrix.system.hive.bean.*; import com.matrix.system.hive.dao.*; -import com.matrix.core.tools.DateUtil; import com.matrix.system.hive.plugin.util.MoneyUtil; -import com.matrix.system.hive.pojo.MyBeauticianCount; import com.matrix.system.hive.service.*; import com.matrix.system.shopXcx.mqTask.MQTaskRouting; +import com.matrix.system.wechart.templateMsg.UniformMsgParam; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -399,7 +400,7 @@ // 设置成功状态 - projServices.setState(Dictionary.SERVICE_STATU_YYCG); + projServices.setState(Dictionary.SERVICE_STATU_XPL); // 判断当前门店是否有历史美疗师 LastestWorkBeatuistaff lastWorkStaff = new LastestWorkBeatuistaff(); lastWorkStaff.setShopId(checkProjServices.getShopId()); @@ -577,11 +578,13 @@ projServices.setState(Dictionary.SERVICE_STATU_FFJS); projServices.setConsumeTime(new Date()); int result=sysProjServicesDao.update(projServices); + achieveNewService.addAchieveByServiceOrder(projServices); + //发送微信公众号提醒 - JSONObject param=new JSONObject(); - param.put("companyId",projServices.getCompanyId()); - param.put("serviceId",projServices.getId()); - rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,param.toJSONString()); + UniformMsgParam uniformMsgParam=new UniformMsgParam(projServices.getCompanyId(),UniformMsgParam.GZH_FWWC); + uniformMsgParam.put("serviceId",projServices.getId()); + rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString()); + return result; } } @@ -618,7 +621,7 @@ @Override public int modifyPLProjServices(SysProjServices projServicesVo) throws GlobleException { SysProjServices projServices = sysProjServicesDao.selectById(projServicesVo.getId()); - + SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); if (!projServices.getState().equals(Dictionary.SERVICE_STATU_XPL)) { throw new GlobleException("该服务单状态为" + projServices.getState() + ",不可以进行当前操作!"); } @@ -633,7 +636,7 @@ if(projServices.getDevisionId()!=null){ outStore.setStaffId(projServices.getDevisionId()); }else{ - SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); + outStore.setStaffId(sysUsers.getSuId()); } outStore.setServiceId(projServices.getId()); @@ -657,7 +660,7 @@ double sum = stores.stream().mapToDouble(item2 -> item2.getStoreTotal()).sum(); Double needAmount = MoneyUtil.div(item.getAmount(), Double.valueOf(shoppingGoods.getVolume())); if (sum < needAmount) { - throw new GlobleException("出库失败:【" + shoppingGoods.getName() + "库存不足】"); + throw new GlobleException("出库失败:【" + shoppingGoods.getName()+"-"+shoppingGoods.getCode()+ "库存不足】"); } //循环获取所有批次产品,并扣减库存 for (SysStoreInfo storeInfo : stores) { @@ -673,8 +676,6 @@ sysOutStoreItem.setStoreId(storeInfo.getId()); sysOutStoreItem.setAmount(oldStoreTotal - storeInfo.getStoreTotal()); realOutStoreItemList.add(sysOutStoreItem); - - storeInfoDao.update(storeInfo); //扣除后剩余库存大于0则跳出扣除,否则剩余数量的负数的绝对值就是再次扣减的数量 if (surplus > 0) { @@ -688,30 +689,15 @@ LogUtil.debug("未选择配料跳过sku={},amount={}", item.getSkuId(), item.getAmount()); } } - sysOutStoreItemDao.batchInsert(realOutStoreItemList); - } - // 设置服务单状态 projServices.setState(Dictionary.SERVICE_STATU_PLWC); - // 设置服务单操作流水 - // TODO 本功能待完善记录最新的排班员工 - /* List<LastestWorkBeatuistaff> lastList = LastestWorkBeatuistaffDao.selectByModel(null); - LastestWorkBeatuistaff lastWork = new LastestWorkBeatuistaff(); - if (lastList.size() > 0) { - lastWork.setChangeDate(new Date()); - lastWork.setStaffId(projServices.getBeauticianId()); - LastestWorkBeatuistaffDao.insert(lastWork); - } else { + if(projServices.getDevisionId()==null){ + //如果没有设置配料师则默认为操作配料的人为配料师 + projServices.setDevisionId(sysUsers.getSuId()); - //TODO 有bug集合为零了 - LastestWorkBeatuistaff modifyObj = lastList.get(0); - modifyObj.setChangeDate(new Date()); - modifyObj.setStaffId(projServices.getBeauticianId()); - LastestWorkBeatuistaffDao.update(modifyObj); - }*/ - + } return sysProjServicesDao.update(projServices); } -- Gitblit v1.9.1