guoyuji
2024-09-24 2f9b500fb9f81fb4d74d7156097f72bae7f6b0cb
Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
5个文件已修改
196 ■■■■ 已修改文件
north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGoodsInventoryService.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/DeliveryService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGoodsInventoryService.java
@@ -10,12 +10,14 @@
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.sd.Order;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.mapper.mm.BasicWarehouseTypeMapper;
import com.example.erp.mapper.mm.FinishedGoodsInventoryMapper;
import com.example.erp.mapper.mm.FinishedOperateLogMapper;
import com.example.erp.mapper.sd.OrderDetailMapper;
import com.example.erp.mapper.sd.OrderMapper;
import com.example.erp.service.userInfo.LogService;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -44,6 +46,8 @@
    OrderMapper orderMapper;
    @Autowired
    SysErrorService sysErrorService;
    @Autowired
    LogService logService;
    public Map<String, Object> defaultDateFinishedGoodsInventory(Integer pageNum, Integer pageSize, FinishedGoodsInventory finishedGoodsInventory) {
        Integer offset = (pageNum - 1) * pageSize;
@@ -88,6 +92,12 @@
            if (object.get("userId") != null) {
                userId = object.get("userId").toString();
            }
            Log log = new Log();
            log.setOperator(userName);
            log.setOperatorId(userId);
            log.setContent(object.toString());
            log.setFunction("addSelectWarehousing入库");
            logService.saveLog(log);
            //获取对象集合循环进行新增修改
            List<FlowCard> flowCardlist = JSONArray.parseArray(JSONObject.toJSONString(object.get("flowCard")), FlowCard.class);
@@ -176,6 +186,12 @@
            if (object.get("userId") != null) {
                userId = object.get("userId").toString();
            }
            Log log = new Log();
            log.setOperator(userName);
            log.setOperatorId(userId);
            log.setContent(object.toString());
            log.setFunction("addDeliveryDetail出库");
            logService.saveLog(log);
            //获取对象集合循环进行新增修改
            List<OrderDetail> orderDetaillist = JSONArray.parseArray(JSONObject.toJSONString(object.get("orderDetail")), OrderDetail.class);
            if (!orderDetaillist.isEmpty()){
@@ -267,6 +283,12 @@
            if (object.get("userId") != null) {
                userId = object.get("userId").toString();
            }
            Log log = new Log();
            log.setOperator(userName);
            log.setOperatorId(userId);
            log.setContent(object.toString());
            log.setFunction("updateFinishedGoodsInventoryAllocate调拨");
            logService.saveLog(log);
            //获取对象集合循环进行新增修改
            List<OrderDetail> orderDetaillist = JSONArray.parseArray(JSONObject.toJSONString(object.get("orderDetail")), OrderDetail.class);
            if (!orderDetaillist.isEmpty()){
@@ -361,6 +383,12 @@
            if (object.get("operateType") != null) {
                operateType = object.get("operateType").toString();
            }
            Log log = new Log();
            log.setOperator(userName);
            log.setOperatorId(userId);
            log.setContent(object.toString());
            log.setFunction("updateFinishedGoodsInventoryTakeOut领出");
            logService.saveLog(log);
            //获取对象集合循环进行新增修改
            List<OrderDetail> orderDetaillist = JSONArray.parseArray(JSONObject.toJSONString(object.get("orderDetail")), OrderDetail.class);
            if (!orderDetaillist.isEmpty()){
@@ -494,6 +522,10 @@
            if (object.get("userId") != null) {
                userId = object.get("userId").toString();
            }
            Log log = new Log();
            log.setOperator(userName);
            log.setOperatorId(userId);
            log.setContent(object.toString());
            //获取对象集合循环进行新增修改
            List<FinishedOperateLog> finishedOperateLogslist = JSONArray.parseArray(JSONObject.toJSONString(object.get("orderDetail")), FinishedOperateLog.class);
            if (!finishedOperateLogslist.isEmpty()){
@@ -503,15 +535,18 @@
                        finishedOperateLogMapper.updateToExamine(finishedOperateLog,userName,"已审核");
                        //审核修改库存数量
                        finishedGoodsInventoryMapper.updateInventoryInventoryOut(finishedOperateLog.getOrderId(),finishedOperateLog.getOperationNumber(),Math.toIntExact(finishedOperateLog.getQuantity()));
                        log.setFunction("updateFinishedGoodsInventoryToExamine审核");
                    } else if (Objects.equals(type, "反审")) {
                        //审核修改领出记录
                        finishedOperateLogMapper.updateToExamine(finishedOperateLog,userName,"未审核");
                        //审核修改库存数量
                        finishedGoodsInventoryMapper.updateInventoryInventoryInt(finishedOperateLog.getOrderId(),finishedOperateLog.getOperationNumber(),Math.toIntExact(finishedOperateLog.getQuantity()));
                        log.setFunction("updateFinishedGoodsInventoryToExamine反审");
                    }
                }
            }
            logService.saveLog(log);
        } catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
@@ -540,6 +575,12 @@
            if (object.get("userId") != null) {
                userId = object.get("userId").toString();
            }
            Log log = new Log();
            log.setOperator(userName);
            log.setOperatorId(userId);
            log.setContent(object.toString());
            log.setFunction("cancelFinishedGoodsInventoryToExamine作废");
            logService.saveLog(log);
            //获取对象集合循环进行新增修改
            List<FinishedOperateLog> finishedOperateLogslist = JSONArray.parseArray(JSONObject.toJSONString(object.get("orderDetail")), FinishedOperateLog.class);
            if (!finishedOperateLogslist.isEmpty()){
@@ -618,7 +659,8 @@
        //设置回滚点
        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
        try {
            Log log = new Log();
            log.setContent(object.toString());
            //获取对象集合循环进行新增修改
            List<FinishedOperateLog> finishedOperateLogslist = JSONArray.parseArray(JSONObject.toJSONString(object.get("orderDetail")), FinishedOperateLog.class);
            if (!finishedOperateLogslist.isEmpty()){
@@ -649,6 +691,7 @@
                            //修改订单表入库状态
                            finishedGoodsInventoryMapper.updateOrderWarehousingState(finishedOperateLog.getOrderId(),0);
                        }
                        log.setFunction("cancelFinishedGoodsInventoryStorage入库");
                    }else if(Objects.equals(finishedOperateLog.getOperateType(), "出库")){
                        //修改记录表
@@ -673,11 +716,13 @@
                            //修改发货表状态
                            finishedGoodsInventoryMapper.updateDeliveryDeliveryState(finishedOperateLog.getOperationOrderNumber(),0);
                        }
                        log.setFunction("cancelFinishedGoodsInventoryStorage出库");
                    }
                }
            }
            logService.saveLog(log);
        } catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
@@ -701,6 +746,11 @@
    public Boolean oneClickStorage(String  orderId,String  userName) {
        boolean saveState = true;
        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
        Log log = new Log();
        log.setContent(orderId);
        log.setOperator(userName);
        log.setFunction("oneClickStorage入库:"+orderId);
        logService.saveLog(log);
        try {
            String oddNumber= orderNumberSetting("入库");
            Order order = orderMapper.selectOne(new QueryWrapper<Order>().eq("order_id",orderId));
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
@@ -10,10 +10,12 @@
import com.example.erp.entity.sd.Delivery;
import com.example.erp.entity.sd.DeliveryDetail;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.mapper.mm.BasicWarehouseTypeMapper;
import com.example.erp.mapper.mm.MaterialInventoryMapper;
import com.example.erp.mapper.mm.MaterialStoreMapper;
import com.example.erp.service.userInfo.LogService;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -40,6 +42,8 @@
    BasicWarehouseTypeMapper basicWarehouseTypeMapper;
    @Autowired
    SysErrorService sysErrorService;
    @Autowired
    LogService logService;
    public Boolean saveMaterialOutbound(Map<String,Object> object) {
        boolean saveState = true;
@@ -50,6 +54,8 @@
        if (object.get("materialOutboundId") != null) {
            materialOutboundId = object.get("materialOutboundId").toString();
        }
        Log log = new Log();
        log.setContent(object.toString());
        try {
            MaterialOutbound materialOutbound = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialOutbound.class);
            List<MaterialOutboundDetail> materialOutboundDetailList = JSONArray.parseArray(JSONObject.toJSONString(object.get("materialOutboundDetail")), MaterialOutboundDetail.class);
@@ -76,11 +82,13 @@
                materialInventoryMapper.deleteMaterialOutboundDetail(materialOutboundId);
                materialInventoryMapper.updateMaterialOutbound(materialOutbound, materialOutboundId);
                oddNumber = materialOutboundId;
                log.setFunction("saveMaterialOutbound修改:"+oddNumber);
            } else {
                //获取单号
                oddNumber = orderNumberSetting("出库");
                //新增材料出库表数据
                materialInventoryMapper.insertMaterialOutbound(materialOutbound, oddNumber);
                log.setFunction("saveMaterialOutbound新增:"+oddNumber);
            }
            //获取对象集合循环进行新增修改
@@ -105,6 +113,7 @@
                }
            }
            logService.saveLog(log);
        } catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
@@ -137,6 +146,8 @@
            if (object.get("materialCode") != null) {
                materialCode = Long.valueOf(object.get("materialCode").toString());
            }
            Log log = new Log();
            log.setContent(object.toString());
            MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class);
@@ -145,9 +156,12 @@
            if(MaterialInventoryCount>0){
                materialInventoryMapper.updateMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory);
                log.setFunction("saveMaterialInventory修改");
            }else {
                materialInventoryMapper.insertMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory);
                log.setFunction("saveMaterialInventory新增");
            }
            logService.saveLog(log);
        } catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
            //将异常传入数据库
@@ -246,7 +260,10 @@
                materialInventoryMapper.deleteMaterialOutboundDetail(materialOutboundId);
                materialInventoryMapper.deleteMaterialOutbound(materialOutboundId);
            }
            Log log = new Log();
            log.setContent(object.toString());
            log.setFunction("deleteMaterialOutbound删除:"+materialOutboundId);
            logService.saveLog(log);
        } catch (Exception e) {
@@ -322,6 +339,11 @@
            if (object.get("reviewed") != null) {
                reviewed = object.get("reviewed").toString();
            }
            Log log = new Log();
            log.setOperator(reviewed);
            log.setContent(object.toString());
            log.setFunction("updateMaterialOutboundToExamine:"+type);
            logService.saveLog(log);
            if (type==1){
                List<MaterialOutboundDetail> materialOutboundDetailList = materialInventoryMapper.getIsNotMaterialOutboundDetail(materialOutboundId);
@@ -375,6 +397,9 @@
            if (object.get("returningId") != null) {
                returningId = object.get("returningId").toString();
            }
            Log log = new Log();
            log.setContent(object.toString());
            ReturningWarehouse returningWarehouse = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), ReturningWarehouse.class);
            List<ReturningWarehouseDetail> returningWarehouseDetailList = JSONArray.parseArray(JSONObject.toJSONString(object.get("returningWarehouseDetail")), ReturningWarehouseDetail.class);
            //查询出库单是否存在
@@ -391,11 +416,13 @@
                //删除材料出库明细的数据
                materialInventoryMapper.deleteReturningWarehouseDetail(returningId);
                oddNumber = returningId;
                log.setFunction("saveReturningWarehouse修改:"+oddNumber);
            } else {
                //获取单号
                oddNumber = orderNumberSetting("返库");
                //新增材料出库表数据
                materialInventoryMapper.insertReturningWarehouse(returningWarehouse, oddNumber);
                log.setFunction("saveReturningWarehouse新增:"+oddNumber);
            }
@@ -455,6 +482,7 @@
                }
            }
            logService.saveLog(log);
        } catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
@@ -499,6 +527,11 @@
            if (object.get("reviewed") != null) {
                reviewed = object.get("reviewed").toString();
            }
            Log log = new Log();
            log.setOperator(reviewed);
            log.setContent(object.toString());
            log.setFunction("updateReturningWarehouseToExamine:"+type);
            logService.saveLog(log);
            if (type==1){
                List<ReturningWarehouseDetail> returningWarehouseDetailList = materialInventoryMapper.getIsNotReturningWarehouseDetail(returningId);
@@ -586,43 +619,47 @@
        //设置回滚点
        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
            String creator = "";
            if (object.get("creator") != null) {
                creator = object.get("creator").toString();
            }
            String type = "";
            if (object.get("type") != null) {
                type = object.get("type").toString();
            }
            int state = 0;
            if (object.get("state") != null) {
                state = Integer.parseInt(object.get("state").toString());
            }
        String creator = "";
        if (object.get("creator") != null) {
            creator = object.get("creator").toString();
        }
        String type = "";
        if (object.get("type") != null) {
            type = object.get("type").toString();
        }
        int state = 0;
        if (object.get("state") != null) {
            state = Integer.parseInt(object.get("state").toString());
        }
        Log log = new Log();
        log.setOperator(creator);
        log.setContent(object.toString());
        log.setFunction("addSelectSurplusMaterialsDate:"+state);
        logService.saveLog(log);
            if(state==1){
                SurplusMaterials surplusMaterials = JSONObject.parseObject(JSONObject.toJSONString(object.get("surplusMaterials")), SurplusMaterials.class);
                if(surplusMaterials!=null){
                    SurplusMaterials surplusMaterials1=materialInventoryMapper.selectSurplusMaterialsCount(surplusMaterials);
                    if(surplusMaterials1!=null){
                        System.out.println(surplusMaterials1);
                        materialInventoryMapper.updateSurplusMaterialsIntQuantity(surplusMaterials1);
                        materialInventoryMapper.insertSurplusMaterialsLog(surplusMaterials1,creator,type);
                    }else{
                        materialInventoryMapper.insertSurplusMaterials(surplusMaterials);
                        materialInventoryMapper.insertSurplusMaterialsLog(surplusMaterials,creator,type);
                    }
                }
            } else if (state==2) {
                List<SurplusMaterials> surplusMaterialsList = JSONArray.parseArray(JSONObject.toJSONString(object.get("surplusMaterials")), SurplusMaterials.class);
                if(!surplusMaterialsList.isEmpty()){
                    for(SurplusMaterials surplusMaterials:surplusMaterialsList){
                        materialInventoryMapper.updateSurplusMaterialsOutQuantity(surplusMaterials);
                        materialInventoryMapper.insertSurplusMaterialsLog(surplusMaterials,creator,type);
                    }
        if(state==1){
            SurplusMaterials surplusMaterials = JSONObject.parseObject(JSONObject.toJSONString(object.get("surplusMaterials")), SurplusMaterials.class);
            if(surplusMaterials!=null){
                SurplusMaterials surplusMaterials1=materialInventoryMapper.selectSurplusMaterialsCount(surplusMaterials);
                if(surplusMaterials1!=null){
                    System.out.println(surplusMaterials1);
                    materialInventoryMapper.updateSurplusMaterialsIntQuantity(surplusMaterials1);
                    materialInventoryMapper.insertSurplusMaterialsLog(surplusMaterials1,creator,type);
                }else{
                    materialInventoryMapper.insertSurplusMaterials(surplusMaterials);
                    materialInventoryMapper.insertSurplusMaterialsLog(surplusMaterials,creator,type);
                }
            }
        } else if (state==2) {
            List<SurplusMaterials> surplusMaterialsList = JSONArray.parseArray(JSONObject.toJSONString(object.get("surplusMaterials")), SurplusMaterials.class);
            if(!surplusMaterialsList.isEmpty()){
                for(SurplusMaterials surplusMaterials:surplusMaterialsList){
                    materialInventoryMapper.updateSurplusMaterialsOutQuantity(surplusMaterials);
                    materialInventoryMapper.insertSurplusMaterialsLog(surplusMaterials,creator,type);
                }
            }
        }
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialStoreService.java
@@ -2,10 +2,12 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.entity.mm.MaterialStore;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.mapper.mm.BasicWarehouseTypeMapper;
import com.example.erp.mapper.mm.MaterialInventoryMapper;
import com.example.erp.mapper.mm.MaterialStoreMapper;
import com.example.erp.service.userInfo.LogService;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -27,6 +29,8 @@
    BasicWarehouseTypeMapper basicWarehouseTypeMapper;
    @Autowired
    SysErrorService sysErrorService;
    @Autowired
    LogService logService;
    public String saveMaterialStore(Map<String,Object> object) {
        String saveState = "true";
@@ -54,6 +58,10 @@
            if (object.get("height") != null) {
                height = Double.parseDouble(object.get("height").toString());
            }
            Log log = new Log();
            log.setContent(object.toString());
            DecimalFormat decimalFormat = new DecimalFormat("#0.00");
            singlePieceArea= Double.parseDouble(decimalFormat.format(width * height / 100000));
            Integer jsonCount=materialStoreMapper.selectMaterialStoreJson(json);
@@ -63,12 +71,15 @@
                    if (Objects.equals(type, "原片")){
                        materialInventoryMapper.updateMaterialInventoryArea(Long.valueOf(id),singlePieceArea);
                    }
                    log.setFunction("saveMaterialStore修改");
                }else{
                    materialStoreMapper.insertMaterialStore(type,json);
                    log.setFunction("saveMaterialStore新增");
                }
            }else{
                saveState = "false1";
            }
            logService.saveLog(log);
        } catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
@@ -111,6 +122,10 @@
                }
            }
            Log log = new Log();
            log.setContent(object.toString());
            log.setFunction("deleteMaterialStore删除:"+id);
            logService.saveLog(log);
north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java
@@ -7,9 +7,11 @@
import com.example.erp.dto.sd.DeliveryDetailDTO;
import com.example.erp.dto.sd.DeliveryDetailProductDTO;
import com.example.erp.entity.sd.*;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.mapper.mm.FinishedGoodsInventoryMapper;
import com.example.erp.mapper.sd.*;
import com.example.erp.service.userInfo.LogService;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -28,6 +30,8 @@
    CustomerMapper customerMapper;
    @Autowired
    SysErrorService sysErrorService;
    @Autowired
    LogService logService;
    public Map<String, Object> getSelectCustomer(Integer pageNum, Integer pageSize, Customer customer) {
@@ -42,6 +46,8 @@
    public Boolean insertCustomer(Map<String,Object> object) {
        boolean saveState = true;
        Log log = new Log();
        log.setContent(object.toString());
        //设置回滚点
        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
        try {
@@ -49,9 +55,12 @@
           if(customer!=null){
               if (customer.getId()!=null && customer.getId()!=0){
                   customerMapper.updateCustomer(customer);
                   log.setFunction("insertCustomer修改");
               }else{
                   customerMapper.insertCustomer(customer);
                   log.setFunction("insertCustomer新增");
               }
               logService.saveLog(log);
           }
@@ -79,6 +88,10 @@
                if (customer.getId()!=null){
                    customerMapper.deleteCustomer(customer);
                }
                Log log = new Log();
                log.setContent(object.toString());
                log.setFunction("deleteCustomer删除");
                logService.saveLog(log);
            }
north-glass-erp/src/main/java/com/example/erp/service/sd/DeliveryService.java
@@ -410,6 +410,10 @@
        deliveryMapper.updateDeliveryToExamine(deliveryId,type);
        Log log = new Log();
        log.setContent(object.toString());
        log.setFunction("updateDeliveryToExamine修改:"+deliveryId);
        logService.saveLog(log);
        return true;
@@ -438,6 +442,11 @@
            deliveryDetailMapper.deleteDeliveryDetail(deliveryId);
            deliveryMapper.deleteDelivery(deliveryId);
            Log log = new Log();
            log.setContent(object.toString());
            log.setFunction("deleteDelivery删除:"+deliveryId);
            logService.saveLog(log);
            return true;
        }catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);