| | |
| | | import com.example.erp.common.Constants; |
| | | import com.example.erp.dto.sd.OrderDTO; |
| | | import com.example.erp.dto.sd.OrderDetailProductDTO; |
| | | import com.example.erp.dto.sd.OrderSearchDTO; |
| | | import com.example.erp.entity.sd.*; |
| | | import com.example.erp.entity.userInfo.Log; |
| | | import com.example.erp.entity.userInfo.SysError; |
| | |
| | | log.setFunction("saveOrderTitle保存表头:"+order.getOrderId()); |
| | | |
| | | Order order1 = orderMapper.selectOrderId(order.getOrderId()); |
| | | //使用订单原本的状态和计算方式 |
| | | order.setCalculateType(order1.getCalculateType()); |
| | | order.setCreateOrder(order1.getCreateOrder()); |
| | | order.setProcessReview(order1.getProcessReview()); |
| | | order.setOrderReview(order1.getOrderReview()); |
| | | order.setProductionOrder(order1.getProductionOrder()); |
| | | order.setProcessingCard(order1.getProcessingCard()); |
| | | order.setWarehousing(order1.getWarehousing()); |
| | | order.setDelivery(order1.getDelivery()); |
| | | |
| | | LambdaUpdateWrapper<Order> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Order::getOrderId, order.getOrderId()); |
| | |
| | | } |
| | | } |
| | | JSONObject orderJson = new JSONObject(config); |
| | | Order order = JSONObject.parseObject(JSONObject.toJSONString(orderJson.get("filter")), Order.class); |
| | | OrderSearchDTO order = JSONObject.parseObject(JSONObject.toJSONString(orderJson.get("filter")), OrderSearchDTO.class); |
| | | Map<String,String> sortDate = (Map<String, String>) config.get("sort"); |
| | | String field = sortDate.get("field").replaceAll("(?<!^)([A-Z])", "_$1").toLowerCase(); |
| | | String orderBy = sortDate.get("order"); |
| | |
| | | } |
| | | //订单审核 |
| | | public boolean reviewOrderById(String id, Integer status, String userId, String userName) { |
| | | Log log = new Log(); |
| | | log.setOperator(userName); |
| | | log.setOperatorId(userId); |
| | | log.setContent(status.toString()); |
| | | log.setFunction("reviewOrderById:"+id); |
| | | logService.saveLog(log); |
| | | Order order = orderMapper.selectOne(new QueryWrapper<Order>().eq("order_id",id)); |
| | | if(order.getProcessReview()!=2){ |
| | | throw new ServiceException(Constants.Code_600,"该订单还未审核"); |
| | |
| | | } |
| | | //工艺审核界面审核更新数据 |
| | | public boolean reviewProcessById(String id, Integer status,List<OrderGlassDetail> orderGlassDetails) { |
| | | Log log = new Log(); |
| | | log.setContent(orderGlassDetails.toString()); |
| | | log.setFunction("reviewProcessById:"+id); |
| | | if(!orderGlassDetails.isEmpty() && status==2){ |
| | | orderGlassDetails.forEach(orderGlassDetail ->{ |
| | | double area = Math.round((orderGlassDetail.getChildWidth()*orderGlassDetail.getChildHeight()/1000000) * 100) * 0.01d; |
| | |
| | | // //赋值订单工艺表 |
| | | // orderProcessDetailMapper.insertOrderProcessDetail(orderProcessDetailList); |
| | | } |
| | | |
| | | logService.saveLog(log); |
| | | return orderMapper.reviewProcessById(id,status); |
| | | } |
| | | //工艺审核界面数据查询 |
| | |
| | | BigDecimal getPrice= BigDecimal.valueOf(orderDetail.getPrice()); |
| | | BigDecimal getQuantity= BigDecimal.valueOf(orderDetail.getQuantity()); |
| | | BigDecimal getComputeGrossArea= BigDecimal.valueOf(orderDetail.getComputeGrossArea()); |
| | | BigDecimal getComputeArea= BigDecimal.valueOf(orderDetail.getComputeArea()); |
| | | BigDecimal getWidth= BigDecimal.valueOf(orderDetail.getWidth()); |
| | | BigDecimal getHeight= BigDecimal.valueOf(orderDetail.getHeight()); |
| | | if (calculateType == 3) { |
| | | orderDetail.setGrossAmount(getPrice.multiply(getQuantity).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | } else { |
| | | }else if (calculateType == 4) { |
| | | if(Objects.equals(orderDetail.getArea(), orderDetail.getComputeArea())&&Objects.equals(orderDetail.getGrossArea(), orderDetail.getComputeGrossArea())){ |
| | | orderDetail.setGrossAmount(getWidth.multiply(getHeight).multiply(getQuantity).multiply(getPrice). |
| | | divide(BigDecimal.valueOf(1000000), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | }else{ |
| | | orderDetail.setGrossAmount(getPrice.multiply(getComputeGrossArea).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | }else if (calculateType == 1){ |
| | | orderDetail.setGrossAmount(getPrice.multiply(getComputeArea).multiply(getQuantity).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | }else{ |
| | | orderDetail.setGrossAmount(getPrice.multiply(getComputeGrossArea).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | return orderDetail; |
| | |
| | | log.setFunction("updateOrderMoney金额重置:"+orderId); |
| | | return true; |
| | | } |
| | | |
| | | public Object scannerGlassInfo(String projectNo) { |
| | | try{ |
| | | String projectId = "P" + projectNo.substring(0,8); |
| | | //炉号 |
| | | Integer heatNo = Integer.valueOf(projectNo.substring(8,11)); |
| | | //炉内序号 |
| | | Integer sortNo = Integer.valueOf(projectNo.substring(11,14)); |
| | | String processId = orderMapper.getProcessIdByOptimizeHeatDetail(projectId,heatNo,sortNo); |
| | | String orderId = flowCardMapper.getOrderIdByProcessId(processId); |
| | | return orderMapper.scannerGlassInfo(projectId,heatNo,sortNo,orderId); |
| | | }catch (Exception e){ |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | } |